# Molecular dynamics¶

Molecular dynamics (MD) can be used to simulate the evolution of a system in time.

Examples

To perform a MD simulation, first select the corresponding Task:

Task MolecularDynamics


All aspects of the simulation can then be configured using the MolecularDynamics block.

MolecularDynamics
AtomTemperature float
Coords float_list
CoordsBox float_list
CoordsSigma float_list
Energy float
EnergySigma float
FractionalCoords float_list
FractionalCoordsBox float_list
FractionalCoordsSigma float_list
Frequency integer
MinDistance float
NumAttempts integer
Rotate [True | False]
StartStep integer
StopStep integer
System string
Temperature float
TemperatureSigma float
Velocity float
VelocityDirection float_list
VelocitySigma float
End
Barostat
BulkModulus float
ConstantVolume [True | False]
Duration integer_list
Equal [None | XYZ | XY | YZ | XZ]
Pressure float_list
Scale [XYZ | Shape | X | Y | Z | XY | YZ | XZ]
Tau float
Type [None | Berendsen | MTK]
End
BondOrderCutoff float
CVHD
Bias
DampingTemp float
Delta float
Height float
End
ColVarBB
at1 string
at2 string
cutoff float
p integer
rmax float
rmin float
End
Frequency integer
StartStep integer
StopStep integer
WaitSteps integer
End
CalcPressure [True | False]
Checkpoint
Frequency integer
End
HeatExchange
HeatingRate float
Method [Simple | HEX | eHEX]
Sink
Box
Amax float
Amin float
Bmax float
Bmin float
Cmax float
Cmin float
End
FirstAtom integer
LastAtom integer
End
Source
Box
Amax float
Amin float
Bmax float
Bmin float
Cmax float
Cmin float
End
FirstAtom integer
LastAtom integer
End
StartStep integer
StopStep integer
End
InitialVelocities
File string
Temperature float
Type [Zero | Random | FromFile | Input]
Values # Non-standard block. See details.
...
End
End
NSteps integer
PRD
BondChange
ChangeThreshold float
DissociationThreshold float
FormationThreshold float
End
CorrelatedSteps integer
DephasingSteps integer
MolCount
nReplicas integer
End
Plumed
Input # Non-standard block. See details.
...
End
End
Preserve
AngularMomentum [True | False]
CenterOfMass [True | False]
Momentum [True | False]
End
Print
System [True | False]
Velocities [True | False]
End
RemoveMolecules
Formula string
Frequency integer
SafeBox
Amax float
Amin float
Bmax float
Bmin float
Cmax float
Cmin float
End
SinkBox
Amax float
Amin float
Bmax float
Bmin float
Cmax float
Cmin float
End
StartStep integer
StopStep integer
End
ReplicaExchange
SwapFrequency integer
TemperatureFactor float_list
nReplicas integer
End
Restart string
Thermostat
BerendsenApply [Local | Global]
ChainLength integer
Duration integer_list
FirstAtom integer
LastAtom integer
Tau float
Temperature float_list
Type [None | Berendsen | NHC]
End
TimeStep float
Trajectory
SamplingFreq integer
TProfileGridPoints integer
End
End


## General¶

The time evolution of the system is simulated by numerically integrating the equations of motion. A velocity Verlet integrator is used with a time step set by the TimeStep key. The MD driver will perform NSteps timesteps in total.

Because the overall computational cost depends on NSteps but not on TimeStep, it is desirable to set the timestep as large as possible to maximize the sampled timescale with a given computational budget. However, numerical integration errors grow rapidly as the timestep increases. These errors will cause a loss of energy conservation, crashes, and other artifacts. It is thus important to set the TimeStep value carefully, as its optimal value strongly depends on the studied system and simulated conditions.

As a rule of thumb, reasonable timesteps for systems not undergoing chemical reactions are 10-20 times lower than the period of the fastest vibration mode. Systems containing hydrogen atoms at room temperature can thus be accurately simulated using a 1 fs timestep. Longer timesteps can be safely used for systems containing only heavy atoms (vibration periods scale with the square root of the atomic mass). Conversely, the timestep needs to be made shorter for high-temperature simulations. The same also applies to simulations of chemical reactions, which are usually accompanied by significant transient local heating. The default timestep of 0.25 fs should work for most of these cases.

MolecularDynamics
NSteps
Type: Integer 1000 The number of steps to be taken in the MD simulation.
TimeStep
Type: Float 0.25 Femtoseconds The time difference per step.

