Molecular simulation

How molecular simulations are built and analysed: potential energy surfaces and force fields, Monte Carlo, molecular dynamics, thermostats and barostats, and transport properties.

Interaction models

Potential energy surfaces and force fields; periodic boundaries, cut-offs, neighbour lists and long-range electrostatics.

1Potential energy surfaces and force fields

The Born–Oppenheimer picture, forces as gradients, pair potentials, the anatomy of a classical force field, and why their limits motivate machine-learned potentials.

about 15 min readBuilds on Classical mechanics and phase space

Atoms move on a landscape

Almost every atomistic simulation, classical or machine-learned, rests on one approximation. Nuclei are thousands of times heavier than electrons, so on the timescale of nuclear motion the electrons relax instantly to their ground state. This Born–Oppenheimer approximation separates the problem: for each fixed arrangement of nuclei R=(r1,…,rN)\mathbf R = (\mathbf r_1, \dots, \mathbf r_N), solving the electronic Schrödinger equation gives one number, the energy E(R)E(\mathbf R). As the nuclei move, that number traces out a 3N3N-dimensional landscape, the potential energy surface (PES).

The force on atom ii is the downhill slope of the landscape:

Fi=−∇riE(R)=−∂E∂ri. \mathbf F_i = -\nabla_{\mathbf r_i} E(\mathbf R) = -\frac{\partial E}{\partial \mathbf r_i}.

Everything else follows from E(R)E(\mathbf R). Minima are stable structures: molecules, crystals, adsorption geometries. First-order saddle points connect minima and are transition states; their height sets reaction rates. The curvature at a minimum, the Hessian ∂2E/∂ri∂rj\partial^2 E/\partial\mathbf r_i\partial\mathbf r_j, gives vibrational frequencies and phonons. Molecular dynamics moves the atoms across the surface under these forces.

Computing E(R)E(\mathbf R) from quantum mechanics, typically with density functional theory (DFT), is accurate but expensive: the cost grows roughly as N3N^3 with the number of electrons, which limits routine DFT molecular dynamics to a few hundred atoms for tens of picoseconds. A force field or interatomic potential replaces the quantum calculation with a cheap analytic function of the positions. This lesson is about the classical forms; the lesson on interatomic potentials replaces them with machine-learned ones.

Pair potentials

The simplest model assumes the energy is a sum over pairs that depends only on distance, E=∑i<ju(rij)E = \sum_{i<j} u(r_{ij}). The force between a pair is then directed along the line joining them, with magnitude F(r)=−du/drF(r) = -\mathrm du/\mathrm dr.

Lennard-Jones. For closed-shell atoms such as argon,

uLJ(r)=4ε[(σr)12−(σr)6],FLJ(r)=24εr[2(σr)12−(σr)6]. u_{\text{LJ}}(r) = 4\varepsilon\left[\left(\frac{\sigma}{r}\right)^{12} - \left(\frac{\sigma}{r}\right)^{6}\right], \qquad F_{\text{LJ}}(r) = \frac{24\varepsilon}{r}\left[2\left(\frac{\sigma}{r}\right)^{12} - \left(\frac{\sigma}{r}\right)^{6}\right].

The r−6r^{-6} attraction has a physical origin: it is the London dispersion interaction between fluctuating dipoles. The r−12r^{-12} repulsion, standing in for Pauli repulsion between overlapping electron clouds, was chosen mainly because it is the square of r−6r^{-6} and cheap to compute; the true repulsion is closer to exponential. The minimum lies at rmin⁡=21/6σ≈1.12 σr_{\min} = 2^{1/6}\sigma \approx 1.12\,\sigma with depth −ε-\varepsilon, and the potential crosses zero at r=σr = \sigma.

Morse. For a chemical bond that can dissociate,

uM(r)=De[1−e−a(r−r0)]2−De, u_{\text{M}}(r) = D_e\left[1 - e^{-a(r - r_0)}\right]^2 - D_e ,

with dissociation energy DeD_e, equilibrium length r0r_0 and width parameter aa. Unlike a spring, it levels off at large rr: bonds break.

Energy, force and the harmonic approximation

Loading the interactive figure…

Drag to change the separation. Upper panel: energy; lower panel: force, the negative slope of the energy. The dashed teal curves are the harmonic approximation at the minimum. The vibrational wavenumber uses the reduced mass of Ar₂, H₂ or a C–H bond.

In the lab, notice three things. The force is zero exactly at the energy minimum and largest in magnitude where the energy curve is steepest. Repulsion at short range is far steeper than attraction at long range. And the harmonic approximation (dashed) is good only near the minimum: real bonds are anharmonic, softer when stretched and stiffer when compressed, which is why thermal expansion exists.

The harmonic approximation and vibrations

Expanding any potential to second order about its minimum gives a spring,

u(r)≈u(r0)+12k (r−r0)2,k=d2udr2∣r0, u(r) \approx u(r_0) + \tfrac12 k\,(r-r_0)^2, \qquad k = \left.\frac{\mathrm d^2u}{\mathrm dr^2}\right|_{r_0},

and a diatomic of reduced mass μ=m1m2/(m1+m2)\mu = m_1m_2/(m_1+m_2) vibrates with angular frequency ω=k/μ\omega = \sqrt{k/\mu}, usually quoted as a wavenumber ν~=ω/(2πc)\tilde\nu = \omega/(2\pi c). For the Morse potential, k=2Dea2k = 2D_e a^2. The H₂ parameters in the lab give about 4400 cm⁻¹, close to the measured harmonic frequency; the C–H bond gives about 2900 cm⁻¹, the familiar C–H stretch region of an infrared spectrum. These numbers matter for simulation: the fastest vibration in a system sets the largest stable time step (the molecular dynamics lesson).

Anatomy of a classical force field

Biomolecular and soft-matter force fields such as AMBER, CHARMM, OPLS-AA and GROMOS write the energy as a sum of simple terms:

E=∑bonds12kb(b−b0)2+∑angles12kθ(θ−θ0)2+∑dihedralskϕ[1+cos⁡(nϕ−δ)]+∑i<j{4εij[(σijrij)12−(σijrij)6]+qiqj4πε0rij}. \begin{aligned} E = &\sum_{\text{bonds}} \tfrac12 k_b (b - b_0)^2 + \sum_{\text{angles}} \tfrac12 k_\theta(\theta - \theta_0)^2 + \sum_{\text{dihedrals}} k_\phi\big[1 + \cos(n\phi - \delta)\big] \\ &+ \sum_{i<j}\left\{ 4\varepsilon_{ij}\left[\left(\frac{\sigma_{ij}}{r_{ij}}\right)^{12} - \left(\frac{\sigma_{ij}}{r_{ij}}\right)^{6}\right] + \frac{q_iq_j}{4\pi\varepsilon_0 r_{ij}} \right\}. \end{aligned}

The first line, the bonded terms, holds the covalent skeleton together. The second, the non-bonded terms, acts between all atoms not closely bonded: van der Waals interactions and electrostatics between fixed partial charges. Parameters for unlike pairs usually come from combining rules, for example Lorentz–Berthelot: σij=(σi+σj)/2\sigma_{ij} = (\sigma_i + \sigma_j)/2, εij=εiεj\varepsilon_{ij} = \sqrt{\varepsilon_i\varepsilon_j}.

Every parameter is fitted, to quantum-chemical calculations (geometries, torsion scans, electrostatic potentials) and to experiments (densities, heats of vaporisation, hydration free energies). A force field is therefore a model with a domain of validity, and it can fail outside it. Two failures recur.

  • Fixed charges cannot polarise. A molecule next to a metal surface or an ion has its electron density distorted; fixed point charges cannot respond. Polarisable force fields add induced dipoles or Drude oscillators, at a cost. For gold surfaces, for example, the GolP-CHARMM force field adds a mobile image charge to every gold atom.
  • Combining rules are approximations. In concentrated solutions, the default cross-interactions between unlike groups can be wrong enough to cause artificial aggregation. Pair-specific corrections (NBFIX in CHARMM) are fitted to experimental osmotic coefficients to fix them.

Other material classes need other functional forms. Metals are poorly described by pair potentials because metallic bonding depends on the local electron density; the embedded-atom method (EAM) adds a many-body embedding term Fi(ρˉi)F_i(\bar\rho_i) for each atom. Covalent solids such as silicon need angle-dependent terms (Stillinger–Weber, Tersoff). Reactive force fields such as ReaxFF let bond orders change continuously so that bonds can form and break.

In practice

Check any potential you implement against a finite-difference derivative. For Lennard-Jones argon:

import numpy as np

eps, sig = 0.997, 3.405                    # argon: kJ/mol, Å
def U(r):                                  # Lennard-Jones energy
    s6 = (sig / r) ** 6
    return 4 * eps * (s6 * s6 - s6)
def F(r):                                  # force = -dU/dr (positive = repulsive)
    s6 = (sig / r) ** 6
    return 24 * eps * (2 * s6 * s6 - s6) / r

r = np.linspace(3.2, 8.0, 2001)
rmin = r[np.argmin(U(r))]
print(f"minimum at r = {rmin:.3f} Å   (2^(1/6) σ = {2**(1/6)*sig:.3f} Å)")
print(f"U(rmin) = {U(rmin):.3f} kJ/mol (= -ε)")

h = 1e-5                                   # check the analytic force by finite differences
print(f"F(4.0) analytic {F(4.0):.6f}, numerical {-(U(4.0+h)-U(4.0-h))/(2*h):.6f}")
minimum at r = 3.822 Å   (2^(1/6) σ = 3.822 Å)
U(rmin) = -0.997 kJ/mol (= -ε)
F(4.0) analytic -0.544033, numerical -0.544033

