3.12 Molecular dynamics

FHI-aims provides the capability to run Born-Oppenheimer molecular dynamics. The necessary keywords are described in this section. A brief description of the physical algorithms implemented in FHI-aims can be found in Ref. [36]. For a truly thorough explanation of the underlying concepts, please refer to the standard literature, e.g., Refs. [94, 37].

Wave function extrapolation

For molecular dynamics runs within the microcanonical ensemble (“NVE”) or for deterministic thermostats, the wave function can be extrapolated in order to reduce the computational effort to reach self-consistency. This section specifies what quantity is actually extrapolated and how.

Following the approach of Kühne et al. [181], we extrapolate the contra-covariant density matrix 𝐏𝐒, the product of the ordinary (purely contravariant) one-particle density matrix 𝐏 and the overlap matrix 𝐒. The contra-covariant density matrix is then used to project new wave function coefficients from the last iteration 𝐜new=(𝐏𝐒)extra𝐜𝐨𝐥𝐝. As a last step, the one-particle coefficients are orthonormalized.

Refer to caption
Figure 3.1: Different extrapolation schemes. The scheme “pno” refers to an n point scheme of order o, remaining orders used to fit odd components.

The extrapolation scheme we use is sketched in Fig. 3.1 for the example of an ordinary function f(t) in a real variable t. For a pno scheme (chosen with wf_extrapolation polynomial n o) n old iterations f(t0kΔt), k=1,,n are stored. An ansatz function with n degrees of freedom is then used to fit all of these previous iterations and evaluated at t0 and the value used to intialize the SCF procedure.

The choice of the fitting function should aim at two targets: accurate extrapolation and time-reversal symmetry. The parameter o specifies the order of the extrapolation. The higher o, the better the extrapolation gets with decreasing time stemps Δt. Time-reversal symmetry is useful to avoid energetic drifts for not-so-tight SCF accuracy settings. By adding odd terms (odd with respect to t0+tt0t), time-reversal symmetry is enhanced [175].

Therefore, in contrast to [255, 136], the (no1) remaining degrees of freedom are not resolved within a least-squares fit but instead to add fitting functions (tt0)2k+1 to enhance time-reversal symmetry and thus energy conversion. Please note, however, that time-reversal symmetry itself only enhances energy conservation and not necessarily dynamical properties of the trajectories.

If you are interested in energy conservation, “p31” is in general a good choice to start with. If a good initial guess for the SCF procedure is desired, you should give “p32” a try. Please note that deactivation of extrapolation (wf_extrapolation none) is actually the same as the “p10” extrapolation (see Fig. 3.1) and simply uses the one-particle coefficients of the last iteration are to initialize the SCF procedure.

Tags for geometry.in:

 

Tag: velocity(geometry.in)

Usage: velocity vx vy vz
Purpose: Specifies a velocity for the immediately preceding atom in file geometry.in.
vx, vy, vz : x, y, and z components of the velocities, in Å/ps.

In geometry.in, the line containing the velocity must follow the line containing the atom that the velocity refers to. This can be used, e.g., to initialize a molecular dynamics run, or for analysis purposes later. Note that, for molecular dynamics, the FHI-aims standard output prints this information in the proper format, as part of a particular geometry associated with a molecular dynamics trajectory.

Tags for general section of control.in:

 

Tag: MD_maxsteps(control.in)

Usage: MD_maxsteps N
Purpose: Sets the maximal number of molecular dynamics steps.
N is an integer number. Default: -1 (infinite run).

A negative number signals that the ending criterion is not checked, in fact, the default setting is N=-1.

 

Tag: check_MD_stop(control.in)

Usage: check_MD_stop .true. / .false.
Purpose: if .true., an MD calculation ist stopped when a file MD_stop is generated
Default: .true.

 

Tag: MD_MB_init(control.in)

Usage: MD_MB_init Temperature
Purpose: Initializes random velocities in a molecular dynamics calculation using a Maxwell-Boltzmann distribution.
Temperature : Initial temperature in K. Default: No initial velocities.

