Algorithm Search⌘K

Definitioncore

Canonical ensemble

Also called NVT ensemble.

The distribution of states at fixed particle number, volume and temperature, with probability proportional to exp(-E/kT).

The canonical ensemble is the probability distribution of a system with a fixed number of particles NN and a fixed volume VV that exchanges energy with a large heat bath at temperature TT. A state of energy EE has a probability proportional to the Boltzmann factor e−E/kBTe^{-E / k_B T}, so low energies are favoured and the temperature sets how strongly. It is the ensemble of most experiments at a fixed temperature, of Metropolis Monte Carlo, and of molecular dynamics with a thermostat such as Langevin dynamics or the Nose-Hoover thermostat. Its normalization is the partition function ZZ, and the Helmholtz free energy is A=−kBTln⁡ZA = -k_B T \ln Z.

Definition

Let Γ=(x1,…,xN,p1,…,pN)\Gamma = (x_1, \ldots, x_N, p_1, \ldots, p_N) be a point of phase space with the positions in the volume VV, and let H(Γ)=K(p)+U(x)H(\Gamma) = K(p) + U(x) with K=∑i∣pi∣2/(2mi)K = \sum_i |p_i|^2 / (2 m_i). Let β=1/(kBT)\beta = 1 / (k_B T). The canonical ensemble at (N,V,T)(N, V, T) is the probability density

ρNVT(Γ)=e−βH(Γ)Z(N,V,T),Z(N,V,T)=1N! hPdN∫e−βH(Γ) dΓ,\rho_{NVT}(\Gamma) = \frac{e^{-\beta H(\Gamma)}}{Z(N, V, T)}, \qquad Z(N, V, T) = \frac{1}{N!\, h_P^{dN}} \int e^{-\beta H(\Gamma)}\, d\Gamma,

in dd dimensions, where hPh_P is Planck's constant, which fixes the units of ZZ, and N!N! counts the exchanges of identical particles. The average of an observable AA is ⟨A⟩NVT=∫A ρNVT dΓ\langle A \rangle_{NVT} = \int A\, \rho_{NVT}\, d\Gamma.

Three facts follow at once and are used on every thermostat page:

  • It factors. e−βH=e−βK(p)e−βU(x)e^{-\beta H} = e^{-\beta K(p)} e^{-\beta U(x)}, so the momenta are independent of the positions. Each momentum component piap_{ia} is normal with mean 0 and variance mikBTm_i k_B T: the Maxwell-Boltzmann distribution. The positions have the density e−βU(x)/Zxe^{-\beta U(x)} / Z_x, with the configurational integral Zx=∫e−βU dxZ_x = \int e^{-\beta U}\,dx. Monte Carlo methods sample this part alone.
  • The kinetic energy has a gamma law. KK is a sum of NfN_f squares of independent normals, so it has the density proportional to KNf/2−1e−βKK^{N_f/2 - 1} e^{-\beta K}, with mean 12NfkBT\frac12 N_f k_B T and variance 12Nf(kBT)2\frac12 N_f (k_B T)^2. Here NfN_f is the number of velocity degrees of freedom: dNdN, minus dd if the total momentum is fixed, minus one for each holonomic constraint. A simulation reports the kinetic temperature kBT=2⟨K⟩/Nfk_B T = 2 \langle K \rangle / N_f, so it must give NfN_f.
  • It is the microcanonical ensemble averaged over the energy. ρNVT=∫ρNVE Ω(E)e−βE dE/Z\rho_{NVT} = \int \rho_{NVE}\, \Omega(E) e^{-\beta E}\, dE / Z, where Ω(E)\Omega(E) is the density of states of the microcanonical ensemble. So ZZ is the Laplace transform of Ω\Omega.

The energy fluctuates. From ⟨E⟩=−∂ln⁡Z/∂β\langle E \rangle = -\partial \ln Z / \partial \beta and one more derivative,

