From energy levels to tables
Look up the standard entropy of carbon monoxide gas in the NIST Chemistry WebBook and you will find 197.660 ± 0.004 J mol⁻¹ K⁻¹, quoted to six figures. Nobody measured that number by warming solid carbon monoxide from near absolute zero, and nobody could: the crystal freezes in with some molecules pointing the wrong way, as Entropy and free energy explained. It was computed, from the mass of the molecule, the spacing of its rotational lines and the wavenumber of its vibration, all measured by the methods of Spectroscopy.
The bridge from those molecular facts to the thermodynamic quantities of Thermochemistry and Chemical equilibrium is statistical thermodynamics. Quantum mechanics tells us which energies a molecule may have; statistics tells us how a mole of molecules shares out its energy among those levels; and from that sharing follow the entropy, the heat capacity, the Gibbs energy and the equilibrium constant. This lesson builds the bridge and walks across it with real molecules, checking every number against the tables.
The Boltzmann distribution
Take one molecule in a gas at temperature . It collides constantly with the others, which act as a huge reservoir of energy, and it hops from one quantum state to another. Which states does it spend its time in? Low-energy states are favoured, but not exclusively: the reservoir can lend energy, and a state's chance falls off exponentially with the energy it costs.
Definition— Boltzmann distribution
In thermal equilibrium at temperature , the probability that a molecule is in a particular state of energy is proportional to . For an energy level with states of the same energy (its degeneracy),
The yardstick is . Levels much less than above the lowest are almost as populated as it; levels many times above are almost empty. Chemists keep in several units at once, and the program below starts by printing them.
Two real cases show the range. Rotational levels of a small molecule are spaced by a few cm⁻¹, far below , so dozens of them are occupied at room temperature; their degeneracy grows while the exponential falls, so the most populated level is not the lowest. Vibrational quanta are usually hundreds or thousands of cm⁻¹, so most molecules sit in . The program computes both.
import numpy as np
h, c, kB, NA = 6.62607015e-34, 2.99792458e10, 1.380649e-23, 6.02214076e23 # c in cm/s
T = 298.15
print(f"kT at {T} K = {kB * T * NA / 1e3:.3f} kJ/mol = {kB * T / (h * c):.1f} cm^-1 = {kB * T / 1.602176634e-19 * 1e3:.1f} meV\n")
# Rotational levels of CO: E_J = hcB J(J+1), degeneracy 2J + 1
B = 1.9225 # cm^-1
J = np.arange(0, 60)
weights = (2 * J + 1) * np.exp(-h * c * B * J * (J + 1) / (kB * T))
p = weights / weights.sum() # the Boltzmann distribution
print("CO at 25 C: fraction of molecules in each rotational level")
for j in range(0, 25, 2):
print(f" J = {j:2d} {p[j]:.4f} " + "#" * int(round(400 * p[j])))
print(f"most populated level: J = {np.argmax(p)}; levels holding 99% of molecules: J = 0 to {np.searchsorted(np.cumsum(p), 0.99)}")
# Vibrations: for a harmonic oscillator the fraction NOT in v = 0 is 1 - (1 - e^-x) = e^-x, x = hc nu / kT
print("\nfraction of molecules vibrationally excited (v >= 1)")
print("molecule wavenumber/cm^-1 298 K 1000 K")
for name, nu in [("H2", 4161), ("N2", 2330), ("CO", 2143), ("Cl2", 554), ("I2", 213)]:
f = [np.exp(-h * c * nu / (kB * TT)) for TT in (298.15, 1000)]
print(f"{name:8s} {nu:12d} {f[0]:14.2e} {f[1]:11.3f}")The partition function
Why the exponential? It follows from the one assumption behind Entropy and free energy: an isolated system is equally likely to be in any of its microstates.
Theorem— The Boltzmann distribution
A system in thermal contact with a much larger reservoir at temperature is found in a particular state of energy with probability , where is summed over states.
Proof
Let the system and reservoir together be isolated, with total energy . When the system is in state , the reservoir has energy and can be in any of microstates. All microstates of the whole are equally likely, so , using . Because , expand to first order: , by the statistical definition of temperature, . Hence , and requiring fixes the constant as . The neglected second-order term is proportional to , where is the reservoir's heat capacity, and vanishes for a large reservoir.
∎
Definition— molecular partition function
The molecular partition function is , with energies measured from the molecule's lowest state. It is a pure number, roughly the number of states thermally accessible to the molecule: close to 1 at very low temperature (only the ground state), and growing without limit as rises.
The partition function holds all the thermodynamics. For molecules of an ideal gas, which are independent and indistinguishable, the total partition function is , and differentiating gives (per mole, with the energy when every molecule is in its lowest state):
The "+1" and the come from the , that is, from the indistinguishability of identical molecules. A useful equivalent, which the programs below use, is to write the average energy and its fluctuations directly: and . A large heat capacity means large energy fluctuations. Mathematically, as a function of is a generating function: is the mean energy and the second derivative its variance, as with a moment-generating function in probability theory; and is the Lagrange multiplier that appears when is maximised at fixed total energy (optimisation).
If a molecule's energy is a sum of independent parts, , the exponential of a sum is a product and the partition function factorises: . Then , and every thermodynamic function, is a sum of contributions, one per kind of motion.
Translation, rotation, vibration and electrons
Each factor comes from a quantum model of Quantum mechanics for chemists or Spectroscopy, summed over its levels.
Translation. A molecule of mass in a container of volume is a particle in a three-dimensional box. Its levels are so close together that the sum becomes an integral:
The thermal wavelength is about the de Broglie wavelength of a molecule at temperature : 19 pm for CO at room temperature. counts how many boxes of size fit in : an astronomically large number, which is why translation dominates the entropy of a gas.
Rotation. A linear molecule has levels with degeneracy , where is the rotational constant in cm⁻¹. When is much larger than the rotational temperature , the sum is close to an integral:
The symmetry number is 1 for an unsymmetrical linear molecule (CO, HCl) and 2 for a symmetrical one (N₂, CO₂, I₂). A non-linear molecule has three rotational constants and , with for water and 12 for methane.
Vibration. Each normal mode is, to a good approximation, a harmonic oscillator with levels above its zero-point level. The sum is a geometric series:
A non-linear molecule of atoms has modes and multiplies their factors; a linear one has .
Electrons. Excited electronic states usually lie so high that is just the degeneracy of the ground state: 1 for most closed-shell molecules, 3 for O₂ (a triplet), and 4 for an iodine atom, whose ground state ²P₃/₂ has four states.
Carbon monoxide from its spectrum
Now the real calculation. Carbon monoxide's spectroscopic constants, from the NIST WebBook, are a rotational constant cm⁻¹ and a fundamental vibrational wavenumber of 2143.27 cm⁻¹; its molar mass is 28.010 g/mol. Translation uses the formula, at the standard pressure of 1 bar; rotation and vibration are summed level by level with a single function that returns , , and from any list of levels.
import numpy as np
h, c, kB, NA = 6.62607015e-34, 2.99792458e10, 1.380649e-23, 6.02214076e23 # SI; c in cm/s
R, p0 = kB * NA, 1e5 # J/(mol K), Pa
def from_levels(energies_K, degeneracies, T):
"""q, and U, Cv, S per mole divided by R, from a list of levels (energies in kelvin, E/k)."""
e, g = np.asarray(energies_K, float), np.asarray(degeneracies, float)
w = g * np.exp(-e / T) # Boltzmann weights
q = w.sum()
mean = (w * e).sum() / q # <E>/k
mean2 = (w * e**2).sum() / q
return q, mean / T, (mean2 - mean**2) / T**2, np.log(q) + mean / T # q, U/RT, Cv/R, S/R
# Carbon monoxide, from spectroscopy (NIST Chemistry WebBook)
M = 28.010e-3 # kg/mol (natural isotopic mixture)
B = 1.9225 # rotational constant of the v = 0 level, cm^-1
nu = 2143.27 # wavenumber of the fundamental vibration, cm^-1
T = 298.15
theta_rot, theta_vib = h * c * B / kB, h * c * nu / kB
# Translation: particle in a box of the molar volume at 1 bar (Sackur-Tetrode)
Lam = h / np.sqrt(2 * np.pi * (M / NA) * kB * T)
q_tr = (R * T / p0) / Lam**3
S_tr, Cp_tr, H_tr = R * (np.log(q_tr / NA) + 2.5), 2.5 * R, 2.5 * R * T
# Rotation: sum over J levels, energy J(J+1) theta_rot, degeneracy 2J+1 (symmetry number 1)
J = np.arange(0, 300)
q_rot, U_rot, Cv_rot, S_rot = from_levels(J * (J + 1) * theta_rot, 2 * J + 1, T)
# Vibration: harmonic levels v * theta_vib, measured from the zero-point level
v = np.arange(0, 40)
q_vib, U_vib, Cv_vib, S_vib = from_levels(v * theta_vib, np.ones_like(v), T)
print(f"theta_rot = {theta_rot:.3f} K theta_vib = {theta_vib:.0f} K thermal wavelength = {Lam * 1e12:.2f} pm")
print(f"q_trans = {q_tr:.3e} (in 1 molar volume) q_rot = {q_rot:.2f} (high-T formula T/theta: {T / theta_rot:.2f})"
f" q_vib = {q_vib:.6f}")
print(f"\n translation rotation vibration total tables")
S = [S_tr, R * S_rot, R * S_vib]
Cp = [Cp_tr, R * Cv_rot, R * Cv_vib]
H = [H_tr / 1e3, R * T * U_rot / 1e3, R * T * U_vib / 1e3]
print(f"S° J/(mol K) {S[0]:10.2f} {S[1]:10.2f} {S[2]:11.4f} {sum(S):9.2f} 197.66")
print(f"Cp° J/(mol K) {Cp[0]:10.2f} {Cp[1]:10.2f} {Cp[2]:11.4f} {sum(Cp):9.2f} 29.14")
print(f"H-H(0) kJ/mol {H[0]:10.3f} {H[1]:10.3f} {H[2]:11.5f} {sum(H):9.3f} 8.671")
print(f"(with the high-temperature formula q_rot = T/theta_rot instead of the sum: H - H(0) = "
f"{(3.5 * R * T + R * T * U_vib) / 1e3:.3f} kJ/mol)")Three molecular numbers and the Planck, Boltzmann and Avogadro constants reproduce the table to within 0.01 J mol⁻¹ K⁻¹ for the entropy and 0.001 kJ/mol for the enthalpy. The breakdown is instructive. Translation provides three-quarters of the entropy, 150.42 J mol⁻¹ K⁻¹; rotation provides 47.23, because about a hundred rotational states are accessible; vibration provides 0.003, because CO hardly vibrates at room temperature. The explicit sum over rotational levels gives , slightly more than the high-temperature formula's 107.79. That small difference, to a very good approximation, is what brings to 8.670 kJ/mol instead of 8.677.
This is how standard entropies of gases are known so precisely. When the calorimetric third-law entropy of CO came out about 4.6 J mol⁻¹ K⁻¹ below this statistical value, the difference was not an error in either: it is the residual entropy of the disordered crystal, close to .
Equilibrium constants from molecular properties
Because for each gas, and , an equilibrium constant can be written entirely in terms of partition functions:
where is the partition function of species in the molar volume at the standard pressure, its stoichiometric number (positive for products), and the difference between the lowest energies of products and reactants, per mole. The two factors pull in opposite directions: is an energy, and the product of partition functions counts how many states each side can spread over.
Take the dissociation of iodine vapour, I₂(g) ⇌ 2 I(g). The energy is the dissociation energy measured from the molecule's lowest vibrational level, cm⁻¹ (148.8 kJ/mol); the molecule's constants are cm⁻¹, cm⁻¹ and ; the atoms have only translation and their electronic degeneracy of 4. The program compares the result with the equilibrium constant calculated from tabulated enthalpies of formation and entropies.
import numpy as np
h, c, kB, NA = 6.62607015e-34, 2.99792458e10, 1.380649e-23, 6.02214076e23 # c in cm/s
R, p0 = kB * NA, 1e5
cm_to_K = h * c / kB # 1 cm^-1 corresponds to 1.4388 K
def ln_q_std(M, T, B=None, sigma=1, nus=(), g_el=1):
"""ln(q°/N_A) for an ideal gas at 1 bar: translation, rigid linear rotor (B, sigma),
harmonic vibrations (wavenumbers nus, from the zero-point level) and electronic degeneracy."""
Lam = h / np.sqrt(2 * np.pi * (M * 1e-3 / NA) * kB * T)
lnq = np.log(kB * T / p0 / Lam**3) + np.log(g_el)
if B is not None:
lnq += np.log(T / (sigma * B * cm_to_K))
for nu in nus:
lnq -= np.log(1 - np.exp(-nu * cm_to_K / T))
return lnq
D0 = 12440.0 # cm^-1: energy to split I2 from its lowest level into two ground-state atoms (148.8 kJ/mol)
def K_iodine(T):
"""K° for I2(g) <=> 2 I(g) from molecular data alone."""
ln_I = ln_q_std(126.904, T, g_el=4) # I atom: 2P3/2 ground state, 4 states
ln_I2 = ln_q_std(253.809, T, B=0.03731, sigma=2, nus=[214.5])
return np.exp(2 * ln_I - ln_I2 - D0 * cm_to_K / T)
# The same K from thermochemical tables (CODATA values on the NIST WebBook) at 298.15 K
dH = 2 * 106.76 - 62.42 # kJ/mol: 2 x DfH°(I, g) - DfH°(I2, g)
dS = 2 * 180.787 - 260.687 # J/(mol K): 2 x S°(I, g) - S°(I2, g)
K_tables = np.exp(-(dH * 1e3 - 298.15 * dS) / (R * 298.15))
print(f"298.15 K: K from molecular data = {K_iodine(298.15):.3e} from tables = {K_tables:.3e}")
print(f"1000 K: K from molecular data = {K_iodine(1000):.3e} from NIST-JANAF tables = 3.08e-03\n")
# Where does K pass 1 (Delta G° = 0)? Bisection on ln K.
lo, hi = 800.0, 2000.0
for _ in range(60):
mid = (lo + hi) / 2
lo, hi = (mid, hi) if K_iodine(mid) < 1 else (lo, mid)
print(f"K = 1 at T = {lo:.0f} K")
# ln K splits into a "number of states" term and an energy term
for T in (298.15, 1000.0, 1446.0):
states = 2 * ln_q_std(126.904, T, g_el=4) - ln_q_std(253.809, T, B=0.03731, sigma=2, nus=[214.5])
energy = D0 * cm_to_K / T
print(f"{T:7.2f} K: ln K = {states:6.2f} (states) - {energy:6.2f} (bond energy) = {states - energy:7.2f}")Molecular data alone give at 298.15 K; the thermochemical tables give , a difference of 1% in a number twenty-one orders of magnitude below one. At 1000 K the two agree within 4%, and most of the gap comes from treating the soft I₂ vibration as harmonic. The last lines show the competition. Two free atoms have far more states available than one molecule, worth about 12 in at every temperature; the bond costs , which is 60 at room temperature but falls as . The two balance at about 1450 K, above which iodine vapour is mostly atoms at standard pressure. Every dissociation shares this pattern: high temperature favours the side with more particles, because entropy is weighted by in .
Heat capacities
Classical physics has a simple rule, equipartition: every quadratic term in a molecule's energy contributes to the molar heat capacity . Translation has three (), a linear rotor two (), and each vibration two, kinetic and potential (). So a diatomic gas should have , and , at every temperature. At room temperature it does not: CO has . Explaining this was one of the first triumphs of quantum theory.
The rule holds only for motions whose level spacing is much smaller than . A motion with widely spaced levels is frozen: almost every molecule is in its ground level, and adding a little heat cannot excite it. For one harmonic vibration the heat capacity is Einstein's function, from his 1907 paper on solids,
which is 0 at low temperature and rises to 1, the classical value, when .
For carbon monoxide, with = 3084 K, the program follows from 100 K to 5000 K and compares it with the NIST-JANAF tables.
import numpy as np
h, c, kB, R = 6.62607015e-34, 2.99792458e10, 1.380649e-23, 8.314462618
theta_vib = h * c * 2143.27 / kB # CO, in K
def einstein(T, theta):
"""Heat capacity of one harmonic vibration, in units of R."""
x = theta / T
return x**2 * np.exp(x) / np.expm1(x)**2
def cp_over_R(T):
return 2.5 + 1.0 + einstein(T, theta_vib) # translation (with pV), rotation, vibration
nist = {298.15: 29.14, 500: 29.82, 1000: 33.18, 2000: 36.22} # NIST-JANAF (Shomate fits), J/(mol K)
print(" T/K Cp/R Cp J/(mol K) NIST-JANAF vibrational part")
for T in [100, 298.15, 500, 750, 1000, 1500, 2000, 3000, 5000]:
cp = cp_over_R(T)
ref = f"{nist[T]:8.2f}" if T in nist else " " * 8
print(f"{T:8.2f} {cp:6.3f} {cp * R:9.2f} {ref} " + "#" * int(round(20 * (cp - 3.5))))
lo, hi = 100.0, 5000.0 # where is the vibration "half switched on"?
for _ in range(60):
mid = (lo + hi) / 2
lo, hi = (mid, hi) if einstein(mid, theta_vib) < 0.5 else (lo, mid)
print(f"\nC(vib) reaches R/2 at {lo:.0f} K = theta_vib / {theta_vib / lo:.2f}")The rigid-rotor, harmonic-oscillator model stays within 1% of the tables up to 2000 K. The vibration is half switched on near 1030 K, about a third of , and the heat capacity approaches the classical only above several thousand kelvin. The remaining differences at high temperature come from anharmonicity and from the stretching of the rotating molecule, which the model leaves out. The same Einstein function, applied to the vibrations of atoms in a crystal, explains why the heat capacities of solids fall towards zero at low temperature.
Statistical thermodynamics at work
Statistical thermodynamics runs quietly underneath much of chemistry and engineering:
- Thermochemical tables. The NIST-JANAF tables and similar compilations used to design combustion engines, rockets and chemical reactors give , and for gases up to 6000 K. Above a few hundred kelvin almost all of those numbers are computed from spectroscopic constants, with corrections for anharmonicity, rotation–vibration coupling and excited electronic states, exactly as in this lesson but with more terms.
- Quantum chemistry output. Every frequency calculation in a program such as those of Computational chemistry ends with a table of translational, rotational, vibrational and electronic contributions to , and , computed with the rigid-rotor, harmonic-oscillator model. Chemists then correct the low-frequency modes, which the harmonic model treats worst (they are often hindered internal rotations), because those modes carry most of the error in computed entropies. The CCCBDB at NIST compares such calculations with experiment for hundreds of molecules.
- Rates. Eyring's transition-state theory, met in Chemical kinetics, is this lesson's equilibrium formula applied to an equilibrium between reactants and the transition state: , with built from partition functions. Kinetic isotope effects follow from the change in vibrational partition functions when hydrogen is replaced by deuterium (Reaction mechanisms).
- Liquids and proteins. When molecules interact strongly the partition function cannot be factorised, and it is sampled instead: Metropolis Monte Carlo (1953) and molecular dynamics generate configurations with Boltzmann probabilities, and free-energy methods compute differences in , for example between a drug bound to a protein and free in water (see atomistic simulation in Lumenary Materials).
Common misconceptions
Misconception
"At equilibrium every molecule has the average energy." The Boltzmann distribution is a distribution. At room temperature some CO molecules are in and some in ; a few in a hundred thousand are vibrationally excited. Chemical reactions often depend on the rare, energetic tail.
Misconception
"The highest level is always the least populated, so the lowest level is always the most populated." Each state is less likely the higher its energy, but a level with many states can hold more molecules than a level below it. CO's most populated rotational level at 25 °C is , not .
Misconception
"Equipartition gives the heat capacity of any gas." Only for motions whose level spacing is small compared with . Vibrations of light, stiffly bonded molecules are frozen at room temperature, and so are rotations of hydrogen at low temperature.
Misconception
"The partition function is just the normalising constant of the Boltzmann distribution." It is that, and also everything else: its logarithm and derivatives give , , , , and . Normalising constants rarely know so much.
Exercises
1. Statistical thermodynamics
Warm-upHumanAt 25 °C, corresponds to about 207 cm⁻¹. Nitrogen, N₂, has a rotational constant of 2.0 cm⁻¹ and a vibrational wavenumber of 2330 cm⁻¹. Which of its motions is essentially frozen (almost every molecule in the lowest level) at 25 °C?
2. Statistical thermodynamics
CoreComputationalHydrogen chloride has rotational constant cm⁻¹. Which rotational level is the most populated at 298.15 K? (Level has energy and degeneracy ; = 207.2 cm⁻¹.)
3. Statistical thermodynamics
CoreHumanN₂ and CO have the same molar mass (28 g/mol), almost the same rotational constant (about 2 cm⁻¹) and vibrations too stiff to matter at 298 K. Their tabulated standard entropies at 298.15 K are 191.61 and 197.66 J mol⁻¹ K⁻¹. Why is CO's larger?
4. Statistical thermodynamics
CoreHumanFor I₂(g) ⇌ 2 I(g), the lesson split into a "states" term of about +12 and an energy term . Which statement explains why dissociation wins at high temperature?
5. Statistical thermodynamics
StretchHumanBy the classical equipartition theorem, what would the molar heat capacity of water vapour be, if every motion behaved classically? (Water is a non-linear molecule of three atoms.)
6. Statistical thermodynamics
CoreComputationalCompute the standard molar entropy of water vapour at 298.15 K from molecular data, as the lesson did for CO, and compare it with the CODATA value, 188.835 J mol⁻¹ K⁻¹. The translational part is written for you. Water is a non-linear (asymmetric-top) rotor, with
and three vibrations, each contributing with . Complete water_entropy(T).
7. Statistical thermodynamics
StretchComputationalIn a mixture of H₂ and D₂ with a catalyst, the isotopes scramble: H₂ + D₂ ⇌ 2 HD. If the atoms paired up at random, would be 4. Compute from molecular properties. All three molecules share one potential energy curve, so their constants follow from H₂'s and the masses: the reduced mass fixes , , the zero-point energy , and the rotational constant . Because two molecules appear on each side, every constant factor cancels, and each species needs only
with and in u and = 2 for H₂ and D₂, 1 for HD. Ignore vibrational excitation above . Complete k_exchange(T).
Further reading and resources
- NIST Chemistry WebBookSpectroscopic constants of diatomic molecules, standard entropies, heat capacities and enthalpies of formation used in this lesson.
- NIST-JANAF Thermochemical TablesTables of Cp, S, H and G for gases at temperatures up to 6000 K, largely computed by statistical thermodynamics.
- NIST Computational Chemistry Comparison and Benchmark DatabaseExperimental and computed rotational constants, vibrational frequencies and thermodynamic functions for hundreds of molecules.
- Die Plancksche Theorie der Strahlung und die Theorie der spezifischen Wärme · Albert Einstein · 1907The first quantum theory of heat capacity.
- A note on the specific heat of the hydrogen molecule · David M. Dennison · 1927Nuclear spin and the puzzle of hydrogen's heat capacity.
- Equation of State Calculations by Fast Computing Machines · N. Metropolis, A. W. Rosenbluth, M. N. Rosenbluth, A. H. Teller, E. Teller · 1953The Metropolis Monte Carlo method for sampling the Boltzmann distribution.
- The Activated Complex in Chemical Reactions · Henry Eyring · 1935Transition-state theory, written in the language of partition functions.
- MIT OpenCourseWare 5.62: Physical Chemistry IIA complete course in statistical mechanics for chemists.