During a long simulation, numerical integration errors will cause some system-wide quantities to drift from their exact values. For example, the system may develop a nonzero net linear velocity, causing an overall translation or flow. Non-periodic (molecular) systems may also develop nonzero angular momentum (overall rotation) and a Brownian motion of their center of mass through space. These problems are corrected by periodically removing any accumulated drift. This feature can be controlled using the Preserve key.

MolecularDynamics
Preserve
Type: Block Periodically remove numerical drift accumulated during the simulation to preserve different whole-system parameters.
AngularMomentum
Type: Bool True Remove overall angular momentum of the system. This option is ignored for 3D-periodic systems.
CenterOfMass
Type: Bool False Translate the system to keep its center of mass at the coordinate origin. This option is not very useful for 3D-periodic systems.
Momentum
Type: Bool True Remove overall (linear) momentum of the system.

## (Re-)Starting a simulation¶

The state of a system at the beginning of a simulation is defined by the positions and momenta of all atoms. The positions can be set in the input or loaded from a file as described under System definition. Initial velocities are then supplied using the InitialVelocities block.

Probably the most common way to start up a simulation is to draw the initial velocities from a Maxwell-Boltzmann distribution by setting Type=Random and Temperature to a suitable value. Alternatively, velocities can be loaded from an ams.rkf file produced by an earlier simulation using Type=FromFile and File. This is the recommended way to start a production simulation from the results of a short preparation/equilibration run.

Velocities of all atoms in units of Å/fs can also be explicitly defined in the Values block after setting Type=Input. This is mainly useful to repeat or extend simulations done by other programs. For example, velocities can be extracted from the vels or moldyn.vel files used by the standalone ReaxFF program. A simple AWK script is supplied in scripting/standalone/reaxff-ams/vels2ams.awk to help with the conversion.

MolecularDynamics
InitialVelocities
Type: Block Sets the frequency for printing to stdout and storing the molecular configuration on the .rkf file.
File
Type: String AMS RKF file containing the initial velocities.
Temperature
Type: Float Kelvin Sets the temperature for the Maxwell-Boltzmann distribution when the type of the initial velocities is set to random, in which case specifying this key is mandatory. ADFinput will use the thermostat temperature as default.
Type
Type: Multiple Choice Random [Zero, Random, FromFile, Input] Specifies the initial velocities to assign to the atoms. Three methods to assign velocities are available. Zero: All atom are at rest at the beginning of the calculation. Random: Initial atom velocities follow a Maxwell-Boltzmann distribution for the temperature given by the [MolecularDynamics%InitialVelocities%Temperature] keyword. FromFile: Load the velocities from a previous ams result file. Input: Atom’s velocities are set to the values specified in the [MolecularDynamics%InitialVelocities%Values] block, which can be accessed via the Expert AMS panel in ADFinput.
Values
Type: Non-standard block This block specifies the velocity of each atom, in Angstrom/fs, when [MolecularDynamics%InitialVelocities%Type] is set to Input. Each row must contain three floating point values (corresponding to the x,y,z component of the velocity vector) and a number of rows equal to the number of atoms must be present, given in the same order as the [System%Atoms] block.

The MD module also supports exact restarts of interrupted simulations by pointing the Restart key to an ams.rkf file. This will restore the entire state of the MD module from the last available checkpoint (if the previous simulation was interrupted) or from the final state (if the previous simulation ended after NSteps). An earlier trajectory can thus be seamlessly extended by increasing NSteps and using Restart.

Note

Restart should be combined with LoadSystem from the same ams.rkf to restore the atomic positions.

Warning

The Restart feature is only intended for exact restarts, so the rest of the MolecularDynamics settings should be the same as in the original run. Only NSteps and engine settings (contents of the Engine block) can always be changed safely across restarts.

Although some MD settings (such as the trajectory sampling options) can in practice be changed without problems, changing others (such as thermostat or barostat settings) will cause the restart to fail or produce physically incorrect results. It is thus strongly recommended to only use Restart for exact continuation and InitialVelocities Type=FromFile together with LoadSystem otherwise.

MolecularDynamics
Restart
Type: String The path to the ams.rkf file from which to restart the simulation.

## Thermostats and barostats¶

By default, the MD simulation samples the microcanonical (NVE) ensemble. Although this is useful to check energy conservation and other basic physical properties, it does not directly map to common experimental conditions. The canonical (NVT) ensemble can be sampled instead by applying a Thermostat, which serves as a simulated heat bath around the system, keeping its average temperature at a set value.