Check yourself

  1. At the minimum of a pair potential, what is the force between the two atoms?
  2. Where is the minimum of the Lennard-Jones potential?
  3. Why do classical fixed-charge force fields struggle to describe a molecule adsorbing on a metal surface?
  4. The harmonic frequency of a bond is ω=k/μ\omega = \sqrt{k/\mu}. Replacing H by D roughly doubles the reduced mass of an X–H bond with a heavy X. What happens to the vibrational frequency?

References and further reading

  1. M. Born and R. Oppenheimer, “Zur Quantentheorie der Molekeln,” Annalen der Physik 389, 457–484 (1927).
  2. J. E. Lennard-Jones, “On the determination of molecular fields. II. From the equation of state of a gas,” Proceedings of the Royal Society A 106, 463–477 (1924).
  3. P. M. Morse, “Diatomic molecules according to the wave mechanics. II. Vibrational levels,” Physical Review 34, 57–64 (1929).
  4. A. R. Leach, Molecular Modelling: Principles and Applications, 2nd ed., Pearson (2001), chapter 4 (empirical force field models).
  5. M. P. Allen and D. J. Tildesley, Computer Simulation of Liquids, 2nd ed., Oxford University Press (2017), chapter 1.
  6. W. D. Cornell, P. Cieplak, C. I. Bayly, I. R. Gould, K. M. Merz, D. M. Ferguson, D. C. Spellmeyer, T. Fox, J. W. Caldwell and P. A. Kollman, “A second generation force field for the simulation of proteins, nucleic acids, and organic molecules,” Journal of the American Chemical Society 117, 5179–5197 (1995).
  7. A. D. MacKerell Jr. et al., “All-atom empirical potential for molecular modeling and dynamics studies of proteins,” Journal of Physical Chemistry B 102, 3586–3616 (1998).
  8. W. L. Jorgensen, D. S. Maxwell and J. Tirado-Rives, “Development and testing of the OPLS all-atom force field on conformational energetics and properties of organic liquids,” Journal of the American Chemical Society 118, 11225–11236 (1996).
  9. M. S. Daw and M. I. Baskes, “Embedded-atom method: derivation and application to impurities, surfaces, and other defects in metals,” Physical Review B 29, 6443–6453 (1984).
  10. A. C. T. van Duin, S. Dasgupta, F. Lorant and W. A. Goddard III, “ReaxFF: a reactive force field for hydrocarbons,” Journal of Physical Chemistry A 105, 9396–9409 (2001).
  11. L. B. Wright, P. M. Rodger, S. Corni and T. R. Walsh, “GolP-CHARMM: first-principles based force fields for the interaction of proteins with Au(111) and Au(100),” Journal of Chemical Theory and Computation 9, 1616–1630 (2013).
  12. S. Panigrahy, R. Sahu, S. K. Reddy and D. Nayar, “Structure, energetics and dynamics in crowded amino acid solutions: a molecular dynamics study,” Physical Chemistry Chemical Physics 25, 5430–5442 (2023), an example of NBFIX corrections fitted to osmotic coefficients.

Monte Carlo methods

Importance sampling, the Metropolis algorithm and Monte Carlo in other ensembles.

2Monte Carlo simulation

Sampling the Boltzmann distribution without dynamics: the origins of Monte Carlo at Los Alamos, Markov chains, stationary distributions and detailed balance, the Metropolis and Metropolis–Hastings acceptance rules, tuning moves and measuring correlation, Monte Carlo in the canonical, isothermal–isobaric, grand canonical and Gibbs ensembles, configurational-bias, cluster and hybrid moves, and when to choose Monte Carlo over molecular dynamics.

about 15 min readBuilds on Ensembles and free energy, Probability and statistics, Integrals

Origins

The averages of statistical mechanics are integrals over all configurations, weighted by the Boltzmann factor, in a space of thousands of dimensions. The chapter on integrals showed why such integrals cannot be done on a grid and why random sampling, with an error falling as 1/N1/\sqrt N whatever the dimension, is the only practical approach. The question is how to sample. Drawing configurations uniformly at random is useless: almost all of them have overlapping atoms and a Boltzmann weight of essentially zero. The samples must be drawn from the Boltzmann distribution itself.

The solution was found at Los Alamos at the dawn of electronic computing. Stanislaw Ulam and John von Neumann had used random sampling for neutron-diffusion calculations in the late 1940s, and Nicholas Metropolis named the approach after the Monte Carlo casino; Metropolis and Ulam described it in 1949. In 1953 Metropolis, Arianna and Marshall Rosenbluth, and Augusta and Edward Teller published “Equation of state calculations by fast computing machines”, in which they computed the equation of state of a two-dimensional system of hard disks on the MANIAC computer. Their algorithm, now called the Metropolis algorithm, generates a sequence of configurations that visits each one with a frequency proportional to its Boltzmann weight, without ever computing the partition function. It is among the most influential algorithms of the twentieth century.

Markov chains and detailed balance

The algorithm generates a Markov chain: a sequence of configurations in which each new one is chosen at random with a probability that depends only on the current one, π(o→n)\pi(o \to n) from old to new. If the chain is run long enough, it settles into a stationary distribution p(x)p(\mathbf x) that no longer changes from step to step. The design problem is to choose π\pi so that the stationary distribution is the Boltzmann distribution. A sufficient condition is detailed balance: in the stationary state, the flow of probability from any configuration to any other is exactly balanced by the reverse flow,

The transition is split into two stages: propose a trial configuration nn with probability α(o→n)\alpha(o \to n), then accept it with probability acc(o→n)\mathrm{acc}(o \to n), otherwise keep oo. If the proposal is symmetric, α(o→n)=α(n→o)\alpha(o \to n) = \alpha(n \to o), detailed balance only constrains the ratio of acceptance probabilities, and the Metropolis choice satisfies it in the simplest way:

The last point is often missed and causes real errors: when a move is rejected, the current configuration must be counted again in all averages. Discarding rejected steps biases the averages towards configurations that are easy to leave.

The algorithm in practice

For a system of particles, a Monte Carlo step consists of choosing a particle, displacing it by a random vector drawn uniformly from a small cube of side 2Δ2\Delta, computing the change in energy, and accepting or rejecting by the Metropolis rule. Only the interactions of the moved particle change, so the energy difference costs O(N)O(N) (or O(1)O(1) with neighbour lists), not a full energy evaluation. One attempted move per particle is a cycle or sweep.

The figure runs the algorithm for a single coordinate in a double-well potential. Each arrow is a trial move: green if accepted, rose if rejected. The histogram of visited positions converges to the Boltzmann distribution.

The Metropolis algorithm, one trial at a time

Loading the interactive figure…

Top: the potential, the current state (orange) and the last trial move (green accepted, rose rejected). Bottom: the histogram of the chain against the exact Boltzmann distribution. Vary the maximum step and watch the acceptance rate and the integrated autocorrelation time; turn off slow motion to accumulate statistics quickly.

The step size Δ\Delta controls efficiency. Very small steps are almost always accepted but move the system hardly at all, so successive configurations are nearly identical. Very large steps jump far but are almost always rejected, so the system stays put. Between these extremes lies an optimum, which the figure measures through the integrated autocorrelation time τint\tau_{\text{int}}: the number of steps needed to produce one effectively independent sample, as defined in the chapter on probability. A common rule of thumb targets an acceptance rate of 30–50 %, but the real criterion is the smallest τint\tau_{\text{int}} for the quantities of interest, and in a double well the optimal step may be the one that can occasionally jump the barrier. Codes adjust Δ\Delta during equilibration to reach a target acceptance, then keep it fixed during production, because changing the move during sampling breaks detailed balance.

Monte Carlo in other ensembles

Molecular dynamics naturally samples the microcanonical ensemble, and other ensembles require thermostats and barostats. Monte Carlo is the opposite: ensembles are chosen simply by choosing which moves to make and how to accept them, each derived from detailed balance in that ensemble.

In the isothermal–isobaric (NPT) ensemble, the volume becomes a variable. A volume move rescales the box and all positions from VV to V′V' and is accepted with