This keyword is for a rough initialization only, and is overridden by any successful calls of the MD restarting procedure through MD_restart. The default initialization for all velocities is zero.

 

Tag: MD_clean_rotations(control.in)

Usage: MD_clean_rotations .true. / .false.
Purpose: if .true., uses Sayvetz conditions to clean initial velocities from rotations
Default: .true. for non-periodic systems, .false. for periodic systems or if relaxation_constraints are used.

This option is useful for non-periodic systems, allowing to weed out some residual numerical noise in the forces. However, seeming rotations of the unit cell can easily appear in periodic systems for completely normal, physical reasons. Since this led to some confusion, this option is now actively disabled (code stops) for periodic systems. If you have a good reason to use this option in periodic systems, it can be re-introduced by hand by setting the keyword force_MD_clean_rotations to .true..

 

Tag: force_MD_clean_rotations(control.in)

Usage: force_MD_clean_rotations .true. / .false.
Purpose: if .true. and MD_clean_rotations set to .true., cleans initial velocities from rotations also for periodic systems.

 

Tag: MD_thermostat_units(control.in)

Usage: MD_thermostat_units units
Purpose: To allow user specification of the effective thermostat mass outside of the internal units.
unit : Unit of the effective mass of the Nosé-Hoover and Nosé-Poincaré thermostats – either amu*bohr^2 (mass-oriented specification) or cm^-1 (frequency oriented specification, to allow to connect the thermostat mass to characteristic frequencies of the system). Default: amu*bohr^2 .

 

Tag: MD_restart(control.in)

Usage: MD_restart option
Purpose: controls the MD initialization from a molecular dynamics restart file.
Restriction: At present, this keyword does not produce proper results when switching ensembles between runs.
option is a string (see below). Default: .false.

Possible values for option are .true., .false., time_restart, or filename. The default is .false..

The data for the molecular dynamics integrator is always written to a file aims_MD_restart.dat after each time step (regardless of whether or not keyword MD_restart is used). If MD_restart is set, this keyword controls the reading of such data from a previous run (if that exists), to either

  • continue a previous run (.true.), or

  • to use previous position / velocity information but reset all timings (time_restart), or

  • to begin a new run from scratch (.false.)

The default file name is used unless the user specifies a specific file filename from where the input is to be read.

Important: If the starting structure and velocities are taken from the restart file, any exact positions noted in geometry.in are ignored. However, the species identification, possible initial charges, and other per-atom information in geometry.in remain valid and must be present as always. If the option .true. is set, the molecular dynamics clock is also read from file, in all other restarts the clock is reset to zero.

 

Tag: MD_restart_binary(control.in)

Usage: MD_restart_binary option
Purpose: controls the format used for the molecular dynamics restart file.
option is a string (see below). Default: .true.

Possible values for option are .true. and .false.. The default is .true.. Use this flag to switch to the ASCII format in the MD restart file.

 

Tag: MD_run(control.in)

Usage: MD_run time ensemble [further specifications]
Purpose: Central controls of the physical parameters of a Born-Oppenheimer molecular dynamics run.
time : Requested MD time in ps.
ensemble : Ensemble specifications for MD_run, listed as subkeywords to MD_run in a separate section below.
further specifications: See ensemble subkeywords below.

This keyword is the key control for all molecular dynamics. The runtimes time are specified in ps. There are five different possible ensembles, each of which require different options - as described in a separate subsection below.

When a schedule of different temperatures, thermostats etc is required within the same run (e.g., initialization followed by NVE, change of temperature, etc.), use the MD_schedule keyword instead of MD_run.

 

Tag: MD_schedule(control.in)

Usage: MD_schedule
Purpose: Must be followed by specific segments of a Born-Oppenheimer molecular dynamics run.

Must be followed by an arbitrary number of lines MD_segment, where different temperatures, thermostats, etc. may be specified for each segment of the run.

 

Tag: MD_segment(control.in)