AMS offers two thermostats with drastically different properties, mode of operation, and applicability, selected using the Type key:

Berendsen

The Berendsen friction thermostat drives the system to a particular target temperature by rescaling the velocities of all atoms in each step. This ensures rapid (exponential) convergence of the temperature with a time constant Tau. However, this thermostat produces an incorrect velocity distribution and should thus be avoided in all situations where correct energy fluctuations are important. Additionally, using a too short time constant Tau tends to cause incorrect equipartition of energy between different degrees of freedom in the system, leading to the “flying ice cube” phenomenon. The time constant Tau should thus be set as large as possible to limit these artifacts while still providing sufficient temperature control. Common values of Tau for condensed-phase systems lie between 100 fs (strong damping, rapid convergence) and 10 ps (weak coupling with minimal artifacts).

This thermostat is mainly useful for systems far from equilibrium, for example during the initial preparation and equilibration phase of a simulation. The NHC thermostat should be preferred where possible.

NHC
This enables a chain of coupled Nosé-Hoover thermostats. This method introduces artificial degrees of freedom representing the heat bath and ensures correct sampling of the canonical ensemble. The combined total energy of the system and the heat bath is conserved and shown in the GUI as Conserved Energy. Checking this quantity for drift and artifacts thus offers a valuable test of the correctness of the simulation. This thermostat exhibits oscillatory relaxation with a period of Tau. It is thus not well suited for systems starting far from equilibrium, because the oscillations may take long to settle. The time constant Tau should be at least comparable to the period of some natural oscillation of the system to ensure efficient energy transfer. It is commonly on the order of hundreds of femtoseconds, although higher values may be used if weak coupling is desired.

Multiple independent thermostats can be used to separately control different regions of the system at the same time. This is done by specifying the Thermostat block multiple times and setting the FirstAtom and/or LastAtom keys to the desired range of atoms. Care needs to be taken to avoid defining thermostats with overlapping atom ranges.

MolecularDynamics
Thermostat
Type: Block True This block allows to specify the use of a thermostat during the simulation. Depending on the selected thermostat type, different additional options may be needed to characterize the specific thermostat’ behavior.
BerendsenApply
Type: Multiple Choice Global [Local, Global] Select how to apply the scaling correction for the Berendsen thermostat: - per-atom-velocity (Local) - on the molecular system as a whole (Global).
ChainLength
Type: Integer 10 Number of individual thermostats forming the NHC thermostat
Duration
Type: Integer List Specifies how many steps should a transition from a particular temperature to the next one in sequence take.
FirstAtom
Type: Integer 1 Index of the first atom to be thermostatted
LastAtom
Type: Integer 0 Index of the last atom to be thermostatted. A value of zero means the last atom in the system.
Tau
Type: Float Femtoseconds The time constant of the thermostat.
Temperature
Type: Float List Kelvin The target temperature of the thermostat.
Type
Type: Multiple Choice None [None, Berendsen, NHC] Selects the type of the thermostat.

Just like using a Thermostat to control the temperature of the system, a Barostat can be applied to keep the pressure constant by adjusting the volume. This enables sampling the isenthalpic-isobaric (NpH) ensemble by using only a barostat or the isothermal-isobaric (NpT) ensemble by combining a barostat and a thermostat. Unlike thermostats, a barostat always applies to the entire system and there can thus be at most one barostat defined.

AMS offers two barostats with similar properties to the related thermostats:

Berendsen
The Berendsen friction-like isobaric ensemble method rescales the system in each step to drive the pressure towards a target value. Similarly to the Berendsen thermostat, the relaxation is exponential with a time constant Tau. Similar considerations for the choice of Tau apply as in the case of the thermostat, but the value of Tau for the barostat is usually at least several times higher than the corresponding Tau used for the thermostat. This barostat does not have any conserved quantity.
MTK
This enables the Martyna-Tobias-Klein extended Lagrangian barostat, which generates a true isobaric ensemble by integrating the cell parameters as additional degrees of freedom. This barostat is derived from the Andersen-Hoover isotropic barostat and the Parrinello-Rahman-Hoover anisotropic barostat. Like the NHC thermostat, it exhibits oscillatory relaxation unsuitable for systems far from equilibrium. This barostat must always be combined with a NHC thermostat. One instance of such thermostat coupled to the atoms as usual, while a second instance is created internally and coupled to the cell degrees of freedom.
MolecularDynamics
Barostat
Type: Block This block allows to specify the use of a barostat during the simulation.
BulkModulus
Type: Float 2200000000.0 Pascal An estimate of the bulk modulus (inverse compressibility) of the system for the Berendsen barostat. This is only used to make Tau correspond to the true observed relaxation time constant. Values are commonly on the order of 10-100 GPa (1e10 to 1e11) for solids and 1 GPa (1e9) for liquids (2.2e9 for water). Use 1e9 to match the behavior of standalone ReaxFF.
ConstantVolume
Type: Bool False Keep the volume constant while allowing the box shape to change. This is currently supported only by the MTK barostat.
Duration
Type: Integer List Specifies how many steps should a transition from a particular pressure to the next one in sequence take.
Equal
Type: Multiple Choice None [None, XYZ, XY, YZ, XZ] Enforce equal scaling of the selected set of dimensions. They will be barostatted as one dimension according to the average pressure over the components.
Pressure
Type: Float List Pascal Specifies the target pressure.
Scale
Type: Multiple Choice XYZ [XYZ, Shape, X, Y, Z, XY, YZ, XZ] Dimensions that should be scaled by the barostat to maintain pressure. Selecting Shape means that all three dimensions and also all the cell angles are allowed to change.
Tau
Type: Float Femtoseconds Specifies the time constant of the barostat.
Type
Type: Multiple Choice None [None, Berendsen, MTK] Selects the type of the barostat.

### Temperature and pressure regimes¶

Arbitrary temperature and pressure regimes can be generated by setting Temperature or Pressure to a list of values, corresponding to the successive set points. This needs to be accompanied by a Duration key specifying the length of each regime segment in steps:

Thermostat
Temperature 0     300     300     500     500     300
Duration      100     200     100     200     100
End


Note that there is always N-1 Duration values for N Temperature values. The target temperature of the thermostat in this example will evolve as follows:

1. Increase linearly from 0 to 300 K over 100 steps.
2. Stay constant at 300 K for 200 steps.
3. Increase linearly from 300 to 500 K over 100 steps.
4. Stay constant at 500 K for 200 steps.
5. Decrease linearly from 500 to 300 K over 100 steps.
6. Stay constant at 300 K for the rest of the simulation.

## Trajectory sampling and output¶

A basic principle of the numerical integration of motion in MD is that the changes in the state of the system between successive time steps are small. This means that storing the results of every step is not useful, because all the data is strongly correlated. Instead, a snapshot of the system is taken every N steps, where N is set low enough to still capture the fastest motion of interest but high enough to avoid wasting space due to correlations. The resulting sequence of snapshots is then commonly called the trajectory.

AMS writes the trajectory to the History and MDHistory sections of ams.rkf, according to the settings in the Trajectory block. A snapshot of the system and various MD variables is stored every SamplingFreq timesteps.

The trajectory itself contains only the data needed for subsequent analysis of the dynamics of the system. However, much more data is usually generated on every integration step. This includes, for example, the internal data used by an engine when evaluating the energies and forces. This information is normally discarded after each step, because it is often very large. However, a Checkpoint containing the complete internal state of the MD driver together with a result file generated by the engine is stored every Frequency steps. An interrupted simulation can then be restarted from this checkpoint using the Restart keyword. Additionally, the engine result files called MDStep*.rkf can also be used to extract various engine-specific details about the system, such as the orbitals for QM engines.

MolecularDynamics
Trajectory
Type: Block Sets the frequency for printing to stdout and storing the molecular configuration on the .rkf file.
SamplingFreq
Type: Integer 100 Write the the molecular geometry (and possibly other properties) to the .rkf file once every N steps.
TProfileGridPoints
Type: Integer 0 Number of points in the temperature profile. If TProfileGridPoints is greater than 0 then a temperature profile will be generates along each of the three unit cell axes. By default, no profile is generated.
Checkpoint
Type: Block Sets the frequency for storing the entire MD state necessary for restarting the calculation.
Frequency
Type: Integer 1000 Write the MD state and engine-specific data to the respective .rkf files once every N steps.
CalcPressure
Type: Bool False Calculate the pressure in periodic systems. This may be computationally expensive for some engines that require numerical differentiation. Some other engines can calculate the pressure for negligible additional cost and will always do so, even if this option is disabled.
Print
Type: Block This block controls the printing of additional information to stdout.
System
Type: Bool False Print the chemical system before and after the simulation.
Velocities
Type: Bool False Print the atomic velocities before and after the simulation.

## Molecule Gun: adding molecules during simulation¶

The molecule gun allows you to “shoot” (add with velocity) a molecule into the simulation box.