⟨δE2⟩=∂2ln⁡Z∂β2=kBT2CV,\langle \delta E^2 \rangle = \frac{\partial^2 \ln Z}{\partial \beta^2} = k_B T^2 C_V,

with the heat capacity CV=∂⟨E⟩/∂TC_V = \partial \langle E \rangle / \partial T at fixed NN and VV (a theorem). For a system of NN particles, ⟨E⟩\langle E \rangle and CVC_V grow as NN, so the relative size of the fluctuation is O(N−1/2)O(N^{-1/2}), and for large NN the canonical ensemble is concentrated near one energy. Averages of local quantities agree with the microcanonical ones up to O(1/N)O(1/N). Fluctuations do not agree: the variance of KK above is the canonical value, and it is different at fixed energy.

Sampling it. A method samples the canonical ensemble if ρNVT\rho_{NVT} (or its marginal in Γ\Gamma, for a method with extra variables) is a stationary density of the method and the method is ergodic, so that time averages converge to ensemble averages. Stationarity can be proved for a given method. Ergodicity holds for stochastic methods such as Langevin dynamics and the Andersen thermostat under mild conditions, and it is a hypothesis for deterministic methods such as the Nose-Hoover thermostat. A time-stepping method keeps ρNVT\rho_{NVT} only up to its time step error unless a Metropolis test corrects it.

Examples and non-examples

One harmonic oscillator. Take H=p2/(2m)+kx2/2H = p^2/(2m) + k x^2 / 2 with m=k=kBT=1m = k = k_B T = 1 in reduced units. Then xx and pp are independent standard normals: ⟨x2⟩=1\langle x^2 \rangle = 1, ⟨x4⟩/⟨x2⟩2=3\langle x^4 \rangle / \langle x^2 \rangle^2 = 3, and ⟨H⟩=1\langle H \rangle = 1, half from each square. The probability of ∣x∣<12|x| < \frac12 is erf⁡(0.5/2)=0.3829\operatorname{erf}(0.5/\sqrt2) = 0.3829. Compare the microcanonical ensemble at the same mean energy E=1E = 1: there xx has the arcsine law on [−2,2][-\sqrt2, \sqrt2], with ⟨x4⟩/⟨x2⟩2=1.5\langle x^4 \rangle / \langle x^2 \rangle^2 = 1.5 and P(∣x∣<12)=2πarcsin⁡(0.5/2)=0.2301P(|x| < \frac12) = \frac{2}{\pi}\arcsin(0.5/\sqrt2) = 0.2301. The ratio ⟨x4⟩/⟨x2⟩2\langle x^4 \rangle / \langle x^2 \rangle^2 is a simple test of whether a thermostat samples the canonical ensemble.

Energy fluctuation of the oscillator. HH is the sum of two independent terms 12x2\frac12 x^2 and 12p2\frac12 p^2, each a half of a chi-squared variable with one degree of freedom, with variance 12(kBT)2\frac12 (k_B T)^2. So ⟨δE2⟩=(kBT)2\langle \delta E^2 \rangle = (k_B T)^2. The formula kBT2CVk_B T^2 C_V gives the same, since ⟨E⟩=kBT\langle E \rangle = k_B T and CV=kBC_V = k_B.

A two-level system. Two states with energies 0 and ϵ\epsilon, and βϵ=1\beta\epsilon = 1. Then Z=1+e−1Z = 1 + e^{-1}, the upper state has probability e−1/(1+e−1)=0.268941e^{-1}/(1 + e^{-1}) = 0.268941, and ⟨E⟩=0.268941 ϵ\langle E \rangle = 0.268941\,\epsilon. The variance is p(1−p)ϵ2=0.196612 ϵ2p(1 - p)\epsilon^2 = 0.196612\,\epsilon^2, so CV=⟨δE2⟩/(kBT2)=(βϵ)2⋅0.196612 kB=0.196612 kBC_V = \langle \delta E^2 \rangle / (k_B T^2) = (\beta\epsilon)^2 \cdot 0.196612\, k_B = 0.196612\, k_B.