Usage: MD_segment time ensemble [further specifications]
Purpose: Central controls of the physical parameters of a Born-Oppenheimer molecular dynamics run.
time : Requested MD time in ps.
ensemble : Ensemble specifications for MD_run, listed as subkeywords to MD_run in a separate section below.
further specifications: See ensemble subkeywords below.

Keyword MD_segment must only appear in consecutive lines after an MD_schedule keyword. Instead of a single set of MD thermostats, temperatures etc. throughout the simulation, this keyword allows to set specific values for only a segment of the full run.

 

Tag: MD_time_step(control.in)

Usage: MD_time_step deltat
Purpose: Set the time step for a molecular dynamics run, in ps.
Default: 0.001 (this is 1 fs)

 

Tag: wf_extrapolation(control.in)

Usage: wf_extrapolation extrapolation_type
Purpose: Used to specify the wave function extrapolation. Options are polynomial n o (an n-point polynomial extrapolation of order o, where the remaining degrees of freedom are used to enhance time reversibility), niklasson06 n (an n-point extrapolation as specified by Niklasson et al. [230]), none (same as polynomial 1 0), linear (polynomial 2 1), and quadratic (polynomial 3 2).
Default: polynomial 3 1 for NVE, none otherwise.

The option polynomial 3 1 strongly reduces a possible energy drift in NVE runs even for moderate force accuracy settings and additionally lowers the number of SCF cycles per time step.

Warning: This feature is experimental. It most probably will not enhance convergence of metallic systems and is not parallelized. The niklasson06 schemes are not suitable for long runs of nontrivial physical systems because a regular reinitialization would be necessary.

 

Tag: wf_func(control.in)

Usage: wf_func specifications
Purpose: Used to activate the wave function extrapolation with fine grained control over the basis functions used for extrapolation. Each wf_func line adds one iteration to the extrapolation scheme and one fitting function. Options are “constant” (1), “linear” (t), “quadratic” (t2), “cubic” (t3), “polynomial n” (tn), “sin ω unit” (sinωt), and “cos ω unit” (cosωt). The unit “unit” is either “cm^-1” or “fs”. Additionally, “none” can be used to add one degree of freedom which is used to stabilize things in a least squares manner.

The same warning as for wf_extrapolation applies.

Ensemble specification options for the MD_run and MD_segment keywords:

When used with a molecular dynamics schedule of time segments with different thermostats, the following subkeywords should appear behind an MD_segment keyword instead of MD_run.

 

MD_run sub-tag: NVE(control.in)

Usage: MD_run time NVE
Purpose: Performs molecular dynamics in the microcanonical ensemble.

 

MD_run sub-tag: NVE_4th_order(control.in)

Usage: MD_run time NVE_4th_order
Purpose: Performs molecular dynamics in the microcanonical ensemble, using a fourth-order integration method. The integrator used is called SI4 in Ref. [152]. This method is sometimes useful for longer time steps and for very accurate MD. Note that there are five force evaluations per time step, instead of the usual single calculation.

 

MD_run sub-tag: NVE_damped(control.in)

Usage: MD_run time NVE_damped damping_factor
Purpose: Performs microcanonical molecular dynamics, but dampens each velocity by a factor damping_factor after each time step.
damping_factor is the damping factor between different MD steps.

This option is a useful addition to the structural relaxation, which can be done in principle with a molecular dynamics run as well. In almost all cases, however, the BFGS algorithm as called with the relax_geometry keyword is preferable.

 

MD_run sub-tag: NVT_andersen(control.in)

Usage: MD_run time NVT_andersen Temperature nu
Purpose: Run molecular dynamics with an Andersen stochastic thermostat.
Temperature is the simulation temperature in K.
nu : Probability that a given atom’s velocity will be “reset” to a Maxwell-Boltzmann distributed value, per picosecond!

Andersen’s [9] simple definition of a thermostat that randomly resets the velocity of individual atoms to a Maxwell-Boltzmann distributed value with a given frequency. This is an example of a rather harsh thermostat.

 

