18.11.2012 Views

ASE Manual Release 3.6.1.2825 CAMd - CampOS Wiki

ASE Manual Release 3.6.1.2825 CAMd - CampOS Wiki

ASE Manual Release 3.6.1.2825 CAMd - CampOS Wiki

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

<strong>ASE</strong> <strong>Manual</strong>, <strong>Release</strong> 3.6.1.2828<br />

third column the absorbance scaled so that data runs from 1 to 0. Start and end point, and width of the<br />

Gaussian/Lorentzian should be given in cm^-1.<br />

7.21 Molecular dynamics<br />

Typical computer simulations involve moving the atoms around, either to optimize a structure (energy minimization)<br />

or to do molecular dynamics. This chapter discusses molecular dynamics, energy minimization algorithms<br />

will be discussed in the optimize section.<br />

A molecular dynamics object will operate on the atoms by moving them according to their forces - it integrates<br />

Newton’s second law numerically. A typical molecular dynamics simulation will use the Velocity Verlet dynamics.<br />

You create the VelocityVerlet object, giving it the atoms and a time step, and then you perform dynamics<br />

by calling its run() method:<br />

dyn = VelocityVerlet(atoms, 5.0 * units.fs)<br />

dyn.run(1000) # take 1000 steps<br />

A number of different algorithms can be used to perform molecular dynamics, with slightly different results.<br />

7.21.1 Choosing the time step<br />

All the dynamics objects need a time step. Choosing it too small will waste computer time, choosing it too large<br />

will make the dynamics unstable, typically the energy increases dramatically (the system “blows up”). If the time<br />

step is only a little to large, the lack of energy conservation is most obvious in Velocity Verlet dynamics, where<br />

energy should otherwise be conserved.<br />

Experience has shown that 5 femtoseconds is a good choice for most metallic systems. Systems with light atoms<br />

(e.g. hydrogen) and/or with strong bonds (carbon) will need a smaller time step.<br />

All the dynamics objects documented here are sufficiently related to have the same optimal time step.<br />

7.21.2 File output<br />

The time evolution of the system can be saved in a trajectory file, by creating a trajectory object, and attaching it<br />

to the dynamics object. This is documented in the module ase.io.trajectory.<br />

Unlike the geometry optimization classes, the molecular dynamics classes do not support giving a trajectory file<br />

name in the constructor. Instead the trajectory must be attached explicitly to the dynamics, and it is stongly<br />

recommended to use the optional interval argument, so every time step is not written to the file.<br />

7.21.3 Logging<br />

A logging mechanism is provided, printing time; total, potential and kinetic energy; and temperature (calculated<br />

from the kinetic energy). It is enabled by giving the logfile argument when the dynamics object is created,<br />

logfile may be an open file, a filename or the string ‘-‘ meaning standard output. Per default, a line is printed<br />

for each timestep, specifying the loginterval argument will chance this to a more reasonable frequency.<br />

The logging can be customized by explicitly attaching a ase.md.MDLogger object to the dynamics:<br />

from ase.md import MDLogger<br />

dyn = VelocityVerlet(atoms, dt=2*ase.units.fs)<br />

dyn.attach(MDLogger(dyn, atoms, ’md.log’, header=False, stress=False,<br />

peratom=True, mode="a"), interval=1000)<br />

This example will skip the header line and write energies per atom instead of total energies. The parameters are<br />

152 Chapter 7. Documentation for modules in <strong>ASE</strong>

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!