The GUI tutorial on the molecule gun.

Molecules can be continuously added to the simulation or only once. The initial position can be pre-set or be random within the simulation box or a part thereof. It can be defined either in the Cartesian or fractional coordinates. The initial velocity can be specified either directly (in Angstrom per femtosecond) or as translational temperature or kinetic energy. Possible applications of the molecule gun include e.g. the simulation of enforced collisions or deposition processes on surfaces.

MolecularDynamics
AddMolecules
Type: Block True This block controls adding molecules to the system (a.k.a. the Molecule Gun). Multiple occurrences of this block are possible. By default, molecules are added at random positions in the simulation box with velocity matching the current system temperature. The initial position can be modified using one of the following keywords: Coords, CoordsBox, FractionalCoords, FractionalCoordsBox. The Coords and FractionalCoords keys can optionally be accompanied by CoordsSigma or FractionalCoordsSigma, respectively.
AtomTemperature
Type: Float 0.0 Kelvin Add random velocity corresponding to the specified temperature to individual atoms of the molecule. The total momentum of the added molecule is not conserved.
Coords
Type: Float List Angstrom Place molecules at or around the specified Cartesian coordinates. This setting takes precedence over other ways to specify initial coordinates of the molecule: [CoordsBox], [FractionalCoords], and [FractionalCoordsBox].
CoordsBox
Type: Float List Angstrom Place molecules at random locations inside the specified box in Cartesian coordinates. Coordinates of the box corners are specified as: Xmin, Xmax, Ymin, Ymax, Zmin, Zmax. This setting is ignored if Coords is used. In ADFinput, if this field is not empty it will be used instead of the default Coords.
CoordsSigma
Type: Float List Angstrom Sigma values (one per Cartesian axis) for a Gauss distribution of the initial coordinates. Can only be used together with Coords.
Energy
Type: Float Hartree Initial kinetic energy of the molecule in the shooting direction.
EnergySigma
Type: Float 0.0 Hartree Sigma value for the Gauss distribution of the initial kinetic energy around the specified value. Should only be used together with Energy.
FractionalCoords
Type: Float List Place molecules at or around the specified fractional coordinates in the main system’s lattice. For non-periodic dimensions a Cartesian value in Angstrom is expected. This setting is ignored if [Coords] or [CoordsBox] is used.
FractionalCoordsBox
Type: Float List Place molecules at random locations inside the box specified as fractional coordinates in the main system’s lattice. Coordinates of the box corners are specified as: Xmin, Xmax, Ymin, Ymax, Zmin, Zmax. For non-periodic dimensions the Cartesian value in Angstrom is expected. This setting is ignored if [Coords], [CoordsBox], or [FractionalCoords] is used.
FractionalCoordsSigma
Type: Float List Sigma values (one per axis) for a Gauss distribution of the initial coordinates. For non-periodic dimensions the Cartesian value in Angstrom is expected. Can only be used together with FractionalCoords.
Frequency
Type: Integer 0 A molecule is added every [Frequency] steps after the StartStep. There is never a molecule added at step 0.
MinDistance
Type: Float 0.0 Angstrom Keep the minimal distance to other atoms of the system when adding the molecule.
NumAttempts
Type: Integer 10 Try adding the molecule up to the specified number of times or until the MinDistance constraint is satisfied. If all attempts fail a message will be printed and the simulation will continue normally.
Rotate
Type: Bool False Rotate the molecule randomly before adding it to the system.
StartStep
Type: Integer 0 Step number when the first molecule should be added. After that, molecules are added every Frequency steps. For example, ff StartStep=99 and Frequency=100 then a molecule will be added at steps 99, 199, 299, etc... No molecule will be added at step 0, so if StartStep=0 the first molecule is added at the step number equal to [Frequency].
StopStep
Type: Integer Do not add this molecule after the specified step.
System
Type: String String ID of the [System] that will be added with this ‘gun’. The lattice specified with this System is ignored and the main system’s lattice is used instead. ADFinput adds the system at the coordinates of the System (thus setting Coords to the center of the System).
Temperature
Type: Float Kelvin Initial energy of the molecule in the shooting direction will correspond to the given temperature.
TemperatureSigma
Type: Float 0.0 Kelvin Sigma value for the Gauss distribution of the initial temperature the specified value. Should only be used together with TemperatureSigma.
Velocity
Type: Float Angstrom/fs Initial velocity of the molecule in the shooting direction.
VelocityDirection
Type: Float List Velocity direction vector for aimed shooting. It will be random if not specified. In ADFinput add one or two atoms (which may be dummies). One atom: use vector from center of the system to add to that atom. Two atoms: use vector from the first to the second atom.
VelocitySigma
Type: Float 0.0 Angstrom/fs Sigma value for the Gauss distribution of the initial velocity around the specified value. Should only be used together with Velocity.