acc=min⁡ ⁣(1,  exp⁡ ⁣{−β[U(n)−U(o)+P(V′−V)]+Nln⁡V′V}), \mathrm{acc} = \min\!\left(1,\; \exp\!\Big\{-\beta\big[U(n) - U(o) + P(V' - V)\big] + N\ln\frac{V'}{V}\Big\}\right),

where the last term comes from the change in the volume available to NN scaled coordinates (for moves uniform in VV).

In the grand canonical (μVT\mu VT) ensemble, particles are inserted at random positions and deleted at random, with

acc(insert)=min⁡ ⁣(1,  VΛ3(N+1) eβ[μ−ΔU]),acc(delete)=min⁡ ⁣(1,  Λ3NV e−β[μ+ΔU]), \mathrm{acc}(\text{insert}) = \min\!\left(1,\; \frac{V}{\Lambda^3(N + 1)}\,e^{\beta[\mu - \Delta U]}\right), \qquad \mathrm{acc}(\text{delete}) = \min\!\left(1,\; \frac{\Lambda^3 N}{V}\,e^{-\beta[\mu + \Delta U]}\right),

where Λ\Lambda is the thermal wavelength. Grand canonical Monte Carlo is the standard method for computing adsorption isotherms of gases in porous materials such as zeolites and metal–organic frameworks, with the chemical potential set from the gas pressure through an equation of state; codes such as RASPA are built around it.

The Gibbs ensemble method of Athanassios Panagiotopoulos (1987) simulates two coexisting phases in two separate boxes without an interface, exchanging volume and particles between them so that pressure and chemical potential equalise; it gives liquid–vapour coexistence curves directly.

Smarter moves

The freedom to invent moves is Monte Carlo’s great strength: moves need not be physical, only correct. Inserting a long chain molecule at a random position almost always produces an overlap and is rejected. Configurational-bias Monte Carlo (J. Ilja Siepmann and Daan Frenkel; Frenkel, G. C. A. M. Mooij and Berend Smit, 1992) grows the chain segment by segment, choosing each segment among several trial positions with probability proportional to its Boltzmann weight, and corrects for the bias in the acceptance rule with a Rosenbluth weight; it made simulations of alkanes in zeolites and of polymer melts practical. Cluster moves, such as the Swendsen–Wang (1987) and Wolff (1989) algorithms for spin models, flip whole correlated clusters at once and largely eliminate critical slowing down near phase transitions (the chapter on phase transitions). Hybrid Monte Carlo (Simon Duane, Anthony Kennedy, Brian Pendleton and Duncan Roweth, 1987) proposes a new configuration by running a short molecular dynamics trajectory with random initial velocities, and accepts it with a Metropolis test on the change in total energy, combining the large collective moves of dynamics with the exactness of Monte Carlo. Replica-exchange moves between simulations at different temperatures are also Monte Carlo moves (the chapter on replica exchange).

Monte Carlo or molecular dynamics?

Both sample equilibrium ensembles, and for equilibrium properties the choice is practical. Molecular dynamics provides genuine time evolution and therefore transport properties and kinetics; it moves all particles collectively and parallelises naturally; and it needs forces, which every modern potential supplies. Monte Carlo provides no dynamics (its “time” is the number of trials), but it can sample ensembles with fluctuating particle numbers, use unphysical moves that jump over barriers, handle discontinuous potentials such as hard spheres, and needs only energy differences. Systems with discrete degrees of freedom, such as lattice models, alloy orderings and adsorption, are natural for Monte Carlo; liquids, biomolecules and anything requiring dynamics are natural for MD. Kinetic Monte Carlo, discussed in the chapter on rates, is a different method that uses rates to generate true stochastic dynamics.

Check yourself

  1. A trial move raises the energy by 2 k_BT. With what probability is it accepted?
  2. A program discards rejected moves instead of counting the old configuration again. What happens?
  3. Why does grand canonical Monte Carlo suit adsorption in porous materials?

References and further reading

  1. N. Metropolis and S. Ulam, “The Monte Carlo method”, Journal of the American Statistical Association 44, 335–341 (1949).
  2. N. Metropolis, A. W. Rosenbluth, M. N. Rosenbluth, A. H. Teller and E. Teller, “Equation of state calculations by fast computing machines”, Journal of Chemical Physics 21, 1087–1092 (1953).
  3. W. K. Hastings, “Monte Carlo sampling methods using Markov chains and their applications”, Biometrika 57, 97–109 (1970).
  4. A. Z. Panagiotopoulos, “Direct determination of phase coexistence properties of fluids by Monte Carlo simulation in a new ensemble”, Molecular Physics 61, 813–826 (1987).
  5. J. I. Siepmann and D. Frenkel, “Configurational bias Monte Carlo: a new sampling scheme for flexible chains”, Molecular Physics 75, 59–70 (1992).
  6. S. Duane, A. D. Kennedy, B. J. Pendleton and D. Roweth, “Hybrid Monte Carlo”, Physics Letters B 195, 216–222 (1987).
  7. D. Frenkel and B. Smit, Understanding Molecular Simulation, 3rd ed., Academic Press (2023), chapters 3, 6, 10 and 13.
  8. D. P. Landau and K. Binder, A Guide to Monte Carlo Simulations in Statistical Physics, 5th ed., Cambridge University Press (2021).
  9. D. Dubbeldam, S. Calero, D. E. Ellis and R. Q. Snurr, “RASPA: molecular simulation software for adsorption and diffusion in flexible nanoporous materials”, Molecular Simulation 42, 81–101 (2016).

Dynamics

Molecular dynamics, numerical integration of the equations of motion, thermostats and barostats.

3Molecular dynamics

Newton's equations on a computer: the Verlet integrator and why it conserves energy, choosing the time step, periodic boundaries and cut-offs, thermostats and barostats, and a working MD workflow.

about 22 min readBuilds on Potential energy surfaces and force fields, The Boltzmann distribution

The idea

Molecular dynamics (MD) solves Newton’s equations of motion for every atom,

mi r¨i=Fi=−∇riE(R),i=1,…,N, m_i\,\ddot{\mathbf r}_i = \mathbf F_i = -\nabla_{\mathbf r_i} E(\mathbf R), \qquad i = 1,\dots,N,

one small time step at a time, starting from some positions and velocities. The result is a trajectory, a movie of the atoms. Averages over the trajectory give thermodynamic and structural properties; correlations in time give transport properties. The method dates from Alder and Wainwright’s hard-sphere simulations (1957) and Rahman’s simulation of liquid argon (1964); today it runs routinely on millions of atoms.

Two facts make MD work in practice. First, a good integrator keeps the total energy constant for millions of steps even though each step has an error. Second, statistical mechanics tells us that a long trajectory samples the same states as an ensemble average (the ergodic hypothesis), so time averages from one simulation give equilibrium properties.

Integrating the equations: Verlet

Expand the position forward and backward in time by a step Δt\Delta t:

r(t±Δt)=r(t)±v(t)Δt+12a(t)Δt2±16r...(t)Δt3+O(Δt4). \mathbf r(t \pm \Delta t) = \mathbf r(t) \pm \mathbf v(t)\Delta t + \tfrac12\mathbf a(t)\Delta t^2 \pm \tfrac16\dddot{\mathbf r}(t)\Delta t^3 + \mathcal O(\Delta t^4).

Adding the two expansions cancels the odd terms and gives the Verlet algorithm (Verlet, 1967),

r(t+Δt)=2r(t)−r(t−Δt)+F(t)mΔt2+O(Δt4). \mathbf r(t+\Delta t) = 2\mathbf r(t) - \mathbf r(t-\Delta t) + \frac{\mathbf F(t)}{m}\Delta t^2 + \mathcal O(\Delta t^4).

The equivalent form used in most codes, velocity Verlet, carries velocities explicitly:

v(t+Δt2)=v(t)+Δt2mF(t),r(t+Δt)=r(t)+Δt v(t+Δt2),v(t+Δt)=v(t+Δt2)+Δt2mF(t+Δt). \begin{aligned} \mathbf v\big(t+\tfrac{\Delta t}{2}\big) &= \mathbf v(t) + \frac{\Delta t}{2m}\mathbf F(t),\\ \mathbf r(t+\Delta t) &= \mathbf r(t) + \Delta t\,\mathbf v\big(t+\tfrac{\Delta t}{2}\big),\\ \mathbf v(t+\Delta t) &= \mathbf v\big(t+\tfrac{\Delta t}{2}\big) + \frac{\Delta t}{2m}\mathbf F(t+\Delta t). \end{aligned}

One force evaluation per step, which is where nearly all the cost lies.

Why Verlet and not something more accurate? The obvious scheme, explicit Euler (r+=vΔt\mathbf r \mathrel{+}= \mathbf v\Delta t, v+=aΔt\mathbf v \mathrel{+}= \mathbf a\Delta t), has a smaller per-step error than you might think, yet its energy grows without limit. Verlet is time-reversible and symplectic: it preserves the volume of phase space exactly, as the true dynamics does. A deep consequence is that a symplectic integrator exactly conserves a slightly perturbed “shadow” Hamiltonian H~=H+O(Δt2)\tilde H = H + \mathcal O(\Delta t^2). The energy therefore fluctuates around a constant value with an amplitude proportional to Δt2\Delta t^2, with no systematic drift for a well-chosen step. Higher-order, non-symplectic methods such as Runge–Kutta are more accurate over a few steps but drift over millions of steps.

A 2D Lennard-Jones fluid

Loading the interactive figure…

Particles are coloured by speed. With velocity Verlet and no thermostat, the total energy (black) stays flat while kinetic and potential energy exchange. Switch to Euler and watch it climb; raise the time step towards 0.03 with Verlet and watch the fluctuations grow until the system explodes. Then turn on a thermostat, change the temperature and density, press Restart and switch the plot to g(r).

Things to try in the lab:

  1. NVE with Verlet at Δt = 0.005. Total energy is flat to four decimal places; kinetic and potential energy trade places.
  2. Euler. The total energy rises steadily: the integrator is pumping energy in. The system heats up until it boils.
  3. Verlet with Δt = 0.02–0.03. Fluctuations grow roughly as Δt2\Delta t^2 until close collisions are no longer resolved and the energy jumps. The NumPy code below shows the same trend quantitatively.
  4. Langevin thermostat at T* = 0.4 and density 0.85, then Restart. The atoms lock into a close-packed (triangular) arrangement, with defects because 100 atoms do not tile a square box perfectly. In the g(r) plot the second peak splits into two, at about 3 σ\sqrt3\,\sigma and 2σ2\sigma, the signature of hexagonal order. At T* = 2 and density 0.3 the system is a dense gas with a single weak peak.

Choosing the time step

The step must resolve the fastest motion in the system, with about 10 to 20 steps per period. The fastest motions in molecules are bond stretches involving hydrogen: a C–H stretch at about 3000 cm⁻¹ has a period of about 11 fs, so unconstrained all-atom MD uses Δt≈0.5\Delta t \approx 0.5–1 fs. Constraining bonds to hydrogen with SHAKE or LINCS removes these motions and allows 2 fs, the standard in biomolecular simulation; hydrogen mass repartitioning (moving mass from heavy atoms to their hydrogens) allows about 4 fs. Coarse-grained models, which have no fast vibrations, use 10–40 fs. Monoatomic Lennard-Jones argon is comfortable at about 5 fs, 0.0020.002–0.005τ0.005\tau in reduced units.

Simulating bulk matter with a few thousand atoms

Periodic boundary conditions. A box of 10410^4 atoms would be mostly surface. Instead the box is surrounded by infinite copies of itself: an atom leaving through one face re-enters through the opposite one. Each atom interacts with the nearest image of every other atom (the minimum-image convention), which is why the box must be more than twice the interaction cut-off. Periodicity suppresses fluctuations longer than the box, and some properties, notably diffusion coefficients, need finite-size corrections.

Cut-offs and neighbour lists. Short-range interactions are truncated at a cut-off rcr_c, typically 1.0–1.2 nm in biomolecular force fields or 2.5σ2.5\sigma for Lennard-Jones. Shifting the potential so that it reaches zero at rcr_c avoids a jump in energy, and long-range dispersion corrections can be added analytically. Rebuilding a list of neighbours within rcr_c plus a skin every few steps makes the cost proportional to NN instead of N2N^2.

Electrostatics cannot be cut off. The Coulomb interaction decays as 1/r1/r and its sum over a periodic system converges only conditionally. Ewald summation splits it into a short-range part summed in real space and a smooth long-range part summed in reciprocal space; the particle-mesh Ewald (PME) method does the reciprocal sum with fast Fourier transforms in O(Nlog⁡N)\mathcal O(N\log N) time. Every serious biomolecular or electrolyte simulation uses PME.

Temperature and pressure control

Plain MD conserves energy and samples the microcanonical (NVE) ensemble. Experiments are usually at constant temperature and pressure. The instantaneous temperature comes from equipartition,

Tinst=2KNdf kB,K=∑i12mivi2, T_{\text{inst}} = \frac{2K}{N_{\text{df}}\,k_B}, \qquad K = \sum_i \tfrac12 m_i v_i^2,

where NdfN_{\text{df}} is the number of degrees of freedom (3N−33N - 3 in 3D after removing centre-of-mass motion, 2N−22N - 2 in the 2D lab). A thermostat modifies the dynamics so that the temperature fluctuates correctly around a target.

  • Berendsen rescales velocities so that TT relaxes exponentially to the target with time constant τT\tau_T. It is robust for equilibration but suppresses the natural fluctuations of the kinetic energy, so it does not generate the canonical ensemble and should not be used for production runs.
  • Nosé–Hoover adds a fictitious heat-bath variable with its own equation of motion. It is deterministic and samples the canonical ensemble, though a single thermostat can be non-ergodic for small or stiff systems (Nosé–Hoover chains fix this).
  • Stochastic velocity rescaling (Bussi, Donadio and Parrinello) is a Berendsen-like scheme with a correctly designed random term. It samples the canonical ensemble and is the default in GROMACS (v-rescale).
  • Langevin dynamics adds friction and a random force to every atom, mv˙=F−γmv+2γmkBT ξ(t)m\dot{\mathbf v} = \mathbf F - \gamma m\mathbf v + \sqrt{2\gamma m k_BT}\,\boldsymbol\xi(t). It is canonical and very stable, but the friction slows diffusion, so dynamical properties depend on γ\gamma.

Barostats do the same for pressure by letting the box volume (and shape) fluctuate: Parrinello–Rahman and the Martyna–Tobias–Klein (MTK) equations are canonical for production; Berendsen and the stochastic cell-rescaling method are used for equilibration or, in the latter case, also production.

A typical workflow

  1. Build the system: structure, topology (force-field parameters), solvent and ions.
  2. Minimise the energy to remove bad contacts.
  3. Equilibrate at constant volume and temperature (NVT) for tens to hundreds of picoseconds, often with restraints on the solute.
  4. Equilibrate at constant pressure (NPT) until the density is stable.
  5. Production: a long run with canonical thermostat and barostat, saving coordinates every few picoseconds.
  6. Analyse, checking equilibration and statistical errors (the lesson on trajectory analysis).

In GROMACS each stage is a preprocess-then-run pair (each .mdp file holds the stage’s settings):

gmx grompp -f em.mdp  -c solvated.gro -p topol.top -o em.tpr
gmx mdrun  -deffnm em                        # energy minimisation
gmx grompp -f nvt.mdp -c em.gro  -r em.gro  -p topol.top -o nvt.tpr
gmx mdrun  -deffnm nvt                       # NVT equilibration
gmx grompp -f npt.mdp -c nvt.gro -t nvt.cpt -r nvt.gro -p topol.top -o npt.tpr
gmx mdrun  -deffnm npt                       # NPT equilibration
gmx grompp -f md.mdp  -c npt.gro -t npt.cpt -p topol.top -o md.tpr
gmx mdrun  -deffnm md -nb gpu                # production, non-bonded work on the GPU
gmx energy -f md.edr -o density.xvg          # pick "Density" from the menu

The same physics in LAMMPS, the classic Lennard-Jones melt in reduced units:

units           lj
atom_style      atomic
lattice         fcc 0.8442
region          box block 0 10 0 10 0 10
create_box      1 box
create_atoms    1 box
mass            1 1.0
velocity        all create 1.44 87287 loop geom
pair_style      lj/cut 2.5
pair_coeff      1 1 1.0 1.0 2.5
neighbor        0.3 bin
fix             1 all nve
thermo          50
run             250

MD in NumPy, and the energy test

A complete velocity-Verlet code fits on one screen. Run it to see how the energy drift depends on the time step (64 atoms in 2D, reduced units):

import numpy as np

def lj_forces(x, L, rc=2.5):
    """Forces and potential energy for a periodic Lennard-Jones system (reduced units)."""
    d = x[:, None, :] - x[None, :, :]            # all pair vectors, shape (N, N, dim)
    d -= L * np.round(d / L)                      # minimum-image convention
    r2 = (d ** 2).sum(-1)
    np.fill_diagonal(r2, np.inf)
    mask = r2 < rc * rc
    inv6 = np.where(mask, r2 ** -3, 0.0)
    ec = 4 * (rc ** -12 - rc ** -6)               # shift so U(rc) = 0
    pe = 0.5 * np.sum(np.where(mask, 4 * (inv6 ** 2 - inv6) - ec, 0.0))
    fmag = np.where(mask, 24 * (2 * inv6 ** 2 - inv6) / r2, 0.0)
    return (fmag[:, :, None] * d).sum(1), pe

def run(dt, nsteps=2000, seed=1):
    rng = np.random.default_rng(seed)
    n, rho = 8, 0.6                                # 8 x 8 = 64 atoms in 2D
    L = np.sqrt(n * n / rho)
    g = (np.arange(n) + 0.5) * L / n
    x = np.array([[a, b] for a in g for b in g])
    v = rng.normal(size=x.shape); v -= v.mean(0)
    v *= np.sqrt(1.0 / (v ** 2).sum(1).mean() * 2)   # T* = 1 (2 degrees of freedom per atom)
    f, pe = lj_forces(x, L)
    energies = []
    for step in range(nsteps):                     # velocity Verlet
        v += 0.5 * dt * f
        x += dt * v
        x %= L
        f, pe = lj_forces(x, L)
        v += 0.5 * dt * f
        energies.append(0.5 * (v ** 2).sum() + pe)
    e = np.array(energies) / len(x)
    return e[-1] - e[0], e.std()

for dt in (0.002, 0.005, 0.01, 0.02):
    drift, fluct = run(dt)
    print(f"dt = {dt:.3f}:  drift of E/N = {drift:+.5f},  fluctuation = {fluct:.5f}")
dt = 0.002:  drift of E/N = -0.00007,  fluctuation = 0.00003
dt = 0.005:  drift of E/N = -0.00078,  fluctuation = 0.00022
dt = 0.010:  drift of E/N = -0.00163,  fluctuation = 0.00071
dt = 0.020:  drift of E/N = +0.03473,  fluctuation = 0.01650

Halving the step from 0.010 to 0.005 cuts the fluctuation by about a factor of three, close to the Δt2\Delta t^2 scaling expected of Verlet; at 0.020 close encounters are no longer resolved and the energy jumps. Checking energy conservation in a short NVE run is the first test of any new force field, MLIP or integrator. It catches wrong forces (forces that are not the gradient of the energy) immediately.

With ASE, the same physics for 108 three-dimensional argon atoms:

import numpy as np
from ase.lattice.cubic import FaceCenteredCubic
from ase.calculators.lj import LennardJones
from ase.md.velocitydistribution import MaxwellBoltzmannDistribution, Stationary
from ase.md.verlet import VelocityVerlet
from ase import units

# 108 argon atoms on an fcc lattice; LJ parameters in eV and Å
atoms = FaceCenteredCubic("Ar", size=(3, 3, 3), latticeconstant=5.26)
atoms.calc = LennardJones(epsilon=0.0104, sigma=3.40, rc=8.5, smooth=True)
MaxwellBoltzmannDistribution(atoms, temperature_K=60, rng=np.random.default_rng(0))
Stationary(atoms)                                  # remove centre-of-mass motion

dyn = VelocityVerlet(atoms, timestep=5 * units.fs)
def report():
    n = len(atoms)
    epot, ekin = atoms.get_potential_energy() / n, atoms.get_kinetic_energy() / n
    print(f"t = {dyn.get_time() / units.fs:6.0f} fs   Epot {epot:.4f}   Ekin {ekin:.4f}   "
          f"Etot {epot + ekin:.5f} eV/atom   T = {ekin / (1.5 * units.kB):5.1f} K")
dyn.attach(report, interval=200)
dyn.run(1000)
t =      0 fs   Epot -0.0789   Ekin 0.0080   Etot -0.07089 eV/atom   T =  62.2 K
t =   1000 fs   Epot -0.0748   Ekin 0.0040   Etot -0.07088 eV/atom   T =  30.6 K
t =   2000 fs   Epot -0.0748   Ekin 0.0039   Etot -0.07088 eV/atom   T =  30.5 K
...

Notice the temperature falling from 60 K to 30 K while the total energy stays constant to 10−510^{-5} eV/atom. The run started from a perfect lattice, at the bottom of the potential well; half of the initial kinetic energy flows into potential energy as the atoms start to vibrate, exactly as the equipartition theorem predicts for a harmonic solid. This is why simulations are equilibrated before anything is measured.

Check yourself

  1. Why is velocity Verlet preferred to a higher-order Runge–Kutta method for long MD runs?
  2. An all-atom simulation with no constraints is unstable at 2 fs. What is the most likely cause?
  3. Which thermostat should not be used for production runs, because it does not sample the canonical ensemble?
  4. You implement a new machine-learned potential and run NVE MD. The total energy drifts steadily even at a tiny time step. What does that suggest?

References and further reading

  1. D. Frenkel and B. Smit, Understanding Molecular Simulation, 3rd ed., Academic Press (2023), chapters 4 (molecular dynamics) and 7 (other ensembles).
  2. M. P. Allen and D. J. Tildesley, Computer Simulation of Liquids, 2nd ed., Oxford University Press (2017), chapters 3 (molecular dynamics) and 5–6 (practical aspects, long-range forces).
  3. M. E. Tuckerman, Statistical Mechanics: Theory and Molecular Simulation, 2nd ed., Oxford University Press (2023), chapters 3 and 4 (symplectic integration, thermostats).
  4. B. J. Alder and T. E. Wainwright, “Phase transition for a hard sphere system,” Journal of Chemical Physics 27, 1208–1209 (1957).
  5. A. Rahman, “Correlations in the motion of atoms in liquid argon,” Physical Review 136, A405–A411 (1964).
  6. L. Verlet, “Computer ‘experiments’ on classical fluids. I. Thermodynamical properties of Lennard-Jones molecules,” Physical Review 159, 98–103 (1967).
  7. W. C. Swope, H. C. Andersen, P. H. Berens and K. R. Wilson, “A computer simulation method for the calculation of equilibrium constants for the formation of physical clusters of molecules,” Journal of Chemical Physics 76, 637–649 (1982) (velocity Verlet).
  8. H. J. C. Berendsen, J. P. M. Postma, W. F. van Gunsteren, A. DiNola and J. R. Haak, “Molecular dynamics with coupling to an external bath,” Journal of Chemical Physics 81, 3684–3690 (1984).
  9. S. Nosé, “A unified formulation of the constant temperature molecular dynamics methods,” Journal of Chemical Physics 81, 511–519 (1984); W. G. Hoover, “Canonical dynamics: equilibrium phase-space distributions,” Physical Review A 31, 1695–1697 (1985).
  10. G. Bussi, D. Donadio and M. Parrinello, “Canonical sampling through velocity rescaling,” Journal of Chemical Physics 126, 014101 (2007).
  11. M. Parrinello and A. Rahman, “Polymorphic transitions in single crystals: a new molecular dynamics method,” Journal of Applied Physics 52, 7182–7190 (1981).
  12. T. Darden, D. York and L. Pedersen, “Particle mesh Ewald: an N·log(N) method for Ewald sums in large systems,” Journal of Chemical Physics 98, 10089–10092 (1993).
  13. B. Hess, H. Bekker, H. J. C. Berendsen and J. G. E. M. Fraaije, “LINCS: a linear constraint solver for molecular simulations,” Journal of Computational Chemistry 18, 1463–1472 (1997).
  14. M. J. Abraham, T. Murtola, R. Schulz, S. Páll, J. C. Smith, B. Hess and E. Lindahl, “GROMACS: high performance molecular simulations through multi-level parallelism from laptops to supercomputers,” SoftwareX 1–2, 19–25 (2015).
  15. A. P. Thompson et al., “LAMMPS: a flexible simulation tool for particle-based materials modeling at the atomic, meso, and continuum scales,” Computer Physics Communications 271, 108171 (2022).
  16. A. H. Larsen et al., “The atomic simulation environment: a Python library for working with atoms,” Journal of Physics: Condensed Matter 29, 273002 (2017).

4Thermostats and barostats

Controlling temperature and pressure in molecular dynamics: why NVE dynamics is not enough, the kinetic temperature, velocity rescaling and the Berendsen weak-coupling scheme and why they fail to sample the canonical ensemble, the Andersen and Langevin stochastic thermostats, the Nosé–Hoover extended system and its chains, stochastic velocity rescaling, and barostats from Berendsen and Andersen to Parrinello–Rahman, MTK and stochastic cell rescaling.

about 17 min readBuilds on Molecular dynamics, Fluctuations and response

Why control temperature

Newton’s equations conserve energy, so plain molecular dynamics samples the microcanonical (NVE) ensemble: constant number of particles, volume and energy. Experiments are almost always done at constant temperature, and usually at constant pressure. Simulations also need temperature control for practical reasons: to equilibrate a system prepared far from equilibrium, to remove the heat produced by a driving force (as in shear or current flow), and to compensate for the slow energy drift caused by numerical integration errors over long runs.

A thermostat modifies the equations of motion so that the system samples the canonical (NVT) ensemble at a chosen temperature T0T_0. The temperature it controls is the kinetic temperature, defined through equipartition (the chapter on Boltzmann and Maxwell) as

T=2KNdf kB,K=∑i12mivi2, T = \frac{2K}{N_{\text{df}}\,k_B}, \qquad K = \sum_i \tfrac12 m_i v_i^2,

where NdfN_{\text{df}} is the number of degrees of freedom (3N3N minus constraints and conserved momenta). In the canonical ensemble the kinetic energy is not constant: it fluctuates, with a gamma distribution whose relative width is 2/Ndf\sqrt{2/N_{\text{df}}}, about 3 % for a thousand atoms. A thermostat that holds KK exactly fixed, or suppresses its fluctuations, does not produce the canonical ensemble, and every quantity derived from fluctuations, such as the heat capacity (the chapter on fluctuations), will be wrong. A good thermostat must get the whole distribution right, not just the average, and ideally disturb the dynamics as little as possible.

Rescaling velocities, and why it is not enough

The simplest idea is to multiply all velocities at every step by the factor that makes the kinetic temperature exactly T0T_0, λ=T0/T\lambda = \sqrt{T_0/T}. This velocity rescaling (Leslie Woodcock, 1971) holds the temperature perfectly constant and therefore removes all its fluctuations. The Berendsen thermostat (Herman Berendsen and colleagues, 1984) softens it by relaxing the temperature exponentially towards T0T_0 with a coupling time τ\tau:

Berendsen coupling was for decades the most popular thermostat because it is stable and gentle, but its incorrect ensemble has consequences. Beyond wrong fluctuations, it can transfer energy systematically between degrees of freedom: in simulations of solvated biomolecules, kinetic energy drained from fast internal motions into overall translation and rotation, so that the molecule “froze” while flying through the box, an artefact named the flying ice cube by Stephen Harvey, Robert Tan and Thomas Cheatham (1998). Berendsen coupling is now recommended only for equilibration.

Stochastic thermostats: Andersen and Langevin

A thermostat that samples the canonical ensemble exactly is obtained by mimicking a heat bath with random collisions. In the Andersen thermostat (Hans Andersen, 1980), each particle is occasionally, with probability νΔt\nu\Delta t per step, given a new velocity drawn from the Maxwell–Boltzmann distribution at T0T_0, as if it had collided with a bath particle. Between collisions the dynamics is Newtonian. The method samples the canonical ensemble exactly, but the collisions randomise momentum and disturb dynamical properties such as diffusion.

The Langevin thermostat adds a friction force and a random force to every particle:

Langevin dynamics is the physical model of a particle in a solvent, the equation Paul Langevin wrote down in 1908 for Brownian motion, and as a thermostat it is robust, simple and exactly canonical. Its friction slows diffusion and other dynamics, increasingly so as γ\gamma grows, so weak coupling (a friction time 1/γ1/\gamma of about a picosecond or longer) is used when dynamics matters.

The Nosé–Hoover extended system

A deterministic route to the canonical ensemble was found by Shuichi Nosé in 1984 and reformulated by William Hoover in 1985. The system is coupled to an extra dynamical variable, a friction coefficient ξ\xi with a fictitious mass QQ, that speeds up or slows down all particles depending on whether the system is too cold or too hot:

Nosé–Hoover dynamics is deterministic, time-reversible and samples the canonical ensemble if it is ergodic. For a single harmonic oscillator, or for stiff, weakly coupled systems, it is not: the trajectory stays on a subset of phase space and the distribution is wrong. Glenn Martyna, Michael Klein and Mark Tuckerman (1992) fixed this with Nosé–Hoover chains, in which the thermostat variable is itself thermostatted by another, and so on; chains of a few thermostats are ergodic in practice and are a standard choice in many codes.

Stochastic velocity rescaling

In 2007 Giovanni Bussi, Davide Donadio and Michele Parrinello combined the simplicity of rescaling with exact canonical sampling in the canonical sampling through velocity rescaling (CSVR) thermostat. Instead of rescaling the kinetic energy to its target value, they rescale it to a value drawn stochastically, so that the kinetic energy follows exactly the canonical distribution:

CSVR samples the canonical ensemble for any coupling time, is as stable as Berendsen, and perturbs dynamical properties very little because it acts only on the total kinetic energy. It is the default in GROMACS (tcoupl = v-rescale) and widely used elsewhere.

The figure runs a small two-dimensional Lennard-Jones fluid under each thermostat and histograms the kinetic energy against the canonical gamma distribution.

Seven thermostats on the same fluid

Loading the interactive figure…

Left: the fluid, coloured by speed. Right, top: the instantaneous kinetic temperature. Right, bottom: the distribution of the kinetic energy against the canonical distribution (rose). The readout compares the relative fluctuation with the canonical value √(2/N_df). Try each thermostat and vary the coupling time.

Velocity rescaling collapses the distribution to a spike. Berendsen produces a distribution that is too narrow, increasingly so for short coupling times. NVE dynamics also gives a narrower distribution, because kinetic energy can only be exchanged with the potential energy of a small isolated system. Andersen, Langevin, Nosé–Hoover (this fluid is chaotic enough to be ergodic) and CSVR all reproduce the canonical fluctuations.

Barostats

Controlling pressure requires letting the volume, and possibly the shape, of the simulation box change. The instantaneous pressure is computed from the virial, P=1dV(2K+∑iri⋅Fi)P = \frac{1}{dV}\left(2K + \sum_i \mathbf r_i\cdot\mathbf F_i\right) in dd dimensions (with the pairwise form used for periodic systems), and in the isothermal–isobaric ensemble the volume fluctuates with a variance set by the compressibility, as the chapter on fluctuations explained.

The Berendsen barostat scales coordinates and box to relax the pressure exponentially towards its target; like its thermostat, it equilibrates well but does not sample the correct ensemble, suppressing volume fluctuations. Andersen’s barostat (1980) treats the volume as a dynamical variable with a fictitious mass, driven by the difference between internal and external pressure, and samples the NPH ensemble correctly. Parrinello–Rahman (Michele Parrinello and Aneesur Rahman, 1981) extends this to the full cell matrix, allowing the box shape to change, which is essential for studying solid–solid phase transitions and anisotropic materials; their simulations of structural transformations in crystals under stress were the first of their kind. Martyna–Tobias–Klein (MTK, 1994) equations combine extended-system thermostats and barostats in a form that samples the NPT ensemble exactly. Stochastic cell rescaling (Mattia Bernetti and Giovanni Bussi, 2020) applies the stochastic idea of CSVR to the volume, giving a first-order barostat that is robust like Berendsen but samples correct volume fluctuations; it is available in GROMACS as pcoupl = c-rescale. Monte Carlo volume moves, as in the chapter on Monte Carlo, are another exact alternative.

Practical recommendations

For equilibration from a poor starting structure, Berendsen thermostats and barostats (or stochastic cell rescaling) are robust and quick. For production runs in which ensemble properties matter, use a thermostat that samples the canonical ensemble: CSVR, Langevin, or Nosé–Hoover chains; and a barostat that samples the correct volume distribution: Parrinello–Rahman, MTK or stochastic cell rescaling. Coupling times of 0.1–1 ps for thermostats and 1–5 ps for barostats are typical. When transport properties such as diffusion or viscosity are computed, use weak coupling or a global thermostat (CSVR, Nosé–Hoover), or run the measurement in NVE after equilibrating, because local stochastic thermostats such as Langevin or Andersen with strong coupling alter the dynamics being measured. And for systems with large, stiff, weakly coupled degrees of freedom, such as a solid at low temperature, check ergodicity: a single Nosé–Hoover thermostat may fail where chains or stochastic thermostats succeed.

Check yourself

  1. A 500-atom simulation with a Berendsen thermostat gives a heat capacity far below experiment. A likely reason is…
  2. Why can a single Nosé–Hoover thermostat fail for a harmonic crystal at low temperature?
  3. Which barostat lets the shape of the simulation box change, as needed for a solid–solid phase transition?
  4. What does the noise term in CSVR achieve compared with Berendsen?

References and further reading

  1. L. V. Woodcock, “Isothermal molecular dynamics calculations for liquid salts”, Chemical Physics Letters 10, 257–261 (1971).
  2. H. J. C. Berendsen, J. P. M. Postma, W. F. van Gunsteren, A. DiNola and J. R. Haak, “Molecular dynamics with coupling to an external bath”, Journal of Chemical Physics 81, 3684–3690 (1984).
  3. S. C. Harvey, R. K.-Z. Tan and T. E. Cheatham III, “The flying ice cube: velocity rescaling in molecular dynamics leads to violation of energy equipartition”, Journal of Computational Chemistry 19, 726–740 (1998).
  4. H. C. Andersen, “Molecular dynamics simulations at constant pressure and/or temperature”, Journal of Chemical Physics 72, 2384–2393 (1980).
  5. S. Nosé, “A unified formulation of the constant temperature molecular dynamics methods”, Journal of Chemical Physics 81, 511–519 (1984).
  6. W. G. Hoover, “Canonical dynamics: equilibrium phase-space distributions”, Physical Review A 31, 1695–1697 (1985).
  7. G. J. Martyna, M. L. Klein and M. Tuckerman, “Nosé–Hoover chains: the canonical ensemble via continuous dynamics”, Journal of Chemical Physics 97, 2635–2643 (1992).
  8. G. Bussi, D. Donadio and M. Parrinello, “Canonical sampling through velocity rescaling”, Journal of Chemical Physics 126, 014101 (2007).
  9. B. Leimkuhler and C. Matthews, “Rational construction of stochastic numerical methods for molecular sampling”, Applied Mathematics Research eXpress 2013, 34–56 (2013).
  10. M. Parrinello and A. Rahman, “Polymorphic transitions in single crystals: a new molecular dynamics method”, Journal of Applied Physics 52, 7182–7190 (1981).
  11. G. J. Martyna, D. J. Tobias and M. L. Klein, “Constant pressure molecular dynamics algorithms”, Journal of Chemical Physics 101, 4177–4189 (1994).
  12. M. Bernetti and G. Bussi, “Pressure control using stochastic cell rescaling”, Journal of Chemical Physics 153, 114107 (2020).
  13. M. E. Tuckerman, Statistical Mechanics: Theory and Molecular Simulation, 2nd ed., Oxford University Press (2023), chapters 4–5.

Analysis

Structure, transport coefficients and statistical error from trajectories.

5Analysing trajectories

Turning a trajectory into numbers you can trust: ensemble averages, equilibration, correlated errors and block averaging, radial distribution functions, diffusion coefficients and a first look at free energies.

about 16 min readBuilds on Molecular dynamics

Averages, and why the error bar is the hard part

Statistical mechanics says an equilibrium property is an ensemble average, ⟨A⟩=∫A(x) p(x) dx\langle A\rangle = \int A(\mathbf x)\,p(\mathbf x)\,\mathrm d\mathbf x, over all microstates x\mathbf x weighted by their Boltzmann probability. A simulation replaces this with a time average over NN saved frames,

Aˉ=1N∑t=1NA(xt), \bar A = \frac1N\sum_{t=1}^{N} A(\mathbf x_t),

which converges to ⟨A⟩\langle A\rangle if the trajectory is long enough to visit the relevant states (ergodicity). Computing Aˉ\bar A is trivial. Knowing how wrong it is is not, because successive frames are correlated: a frame saved 10 fs after the last one is nearly the same configuration. Treating NN correlated frames as independent gives an error bar that is too small, sometimes by an order of magnitude.

Correlation time and effective sample size

The autocorrelation function of the fluctuations δAt=At−Aˉ\delta A_t = A_t - \bar A measures how long the signal remembers itself:

C(k)=⟨δAt δAt+k⟩⟨δA2⟩,C(0)=1. C(k) = \frac{\langle \delta A_t\,\delta A_{t+k}\rangle}{\langle \delta A^2\rangle}, \qquad C(0) = 1 .

For a correlated series of variance σ2\sigma^2, the variance of the mean is

Var⁡(Aˉ)=σ2N 2τint,τint=12+∑k=1∞C(k), \operatorname{Var}(\bar A) = \frac{\sigma^2}{N}\,2\tau_{\text{int}}, \qquad \tau_{\text{int}} = \frac12 + \sum_{k=1}^{\infty} C(k),

with the integrated autocorrelation time τint\tau_{\text{int}} in units of the sampling interval (τint=12\tau_{\text{int}} = \tfrac12 for independent samples). Equivalently, the data contain only

Neff=N2τint N_{\text{eff}} = \frac{N}{2\tau_{\text{int}}}

independent samples. Saving frames more often does not help once the interval is shorter than the correlation time; it only adds disk space.

Block averaging

Summing C(k)C(k) directly is noisy at long lags. The block-averaging method of Flyvbjerg and Petersen (1989) avoids it. Divide the series into MM blocks of length bb, average within each block, and treat the block means as samples:

σAˉ(b)=1M(M−1)∑j=1M(Aˉj−Aˉ)2. \sigma_{\bar A}(b) = \sqrt{\frac{1}{M(M-1)}\sum_{j=1}^{M}\big(\bar A_j - \bar A\big)^2}.

For b=1b = 1 this is the naive standard error. As bb grows beyond the correlation time, the block means become independent and σAˉ(b)\sigma_{\bar A}(b) rises to a plateau, the honest error. If no plateau appears before the number of blocks becomes small, the simulation is too short to estimate its own error.

Block averaging a correlated MD observable

Loading the interactive figure…

Top: a synthetic observable with a tunable correlation time; the orange line is the mean of the retained part. Left: block-averaged error against block size, compared with the exact answer (dashed). Right: the autocorrelation function. Increase τ and watch the gap between naive and honest errors grow; turn on the far-from-equilibrium start and discard the transient.

Use the lab to see three lessons.

  1. The naive error is wrong by 2τint\sqrt{2\tau_{\text{int}}}. At τ=40\tau = 40 steps it is about 9 times too small; the block-averaged plateau matches the exact value.
  2. The plateau needs many correlation times. At τ=400\tau = 400 steps there are only about 10 independent samples in 8192 steps, the plateau is noisy and the error itself is uncertain.
  3. Equilibration bias is not a statistical error. With the far-from-equilibrium start, the mean is biased however carefully you compute its error bar. Discarding the first stretch removes the bias. Chodera’s (2016) method chooses the cut-off automatically by maximising the number of effectively independent samples that remain.

The same calculation in NumPy, on a series with τ=50\tau = 50:

import numpy as np

def block_average(x, min_blocks=8):
    """Standard error of the mean of a correlated series, for block sizes 1, 2, 4, ..."""
    x = np.asarray(x, float)
    out = []
    b = 1
    while len(x) // b >= min_blocks:
        m = len(x) // b
        means = x[: m * b].reshape(m, b).mean(axis=1)
        out.append((b, means.std(ddof=1) / np.sqrt(m)))
        b *= 2
    return out

# a correlated test series: AR(1) with correlation time tau = 50 steps
rng = np.random.default_rng(0)
tau, n = 50, 2 ** 15
phi = np.exp(-1 / tau)
x = np.empty(n); x[0] = rng.normal()
for i in range(1, n):
    x[i] = phi * x[i - 1] + np.sqrt(1 - phi ** 2) * rng.normal()

for b, se in block_average(x):
    print(f"block {b:5d}: SE = {se:.4f}")
tau_int = (1 + phi) / (2 * (1 - phi))
print(f"naive SE {x.std(ddof=1) / np.sqrt(n):.4f}, exact SE {np.sqrt(2 * tau_int / n):.4f}")

The block error climbs from 0.0056 (naive) to a plateau of about 0.053 at block sizes of 512–1024 steps, against an exact value of 0.055, then becomes noisy as the number of blocks falls. My browser tool Converge does this analysis, together with equilibration detection, for any GROMACS .xvg file.

Structure: the radial distribution function

The radial distribution function g(r)g(r) is the density of particles at distance rr from a reference particle, relative to the bulk density ρ\rho:

g(r)=1ρN⟨∑i∑j≠iδ(r−rij)⟩14πr2(3D). g(r) = \frac{1}{\rho N}\left\langle \sum_{i}\sum_{j\ne i}\delta\big(r - r_{ij}\big)\right\rangle \frac{1}{4\pi r^2} \quad\text{(3D)} .

In practice: histogram all pair distances (minimum image) in shells of width Δr\Delta r, divide each bin by the number expected for an ideal gas at the same density, ρ N 4πr2Δr\rho\,N\,4\pi r^2\Delta r, and average over frames. g(r)→1g(r) \to 1 at large rr in a fluid. Its first peak marks the nearest-neighbour shell, and integrating to the first minimum r1r_1 gives the coordination number

n1=4πρ∫0r1g(r) r2 dr. n_1 = 4\pi\rho\int_0^{r_1} g(r)\,r^2\,\mathrm dr .

g(r)g(r) is measurable: its Fourier transform is the structure factor S(q)S(q) from X-ray or neutron scattering, which makes it a direct test of a force field against experiment. Integrals of g(r)−1g(r) - 1 over all space, the Kirkwood–Buff integrals

Gij=4π∫0∞[gij(r)−1]r2 dr, G_{ij} = 4\pi\int_0^{\infty}\big[g_{ij}(r) - 1\big]r^2\,\mathrm dr,

connect structure to thermodynamics: preferential solvation, activity coefficients and partial molar volumes. They converge slowly and need finite-size corrections in a closed simulation box; my tool KBkit implements them. The g(r) view of the MD lab builds the 2D version live.

Dynamics: diffusion

The mean-squared displacement of a particle grows linearly at long times in a fluid, and its slope gives the self-diffusion coefficient through the Einstein relation,

MSD(t)=⟨∣r(t0+t)−r(t0)∣2⟩  →t→∞  2dDt, \text{MSD}(t) = \big\langle\lvert\mathbf r(t_0 + t) - \mathbf r(t_0)\rvert^2\big\rangle \;\xrightarrow{t\to\infty}\; 2dDt ,

with dd the dimension (6Dt in 3D). Two practical rules: use unwrapped coordinates (not folded back into the box), and fit only the linear regime, after the short-time ballistic region. The equivalent Green–Kubo formula integrates the velocity autocorrelation function, D=1d∫0∞⟨v(0)⋅v(t)⟩ dtD = \frac1d\int_0^\infty\langle\mathbf v(0)\cdot\mathbf v(t)\rangle\,\mathrm dt; similar formulas give viscosity and conductivity from stress and current correlations. Diffusion coefficients in periodic boxes are systematically too small because of hydrodynamic self-interaction with the periodic images; Yeh and Hummer’s correction adds kBTξ/(6πηL)k_BT\xi/(6\pi\eta L) with ξ≈2.837\xi \approx 2.837 for a cubic box of side LL.

import numpy as np

def msd(pos, max_lag):
    """Mean-squared displacement from unwrapped positions of shape (frames, atoms, 3)."""
    return np.array([np.mean(np.sum((pos[lag:] - pos[:-lag]) ** 2, axis=-1)) if lag else 0.0
                     for lag in range(max_lag)])

# test on Brownian particles with a known diffusion coefficient
rng = np.random.default_rng(1)
D, dt, frames, atoms = 0.5, 0.01, 4000, 200           # nm^2/ns, ns
steps = rng.normal(scale=np.sqrt(2 * D * dt), size=(frames, atoms, 3))
pos = np.cumsum(steps, axis=0)
lags = np.arange(400)
m = msd(pos, 400)
slope = np.polyfit(lags[50:] * dt, m[50:], 1)[0]       # fit the linear regime
print(f"D from MSD = {slope / 6:.3f} nm^2/ns (true {D})")

This recovers D=0.509D = 0.509 against a true value of 0.5. Testing analysis code on synthetic data with a known answer, as here, is good practice before trusting it on a real trajectory.

Free energies are not simple averages

Many quantities that matter most, such as binding free energies, solubilities, the free-energy profile of a molecule crossing a membrane or adsorbing on a surface, are not averages of any instantaneous observable. A free-energy difference involves the ratio of partition functions, and states separated by high barriers are rarely visited in a plain simulation. Umbrella sampling adds harmonic bias potentials (windows) along a reaction coordinate so that every region is sampled, and the weighted histogram analysis method (WHAM) or MBAR recombines the biased windows into an unbiased potential of mean force. Window placement and overlap decide whether the result can be trusted; my tool WindowWise plans and checks them. These methods produced the roughly 470,000 free-energy profiles used to train the adhesion model described on the research page.

Check yourself

  1. You save a frame every 1 ps from a 10 ns run, and the observable’s integrated autocorrelation time is 50 ps. About how many independent samples do you have?
  2. In a block-averaging plot the error keeps rising with block size and never reaches a plateau. What should you conclude?
  3. Why must mean-squared displacements be computed from unwrapped coordinates?
  4. What does the first minimum of g(r)g(r) commonly define?

References and further reading

  1. A. Grossfield, P. N. Patrone, D. R. Roe, A. J. Schultz, D. W. Siderius and D. M. Zuckerman, “Best practices for quantification of uncertainty and sampling quality in molecular simulations,” Living Journal of Computational Molecular Science 1, 5067 (2018).
  2. H. Flyvbjerg and H. G. Petersen, “Error estimates on averages of correlated data,” Journal of Chemical Physics 91, 461–466 (1989).
  3. J. D. Chodera, “A simple method for automated equilibration detection in molecular simulations,” Journal of Chemical Theory and Computation 12, 1799–1805 (2016).
  4. M. P. Allen and D. J. Tildesley, Computer Simulation of Liquids, 2nd ed., Oxford University Press (2017), chapters 2 (statistical mechanics), 8 (how to analyse the results).
  5. J. G. Kirkwood and F. P. Buff, “The statistical mechanical theory of solutions. I,” Journal of Chemical Physics 19, 774–777 (1951).
  6. I.-C. Yeh and G. Hummer, “System-size dependence of diffusion coefficients and viscosities from molecular dynamics simulations with periodic boundary conditions,” Journal of Physical Chemistry B 108, 15873–15879 (2004).
  7. G. M. Torrie and J. P. Valleau, “Nonphysical sampling distributions in Monte Carlo free-energy estimation: umbrella sampling,” Journal of Computational Physics 23, 187–199 (1977).
  8. S. Kumar, J. M. Rosenberg, D. Bouzida, R. H. Swendsen and P. A. Kollman, “The weighted histogram analysis method for free-energy calculations on biomolecules. I. The method,” Journal of Computational Chemistry 13, 1011–1021 (1992).
  9. M. R. Shirts and J. D. Chodera, “Statistically optimal analysis of samples from multiple equilibrium states,” Journal of Chemical Physics 129, 124105 (2008).
  10. N. Michaud-Agrawal, E. J. Denning, T. B. Woolf and O. Beckstein, “MDAnalysis: a toolkit for the analysis of molecular dynamics simulations,” Journal of Computational Chemistry 32, 2319–2327 (2011).
  11. R. T. McGibbon et al., “MDTraj: a modern open library for the analysis of molecular dynamics trajectories,” Biophysical Journal 109, 1528–1532 (2015).

6Transport coefficients

Computing how matter, momentum and charge move from equilibrium molecular dynamics: Brownian motion and Einstein's relation, the mean-squared displacement, time-correlation functions and the velocity autocorrelation, the Green–Kubo relations for diffusion, viscosity, thermal and electrical conductivity, the cage effect and long-time tails, finite-size corrections, and practical error estimation.

about 13 min readBuilds on Analysing trajectories, Fluctuations and response, Thermostats and barostats

From fluctuations to transport

Transport coefficients describe how a system responds to gradients: the diffusion coefficient relates a flux of particles to a concentration gradient (Fick’s law), the shear viscosity relates a momentum flux to a velocity gradient, the thermal conductivity relates a heat flux to a temperature gradient, and the electrical conductivity relates a current to an electric field. They can be measured in simulations by imposing a gradient and measuring the flux, but the fluctuation–dissipation theorem offers a more elegant route: in equilibrium, the spontaneous fluctuations of the fluxes already contain the transport coefficients. This chapter shows how, starting with the oldest example, diffusion.

Brownian motion and the mean-squared displacement

In 1827 the botanist Robert Brown observed pollen particles in water moving erratically, a motion he could not explain. In 1905 Albert Einstein showed that such motion is caused by collisions with the molecules of the liquid and that, although each trajectory is random, its statistics are precise: the mean-squared displacement grows linearly in time, with a slope set by the diffusion coefficient, and the diffusion coefficient is related to the friction the particle feels, D=kBT/ζD = k_BT/\zeta. Jean Perrin’s measurements of this growth in 1908–1909 confirmed Einstein’s theory and gave one of the first accurate values of Avogadro’s number, settling the long debate about the reality of atoms.

For a particle in a simulation the same law holds once its motion has become diffusive:

At short times the motion is ballistic, MSD≈⟨v2⟩t2\text{MSD} \approx \langle v^2\rangle t^2, because a particle moves freely between collisions. In a dense liquid there is an intermediate regime where each particle rattles in a cage formed by its neighbours before escaping. Only at times long compared with these processes does the MSD become linear, and the diffusion coefficient is read from the slope in that regime, typically on a log–log plot to check that the exponent has reached 1.

Time-correlation functions and Green–Kubo

The displacement is the time integral of the velocity, so the MSD can be rewritten in terms of the velocity autocorrelation function (VACF), Cv(t)=⟨vi(0)⋅vi(t)⟩C_v(t) = \langle \mathbf v_i(0)\cdot\mathbf v_i(t)\rangle, the average product of a particle’s velocity now with its velocity a time tt later. Differentiating the Einstein relation twice gives the Green–Kubo formula for diffusion:

Melville Green (1952, 1954) and Ryogo Kubo (1957) showed that every transport coefficient has such a representation: the integral over time of the equilibrium autocorrelation function of the corresponding microscopic flux. The general pattern is

γ=1normalisation∫0∞⟨J(0) J(t)⟩ dt, \gamma = \frac{1}{\text{normalisation}}\int_0^\infty \big\langle J(0)\,J(t)\big\rangle\,\mathrm dt ,

with JJ the particle velocity for diffusion, an off-diagonal component of the pressure tensor for shear viscosity, η=VkBT∫0∞⟨Pxy(0)Pxy(t)⟩dt\eta = \frac{V}{k_BT}\int_0^\infty\langle P_{xy}(0)P_{xy}(t)\rangle\mathrm dt, the heat current for thermal conductivity, and the electric current for electrical conductivity.

The figure runs a two-dimensional Lennard-Jones fluid and computes both estimates of the diffusion coefficient from the same trajectory, averaging over particles and over many time origins.

Diffusion two ways

Loading the interactive figure…

Left: the mean-squared displacement with a straight-line fit to its long-time part (slope 4D in two dimensions). Right: the normalised velocity autocorrelation function (orange) and its running integral (teal, scaled). The readouts compare D from the Einstein relation and from the Green–Kubo integral. Raise the density to see the cage effect.

At low density the VACF decays smoothly and monotonically: a particle keeps moving in roughly the same direction until a collision randomises it. At high liquid densities it develops a negative dip: a particle moving into its cage of neighbours rebounds, so its velocity a short time later is anticorrelated with its initial velocity. This cage effect reduces the diffusion coefficient, because the negative part of the VACF subtracts from its integral. The two estimates agree within statistical error, as they must, but they converge differently: the Einstein estimate needs the MSD to be clearly linear, and the Green–Kubo integral needs the VACF to have decayed to zero, with noise in its tail accumulating in the integral.

Long-time tails and finite-size effects

In 1967–1970 Berni Alder and Thomas Wainwright, simulating hard spheres, discovered that the VACF does not decay exponentially at long times, as kinetic theory had assumed, but as a power law, t−d/2t^{-d/2}. A moving particle sets up a vortex flow in the surrounding fluid that pushes it from behind, a hydrodynamic memory effect. This long-time tail was one of the first major discoveries made by computer simulation. In two dimensions the t−1t^{-1} tail makes the Green–Kubo integral diverge logarithmically, so a strictly defined diffusion coefficient does not exist in two-dimensional fluids, which is worth remembering when interpreting the figure; in three dimensions the t−3/2t^{-3/2} tail is integrable.

The same hydrodynamic interactions cause a systematic finite-size effect in periodic simulations: a particle interacts with the flows set up by its own periodic images, which lowers its diffusion coefficient. In three dimensions the correction derived by In-Chul Yeh and Gerhard Hummer (2004) is D∞=DPBC+ξ kBT6πηLD_\infty = D_{\text{PBC}} + \frac{\xi\,k_BT}{6\pi\eta L}, with ξ≈2.837\xi \approx 2.837 for a cubic box of side LL and η\eta the shear viscosity. For water in a box of a few nanometres the correction is about 10–20 %, comparable to many of the differences between force fields that simulations try to resolve, so it should always be applied or checked by varying the box size.

Practical transport calculations

Several practical points determine whether a transport calculation is reliable. Use thermostats that do not disturb the dynamics, or measure in NVE after equilibration, as the chapter on thermostats explains; strong Langevin friction lowers diffusion coefficients directly. Unwrap trajectories and remove any drift of the centre of mass. Average over many time origins, but remember that overlapping windows are correlated, so estimate errors by splitting the trajectory into independent blocks or running independent replicas. For collective properties such as viscosity and conductivity, which involve a single flux for the whole system rather than one per particle, statistics are much poorer than for self-diffusion, and long runs, several independent simulations or the Einstein–Helfand (integrated) forms of the Green–Kubo relations are needed. Non-equilibrium methods, such as imposing shear flow (Lees–Edwards boundaries, or the reverse non-equilibrium method of Florian Müller-Plathe, 1999), are often more efficient for viscosity and thermal conductivity.

Check yourself

  1. A 3D MSD has slope 6 × 10⁻⁹ m²/s at long times. What is D?
  2. Why does the VACF of a dense liquid become negative at short times?
  3. Two simulations of water in boxes of 2 nm and 6 nm give different self-diffusion coefficients. Which is closer to the infinite-system value, and why?

References and further reading

  1. A. Einstein, “Über die von der molekularkinetischen Theorie der Wärme geforderte Bewegung von in ruhenden Flüssigkeiten suspendierten Teilchen”, Annalen der Physik 17, 549–560 (1905).
  2. J. Perrin, “Mouvement brownien et réalité moléculaire”, Annales de Chimie et de Physique 18, 5–114 (1909).
  3. M. S. Green, “Markoff random processes and the statistical mechanics of time-dependent phenomena. II. Irreversible processes in fluids”, Journal of Chemical Physics 22, 398–413 (1954).
  4. R. Kubo, “Statistical-mechanical theory of irreversible processes. I”, Journal of the Physical Society of Japan 12, 570–586 (1957).
  5. B. J. Alder and T. E. Wainwright, “Decay of the velocity autocorrelation function”, Physical Review A 1, 18–21 (1970).
  6. I.-C. Yeh and G. Hummer, “System-size dependence of diffusion coefficients and viscosities from molecular dynamics simulations with periodic boundary conditions”, Journal of Physical Chemistry B 108, 15873–15879 (2004).
  7. F. Müller-Plathe, “Reversing the perturbation in nonequilibrium molecular dynamics: an easy way to calculate the shear viscosity of fluids”, Physical Review E 59, 4894–4898 (1999).
  8. J.-P. Hansen and I. R. McDonald, Theory of Simple Liquids, 4th ed., Academic Press (2013), chapters 7–8.
  9. E. J. Maginn, R. A. Messerly, D. J. Carlson, D. R. Roe and J. R. Elliott, “Best practices for computing transport properties 1. Self-diffusivity and viscosity from equilibrium molecular dynamics”, Living Journal of Computational Molecular Science 1, 6324 (2019).