# Ramping up the temperature

In this example, a small cubic nanoparticle is melted by increasing the temperature stepwise. Five plots are generated at each temperature using PrimiPlotter.

Melting.py

`"Melting a copper cluster."`

from asap3 import Atoms, EMT, units from ase.visualize.primiplotter import PrimiPlotter, PngFile from ase.lattice.cubic import FaceCenteredCubic from asap3.md.langevin import Langevin

# Create the atoms atoms = FaceCenteredCubic(size=(5,5,5), symbol="Cu", pbc=False)

# Associate the EMT potential with the atoms atoms.set_calculator(EMT())

# Temperature profile temperatures = (250, 500, 750, 1000, 1250, 1500, 1750)

# How many steps at each temperature nsteps = 10000

# Interval between plots plotinterval = 2000

# Make the Langevin dynamics module dyn = Langevin(atoms, 5*units.fs, units.kB*temperatures, 0.002)

# The plotter plotter = PrimiPlotter(atoms) # plotter.set_output(X11Window()) # Plot in a window on the screen plotter.set_output(PngFile("plt")) # Save plots in files plt0000.gif ... plotter.set_rotation((10.0, 5.0, 0)) dyn.attach(plotter.plot, interval=plotinterval)

# The main loop for t in temperatures:

System Message: ERROR/3 (<string>, line 50)

Unexpected indentation.

dyn.set_temperature(units.kB*t) for i in range(nsteps//100):

System Message: ERROR/3 (<string>, line 52)

Unexpected indentation.

dyn.run(100) print("E_total = %-10.5f T = %.0f K (goal: %.0f K, step %d of %d)" %

System Message: ERROR/3 (<string>, line 54)

Unexpected indentation.
(atoms.get_total_energy()/len(atoms), atoms.get_temperature(),
t, i, nsteps//100))

Asap: Ramping up the temperature (last edited 2020-09-03 09:41:53 by JakobSchiøtz)