MD_run sub-tag: NVT_berendsen(control.in)

Usage: MD_run time NVT_berendsen Temperature tau
Purpose: Molecular dynamics run using the Berendsen thermostat.
Temperature is the simulation temperature in K.
tau is a relaxation time of the thermostat, in ps.

Note that the Berendsen thermostat does NOT resemble any physical ensemble, but that it is a useful standard to initialize a molecular dynamics simulation. The relaxation time tau must be chosen by the user, there is no default. Remember that the special case τ=Δt reproduces the correct temperature exactly at every time step and can be used for a very rough initialization.

 

MD_run sub-tag: NVT_parrinello(control.in)

Usage: MD_run time NVT_parrinello Temperature tau
Purpose: Molecular dynamics run using the Bussi-Donadio-Parrinello thermostat. [49]
Temperature is the simulation temperature in K.
tau is a relaxation time of the thermostat, in ps.

This is the Bussi-Donadio-Parrinello thermostat, as described in Ref. [49] It a) properly samples the canonical distribution and b) preserves time correlations. The relaxation time tau (in ps) must be chosen by the user, there is no default. The performance of the thermostat is claimed in Ref. [49] to be practically independent of the value of τ, for condensed phases. For clusters, though, a proper tuning of tau might be necessary. When this ensemble is chosen, the conserved pseudo-Hamiltonian (as described in Ref. [49]) is printed in the output.

 

MD_run sub-tag: GLE_thermostat(control.in)

Usage: MD_run time GLE_thermostat Temperature Number_of_aux_DOF
Purpose: Molecular dynamics run using the colored-noise thermostats based on the Generalized Langevin Equation, proposed by M. Ceriotti and coworkers [55, 58, 56].
Temperature is the simulation temperature in K.
Number_of_aux_DOF (integer) is the number of auxiliary degrees of freedom for this thermostat, that specifies the dimensions of the input matrices

This is a flexible thermostat based on the Generalized Langevin Equation, that adds extra degrees of freedom to the equations of motion and has a frequency dependent memory kernel, so that one can adjust the performance of the thermostat for different degrees of freedom in the system. It requires also matrices as inputs, for which we refer the reader to the keywords MD_gle_A and MD_gle_C. Please read references [55, 58, 56] and references therein before using this. It can be used to sample the canonical ensemble or to break detailed balance and simulate other conditions, including approximate quantum effects. It has a conserved quantity in the same spirit of the BDP thermostat.

 

MD_run sub-tag: NVT_nose-hoover(control.in)

Usage: MD_run time NVT_nose-hoover Temperature Q
Purpose: Run molecular dynamics with a Nosé-Hoover thermostat.
Temperature is the simulation temperature in K.
Q : Effective mass specification of the thermostat in units as specified by MD_thermostat_units.

Probably the most popular thermostat in the literature.

 

MD_run sub-tag: NVT_nose-poincare(control.in)

Usage: MD_run time NVT_nose-poincare Temperature Q
Purpose: Run molecular dynamics with a Nosé-Poincaré thermostat.
Temperature is the simulation temperature in K.
Q : Effective mass specification of the thermostat in units as specified by MD_thermostat_units.

Due to numerical issues, this thermostat has been disabled for the time being.

 

Tag: MD_gle_A(control.in)

Usage: MD_gle_A entries
Purpose: Required input for GLE_thermostat
entries contains all entries (Number_of_aux_DOF + 1) of one row of the matrix. One must repeat this flag for each row of the matrix, in order.

Units should be 1/ps, and the matrix can be downloaded from http://epfl-cosmo.github.io/gle4md/. If you wish to model different dynamics (quantum effects, or thermalization of PIMD), one can also specify a C matrix with the keyword MD_gle_C.

 

Tag: MD_gle_C(control.in)

Usage: MD_gle_C entries
Purpose: Optional input for GLE_thermostat
entries contains all entries (Number_of_aux_DOF + 1) of one row of the matrix. One must repeat this flag for each row of the matrix, in order.

