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.

header: Print a header line defining the columns.<br />

stress: Print the six components of the stress tensor.<br />

peratom: Print energy per atom instead of total energy.<br />

mode: If ‘a’, append to existing file, if ‘w’ overwrite existing file.<br />

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

Despite appearances, attaching a logger like this does not create a cyclic reference to the dynamics.<br />

Note: If building your own logging class, be sure not to attach the dynamics object directly to the logging object.<br />

Instead, create a weak reference using the proxy method of the weakref package. See the ase.md.MDLogger<br />

source code for an example. (If this is not done, a cyclic reference may be created which can cause certain<br />

calculators, such as Jacapo, to not terminate correctly.)<br />

7.21.4 Constant NVE simulations (the microcanonical ensemble)<br />

Newton’s second law preserves the total energy of the system, and a straightforward integration of Newton’s<br />

second law therefore leads to simulations preserving the total energy of the system (E), the number of atoms (N)<br />

and the volume of the system (V). The most appropriate algorithm for doing this is velocity Verlet dynamics, since<br />

it gives very good long-term stability of the total energy even with quite large time steps. Fancier algorithms such<br />

as Runge-Kutta may give very good short-term energy preservation, but at the price of a slow drift in energy over<br />

longer timescales, causing trouble for long simulations.<br />

In a typical NVE simulation, the temperature will remain approximately constant, but if significant structural<br />

changes occurs they may result in temperature changes. If external work is done on the system, the temperature is<br />

likely to rise significantly.<br />

Velocity Verlet dynamics<br />

class md.verlet.VelocityVerlet(atoms, timestep)<br />

VelocityVerlet is the only dynamics implementing the NVE ensemble. It requires two arguments, the atoms<br />

and the time step. Choosing a too large time step will immediately be obvious, as the energy will increase with<br />

time, often very rapidly.<br />

Example: See the tutorial Molecular dynamics.<br />

7.21.5 Constant NVT simulations (the canonical ensemble)<br />

Since Newton’s second law conserves energy and not temperature, simulations at constant temperature will somehow<br />

involve coupling the system to a heat bath. This cannot help being somewhat artificial. Two different approaches<br />

are possible within <strong>ASE</strong>. In Langevin dynamics, each atom is coupled to a heat bath through a fluctuating<br />

force and a friction term. In Nosé-Hoover dynamics, a term representing the heat bath through a single degree of<br />

freedom is introduced into the Hamiltonian.<br />

Langevin dynamics<br />

class md.langevin.Langevin(atoms, timestep, temperature, friction)<br />

The Langevin class implements Langevin dynamics, where a (small) friction term and a fluctuating force are added<br />

to Newton’s second law which is then integrated numerically. The temperature of the heat bath and magnitude of<br />

the friction is specified by the user, the amplitude of the fluctuating force is then calculated to give that temperature.<br />

This procedure has some physical justification: in a real metal the atoms are (weakly) coupled to the electron gas,<br />

and the electron gas therefore acts like a heat bath for the atoms. If heat is produced locally, the atoms locally<br />

get a temperature that is higher than the temperature of the electrons, heat is transferred to the electrons and then<br />

rapidly transported away by them. A Langevin equation is probably a reasonable model for this process.<br />

7.21. Molecular dynamics 153

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

Saved successfully!

Ooh no, something went wrong!