Classical statistical mechanics
Statistical mechanics provides the fundamental bridge between microscopic models of matter and macroscopic thermodynamic behavior. In this chapter, we introduce the key concepts of classical statistical mechanics that underpin all sampling methods discussed in this series — including nested sampling. We will see how probability distributions on phase space give rise to thermodynamic ensembles, how partition functions encode all equilibrium thermodynamics, and how response functions signal phase transitions.
Phase space and the Hamiltonian
The microstate of a classical system of
which is preserved under Hamiltonian time evolution (Liouville's theorem).
The energetics of the system are encoded in the Hamiltonian
which separates into a kinetic energy
The Boltzmann distribution
The central object of equilibrium statistical mechanics is the probability density
where
The Boltzmann factor
- At low temperature (high
), the distribution concentrates sharply at energy minima - At high temperature (low
), the distribution becomes nearly uniform — all states are equally likely
Let's visualize this on a 2D potential energy surface. We use Hosaki's function, which has a local minimum at
At very low temperatures, the probability is concentrated almost entirely in the global minimum at
Partition functions
The Boltzmann distribution must be normalized to define a proper probability density. The normalization constant is the partition function, which for the canonical (NVT) ensemble reads
Thanks to the additive structure of the Hamiltonian
where
is the configurational partition function. This is the quantity that matters for sampling methods like nested sampling, which operate entirely in configuration space.
The corresponding configurational probability density is simply
The NVT ensemble: Helmholtz free energy
The logarithm of the partition function defines the Helmholtz free energy
which encodes all equilibrium thermodynamics of the canonical ensemble. This is a remarkable statement: if we know
The power of this becomes clear when we write out the derivatives explicitly — each macroscopic quantity corresponds to a microscopic average over the Boltzmann distribution:
This is the bridge between phenomenological thermodynamics and microscopic statistical mechanics. The average energy is the expectation of
For our 2D Hosaki potential, the configurational partition function takes the explicit form
which we evaluate numerically on a grid. The plots below show
Notice the peak in
The NPT ensemble: Gibbs free energy
In many practical situations — particularly in materials science — both temperature and pressure are controlled externally. This defines the isothermal-isobaric (NPT) ensemble. The relevant energy becomes the enthalpy
The corresponding thermodynamic potential is the Gibbs free energy
which is related to the Helmholtz free energy by a Legendre transformation:
Again, each thermodynamic derivative has a direct microscopic interpretation as a statistical average — the average volume, the average enthalpy, and the enthalpy variance — computed over the Boltzmann distribution
The toy model
To illustrate the NPT ensemble, we use a toy model introduced in [Ref. 1]: two particles in a one-dimensional periodic box, interacting via a pair potential with a repulsive core and an attractive well. The system is fully described by the interparticle distance
where the triangular integration domain
The enthalpy surface
Now, what does the Boltzmann distribution
NPT thermodynamic quantities
We can now evaluate all the derivatives introduced above for the toy model. The plots below show the Gibbs free energy, average volume, heat capacity
Response functions and phase transitions
Phase transitions correspond to non-analytic behavior of thermodynamic potentials in the thermodynamic limit. For finite systems — like our toy model — these singularities are rounded, manifesting instead as pronounced peaks in response functions.
Key insight: Peaks in
The heat capacity
| Response function | Potential | Expression |
|---|---|---|
This structure can be understood through a Taylor expansion: the thermodynamic potential around equilibrium looks like
The quadratic term encodes the energetic cost of perturbations. When it diverges — when the curvature of the free-energy surface changes dramatically — we are at a phase transition.
Pressure dependence of the phase transition
Try different pressures in the toy model above and observe how the
Connection to nested sampling
Nested sampling provides a unique approach to statistical mechanics: rather than sampling at a fixed temperature, it reconstructs the full free-energy landscape
This makes NS particularly powerful for studying phase transitions: the peaks in response functions, the competing free-energy sheets of different phases, and the complete equation of state all emerge naturally from a single NS run. We will explore this in detail in the nested sampling primer.