## Removing molecules during simulation¶

This feature can be used, for example, to remove reaction products from the system.

MolecularDynamics
RemoveMolecules
Type: Block True This block controls removal of molecules from the system. Multiple occurrences of this block are possible.
Formula
Type: String Molecular formula of the molecules that should be removed from the system. The order of elements in the formula is very important and the correct order is: C, H, all other elements in the strictly alphabetic order. Element names are case-sensitive, spaces in the formula are not allowed. Digit ‘1’ must be omitted. Valid formula examples: C2H6O, H2O, O2S. Invalid formula examples: C2H5OH, H2O1, OH, SO2. Invalid formulas are silently ignored.
Frequency
Type: Integer 0 The specified molecules are removed every so many steps after the StartStep. There is never a molecule removed at step 0.
SafeBox
Type: Block Part of the simulation box where molecules may not be removed. Only one of the SinkBox or SafeBox blocks may be present. If this block is present a molecule will not be removed if any of its atoms is within the box. For a periodic dimension it is given as a fraction of the simulation box (the full 0 to 1 range by default). For a non-periodic dimension it represents absolute Cartesian coordinates in atomic units.
Amax
Type: Float Coordinate of the upper bound along the first axis.
Amin
Type: Float Coordinate of the lower bound along the first axis.
Bmax
Type: Float Coordinate of the upper bound along the second axis.
Bmin
Type: Float Coordinate of the lower bound along the second axis.
Cmax
Type: Float Coordinate of the upper bound along the third axis.
Cmin
Type: Float Coordinate of the lower bound along the third axis.
SinkBox
Type: Block Part of the simulation box where molecules will be removed. By default, molecules matching the formula will be removed regardless of their location. If this block is present a molecule will be removed if any of its atoms is within the box. For a periodic dimension it is given as a fraction of the simulation box (the full 0 to 1 range by default). For a non-periodic dimension it represents absolute Cartesian coordinates in atomic units.
Amax
Type: Float Coordinate of the upper bound along the first axis.
Amin
Type: Float Coordinate of the lower bound along the first axis.
Bmax
Type: Float Coordinate of the upper bound along the second axis.
Bmin
Type: Float Coordinate of the lower bound along the second axis.
Cmax
Type: Float Coordinate of the upper bound along the third axis.
Cmin
Type: Float Coordinate of the lower bound along the third axis.
StartStep
Type: Integer 0 Step number when molecules are removed for the first time. After that, molecules are removed every [Frequency] steps. For example, if StartStep=99 and Frequency=100 then molecules will be removed at steps 99, 199, 299, etc... No molecule will be removed at step 0, so if StartStep=0 the first molecules are removed at the step number equal to [Frequency].
StopStep
Type: Integer Do not remove the specified molecules after this step.
BondOrderCutoff
Type: Float 0.5 Bond order cutoff for analysis of the molecular composition. Bonds with bond order smaller than this value are neglected when determining the molecular composition.

## The PLUMED library support in AMS¶

PLUMED is a plugin that works with various MD programs and is also available in AMS. It can be used for on-the-fly analysis of the dynamics, or to perform a wide variety of free energy methods. The interface with the plugin is really simple: you just need to specify the PLUMED input in the MolecularDynamics%Plumed%Input block and it will be passed to the library “as is”. At each MD step, the current state of the system will be passed to the plugin to be updated according to the PLUMED input.

MolecularDynamics
Plumed
Type: Block Input for PLUMED.
Input
Type: Non-standard block Input for PLUMED. Contents of this block is passed to PLUMED as is.

## Collective Variable-driven HyperDynamics (CVHD)¶

The Collective Variable-driven HyperDynamics is a molecular dynamics acceleration method that allows observation of rare events by filling energy minima with a bias potential. In this sense it is similar to metadynamics. The difference of the hyperdynamics is that it ensures that the bias disappears in the transition state region. This difference allows hyperdynamics to calculate the rate of slow processes, for example the ignition phase of combustion.

The GUI tutorial on CVHD.

The CVHD implementation in AMS follows the algorithm described in K.M. Bal, E.C. Neyts, JCTC, 11 (2015)

