Skip to article frontmatterSkip to article content
Site not loading correctly?

This may be due to an incorrect BASE_URL configuration. See the MyST Documentation for reference.

6. Stochastic thermostats: Andersen and Langevin (BAOAB) dynamics

School of Engineering and Digital Sciences, Nazarbayev University

Track: core  ·  Prerequisites: Chapter 5, stochastic differential equations (engstoch)

This chapter builds and verifies the core algorithms for stochastic thermostats: andersen and langevin (baoab) dynamics in plain Python and NumPy, checking every result against an exact statistical-mechanics limit or published benchmark.

6.1 Physical principles and governing equations

Langevin dynamics couples each particle to an implicit solvent bath via friction γ\gamma and white noise obeying the fluctuation–dissipation theorem:

mv˙=f(r)−mγv+2mγkBT η(t).(6.1)m\dot{\mathbf{v}} = \mathbf{f}(\mathbf{r}) - m\gamma \mathbf{v} + \sqrt{2 m \gamma k_B T}\,\boldsymbol{\eta}(t). \tag{6.1}

The symmetric BAOAB splitting (Leimkuhler & Matthews) places the exact Ornstein–Uhlenbeck step O at the center of the drift–kick cycle, yielding exact configurational variance ⟨x2⟩=kBT/k\langle x^2 \rangle = k_B T / k on a harmonic oscillator for any stable timestep Δt<2/ω\Delta t < 2/\omega.

6.2 Inside the algorithm

6.3 Checks

BAOAB <x^2> across dt = [0.05..0.50]: [0.992 0.978 0.97  0.993] (exact = 1.000)
<Figure size 1120x430 with 2 Axes>

Figure 6.1. (a) Primary physical or dynamical observable computed from scratch in engsim. (b) Quantitative verification against the analytical or benchmark reference.

6.4 What to trust

  • Numerical predictions are verified to the stated tolerances against exact analytical limits (engsim.reference).

  • Finite-size effects (NN, periodic image interactions) and timestep truncation (O(Δt2)O(\Delta t^2)) should always be checked before comparing against bulk experimental data.

Summary

  • The algorithm is implemented transparently in pure NumPy without hidden black-box routines.

  • All core physical invariants (conservation laws, ensemble variance, or scaling exponents) are verified quantitatively in code.

Exercises

  1. Free-particle Langevin diffusion: Simulate 100 free Langevin particles (f=0,T=1.5,γ=2.0\mathbf{f}=\mathbf{0}, T=1.5, \gamma=2.0) and verify D=T/γ=0.75D = T/\gamma = 0.75.

  2. Andersen collision rate bias: Show how a very high Andersen collision frequency ν\nu suppresses self-diffusion.

  3. LJTS fluid under BAOAB: Equilibrate a 108-atom LJTS liquid at T∗=1.0T^* = 1.0 using baoab_langevin_step.

Worked solutions are provided in 06_solutions.ipynb.

Suggested references

  • G. Bussi, D. Donadio, and M. Parrinello, J. Chem. Phys. 126, 014101 (2007).

  • B. Leimkuhler and C. Matthews, Molecular Dynamics: With Deterministic and Stochastic Numerical Methods (Springer, 2015).