ES98D · Course contents

3. Trajectories, heat baths and numerical time

Release a particle in the harmonic well U(x)=kx2/2U(x)=kx^2/2. Newton's equation makes it oscillate; adding drag makes it settle at zero. Neither motion, by itself, describes the nonzero equilibrium width of a warm particle. To obtain that width while dissipating energy, we must model fluctuations as well as friction.

This chapter constructs that balance and then asks what survives a finite numerical timestep. The same distinction between an exact invariant measure and its numerical approximation will recur in Monte Carlo.

3.1 The degrees of freedom we eliminated return as noise

For a smooth potential, isolated classical motion satisfies

dXt=Vt dt,m dVt=−∇U(Xt)dt.dX_t=V_t\,dt,\qquad m\,dV_t=-\nabla U(X_t)dt.

Coupling to an unresolved fluid motivates a drag force −γV-\gamma V, where γ>0\gamma>0 has units mass/time. Many rapidly decorrelating bath impulses are approximated by Gaussian white noise. This is a coarse-grained Markov approximation: a bath with important memory can require coloured noise and a memory-dependent friction instead.

A dd-dimensional Wiener process WtW_t has independent Gaussian increments with covariance Δt Id\Delta t\,I_d. Its derivative is not an ordinary function. The Langevin SDE is

dXt=Vt dt,m dVt=−∇U(Xt)dt−γVtdt+2γkBT dWt.dX_t=V_t\,dt,\qquad m\,dV_t=-\nabla U(X_t)dt-\gamma V_tdt +\sqrt{2\gamma k_BT}\,dW_t.

Formally the random force has mean zero and component covariance

