Lesson 3.5 · 14 min
Langevin dynamics
Langevin dynamics gives every atom its own small heat bath: a friction force plus random kicks, balanced so the system reaches the right temperature. It is robust and always ergodic, but strong friction slows the real dynamics.
- The Langevin equation: friction plus random force, and the fluctuation–dissipation balance
- How the friction γ controls temperature relaxation, and how it slows diffusion
- The BAOAB integrator, and when to use Langevin dynamics
The idea
Paul Langevin (1908) described a pollen grain in water as feeling two forces from the water molecules: a smooth friction that opposes its motion, and rapid random kicks. Langevin dynamics applies the same idea to every atom in a simulation, as if each atom were bathed in an invisible solvent.
The friction alone would cool the system to zero; the kicks alone would heat it forever. For the right temperature they must be balanced: the stronger the friction γ, the stronger the kicks must be. This balance is the fluctuation–dissipation theorem, and it makes the atoms sample the canonical (NVT) distribution at T.
Why it is popular. Each atom is thermostatted on its own (a local thermostat), so there is no global ringing (unlike Nosé–Hoover) and no flying ice cube. The noise makes the dynamics ergodic even for small or stiff systems. It is very stable with large time steps, and it naturally models a solvent you do not simulate explicitly (implicit solvent, coarse-grained models, Brownian dynamics).
The price. The friction and noise change the dynamics. Velocities forget their past in a time 1/γ, and at strong friction atoms move by diffusion like pollen grains. A free particle has D = kBT/(mγ); in a liquid, collisions with neighbours slow it further. Use a small γ (about 0.1–1 ps⁻¹ for atomistic systems) if you care about diffusion or viscosity; a large γ is fine if you only need equilibrium averages.
The algorithm
The BAOAB splitting (Leimkuhler and Matthews, 2013) is simple and gives very accurate configurational averages:
c1 = exp(-gamma * dt)
c2 = sqrt((1 - c1**2) * kB * T / m)
every step:
v += (dt/2) * F / m # B: half kick
x += (dt/2) * v # A: half drift
v = c1 * v + c2 * gaussian() # O: friction + noise (exact)
x += (dt/2) * v # A: half drift
F = forces(x)
v += (dt/2) * F / m # B: half kick
- The O step solves the friction-plus-noise part exactly, so it works for any γ, even very large.
- Use a different random number for every atom, direction and step. Total momentum is not conserved, so Nf = 3N.
- γ = 0 gives back velocity Verlet (NVE). 1/γ plays the role of the coupling time τ of the other thermostats (the kinetic energy relaxes with time constant 1/(2γ)).
- LAMMPS:
fix langevin T T damp seed(damp = 1/γ) together withfix nve. GROMACS:integrator = sdwithtau-t= 1/γ.