← Part IV/Partition Functions

Partition Functions

Reading time: ~45 minutes | Derivations: 5 | Simulations: 2

1. Introduction: The Bridge Between Worlds

The partition function is the single most important quantity in statistical mechanics. It encodes all thermodynamic information about a system in one mathematical object — a sum over Boltzmann-weighted states that connects the microscopic energy spectrum to macroscopic observables.

The Canonical Partition Function

For a system with discrete energy levels $\{E_i\}$, the canonical partition function is:

$$Z = \sum_i g_i \, e^{-E_i / k_B T} = \sum_i g_i \, e^{-\beta E_i}$$

where $\beta = 1/(k_B T)$ is the thermodynamic beta, $g_i$ is the degeneracy of level $i$, and the sum runs over all distinct energy levels.

The German word Zustandssumme ("sum over states") captures the essence: we sum over every accessible quantum state, each weighted by its Boltzmann factor. At low temperature, only the ground state contributes significantly. As $T \to \infty$, all states participate equally, and $Z$ grows without bound.

For a single molecule, we write the molecular partition function as $q$. For $N$ indistinguishable, non-interacting molecules, the system partition function is:

$$Q = \frac{q^N}{N!}$$

The $N!$ accounts for the indistinguishability of identical particles (Gibbs's correction), preventing the Gibbs paradox in which the entropy of mixing two identical gases would be nonzero.

Why the Partition Function Matters

  • Every thermodynamic quantity can be derived from $Z$ by differentiation
  • It provides the normalization for the Boltzmann distribution
  • The logarithm of $Z$ is directly proportional to the Helmholtz free energy
  • Chemical equilibrium constants follow from ratios of partition functions
  • It naturally incorporates quantum effects through the energy level structure

2. Derivation: Translational Partition Function

A molecule of mass $m$ confined to a cubic box of side $L$(volume $V = L^3$) has particle-in-a-box energy levels in three dimensions:

$$E_{n_x, n_y, n_z} = \frac{h^2}{8mL^2}\left(n_x^2 + n_y^2 + n_z^2\right), \quad n_x, n_y, n_z = 1, 2, 3, \ldots$$

The translational partition function is therefore:

$$q_{\text{trans}} = \sum_{n_x=1}^{\infty} \sum_{n_y=1}^{\infty} \sum_{n_z=1}^{\infty} \exp\!\left[-\frac{h^2(n_x^2 + n_y^2 + n_z^2)}{8mL^2 k_B T}\right]$$

Because the energy is a sum of independent terms, the triple sum factors:

$$q_{\text{trans}} = \left(\sum_{n=1}^{\infty} e^{-n^2 h^2 / (8mL^2 k_B T)}\right)^{\!3}$$

High-Temperature (Continuum) Limit

Define $\alpha = h^2/(8mL^2 k_B T)$. For typical molecules at room temperature,$\alpha \sim 10^{-18}$, so the spacing between levels is vastly smaller than $k_B T$. We replace the sum by an integral:

$$\sum_{n=1}^{\infty} e^{-\alpha n^2} \approx \int_0^{\infty} e^{-\alpha n^2}\, dn = \frac{1}{2}\sqrt{\frac{\pi}{\alpha}}$$

This is the Gaussian integral $\int_0^\infty e^{-ax^2}\,dx = \frac{1}{2}\sqrt{\pi/a}$.

Substituting back and cubing:

$$q_{\text{trans}} = \left(\frac{1}{2}\sqrt{\frac{\pi}{\alpha}}\right)^3 = \left(\frac{2\pi m k_B T}{h^2}\right)^{3/2} L^3 = \left(\frac{2\pi m k_B T}{h^2}\right)^{3/2} V$$

Thermal de Broglie Wavelength

Define the thermal de Broglie wavelength:

$$\Lambda = \frac{h}{\sqrt{2\pi m k_B T}} = h\left(\frac{\beta}{2\pi m}\right)^{1/2}$$

Then the translational partition function takes the elegant form:

$$\boxed{q_{\text{trans}} = \frac{V}{\Lambda^3}}$$

Physical interpretation: $q_{\text{trans}}$ counts the number of thermal de Broglie volumes that fit inside the container. For an ideal gas at STP,$q_{\text{trans}} \sim 10^{30}$ — an enormous number, confirming that the classical (high-temperature) limit is valid.

3. Derivation: Rotational Partition Function

For a rigid rotor (linear molecule), the rotational energy levels are:

$$E_J = \frac{\hbar^2}{2I} J(J+1) = k_B \Theta_{\text{rot}} \, J(J+1), \quad J = 0, 1, 2, \ldots$$

where $I$ is the moment of inertia and we define the characteristic rotational temperature:

$$\Theta_{\text{rot}} = \frac{\hbar^2}{2I k_B} = \frac{hB}{k_B}$$

where $B$ is the rotational constant in frequency units. For N$_2$,$\Theta_{\text{rot}} \approx 2.88$ K; for H$_2$,$\Theta_{\text{rot}} \approx 87.6$ K.

Each level $J$ has degeneracy $g_J = 2J + 1$ (from the magnetic quantum number $m_J = -J, \ldots, +J$). The rotational partition function is:

$$q_{\text{rot}} = \frac{1}{\sigma} \sum_{J=0}^{\infty} (2J+1) \, e^{-J(J+1)\Theta_{\text{rot}}/T}$$

The symmetry number $\sigma$ corrects for overcounting of indistinguishable orientations: $\sigma = 1$ for heteronuclear diatomics (CO, HCl),$\sigma = 2$ for homonuclear diatomics (N$_2$, O$_2$).

High-Temperature Limit

When $T \gg \Theta_{\text{rot}}$, many rotational levels are populated and we may replace the sum by an integral. Let $x = J(J+1)$, so$dx = (2J+1)\,dJ$:

$$q_{\text{rot}} \approx \frac{1}{\sigma}\int_0^{\infty} e^{-x\,\Theta_{\text{rot}}/T}\,dx = \frac{1}{\sigma}\cdot\frac{T}{\Theta_{\text{rot}}}$$
$$\boxed{q_{\text{rot}} = \frac{T}{\sigma\,\Theta_{\text{rot}}}} \qquad (T \gg \Theta_{\text{rot}})$$

At 300 K for N$_2$: $q_{\text{rot}} \approx 300/(2 \times 2.88) \approx 52$.

Extension to Polyatomic Molecules

Symmetric Top

For a symmetric top with moments of inertia $I_A = I_B \neq I_C$:

$$q_{\text{rot}}^{\text{sym}} = \frac{1}{\sigma}\sqrt{\frac{\pi T^3}{\Theta_A^2 \Theta_C}}$$

where $\Theta_A = \hbar^2/(2I_A k_B)$ and similarly for $\Theta_C$.

Asymmetric Top

For a general asymmetric top with three distinct moments $I_A, I_B, I_C$:

$$q_{\text{rot}}^{\text{asym}} = \frac{1}{\sigma}\sqrt{\frac{\pi T^3}{\Theta_A \Theta_B \Theta_C}}$$

Water is an asymmetric top with $\sigma = 2$: $\Theta_A = 40.1$ K,$\Theta_B = 20.9$ K, $\Theta_C = 13.4$ K. At 300 K,$q_{\text{rot}} \approx 43$.

Note: Rotational contributions give $C_V = k_B$ per molecule for linear molecules (2 rotational degrees of freedom) and $C_V = \frac{3}{2}k_B$for nonlinear molecules (3 rotational degrees of freedom) in the classical limit.

4. Derivation: Vibrational Partition Function

In the harmonic approximation, a diatomic molecule has vibrational energy levels:

$$E_v = \left(v + \frac{1}{2}\right)h\nu, \quad v = 0, 1, 2, \ldots$$

Measuring energies from the zero-point level (setting $E_0 = 0$), the vibrational partition function becomes:

$$q_{\text{vib}} = \sum_{v=0}^{\infty} e^{-v h\nu/(k_B T)} = \sum_{v=0}^{\infty} \left(e^{-\Theta_{\text{vib}}/T}\right)^v$$

where we define the characteristic vibrational temperature:

$$\Theta_{\text{vib}} = \frac{h\nu}{k_B}$$

For N$_2$: $\Theta_{\text{vib}} \approx 3393$ K; for HCl: $\Theta_{\text{vib}} \approx 4303$ K.

This is a geometric series with ratio $r = e^{-\Theta_{\text{vib}}/T} < 1$. Using $\sum_{v=0}^{\infty} r^v = 1/(1-r)$:

$$\boxed{q_{\text{vib}} = \frac{1}{1 - e^{-\Theta_{\text{vib}}/T}}}$$

Vibrational Energy and Heat Capacity

The mean vibrational energy (per molecule, above zero-point) is obtained from$\langle E \rangle = -\partial \ln q_{\text{vib}} / \partial \beta$:

$$\langle E_{\text{vib}} \rangle = \frac{k_B \Theta_{\text{vib}}}{e^{\Theta_{\text{vib}}/T} - 1}$$

The vibrational contribution to the heat capacity is:

$$\frac{C_{V,\text{vib}}}{k_B} = \left(\frac{\Theta_{\text{vib}}}{T}\right)^2 \frac{e^{\Theta_{\text{vib}}/T}}{\left(e^{\Theta_{\text{vib}}/T} - 1\right)^2}$$

This is the Einstein function. Key limiting behaviors:

  • $T \gg \Theta_{\text{vib}}$: $C_{V,\text{vib}} \to k_B$ (classical equipartition)
  • $T \ll \Theta_{\text{vib}}$: $C_{V,\text{vib}} \to k_B (\Theta_{\text{vib}}/T)^2 e^{-\Theta_{\text{vib}}/T} \to 0$ (mode frozen out)

Polyatomic molecules: A nonlinear molecule with $N$ atoms has$3N - 6$ vibrational modes (or $3N - 5$ for linear). Each mode has its own $\Theta_{\text{vib},i}$, and the total vibrational partition function is $q_{\text{vib}} = \prod_{i} q_{\text{vib},i}$.

5. Derivation: Electronic Partition Function

The electronic partition function sums over electronic energy levels, each with its own degeneracy:

$$q_{\text{elec}} = g_0 + g_1 e^{-\varepsilon_1/(k_B T)} + g_2 e^{-\varepsilon_2/(k_B T)} + \cdots$$

where $g_i$ is the degeneracy of the $i$-th electronic state and$\varepsilon_i$ is its energy above the ground state.

The Usual Simplification

For most molecules, the first excited electronic state lies tens of thousands of cm$^{-1}$above the ground state, corresponding to $\Theta_{\text{elec}} \sim 10^4$$10^5$ K. At ordinary temperatures, all excited-state Boltzmann factors are negligible:

$$\boxed{q_{\text{elec}} \approx g_0}$$

Examples: N$_2$ ($g_0 = 1$, $^1\Sigma_g^+$), O$_2$ ($g_0 = 3$, $^3\Sigma_g^-$), Cl ($g_0 = 4$, $^2P_{3/2}$).

Exception: Nitric Oxide (NO)

NO is a remarkable exception. Its ground state $^2\Pi_{1/2}$ ($g_0 = 2$) has a low-lying excited state $^2\Pi_{3/2}$ ($g_1 = 2$) at only$\varepsilon_1 = 121.1$ cm$^{-1}$, corresponding to$\Theta_{\text{elec}} \approx 174$ K. This is comparable to room temperature!

$$q_{\text{elec}}^{\text{NO}} = 2 + 2\,e^{-174/T}$$

At 300 K: $q_{\text{elec}}^{\text{NO}} \approx 2 + 2(0.562) = 3.12$. The excited state contributes significantly to the partition function and therefore to the entropy and heat capacity of NO gas.

Electronic Contribution to Heat Capacity

For a two-level electronic system with degeneracies $g_0, g_1$ and gap $\varepsilon_1$:

$$\frac{C_{V,\text{elec}}}{k_B} = \frac{g_1}{g_0}\left(\frac{\varepsilon_1}{k_B T}\right)^2 \frac{e^{-\varepsilon_1/(k_BT)}}{\left(1 + \frac{g_1}{g_0}e^{-\varepsilon_1/(k_BT)}\right)^2}$$

This is a Schottky anomaly: the heat capacity has a maximum at$k_BT \approx 0.42\,\varepsilon_1$ and vanishes at both low and high temperatures.

6. Derivation: Total Molecular Partition Function

The key assumption enabling the factorization of the molecular partition function is the separability of degrees of freedom. If the total molecular energy can be written as:

$$\varepsilon = \varepsilon_{\text{trans}} + \varepsilon_{\text{rot}} + \varepsilon_{\text{vib}} + \varepsilon_{\text{elec}}$$

then because the exponential of a sum is a product of exponentials, the molecular partition function factors:

$$\boxed{q = q_{\text{trans}} \times q_{\text{rot}} \times q_{\text{vib}} \times q_{\text{elec}}}$$

This factorization is approximate: rotation-vibration coupling, centrifugal distortion, and electronic-vibrational interactions break strict separability. These corrections are typically small for low-lying states.

Thermodynamic Quantities from the Partition Function

For $N$ indistinguishable molecules, $Q = q^N/N!$. Using Stirling's approximation ($\ln N! \approx N\ln N - N$):

$$\ln Q = N\ln q - N\ln N + N$$

Internal Energy

$$E = -\frac{\partial \ln Q}{\partial \beta}\bigg|_{V} = -N\frac{\partial \ln q}{\partial \beta}\bigg|_{V}$$

Equivalently, $E = k_B T^2 \frac{\partial \ln Q}{\partial T}\Big|_V$.

Helmholtz Free Energy

$$\boxed{A = -k_B T \ln Q}$$

This is the fundamental bridge equation of statistical thermodynamics. All other thermodynamic potentials follow from $A$.

Entropy

From $S = -(\partial A/\partial T)_V$ or equivalently $S = (E - A)/T$:

$$\boxed{S = k_B \ln Q + \frac{E}{T}}$$

For an ideal gas, this yields the Sackur-Tetrode equation for translational entropy:

$$S_{\text{trans}} = Nk_B\left[\ln\left(\frac{V}{N\Lambda^3}\right) + \frac{5}{2}\right]$$

Pressure

$$P = -\left(\frac{\partial A}{\partial V}\right)_T = k_B T \left(\frac{\partial \ln Q}{\partial V}\right)_T$$

Since only $q_{\text{trans}} \propto V$, this immediately gives the ideal gas law:$P = Nk_BT/V$.

Chemical Potential

$$\mu = -k_B T \ln\left(\frac{q}{N}\right) = -k_B T \ln\left(\frac{q}{N}\right)$$

This connects to chemical equilibrium: for the reaction $aA + bB \rightleftharpoons cC + dD$, the equilibrium constant is:

$$K = \frac{(q_C/V)^c (q_D/V)^d}{(q_A/V)^a (q_B/V)^b} \, e^{-\Delta E_0/(k_BT)}$$

7. Applications

Heat Capacities of Gases

The heat capacity of an ideal gas reveals which degrees of freedom are active at a given temperature. For a diatomic molecule:

  • Low T ($T \ll \Theta_{\text{rot}}$): Only translation is active. $C_V = \frac{3}{2}Nk_B$, giving$\gamma = C_P/C_V = 5/3$ (monatomic-like).
  • Intermediate T ($\Theta_{\text{rot}} \ll T \ll \Theta_{\text{vib}}$): Translation + rotation active. $C_V = \frac{5}{2}Nk_B$, giving$\gamma = 7/5 = 1.4$. This is the regime for N$_2$ and O$_2$ at room temperature.
  • High T ($T \gg \Theta_{\text{vib}}$): All modes active. $C_V = \frac{7}{2}Nk_B$, giving $\gamma = 9/7 \approx 1.29$.

Chemical Equilibrium from Partition Functions

The equilibrium constant for any gas-phase reaction can be computed from molecular partition functions without any empirical input beyond spectroscopic data. For example, the dissociation of I$_2$:

$$\text{I}_2(g) \rightleftharpoons 2\text{I}(g)$$
$$K_P = \frac{k_BT(q_{\text{I}}/V)^2}{q_{\text{I}_2}/V}\,e^{-D_0/(k_BT)}$$

where $D_0$ is the dissociation energy from the zero-point level. Computing each $q$ from spectroscopic constants gives excellent agreement with experimental equilibrium constants.

Spectroscopic Determination of q

The molecular parameters entering partition functions — rotational constants ($B$), vibrational frequencies ($\nu$), electronic term values — are all measured spectroscopically. High-resolution infrared and microwave spectroscopy provide these constants to extraordinary precision (often 8+ significant figures for $B$), making statistical mechanical calculations of thermodynamic properties more accurate than direct calorimetric measurements for many small molecules.

8. Historical Context

Ludwig Boltzmann (1844–1906)

Boltzmann laid the foundations of statistical mechanics in the 1870s. His expression $S = k_B \ln W$ (carved on his tombstone) connects entropy to the number of microstates. He introduced the concept of the partition function as the normalization of the probability distribution over states, though the term "Zustandssumme" came later from Planck.

Max Planck (1858–1947)

In his derivation of the blackbody radiation law (1900), Planck introduced energy quantization $E = nh\nu$ and computed the partition function for quantum oscillators. This was the first quantum partition function, though Planck did not initially appreciate its revolutionary implications. His result for the average energy of an oscillator, $\langle E \rangle = h\nu/(e^{h\nu/k_BT} - 1)$, is precisely the vibrational contribution we derived above.

Albert Einstein (1879–1955)

Einstein's 1907 paper on the specific heat of solids was a triumph of partition function methods. By modeling a solid as $3N$ independent quantum oscillators all at the same frequency, he derived the Einstein heat capacity function that correctly predicts $C_V \to 0$ as $T \to 0$, resolving the classical equipartition catastrophe. Though quantitatively imperfect at very low temperatures (due to the single-frequency assumption), it demonstrated the power of quantum statistical mechanics.

Peter Debye (1884–1966)

Debye improved upon Einstein's model in 1912 by recognizing that a solid has a continuous spectrum of vibrational frequencies up to a cutoff $\nu_D$(the Debye frequency). His model gives $C_V \propto T^3$ at low temperatures, in excellent agreement with experiment. The Debye model remains the standard starting point for understanding the thermal properties of solids.

9. Simulation: Heat Capacity Contributions (Python)

This simulation computes and plots the individual contributions of translational, rotational, vibrational, and electronic modes to the constant-volume heat capacity $C_V/Nk_B$ as a function of temperature for two molecules: N$_2$ (linear diatomic) and H$_2$O (nonlinear triatomic). The rotational partition function for N$_2$is computed by exact summation over $J$ levels, capturing the quantum freeze-out at low temperature. Characteristic temperatures $\Theta_{\text{rot}}$ and$\Theta_{\text{vib}}$ are printed for comparison.

Heat Capacity from Partition Functions: N₂ and H₂O

Python

Computes translational, rotational, vibrational, and electronic contributions to Cv/NkB vs temperature for N₂ and H₂O. Characteristic temperatures and room-temperature values are printed.

partition_heat_capacity.py192 lines

Click Run to execute the Python code

Code will be executed with Python 3 on the server

10. Computation: Molecular Partition Functions (Fortran)

This Fortran program computes the translational, rotational, vibrational, and electronic partition functions for five diatomic molecules (N$_2$, O$_2$, CO, HCl, NO) at temperatures from 100 K to 5000 K. It uses exact summation for the rotational partition function at low temperatures and the high-temperature approximation when appropriate. Thermodynamic properties (energy, entropy, free energy) are computed at 298.15 K. Note the difference for NO, which has a doubly degenerate ground electronic state.

Diatomic Partition Functions & Thermodynamics

Fortran

Computes molecular partition functions (translational, rotational, vibrational, electronic) and thermodynamic properties for N₂, O₂, CO, HCl, and NO across a range of temperatures.

partition_functions.f90167 lines

Click Run to execute the Fortran code

Code will be compiled with gfortran and executed on the server

Summary of Partition Functions

ModePartition Function$C_V/k_B$ (classical)Characteristic T
Translation$V/\Lambda^3$$3/2$$\sim 10^{-15}$ K
Rotation (linear)$T/(\sigma\Theta_{\text{rot}})$$1$$\sim 1$$100$ K
Rotation (nonlinear)$\frac{1}{\sigma}\sqrt{\pi T^3/(\Theta_A\Theta_B\Theta_C)}$$3/2$$\sim 10$$50$ K
Vibration$1/(1 - e^{-\Theta_{\text{vib}}/T})$$1$ per mode$\sim 1000$$6000$ K
Electronic$g_0 + g_1 e^{-\varepsilon_1/k_BT} + \cdots$Schottky$\sim 10^4$$10^5$ K

Key Takeaways

1.

The partition function $q$ is a sum over Boltzmann-weighted states that encodes all equilibrium thermodynamic information about a molecule.

2.

Under the separability assumption, $q = q_{\text{trans}} \cdot q_{\text{rot}} \cdot q_{\text{vib}} \cdot q_{\text{elec}}$, allowing each contribution to be computed independently.

3.

Characteristic temperatures ($\Theta_{\text{rot}}$, $\Theta_{\text{vib}}$) determine when each mode "thaws" — transitions from quantum freeze-out to classical equipartition.

4.

The thermal de Broglie wavelength $\Lambda$ sets the quantum length scale for translation: when $\Lambda \ll$ the mean intermolecular spacing, classical behavior prevails.

5.

All thermodynamic quantities follow from derivatives of $\ln Q$: energy, entropy, free energy, pressure, chemical potential, and equilibrium constants.