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.

5. Velocity rescaling, Berendsen, and Bussi–Donadio–Parrinello (CSVR) thermostats

School of Engineering and Digital Sciences, Nazarbayev University

Track: core  ·  Prerequisites: Part I (Chapters 1–4), statistical mechanics

This chapter builds and verifies the core algorithms for velocity rescaling, berendsen, and bussi–donadio–parrinello (csvr) thermostats in plain Python and NumPy, checking every result against an exact statistical-mechanics limit or published benchmark.

5.1 Physical principles and governing equations

In the canonical (NVTNVT) ensemble, total kinetic energy KK is not constant — it follows a Gamma / χdof2\chi^2_{\text{dof}} distribution with exact mean and variance:

⟨K⟩=Ndof2kBT,Var(K)=Ndof2(kBT)2.(5.1)\langle K \rangle = \frac{N_{\text{dof}}}{2} k_B T, \qquad \mathrm{Var}(K) = \frac{N_{\text{dof}}}{2} (k_B T)^2. \tag{5.1}

The Berendsen thermostat rescales velocities deterministically toward T0T_0, collapsing Var(K)→0\mathrm{Var}(K) \to 0 (failing the canonical ensemble). Bussi–Donadio–Parrinello (CSVR) draws the target kinetic energy stochastically from the exact χNdof2\chi^2_{N_{\text{dof}}} distribution with relaxation time τT\tau_T.

5.2 Inside the algorithm

5.3 Checks

Exact NVT: <K>=113.40, Var(K)=136.08
Bussi CSVR: <K>=113.13, Var(K)=117.40
Berendsen:  <K>=113.40, Var(K)=2.02e-28
<Figure size 1120x430 with 2 Axes>

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

5.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. Tau independence of CSVR variance: Verify that bussi_csvr_thermostat reproduces Var(K)=Ndof2T2\mathrm{Var}(K) = \frac{N_{\text{dof}}}{2}T^2 for both τT=0.05\tau_T = 0.05 and τT=0.5\tau_T = 0.5.

  2. Coupled LJTS NVT-CSVR fluid: Couple bussi_csvr_thermostat to velocity_verlet_step on a 108-atom LJTS fluid and verify mean temperature convergence.

  3. Heat capacity error under Berendsen: Show how suppressing Var(K)\mathrm{Var}(K) biases the Lebowitz fluctuation formula for CVC_V.

Worked solutions are provided in 05_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).