The kinetic energy of 20 particles. Take 20 particles on a line with kBT=1k_B T = 1 and no constraint, so Nf=20N_f = 20. The canonical law of KK has mean 10 and variance 10, so the standard deviation of the kinetic temperature 2K/Nf2K/N_f is 2/Nf=0.316\sqrt{2/N_f} = 0.316 times TT. A run that reports the mean of KK only does not test the ensemble; the variance is the stronger test, and the thermostat pages of this area use these two numbers.

Non-example: the Berendsen thermostat. The Berendsen thermostat relaxes KK toward its target. For free particles the variance of KK goes to 0, not to 12Nf(kBT)2\frac12 N_f (k_B T)^2, so it does not sample this ensemble.

Non-example: one oscillator with one Nose-Hoover thermostat. The canonical density is stationary for the Nose-Hoover equations, but on one harmonic oscillator the motion is not ergodic. A long run gives ⟨x2⟩≈0.79\langle x^2 \rangle \approx 0.79 and ⟨x4⟩/⟨x2⟩2≈1.54\langle x^4 \rangle / \langle x^2 \rangle^2 \approx 1.54 instead of 1 and 3 (a measurement on the Nose-Hoover page). Nose-Hoover chains repair this case.

Non-example: plain molecular dynamics. Molecular dynamics without a thermostat conserves the energy, so it samples the microcanonical ensemble at best. Its kinetic energy fluctuates, but with the microcanonical variance.

  • Microcanonical ensemble. Fixed NN, VV and EE. The canonical ensemble is its average over EE with the weight Ω(E)e−βE\Omega(E) e^{-\beta E}.
  • Partition function. The normalization ZZ. Derivatives of ln⁡Z\ln Z give the mean energy, the heat capacity and, through A=−kBTln⁡ZA = -k_B T \ln Z, the free energy, which free energy perturbation and thermodynamic integration compute as differences.
  • Isothermal-isobaric ensemble. Fixed NN, PP and TT, with density proportional to e−β(H+PV)e^{-\beta(H + PV)} and the volume as an extra variable. The Parrinello-Rahman barostat together with a thermostat samples a form of it.
  • Boltzmann distribution. The same weight e−βEe^{-\beta E} on a discrete set of states, as in the two-level example and in the Ising model.
  • Stationary distribution. A Monte Carlo chain such as Metropolis-Hastings is built so that e−βU/Zxe^{-\beta U}/Z_x is its stationary distribution, often through detailed balance.

References

  1. Michael P. Allen and Dominic J. Tildesley, Computer Simulation of Liquids, second edition, Oxford University Press, 2017, Chapter 2, statistical mechanics (the common ensembles and their fluctuations)
  2. Mark E. Tuckerman, Statistical Mechanics, Theory and Molecular Simulation, Oxford University Press, 2010, Chapter 4, the canonical ensemble
  3. Daan Frenkel and Berend Smit, Understanding Molecular Simulation, From Algorithms to Applications, second edition, Academic Press, 2002, Chapter 2 (statistical mechanics and ensembles)
  4. Ben Leimkuhler and Charles Matthews, Molecular Dynamics, With Deterministic and Stochastic Numerical Methods, Springer, 2015, Chapter 6, the canonical distribution and stochastic differential equations

Where this leads

About this page

The build computes these levels from the evidence in the repository. Each row says what the next level needs. Read what the levels mean.

LadderLevelWhat the next level needs
Human proofH0 no proof
  • add a proof in proofs/ (06.5)
LeanL0 no Lean part
  • name a Lean module in the lean field (07)
VisualV0 none
  • add viz/scene.ts or a figure (10)
WritingW4 complete
  • a review of the text: no review record reviews/4VMCW9/text.yaml