E[ηa(t)ηb(t′)]=2γkBT δabδ(t−t′).\mathbb E[\eta_a(t)\eta_b(t')] =2\gamma k_BT\,\delta_{ab}\delta(t-t').

Why this amplitude? Set the conservative force to zero and apply Itô's formula to one component V2V^2. If the random-force amplitude is σ\sigma, then

ddtE[V2]=−2γmE[V2]+σ2m2.\frac{d}{dt}\mathbb E[V^2] =-\frac{2\gamma}{m}\mathbb E[V^2]+\frac{\sigma^2}{m^2}.

At equilibrium, equipartition demands mE[V2]=kBTm\mathbb E[V^2]=k_BT. Thus σ2=2γkBT\sigma^2=2\gamma k_BT. The fluctuation–dissipation relation is a constraint imposed by the target thermal distribution, not an independent knob for making trajectories look random.

For a confining smooth potential, this SDE preserves the full canonical position–velocity measure. Whether it converges to that measure additionally depends on the domain, regularity and accessibility; the word “Langevin” alone is not an ergodicity proof.

3.2 Eliminate velocity only after identifying its timescale

A free velocity relaxes on the time τv=m/γ\tau_v=m/\gamma. If this is short compared with the timescales on which positions and forces change, observations made after that transient can be described by the constant-friction overdamped limit

dXt=−1γ∇U(Xt)dt+2kBTγ dWt=−1γ∇U(Xt)dt+2βγ dWt.dX_t=-\frac1\gamma\nabla U(X_t)dt +\sqrt{\frac{2k_BT}{\gamma}}\,dW_t =-\frac1\gamma\nabla U(X_t)dt +\sqrt{\frac{2}{\beta\gamma}}\,dW_t.

This is a limiting model, not a pointwise assertion that a white-noise acceleration is small. Its mobility is 1/γ1/\gamma and its diffusion coefficient is D=kBT/γD=k_BT/\gamma. With U=0U=0, each component has mean-square displacement 2Dt2Dt. Spatially varying mobility needs additional care, including a thermal drift in the Itô formulation; we use constant mobility here.

The original viva answer used 2β/γ\sqrt{2\beta/\gamma} while defining β=(kBT)−1\beta=(k_BT)^{-1}. That factor is incorrect. It reverses the temperature dependence and fails the stationary-distribution check below.

3.3 The probability current checks the model

For the overdamped process, a density ρ\rho obeys the Fokker–Planck equation

∂tρ=1γ∇⋅(ρ∇U)+1βγΔρ=−∇⋅J,J=−1γρ∇U−1βγ∇ρ.\partial_t\rho=\frac1\gamma\nabla\cdot(\rho\nabla U) +\frac1{\beta\gamma}\Delta\rho=-\nabla\cdot J, \qquad J=-\frac1\gamma\rho\nabla U-\frac1{\beta\gamma}\nabla\rho.

Substitute ρ=π∝e−βU\rho=\pi\propto e^{-\beta U}. Since ∇π=−βπ∇U\nabla\pi=-\beta\pi\nabla U, the drift and diffusive currents cancel pointwise: J=0J=0. With periodic or reflecting boundaries, or sufficient decay at infinity, this gives a stationary probability measure. Normalisability and boundary conditions are essential; a free particle on all of Rd\mathbb R^d has no normalisable uniform equilibrium.

For the harmonic well the stationary law is Gaussian,

π(x)=βk2πe−βkx2/2,Var⁡(X)=1βk,τx=γk.\pi(x)=\sqrt{\frac{\beta k}{2\pi}}e^{-\beta kx^2/2}, \qquad \operatorname{Var}(X)=\frac1{\beta k}, \qquad \tau_x=\frac\gamma k.

Increasing friction slows relaxation but does not change this width. Increasing temperature broadens the distribution. Compare these effects in the exact formulas represented below; the curves are equilibrium laws, not finite simulated histograms.

Width and relaxation answer different questions

Cooling narrows equilibrium

position xequilibrium density−3300.85β = 4 (dashed)β = 1 (solid)

Temperature changes the equilibrium spread: variance is 1/(βk).

Friction slows relaxation

time tnormalised covariance0401γ = 4 (dashed)γ = 1 (solid)

Friction changes the clock: decay time is γ/k, while the equilibrium width stays fixed.

Analytic overdamped harmonic laws with stiffness k = 1. Left varies inverse temperature with γ = 1. Right varies friction with β = 1. All quantities are nondimensional. ↗

In fact Cov⁡(Xt,X0)=e−kt/γ/(βk)\operatorname{Cov}(X_t,X_0)=e^{-kt/\gamma}/(\beta k) at stationarity. Equilibrium spread and relaxation rate are different properties of the same model. An algorithm can preserve one while changing the other.

Release an ensemble at the same point in a harmonic well. What does the average do, and what does an individual path do instead?

Thermal noise broadens a relaxing cloud
One realised path and exact mean
position xphysical time09-33
The ensemble spreads in the well
equilibrium reference densityposition x-3301

X′ = e⁻ΔᵗX + √[T(1 − e⁻²Δᵗ)] ξ

Time 1.62; exact mean 0.40; exact transient variance 0.58.

Paused. Play the sequence, step through it, or drag the position slider.

Exact sampled OU transition with k = γ = 1 and Δt = 0.075. The cloud has 32 paths and is not a precision density estimator. Joining sampled positions is visual interpolation, not Euler integration. The position scale is fixed during playback and adapts when temperature changes.

Play one fixed-seed ensemble and follow the highlighted path. Change temperature to replay the same Gaussian innovations at a different thermal scale. ↗

3.4 Numerical trajectories introduce a second approximation

For smooth isolated dynamics, velocity Verlet uses

vn+1/2=vn+Δt2a(rn),rn+1=rn+Δt vn+1/2,v_{n+1/2}=v_n+\frac{\Delta t}{2}a(r_n),\qquad r_{n+1}=r_n+\Delta t\,v_{n+1/2}, vn+1=vn+1/2+Δt2a(rn+1),ai(r)=−∇iU(r)mi.v_{n+1}=v_{n+1/2}+\frac{\Delta t}{2}a(r_{n+1}), \qquad a_i(r)=-\frac{\nabla_iU(r)}{m_i}.

It is second-order, time-reversible and symplectic for the smooth Hamiltonian problem, with typically bounded oscillatory energy error in a resolved stable regime. It does not conserve the exact Hamiltonian at every step. For a harmonic mode of frequency ω\omega, stability requires ωΔt<2\omega\Delta t<2; accurate trajectories need a smaller step. The fastest mode, rather than the slow process of scientific interest, constrains the timestep.

For overdamped motion, Euler–Maruyama gives

Xn+1=Xn−Δtγ∇U(Xn)+2Δtβγ ξn,ξn∼N(0,I).X_{n+1}=X_n-\frac{\Delta t}{\gamma}\nabla U(X_n) +\sqrt{\frac{2\Delta t}{\beta\gamma}}\,\xi_n, \qquad \xi_n\sim N(0,I).

The harmonic case exposes its bias without a simulation. Setting a=1−kΔt/γa=1-k\Delta t/\gamma, the stationary variance solves S=a2S+2Δt/(βγ)S=a^2S+2\Delta t/(\beta\gamma), hence

S=1βk11−kΔt/(2γ),0<kΔt/γ<2.S=\frac{1}{\beta k}\frac{1}{1-k\Delta t/(2\gamma)}, \qquad 0<k\Delta t/\gamma<2.

A stable discretisation can therefore sample the wrong width. Reducing the step checks this bias; a Metropolis correction can instead restore the target measure at the cost of changing the process. For underdamped Langevin dynamics, splitting the deterministic force, drift and Ornstein–Uhlenbeck velocity update gives useful integrators; simply appending arbitrary noise to Verlet is not an accuracy argument.

Does a numerical oscillator trace the exact phase-space circle? Follow the orbit and its energy at the same time.

A stable orbit can still carry energy error
Numerical and exact phase space
xv1−11−1equal scales on both phase axes
Energy at every computed step
numerical energy Hcomputed update n012000.55Δt = 0.50

Hₙ = (xₙ² + vₙ²)/2; H₀ = 1/2

Time 10.50; H = 0.4731; energy error -0.0269.

Paused. Play the sequence, step through it, or drag the position slider.

Harmonic oscillator, x₀ = 1, v₀ = 0, m = k = 1. All selectable steps satisfy Δt < 2. Lines connect discrete states for readability; 120 updates are shown, so elapsed physical time changes with Δt.

Replay velocity Verlet at a larger timestep. The exact reference point is evaluated at the same physical time nΔt; the energy trace exposes the discretisation error. ↗

3.5 Preserving a distribution does not guarantee exploration

A thermostat exchanges energy to target NVT. Langevin friction and noise give one construction. A deterministic Nosé–Hoover thermostat introduces a bath variable ζ\zeta, for example through p˙i=Fi−ζpi\dot p_i=F_i-\zeta p_i and ζ˙=(2K−fkBT)/Qth\dot\zeta=(2K-fk_BT)/Q_{\mathrm{th}}, with ff thermal degrees of freedom and thermostat mass QthQ_{\mathrm{th}}. Suitable extended dynamics admit a canonical physical marginal, but simple systems can be nonergodic. Thermostat chains add coupled variables to improve exploration without a universal guarantee.

A barostat additionally evolves the volume or cell to target pressure; it must be constructed with the intended NPT measure. Neither resetting velocities to a fixed kinetic energy every step nor rescaling a box arbitrarily produces the correct ensemble fluctuations. For a transport measurement, coupling choices also affect physical dynamics, even when equilibrium position averages look right.

3.6 A finite box with bulk ambitions

Periodic boundaries reduce exposed surfaces by identifying opposite faces. In a cubic cell of side LL, wrap positions modulo LL. For short-range pair interactions, the minimum-image displacement subtracts Lround⁡(Δr/L)L\operatorname{round}(\Delta r/L) componentwise. Using a spherical cutoff rc<L/2r_c<L/2 avoids including two images of the same particle in this simple construction. General cells require the corresponding geometric analysis.

Truncation changes the interaction model. A shifted potential, u(r)−u(rc)u(r)-u(r_c) below rcr_c, makes the energy continuous but generally leaves a force jump. A force-shifted version

ufs(r)=u(r)−u(rc)−(r−rc)u′(rc),r<rc,u_{\mathrm{fs}}(r)=u(r)-u(r_c)-(r-r_c)u'(r_c),\qquad r<r_c,

with zero beyond, makes both energy and force continuous. Switching functions give other smooth approximations. Tail corrections rely on assumptions about distant correlations and cannot replace a proper long-range treatment of Coulomb interactions.

Avoid repeating the same pair search

A neighbour list stores pairs within rc+δr_c+\delta, where δ\delta is a skin distance. If every particle has moved by less than δ/2\delta/2 since the list was built, no pair initially outside the list can have entered the interaction cutoff: relative separation can shrink by at most δ\delta. Rebuild before that bound fails, using displacements that account for periodic wrapping.

Cell-based searches and bounded local density can make short-range force evaluation approximately linear in NN. The gain depends on locality and list maintenance; it is not obtained by storing an incomplete list. This is an implementation invariant with a direct geometric proof.

3.7 One initial microstate must become representative

For a solid, start from a lattice compatible with the intended crystal, such as fcc, bcc, hcp or diamond cubic. A liquid can be prepared by melting an ordered structure or placing particles randomly subject to excluded-volume constraints. Dilute gases admit simpler random placements. Severe overlaps in a repulsive model create enormous forces and can destabilise the first step.

The original source describes a 64-atom diamond-cubic silicon supercell heated to 5000 K and equilibrated at 2000 K. Its underlying data and force-field slides are unavailable here. The example illustrates a preparation protocol, not a temperature recommendation transferable to every silicon potential.

For canonical unconstrained velocities, draw each component independently from N(0,kBT/mi)N(0,k_BT/m_i). To impose zero total momentum, subtract the centre-of-mass velocity vcm=∑imivi/∑imiv_{\mathrm{cm}}=\sum_i m_iv_i/\sum_i m_i. This samples a constrained kinetic distribution and removes dd degrees of freedom. Holonomic constraints remove further degrees of freedom. Temperature estimates use Tkin=2K/(fkB)T_{\mathrm{kin}}=2K/(fk_B) with the appropriate ff.

Setting velocities to zero describes a cold start, while rescaling them to an exact kinetic energy fixes a quantity that should fluctuate in an unconstrained canonical ensemble. Either can be a preparation step, followed by equilibration; neither is the same as an equilibrium Maxwell draw.

Initial structure can select a metastable basin. Even a mathematically ergodic process may need far longer than the available runtime to leave it. Compare independent starts, monitor slow observables and distinguish preparation from production data. Discarding a fixed number of frames is not proof of equilibration. Monte Carlo will change the sampling dynamics, but it inherits this finite-time problem.

Exercises

  1. Derive the stationary harmonic variance from Itô's formula and compare it with the Euler–Maruyama result.
  2. Hold TT and kk fixed and double γ\gamma. Which quantities in the harmonic figure change?
  3. Prove the neighbour-skin criterion using the triangle inequality. Why is a displacement measured only between wrapped coordinates insufficient?