Ova

How do you calculate force in molecular dynamics?

Published in Molecular Dynamics Force Calculation 6 mins read

In molecular dynamics (MD) simulations, force on each atom is fundamentally calculated as the negative gradient of the system's total potential energy with respect to the atom's position. This relationship is expressed by the equation F = -∇U, where F is the force vector, U is the potential energy, and is the gradient operator.

This means that atoms are pushed in the direction that reduces the system's potential energy. The potential energy itself is defined by a mathematical model called a force field, which describes how atoms interact with each other.

The Core Principle: Potential Energy and Force

The total potential energy ($U_{total}$) of a system in molecular dynamics is a sum of various interaction terms, often categorized as bonded and non-bonded interactions. Each term contributes to the overall force acting on an atom.

  • Bonded interactions describe forces between atoms directly connected by chemical bonds, within specific angles, or involved in dihedral (torsional) rotations.
  • Non-bonded interactions account for forces between all other atoms that are not directly bonded, primarily van der Waals forces (dispersion and repulsion) and electrostatic forces.

To obtain the force acting on an individual atom, the derivative of the potential energy with respect to that atom's coordinates is computed.

Pairwise Interactions and Vector Calculation

A key aspect of force calculation, especially for non-bonded interactions, is efficiency. For any given pair of particles, the magnitude of the force is calculated only once based on the scalar distance between them. This scalar force magnitude is then multiplied by the normalized direction vector pointing from one particle to the other to obtain the components of the force vector.

For example, for two particles $i$ and $j$ at positions $\mathbf{r}_i$ and $\mathbf{r}j$, the force $\mathbf{F}{ij}$ exerted on particle $i$ by particle $j$ is calculated as:

$\mathbf{F}_{ij} = \left(-\frac{dU}{dr}\right) \frac{\mathbf{r}_j - \mathbf{r}_i}{|\mathbf{r}_j - \mathbf{r}_i|}$

Where:

  • $\left(-\frac{dU}{dr}\right)$ is the scalar magnitude of the force, derived from the derivative of the potential energy with respect to the inter-particle distance ($r$).
  • $\frac{\mathbf{r}_j - \mathbf{r}_i}{|\mathbf{r}_j - \mathbf{r}i|}$ is the normalized direction vector, $\mathbf{n}{ji}$, pointing from particle $i$ to particle $j$.

This approach efficiently determines the vectorial components of the force acting on each atom due to every other interacting atom.

Example: Lennard-Jones Potential

A common non-bonded interaction is the Lennard-Jones potential, which models van der Waals forces:

$U_{LJ}(r) = 4\epsilon \left[ \left(\frac{\sigma}{r}\right)^{12} - \left(\frac{\sigma}{r}\right)^6 \right]$

Where:

  • $r$ is the distance between two atoms.
  • $\epsilon$ is the depth of the potential well (strength of interaction).
  • $\sigma$ is the finite distance at which the inter-particle potential is zero.

The force derived from this potential is:

$\mathbf{F}{LJ}(r) = -\frac{dU{LJ}}{dr} \frac{\mathbf{r}}{|\mathbf{r}|} = 4\epsilon \left[ 12\frac{\sigma^{12}}{r^{13}} - 6\frac{\sigma^6}{r^7} \right] \frac{\mathbf{r}}{|\mathbf{r}|}$

This shows how the scalar force magnitude (the term in brackets) is combined with the direction vector to yield the full force.

Components of a Force Field

A typical force field, like AMBER or CHARMM, combines several terms to represent the total potential energy:

$U{total} = U{bond} + U{angle} + U{dihedral} + U_{nonbonded}$

Each term has a specific mathematical form:

Force Field Term Description Potential Energy Formula (Example) Force Calculation
Bonds Stretching or compressing chemical bonds. $U_{bond} = k_b (r - r_0)^2$ Derivative with respect to bond length.
Angles Bending of angles between three connected atoms. $U{angle} = k\theta (\theta - \theta_0)^2$ Derivative with respect to angle.
Dihedrals Torsion around chemical bonds (rotation). $U{dihedral} = \sum{n} k_\phi (1 + \cos(n\phi - \delta))$ Derivative with respect to dihedral angle.
Van der Waals Short-range attraction (dispersion) and repulsion. $U_{LJ} = 4\epsilon [(\frac{\sigma}{r})^{12} - (\frac{\sigma}{r})^6]$ Derivative with respect to inter-particle distance.
Electrostatics Long-range attraction or repulsion between charges. $U_{Coulomb} = \frac{k_c q_i q_j}{\epsilon_r r}$ Derivative with respect to inter-particle distance.
  • $kb, k\theta, k_\phi$: Force constants.
  • $r_0, \theta_0$: Equilibrium bond length and angle.
  • $n, \delta$: Periodicity and phase shift for dihedrals.
  • $q_i, q_j$: Partial charges of atoms $i$ and $j$.
  • $k_c$: Coulomb's constant.
  • $\epsilon_r$: Dielectric constant.

Practical Considerations in Force Calculation

Several computational techniques are employed to make force calculations efficient for systems with thousands or millions of atoms:

  • Cutoffs: For non-bonded interactions (especially van der Waals), forces become negligible beyond a certain distance. Simulations often employ a cutoff radius, beyond which these interactions are ignored to save computational time.
  • Periodic Boundary Conditions (PBC): To simulate bulk systems and avoid surface effects, the simulation box is replicated in all directions. When an atom leaves the primary box, it re-enters from the opposite side.
  • Neighbor Lists: To avoid checking all possible pairs of atoms for interactions, which is computationally expensive ($O(N^2)$), neighbor lists are maintained. These lists only include atoms that are within a certain "skin" distance of each other and are updated periodically.
  • Long-Range Electrostatics: Electrostatic forces are long-ranged and cannot be simply cut off. Methods like the Particle Mesh Ewald (PME) summation are used to accurately calculate these interactions in periodic systems.

Why Accurate Force Calculation is Crucial

The accuracy of MD simulations directly hinges on the precision of force calculations. Errors in force calculations can lead to:

  • Incorrect trajectories: Atoms might move in unrealistic ways.
  • Unstable simulations: The system might "blow up" or behave erratically.
  • Inaccurate thermodynamic properties: Calculated properties like temperature, pressure, and energy might not reflect the real system.
  • Misleading structural insights: The simulated molecular structure might not correspond to experimental observations.

Therefore, selecting an appropriate force field and employing robust computational algorithms for force calculation are paramount for obtaining meaningful results from molecular dynamics simulations.