Lesson 4.1 · 14 min

Bonds and angles

Atoms in a molecule are held together by bonds and angles, which force fields model as springs. Learn the potentials, how to turn them into forces on each atom, and why their fast vibrations set the time step.

The idea

So far our atoms only interacted through Lennard-Jones forces. In a molecule, some atoms are chemically bonded. A force field describes this with simple terms that depend only on the internal geometry (Lesson 4.3 puts them all together):

Forces. The force is minus the gradient of the energy with respect to each atom's position. For a bond the force acts along the bond and pulls the atoms back towards r₀. For an angle the forces on the outer atoms act perpendicular to their bonds, opening or closing the angle; the central atom gets minus their sum. In every case the forces add up to zero (Newton's third law). Always test analytic forces against a numerical derivative of the energy; the code tab does this.

Fast vibrations. Bonds are stiff and hydrogen is light, so an O–H or C–H bond vibrates with a period of only about 10 fs. With 10–20 steps per vibration needed (Lesson 1.4), flexible bonds to hydrogen force Δt ≈ 0.5–1 fs. This is why most simulations constrain these bonds (Lesson 4.4) and use 2 fs.

Key idea. Bonds and angles are springs on the internal coordinates. Their forces follow from the chain rule; check them numerically. The stiffest, lightest spring (X–H bonds) sets the largest stable time step.

The algorithm

Forces from a harmonic bond (i–j) and angle (i–j–k):

# bond
d = r_i - r_j;  r = |d|
F_i = -k_b (r - r0) d / r;   F_j = -F_i

# angle at j
a = r_i - r_j;  b = r_k - r_j
cos_t = a·b / (|a||b|);  theta = arccos(cos_t)
g = k_theta (theta - theta0) / sin(theta)
F_i = g * ( b/(|a||b|) - cos_t a/|a|² )
F_k = g * ( a/(|a||b|) - cos_t b/|b|² )
F_j = -F_i - F_k
  1. Bonded atoms (1–2) and atoms sharing an angle (1–3) are usually excluded from the Lennard-Jones and Coulomb interactions. Their interaction is already in the bonded terms.
  2. Watch the convention! GROMACS writes ½k(r − r₀)². AMBER and LAMMPS write K(r − r₀)², so K = k/2. Units also differ: kJ mol⁻¹ nm⁻² vs kcal mol⁻¹ Å⁻².
  3. θ near 180° makes sin θ → 0 in the formula. Linear molecules need special treatment (or a cosine-based angle potential).
  4. Check: finite-difference forces must match the analytic ones to many digits, and all forces must sum to zero.