This matrix is optional for the usage of the GLE thermostats. If sampling the canonical ensemble it is not needed. Otherwise, it is. Units should be K, and the matrix can be downloaded from http://epfl-cosmo.github.io/gle4md/.

3.12.1 Path integral molecular dynamics and advanced types of dynamics

The best way to perform path integral molecular dynamics and other more advanced dynamics techniques in FHI-aims is through the i-PI python wrapper [57]. This code is available free of charge. Information about the code can be found in http://ipi-code.org/ and we provide a quick tutorial on how one can make it work with FHI-aims in the tutorials. Through this interface, one can perform all types of dynamics (classical or quantum) with a wide range of thermostats, barostats, and different path integral acceleration techniques. i-PI uses internet sockets for the communication with the client codes, making it also easy to join different codes in the same simulation (e.g. a thermodynamic integration), as long as they can all communicate with i-PI. Note that NPT and NST (constant stress) simulations are currently supported only for functionals where the analytical stress tensor is available. If you wish to perform an NPT simulation, please add also compute_analytical_stress .true. to your control.in file.

The basic keywords that can appear in the control.in file of FHI-aims are listed below. Examples of how to run FHI-aims bound to i-PI are available in the folder aimsfiles/examples/ipi with the corresponding i-PI and FHI-aims input files, as well as a short explanation on how to run the programs. Examples of FHI-aims being used with i-PI can also be found in the i-PI distribution. Please refer also to the i-PI manual and contact the developer responsible for the FHI-aims interface (Mariana Rossi) if you have any doubts about the usage of FHI-aims with this code.

 

Tag: use_pimd_wrapper(control.in)

Usage: use_pimd_wrapper hostaddress portnumber
Purpose: Interfaces FHI-aims to an internet socket based python wrapper code that does path integral molecular dynamics.
hostaddress accepts a host name or an IP address. If you want to use UNIX sockets, add ’UNIX:’ before the host address.
portnumber should contain the number of the port that the wrapper is listening to.

 

Tag: communicate_pimd_wrapper(control.in)

Usage: communicate_pimd_wrapper quantity
Purpose: Communicates the specified quantity to the i-PI code. Currently i-PI keeps track of this specified quantity for each step of the dynamics and each replica of the system (should they exist). They are written on a file created by i-PI that can be easily parsed for postprocessing purposes. The current available options are: dipole, polarizability,hirshfeld, workfunction and friction.

3.12.2 Running FHI-aims with i-PI over TCP/IP Sockets

Using TCP/IP sockets (Internet sockets) is the most straightforward and consistent way of using the i-PI wrapper with FHI-aims, particularly on HPC systems where UNIX sockets are unavailable. However, IP/TCP ports are assigned dynamically on a system, and therefore there can be no guarantee that a previously assigned port in an input file will be free when the calculation starts. To avoid this problem we recommend using the utility script get_free_port.py in the utilities directory to set the port to right before initializing the calculation either locally or inside the submission script on an HPC system. This script will automatically check if a requested port and change it if it is not free or find a free port, and update both the relevant information in the i-PI and FHI-aims input files. To use the script simply, run

  > get_free_port.py -x inputs.template.xml \
                     -ox inputs.xml \
                     -c control.in \
                     -oc {system_name_descriptor}/control.in

or for cases when multiple calculators are used

  > get_free_port.py -x inputs.template.xml \
                     -ox inputs.xml \
                     -c control.in \
                     -oc {system_1_name_descriptor}/control.in \
                         {system_2_name_descriptor}/control.in

In cases where you simply want to overwrite the template input files do not set the -ox or -oc variables. Additionally if you are running a system with a variable IP address, you can update the hostaddress with the following command:

  > get_free_port.py --host HOST_ADDRESS \
                     -x inputs.template.xml \
                     -ox inputs.xml \
                     -c control.in \
                     -oc {system_name_descriptor}/control.in

where ----host default will set the host to be the default for the system you are on. For a complete description of the functionality of the script run

  > get_free_port.py --help