The StartStep, Frequency, StopStep, and WaitSteps keys define when and how often the bias potential is added, and when it is removed. The Bias block defines parameters of the bias potential peaks and the ColVarBB block describes parameters of the bond-breaking collective variable.

MolecularDynamics
CVHD
Type: Block True Input for the Collective Variable-driven HyperDynamics (CVHD).
Bias
Type: Block The bias is built from a series of Gaussian peaks deposited on the collective variable axis every [Frequency] steps during MD. Each peak is characterized by its (possibly damped) height and the RMS width (standard deviation).
DampingTemp
Type: Float 0.0 Kelvin During well-tempered hyperdynamics the height of the added bias is scaled down with an exp(-E/kT) factor [PhysRevLett 100, 020603 (2008)], where E is the current value of the bias at the given CV value and T is the damping temperature DampingTemp. If DampingTemp is zero then no damping is applied.
Delta
Type: Float Standard deviation parameter of the Gaussian bias peak.
Height
Type: Float Hartree Height of the Gaussian bias peak.
ColVarBB
Type: Block True Description of a bond-breaking collective variable (CV) as described in [Bal & Neyts, JCTC, 11 (2015)]. A collective variable may consist of multiple ColVar blocks.
at1
Type: String Atom type name of the first atom of the bond. The name must be as it appears in the System block. That is, if the atom name contains an extension (e.g C.1) then the full name including the extension must be used here.
at2
Type: String Atom type name of the second atom of the bond. The value is allowed to be the same as [at1], in which case bonds between atoms of the same type will be included.
cutoff
Type: Float 0.3 Bond order cutoff. Bonds with BO below this value are ignored when creating the initial bond list for the CV. The bond list does not change during lifetime of the variable even if some bond orders drop below the cutoff.
p
Type: Integer 6 Exponent value p used to calculate the p-norm for this CV.
rmax
Type: Float Angstrom Max bond distance parameter Rmax used for calculating the CV. It should be close to the transition-state distance for the corresponding bond.
rmin
Type: Float Angstrom Min bond distance parameter Rmin used for calculating the CV. It should be close to equilibrium distance for the corresponding bond.
Frequency
Type: Integer Frequency of adding a new bias peak, in steps. New bias is deposited every [Frequency] steps after [StartStep] if the following conditions are satisfied: the current CV value is less than 0.9 (to avoid creating barriers at the transition state), the step number is greater than or equal to [StartStep], and the step number is less than or equal to [StopStep].
StartStep
Type: Integer If this key is specified, the first bias will be deposited at this step. Otherwise, the first bias peak is added at the step number equal to the Frequency parameter. The bias is never deposited at step 0.
StopStep
Type: Integer No bias will be deposited after the specified step. The already deposited bias will continue to be applied until the reaction event occurs. After that no new CVHD will be started. By default, the CVHD runs for the whole duration of the MD calculation.
WaitSteps
Type: Integer If the CV value becomes equal to 1 and remains at this value for this many steps then the reaction event is considered having taken place. After this, the collective variable will be reset and the bias will be removed.

During a CVHD calculation, the following variables are saved to the MDHistory section of the RKF file, in addition to other MD properties:

• BiasEnergy - value the bias energy at the current MD step, in Hartree.
• MaxBiasEnergy - max BiasEnergy since the last sampling step.
• BoostFactor - the boost factor at the given MD step. The boost factor is calculated at each MD step as $$boost = e^{E_{bias}/kT}$$, where T is the MD ensemble temperature.
• MaxBoostFactor - max BoostFactor value since the last sampling step.
• HyperTime - boosted MD time, in femtoseconds, which is a sum of the hyper-time steps calculated from the current boost factor and the MD time step as $$\Delta t_{boost} = boost * \Delta t$$. In hyperdynamics, the hyper-time value is directly related to the rate of the process boosted by the corresponding collective variable.

## Non-equilibrium MD (NEMD): heat exchange¶

There are different methods to study thermal conductivity using non-equilibrium molecular dynamics (NEMD). A common feature of these methods is that they require the system to be divided into three or more zones, each with its own thermostat and other properties. One method maintains the temperature of the heat source and the heat sink zones at the given temperature using two different thermostats and measures the amount of heat transferred. These method does not require any special features besides a standard thermostat and a possibility to calculate the amount of heat accumulated by the thermostat per unit of time. The accumulated thermostat energies are available in the MDHistory section of ams.rkf file, in variables called ‘XXXXstat#Energy’, where XXXX is a 4-letter abbreviation of the thermo-/barostat (‘BerT’ for a Berendset thermostat, ‘NHCT’ for an NHC thermostat, ‘NHTB’ for an MTK barostat, etc.) and ‘#’ is a 1-digit index of the thermo-/barostat.

In the other method, the heat flow is constant and the induced temperature gradient is measured. This method is implemented in AMS in three variants: a simple heat exchange, HEX [18] and eHEX [19]. In the simple heat exchange method the atom velocities are scaled up (or down) by a factor corresponding to the amount of heat deposited to the heat source (or withdrawn from the heat sink) without paying attention to the conservation of the total momentum of the heat source (or sink). In the HEX method the velocities are scaled in such a way that the total momentum is conserved. This, however, introduces a small but measurable drift in the total energy. The eHEX algorithm improves upon the HEX by adding a third-order time-integration correction to remove the drift.

This method is controlled by the HeatExchange sub-block of the MolecularDynamics block:

MolecularDynamics
HeatExchange
Type: Block True Input for the heat-exchange non-equilibrium MD (T-NEMD).
HeatingRate
Type: Float Hartree/fs Rate at which the energy is added to the Source and removed from the Sink. A heating rate of 1 Hartree/fs equals to about 0.00436 Watt of power being transfered through the system.
Method
Type: Multiple Choice Simple [Simple, HEX, eHEX] Heat exchange method used. Simple: kinetic energy of the atoms of the source and sink regions is modified irrespective of that of the center of mass (CoM) of the region (recommended for solids). HEX: kinetic energy of the atoms of these regions is modified keeping that of the corresponding CoM constant. eHEX: an enhanced version of HEX that conserves the total energy better (recommended for gases and liquids).
Sink
Type: Block Defines the heat sink region (where the heat will be removed).
Box
Type: Block Part of the simulation box (in fractional cell coordinates) defining the heat sink. If this block is specified, then by default, the whole box in each of the three dimensions is used, which usually does not make much sense. Normally, you will want to set the bounds along one of the axes. This block is mutually exclusive with the FirstAtom/LastAtom setting.
Amax
Type: Float 1.0 Coordinate of the upper bound along the first axis.
Amin
Type: Float 0.0 Coordinate of the lower bound along the first axis.
Bmax
Type: Float 1.0 Coordinate of the upper bound along the second axis.
Bmin
Type: Float 0.0 Coordinate of the lower bound along the second axis.
Cmax
Type: Float 1.0 Coordinate of the upper bound along the third axis.
Cmin
Type: Float 0.0 Coordinate of the lower bound along the third axis.
FirstAtom
Type: Integer Index of the first atom of the region. This key is ignored if the [Box] block is present.
LastAtom
Type: Integer Index of the last atom of the region. This key is ignored if the [Box] block is present.
Source
Type: Block Defines the heat source region (where the heat will be added).
Box
Type: Block Part of the simulation box (in fractional cell coordinates) defining the heat source. If this block is specified, then by default, the whole box in each of the three dimensions is used, which usually does not make much sense. Normally, you will want to set the bounds along one of the axes. This block is mutually exclusive with the FirstAtom/LastAtom setting.
Amax
Type: Float 1.0 Coordinate of the upper bound along the first axis.
Amin
Type: Float 0.0 Coordinate of the lower bound along the first axis.
Bmax
Type: Float 1.0 Coordinate of the upper bound along the second axis.
Bmin
Type: Float 0.0 Coordinate of the lower bound along the second axis.
Cmax
Type: Float 1.0 Coordinate of the upper bound along the third axis.
Cmin
Type: Float 0.0 Coordinate of the lower bound along the third axis.
FirstAtom
Type: Integer Index of the first atom of the region. This key is ignored if the [Box] block is present.
LastAtom
Type: Integer Index of the last atom of the region. This key is ignored if the [Box] block is present.
StartStep
Type: Integer 0 Index of the MD step at which the heat exchange will start.
StopStep
Type: Integer Index of the MD step at which the heat exchange will stop.

One should be careful when choosing a value for the HeatingRate because a too large value may lead to pyrolysis of the heat source or to an abnormal termination when all the kinetic energy of the heat sink has been drained. The optimal value depends on the size of the system, its heat conductivity and the desired temperature gradient value. The thermal conductivity k can be calculated by dividing the heat flow rate W by the temperature gradient grad(T) and by the flow cross-section area S: $$k = W/(S \cdot grad(T))$$. See the trajectory sampling section above on how to obtain the temperature profile from which the grad(T) can be computed.