Skip to content
LumenaryAcademy
Quantum 80 min

Computational chemistry

Solving the Schrödinger equation for real molecules — the electronic-structure problem, Hartree–Fock and basis sets, density functional theory, force fields, and how chemists choose a method they can afford and trust.

Code tested · 5AI-draftedAwaiting review by a chemist

Your guides: Chloe · The Chemist, Margaret · The Analyst, Gideon · The Sceptic

MotivationH

Chemistry on a computer

In 1929 Paul Dirac remarked that the physical laws needed for the whole of chemistry were now completely known, and that the only difficulty was that the equations were far too complicated to solve. The rest of the century was spent on that difficulty. Quantum mechanics for chemists solved the Schrödinger equation exactly for one electron; Molecular orbitals solved a drastically simplified version for π electrons. Real molecules have dozens or thousands of electrons that all repel each other.

Today a chemist can compute, on a laptop, the structure of a medium-sized molecule to within a picometre or two, its vibrational spectrum to within a few per cent, and the energy of a reaction to within a few kJ/mol; with a computing cluster, the mechanism of an enzyme. Computation has become an instrument, used alongside the spectrometer, and the 1998 Nobel Prize, to Walter Kohn and John Pople, and the 2013 prize, to Martin Karplus, Michael Levitt and Arieh Warshel, recognised the methods that made it so.

Like any instrument, it has a working range and ways of misleading. This lesson explains the main methods, from the most accurate and expensive to the cheapest, runs small versions of two of them, and ends with how chemists choose.

DefinitionsH

The electronic-structure problem

Nuclei are thousands of times heavier than electrons and move far more slowly, so chemists solve for the electrons with the nuclei held still. This is the Born–Oppenheimer approximation, already used in Spectroscopy.

Definition— electronic-structure problem

For fixed nuclear positions R\mathbf R, find the lowest eigenvalue E(R)E(\mathbf R) of the electronic Hamiltonian

H^el=−∑i12∇i2  −  ∑i,AZAriA  +  ∑i<j1rij  +  ∑A<BZAZBRAB\hat H_\text{el} = -\sum_i \tfrac12\nabla_i^2 \;-\; \sum_{i,A}\frac{Z_A}{r_{iA}} \;+\; \sum_{i\lt j}\frac{1}{r_{ij}} \;+\; \sum_{A\lt B}\frac{Z_AZ_B}{R_{AB}}

(in atomic units: kinetic energy of the electrons, their attraction to the nuclei, their repulsion of each other, and the repulsion of the nuclei). The function E(R)E(\mathbf R) over all nuclear positions is the potential energy surface.

Almost everything a chemist wants is a feature of that surface. Its minima are stable structures; the curvature at a minimum gives vibrational frequencies and, through Statistical thermodynamics, entropies and free energies; saddle points are transition states, and the energies of minima and saddles give equilibrium constants and, through Eyring's equation, rates. The difficulty is entirely in the term 1/rij1/r_{ij}: without it, each electron could be solved for separately.

The target accuracy has a name. Chemical accuracy is about 1 kcal/mol, or 4 kJ/mol, because an error of that size changes a rate or an equilibrium constant at room temperature by a factor of about five. Total energies are enormous by comparison, millions of kJ/mol for a medium-sized molecule, so methods succeed only when their errors cancel between the things being compared.

ComputationC

Hartree–Fock and the self-consistent field

The oldest practical approach, developed by Douglas Hartree and Vladimir Fock around 1930, replaces the repulsion between every pair of electrons by the repulsion of each electron with the average charge cloud of all the others. Each electron then has its own orbital, as in Molecular orbitals, and the many-electron wavefunction is the antisymmetrised product of orbitals, a single Slater determinant (Quantum mechanics for chemists).

Definition— Roothaan–Hall equations

Expanding each orbital in a fixed set of basis functions, ψi=∑μCμiϕμ\psi_i = \sum_\mu C_{\mu i}\phi_\mu, turns Hartree–Fock theory into a matrix equation (Clemens Roothaan and George Hall, 1951):

F(C) C=S C ε,\mathbf F(\mathbf C)\,\mathbf C = \mathbf S\,\mathbf C\,\boldsymbol\varepsilon,

where S\mathbf S is the overlap matrix of the basis functions and the Fock matrix F\mathbf F is the one-electron Hamiltonian plus the average repulsion, which depends on the occupied orbitals C\mathbf C themselves.

Because F\mathbf F depends on the answer, the equations are solved by iteration: guess the orbitals, build F\mathbf F, solve the generalised eigenvalue problem, rebuild F\mathbf F from the new orbitals, and repeat until nothing changes. The result is a self-consistent field (SCF).

guess orbitals(or density)build Fock matrixfrom the densitysolve FC = SCεfor new orbitalsenergy stoppedchanging?noyesenergy,orbitals
The self-consistent-field loop. Every Hartree–Fock and Kohn–Sham calculation runs this cycle: the orbitals determine the field each electron feels, and the field determines the orbitals, until the two agree.

The program below is a complete Hartree–Fock code for molecules whose basis functions are all s-type Gaussians, enough for H₂ and HeH⁺. It computes the overlap, kinetic, nuclear-attraction and electron-repulsion integrals from their closed-form expressions, runs the SCF loop, and compares two standard basis sets.

python
import numpy as np
from math import erf, pi, sqrt

# Basis functions: contractions of normalised s-type Gaussians, (exponents, coefficients) on a centre.
STO3G_H  = ([3.42525091, 0.62391373, 0.16885540], [0.15432897, 0.53532814, 0.44463454])
STO3G_He = ([6.36242139, 1.15892300, 0.31364979], [0.15432897, 0.53532814, 0.44463454])
G631_H   = [([18.7311370, 2.8253937, 0.6401217], [0.03349460, 0.23472695, 0.81375733]),
            ([0.1612778], [1.0])]                 # 6-31G for hydrogen: two s functions

def F0(t):                                        # the Boys function for s orbitals
    return 1.0 if t < 1e-12 else 0.5 * sqrt(pi / t) * erf(sqrt(t))

def norm(a):
    return (2 * a / pi) ** 0.75

def prim_integrals(a, A, b, B, nuclei):
    p, AB2 = a + b, np.sum((A - B) ** 2)
    P = (a * A + b * B) / p
    K = np.exp(-a * b / p * AB2) * norm(a) * norm(b)
    S = (pi / p) ** 1.5 * K
    T = a * b / p * (3 - 2 * a * b / p * AB2) * (pi / p) ** 1.5 * K
    V = sum(-2 * pi / p * Z * K * F0(p * np.sum((P - C) ** 2)) for Z, C in nuclei)
    return S, T, V

def prim_eri(a, A, b, B, c, C, d, D):
    p, q = a + b, c + d
    P, Q = (a * A + b * B) / p, (c * C + d * D) / q
    pre = 2 * pi ** 2.5 / (p * q * sqrt(p + q))
    e = np.exp(-a * b / p * np.sum((A - B) ** 2) - c * d / q * np.sum((C - D) ** 2))
    return pre * e * F0(p * q / (p + q) * np.sum((P - Q) ** 2)) * norm(a) * norm(b) * norm(c) * norm(d)

def scf(basis, nuclei, n_electrons, verbose=False):
    """Restricted Hartree-Fock (Roothaan) for s-only basis sets. basis: list of (contraction, centre)."""
    n = len(basis)
    S, H = np.zeros((n, n)), np.zeros((n, n))
    for i, ((ea, ca), A) in enumerate(basis):
        for j, ((eb, cb), B) in enumerate(basis):
            for a, da in zip(ea, ca):
                for b, db in zip(eb, cb):
                    s, t, v = prim_integrals(a, A, b, B, nuclei)
                    S[i, j] += da * db * s
                    H[i, j] += da * db * (t + v)
    eri = np.zeros((n, n, n, n))
    for i in range(n):
        for j in range(n):
            for k in range(n):
                for l in range(n):
                    (e1, c1), A = basis[i]; (e2, c2), B = basis[j]
                    (e3, c3), C = basis[k]; (e4, c4), D = basis[l]
                    eri[i, j, k, l] = sum(d1 * d2 * d3 * d4 * prim_eri(a1, A, a2, B, a3, C, a4, D)
                                          for a1, d1 in zip(e1, c1) for a2, d2 in zip(e2, c2)
                                          for a3, d3 in zip(e3, c3) for a4, d4 in zip(e4, c4))
    w, U = np.linalg.eigh(S)
    X = U @ np.diag(w ** -0.5) @ U.T               # symmetric orthogonalisation, X = S^(-1/2)
    P = np.zeros((n, n))                           # start from no electron repulsion at all
    E_old = 0.0
    for it in range(1, 100):
        F = H + np.einsum("kl,ijkl->ij", P, eri) - 0.5 * np.einsum("kl,ikjl->ij", P, eri)
        eps, Cp = np.linalg.eigh(X.T @ F @ X)
        C = X @ Cp
        occ = C[:, : n_electrons // 2]
        P = 2 * occ @ occ.T
        E = 0.5 * np.sum(P * (H + F))
        if verbose:
            print(f"   iteration {it}: electronic energy {E:.8f} hartree")
        if abs(E - E_old) < 1e-10:
            break
        E_old = E
    E_nuc = sum(Z1 * Z2 / np.linalg.norm(C1 - C2) for i, (Z1, C1) in enumerate(nuclei) for Z2, C2 in nuclei[i + 1:])
    return E + E_nuc, eps

def h2(R, which):
    A, B = np.array([0.0, 0.0, 0.0]), np.array([0.0, 0.0, R])
    shells = [STO3G_H] if which == "STO-3G" else G631_H
    basis = [(s, A) for s in shells] + [(s, B) for s in shells]
    return scf(basis, [(1.0, A), (1.0, B)], 2)[0]

R = 1.4                                            # bohr (74.1 pm)
print("H2 at R = 1.4 bohr, total energy in hartree")
for which in ("STO-3G", "6-31G"):
    print(f"   Hartree-Fock / {which:7s} {h2(R, which):.5f}")
print("   Hartree-Fock limit       -1.13363   (a complete basis)")
print("   exact                    -1.17447   (Kolos and Wolniewicz)")
print(f"   correlation energy        {(-1.17447 + 1.13363) * 2625.4996:.0f} kJ/mol")

# Equilibrium bond length: a parabola through the energies near the minimum
for which in ("STO-3G", "6-31G"):
    Rs = np.linspace(1.25, 1.50, 11)
    E = [h2(r, which) for r in Rs]
    a2, a1, a0 = np.polyfit(Rs, E, 2)
    print(f"{which:7s} equilibrium bond length {-a1 / (2 * a2) * 52.9177:.1f} pm   (experiment 74.1 pm)")

print("\nHeH+ (STO-3G, R = 1.4632 bohr): the SCF loop converging")
A, B = np.array([0.0, 0.0, 0.0]), np.array([0.0, 0.0, 1.4632])
E, eps = scf([(STO3G_He, A), (STO3G_H, B)], [(2.0, A), (1.0, B)], 2, verbose=True)
print(f"   total energy {E:.6f} hartree; orbital energies {np.round(eps, 4)}")
Runs entirely in your browser, in an isolated worker. Nothing is sent to a server.

The minimal STO-3G basis gives −1.11671 hartree for H₂, the larger 6-31G basis −1.12674, and an infinitely large basis would give −1.13363, the Hartree–Fock limit. But the exact energy is −1.17447. The remaining 0.041 hartree, 107 kJ/mol, is the correlation energy: what the average-field picture misses because real electrons dodge each other instantaneously. No basis set, however large, can recover it within Hartree–Fock. The SCF loop for HeH⁺ shows the self-consistency at work: the first iteration ignores the repulsion between the electrons altogether (energy −5.20 hartree), and the energy then settles, to ten decimal places, within fourteen iterations.

Beyond Hartree–Fock. Methods that recover correlation start from the Hartree–Fock determinant and mix in excited determinants. Møller–Plesset perturbation theory (MP2) adds a second-order correction cheaply. Coupled-cluster theory, especially CCSD(T), which includes single and double excitations fully and triple excitations by perturbation, reaches chemical accuracy for most well-behaved molecules and is called the "gold standard" of the field. Full configuration interaction (FCI), which mixes in every determinant, is the exact answer in a given basis, and its cost is the subject of the next section but one.

ExplanationH

Basis sets

The orbitals of the hydrogen atom decay as e−ζre^{-\zeta r}, Slater-type functions. Integrals over such functions on several centres are very hard to compute. In 1950 Frank Boys proposed using Gaussian functions, e−αr2e^{-\alpha r^2}, instead: a product of two Gaussians on different centres is a single Gaussian on a point between them, so every integral reduces to a closed formula, like the ones in the program. Gaussians have the wrong shape (no cusp at the nucleus, too fast a decay far away), so a basis function is a fixed contraction of several of them.

  • Minimal basis sets have one function per atomic orbital. STO-3G (Warren Hehre, Robert Stewart and John Pople, 1969) fits each Slater orbital with three Gaussians.
  • Split-valence sets such as 6-31G give each valence orbital two functions, an inner and an outer one, so orbitals can shrink or swell in a molecule.
  • Polarisation functions (d on carbon, p on hydrogen; the "" in 6-31G) let orbitals bend, which bonds need. Diffuse functions ("+") describe anions and weak interactions.
  • The correlation-consistent sets of Thom Dunning (1989), cc-pVDZ, cc-pVTZ, cc-pVQZ and so on, add functions in a systematic order, so correlated energies converge smoothly and can be extrapolated to the complete-basis limit.

Every standard set is available from the Basis Set Exchange. Calculations on crystals usually use plane waves instead, as in density functional theory in Lumenary Materials.

ComputationC

What exactness costs

Full configuration interaction is exact in its basis, so why not always use it? Count the determinants it needs: every way of placing the spin-up electrons in the orbitals, times every way of placing the spin-down ones. Then look at how the approximate methods' costs grow with the number of basis functions NN.

python
from math import comb, log10

# Full configuration interaction (the exact answer in a given basis) uses every way of placing
# the alpha electrons and the beta electrons in the orbitals.
def n_determinants(n_orbitals, n_alpha, n_beta):
    return comb(n_orbitals, n_alpha) * comb(n_orbitals, n_beta)

print("molecule, basis           basis functions   electrons   determinants in full CI")
for name, n_bf, n_el in [("H2, 6-31G", 4, 2), ("H2O, cc-pVDZ", 24, 10), ("N2, cc-pVDZ", 28, 14),
                         ("benzene, cc-pVDZ", 114, 42)]:
    d = n_determinants(n_bf, n_el // 2, n_el // 2)
    size = f"{d:,}" if d < 1e6 else f"about 10^{log10(d):.1f}"
    print(f"{name:26s} {n_bf:10d} {n_el:12d}        {size}")

# Approximate methods trade accuracy for a cost that grows as a power of the basis size N.
methods = [("force field", 2), ("DFT (hybrid)", 4), ("Hartree-Fock", 4), ("MP2", 5), ("CCSD", 6), ("CCSD(T)", 7)]
print("\nformal scaling: cost multiplies by ... when the molecule is made")
print("method           N^k     2x bigger     10x bigger")
for name, k in methods:
    print(f"{name:15s}  N^{k}   {2**k:10,d}   {10**k:12,d}")

# Two-electron integrals (pq|rs): about N^4/8 distinct ones, 8 bytes each
for n_bf in (114, 500, 2000):
    n_int = n_bf**4 / 8
    print(f"{n_bf:5d} basis functions: {n_int:.1e} two-electron integrals, {n_int * 8 / 1e9:,.1f} GB to store them all")
Runs entirely in your browser, in an isolated worker. Nothing is sent to a server.

Full CI on water in a modest basis already needs about two billion determinants; on benzene, 104510^{45}, more than any computer will ever hold. This exponential wall is why every practical method is an approximation, and why chemistry is one of the problems that motivate quantum computers (Quantum computing for chemistry). The polynomial methods are affordable but still steep: making a molecule twice as large multiplies the cost of CCSD(T) by 128, so it is routinely used on molecules of a few dozen atoms, while density functional theory handles hundreds. Even storing the two-electron integrals becomes impossible beyond a few hundred basis functions, so modern programs recompute them on the fly or approximate them by density fitting, and "local" correlation methods such as DLPNO-CCSD(T) exploit the fact that distant electrons barely correlate, bringing near-CCSD(T) accuracy to molecules of hundreds of atoms.

DefinitionsH

Density functional theory

A wavefunction for nn electrons depends on 3n3n coordinates; the electron density ρ(r)\rho(\mathbf r) depends on only three. In 1964 Pierre Hohenberg and Walter Kohn proved that the ground-state density determines everything about the ground state, including its energy.

Theorem— Hohenberg–Kohn

The ground-state electron density of a system of electrons in an external potential (the field of the nuclei) determines that potential up to a constant, and hence the Hamiltonian and every ground-state property. There is a universal functional E[ρ]E[\rho] whose minimum over densities is the ground-state energy.

The theorem says the functional exists, not what it is. In 1965 Kohn and Lu Jeu Sham made it usable: they imagined a system of non-interacting electrons with the same density as the real one, whose kinetic energy can be computed exactly from orbitals, and they swept everything unknown into one term, the exchange–correlation energy Exc[ρ]E_\text{xc}[\rho]. The resulting Kohn–Sham equations look like Hartree–Fock and are solved by the same SCF loop, at similar or lower cost, but if ExcE_\text{xc} were exact they would give the exact energy.

ExcE_\text{xc} is not known exactly, and density functional approximations form a hierarchy that John Perdew called Jacob's ladder, each rung using more information:

RungUsesExamplesTypical use
LDAdensitySVWNsolids, historically
GGA+ density gradientPBE, BLYPsolids, large systems
meta-GGA+ kinetic-energy densitySCAN, r²SCAN, TPSSsolids and molecules
hybrid+ some exact (Hartree–Fock) exchangeB3LYP, PBE0general molecular chemistry
range-separated, double hybrid+ exchange by distance, + MP2-like correlationωB97X-V, ωB97M-V, DSD-PBEP86accurate thermochemistry

Two corrections and two cautions matter in practice. Most functionals miss dispersion, the weak attraction between all molecules, and are combined with an empirical correction such as Stefan Grimme's D3 or D4; without it, a DFT calculation may predict that two stacked benzene rings repel. And approximate functionals suffer self-interaction (or delocalisation) error, in which an electron partly repels itself, so they spread charge too widely, underestimate reaction barriers and mis-describe stretched bonds. Systems with several near-degenerate electronic configurations, such as many transition-metal complexes and molecules with breaking bonds, are hard for every single-determinant method, Hartree–Fock and DFT alike, and need multireference methods. Benchmarks such as GMTKN55, with about 1500 reference energies, are how the field decides which functional to trust for what.

ComputationC

Force fields and molecular mechanics

For a protein of ten thousand atoms in water, even DFT is too expensive for anything but a snapshot. Molecular mechanics gives up on electrons altogether: atoms are balls, bonds are springs, and the energy is a sum of simple terms with parameters fitted to experiments and to quantum-chemical calculations.

θφδ+δ−bond stretchangle bendtorsionnon-bonded
The terms of a typical force field. Bond stretching and angle bending are harmonic springs; torsions are periodic functions of the dihedral angle, here three-fold as about a C–C single bond; atoms that are not bonded interact through a Lennard-Jones term (repulsion at short range, dispersion attraction at long range) and through the Coulomb interaction of partial charges. Each sketch shows the energy against the coordinate.

Norman Allinger's MM2 (1977) made molecular mechanics a standard tool for organic conformations; AMBER, CHARMM, OPLS and GROMOS made it the basis of biomolecular simulation. Here is a small force field for cyclohexane, treating each CH₂ group as one particle (a united-atom model), with bond, angle and torsion terms of the size used in united-atom models of alkanes. The program minimises the energy from several starting shapes with a quasi-Newton (BFGS) method, using gradients by finite differences (Optimisation).

python
import numpy as np

# A united-atom force field for cyclohexane: each CH2 group is one particle.
KCAL = 4.184                                  # kJ per kcal
r0, kb = 1.526, 260 * KCAL                    # bond: E = kb (r - r0)^2, kJ/mol/A^2
th0, kth = np.radians(112.4), 63 * KCAL       # angle: E = kth (theta - th0)^2, kJ/mol/rad^2
V1, V2, V3 = 1.411 * KCAL, -0.271 * KCAL, 3.145 * KCAL   # torsion Fourier terms, kJ/mol

def dihedral(p0, p1, p2, p3):
    b0, b1, b2 = p0 - p1, p2 - p1, p3 - p2
    b1 = b1 / np.linalg.norm(b1)
    v, w = b0 - np.dot(b0, b1) * b1, b2 - np.dot(b2, b1) * b1
    return np.arctan2(np.dot(np.cross(b1, v), w), np.dot(v, w))

def energy(flat, parts=False):
    x = flat.reshape(6, 3)
    e_b = e_a = e_t = 0.0
    for i in range(6):
        a, b, c, d = x[i], x[(i + 1) % 6], x[(i + 2) % 6], x[(i + 3) % 6]
        e_b += kb * (np.linalg.norm(b - a) - r0) ** 2
        u, v = a - b, c - b
        th = np.arccos(np.dot(u, v) / (np.linalg.norm(u) * np.linalg.norm(v)))
        e_a += kth * (th - th0) ** 2
        phi = dihedral(a, b, c, d)                         # 180 degrees = anti
        e_t += 0.5 * (V1 * (1 + np.cos(phi)) + V2 * (1 - np.cos(2 * phi)) + V3 * (1 + np.cos(3 * phi)))
    return (e_b, e_a, e_t) if parts else e_b + e_a + e_t

def gradient(flat, h=1e-5):
    g = np.zeros_like(flat)
    for i in range(len(flat)):
        d = np.zeros_like(flat); d[i] = h
        g[i] = (energy(flat + d) - energy(flat - d)) / (2 * h)
    return g

def minimise(flat, steps=500):
    """Quasi-Newton (BFGS) minimisation with a backtracking line search."""
    Hinv = np.eye(len(flat)) * 1e-3
    g = gradient(flat)
    for it in range(steps):
        p = -Hinv @ g
        t, e0 = 1.0, energy(flat)
        while energy(flat + t * p) > e0 + 1e-4 * t * (g @ p) and t > 1e-10:
            t *= 0.5
        new = flat + t * p
        g_new = gradient(new)
        s, y = new - flat, g_new - g
        if s @ y > 1e-12:
            rho = 1 / (s @ y)
            I = np.eye(len(flat))
            Hinv = (I - rho * np.outer(s, y)) @ Hinv @ (I - rho * np.outer(y, s)) + rho * np.outer(s, s)
        flat, g = new, g_new
        if np.max(np.abs(g)) < 1e-4:
            break
    return flat, it + 1

def describe(flat):
    x = flat.reshape(6, 3)
    angles = [np.degrees(np.arccos(np.dot(x[i] - x[(i + 1) % 6], x[(i + 2) % 6] - x[(i + 1) % 6]) /
              (np.linalg.norm(x[i] - x[(i + 1) % 6]) * np.linalg.norm(x[(i + 2) % 6] - x[(i + 1) % 6]))))
              for i in range(6)]
    tors = [np.degrees(dihedral(x[i], x[(i + 1) % 6], x[(i + 2) % 6], x[(i + 3) % 6])) for i in range(6)]
    return np.mean(angles), tors

rng = np.random.default_rng(7)
ring = np.array([[1.53 * np.cos(k * np.pi / 3), 1.53 * np.sin(k * np.pi / 3), 0.0] for k in range(6)])
starts = {
    "flat ring, slightly jiggled": ring + rng.normal(0, 0.05, ring.shape),
    "boat, exactly symmetric": ring + np.array([[0, 0, z] for z in (0.5, 0, 0, 0.5, 0, 0)]),
    "boat, slightly jiggled": ring + np.array([[0, 0, z] for z in (0.5, 0, 0, 0.5, 0, 0)])
                              + rng.normal(0, 0.05, ring.shape),
}
results = {}
print("start                         E/kJ mol^-1   bonds  angles torsions   mean CCC angle   torsions (degrees)")
flat_e = energy(ring.ravel(), parts=True)
print(f"{'perfectly flat hexagon':28s} {sum(flat_e):10.1f}   {flat_e[0]:5.1f} {flat_e[1]:6.1f} {flat_e[2]:7.1f}")
for name, x0 in starts.items():
    x, n = minimise(x0.ravel())
    e = energy(x, parts=True)
    ang, tors = describe(x)
    results[name] = sum(e)
    print(f"{name:28s} {sum(e):10.1f}   {e[0]:5.1f} {e[1]:6.1f} {e[2]:7.1f}   {ang:10.1f}       "
          + " ".join(f"{t:+5.0f}" for t in tors) + f"   ({n} steps)")
chair = results["flat ring, slightly jiggled"]
for name in ("boat, exactly symmetric", "boat, slightly jiggled"):
    print(f"{name}: {results[name] - chair:.1f} kJ/mol above the chair")
Runs entirely in your browser, in an isolated worker. Nothing is sent to a server.

A flat hexagon costs 142 kJ/mol, mostly from six fully eclipsed bonds and from angles of 120° instead of 112°. Given only a small random nudge, the minimiser folds it into the chair: torsions alternating ±57°, C–C–C angles of 110.6°, close to the measured geometry of cyclohexane (Stereochemistry). Its energy falls from 142 to 24.5 kJ/mol, and almost all of what remains is in the six gauche-like torsions that a six-membered ring cannot avoid. Started from an exactly symmetric boat, it stays a boat, because a symmetric gradient cannot break the symmetry: the boat is a saddle point, not a minimum. A nudged boat relaxes to the twist-boat, with torsions of about +32° and −67°, a true local minimum 28.6 kJ/mol above the chair. Spectroscopic measurements (Squillacote and colleagues, 1975) put it roughly 20 to 23 kJ/mol above the chair: the right shape and the right order, but too high by several kJ/mol.

When a reaction must happen inside a large system, such as an enzyme's active site, chemists combine the two levels: quantum mechanics for the few dozen atoms that react, molecular mechanics for the rest. These QM/MM methods, introduced by Warshel and Levitt in 1976, were the core of the 2013 Nobel Prize.

ExplanationH

Choosing a method

A computational chemist chooses by asking what accuracy the question needs and what the system size allows. As of 2026, a common pattern for an organic or organometallic molecule of up to about a hundred atoms is:

TaskTypical methodTypical error
search thousands of conformersforce field or a semiempirical method such as GFN2-xTBrough ranking only
optimise geometries, compute frequenciesa hybrid or meta-GGA functional with dispersion correction, triple-zeta basisbond lengths about 1 pm
final reaction and barrier energiesDLPNO-CCSD(T) or a double-hybrid functional, large basis4–8 kJ/mol
benchmark a few small moleculesCCSD(T) extrapolated to the complete basisabout 1–2 kJ/mol
proteins, liquids, materials over nanosecondsforce field molecular dynamics, or QM/MM where bonds changedepends on parameters

The main programs differ in licensing and emphasis. Gaussian, descended from John Pople's group, is the longest-established commercial program. ORCA, from Frank Neese's group at the Max Planck Institute for Coal Research in Germany, is free for academic use and strong in local coupled-cluster and spectroscopy. Psi4 and PySCF are open source and driven from Python, which makes them favourites for method development and teaching; Q-Chem, Molpro, TURBOMOLE, NWChem and, for solids, CP2K and VASP fill other niches. A first PySCF calculation looks like this (not run here: PySCF is not available in the browser):

python
# Not run here: needs PySCF installed (pip install pyscf).
from pyscf import gto, scf, dft

mol = gto.M(atom="O 0 0 0; H 0 0.757 0.587; H 0 -0.757 0.587", basis="cc-pvdz")
hf = scf.RHF(mol).run()              # Hartree-Fock energy, in hartree
ks = dft.RKS(mol)
ks.xc = "b3lyp"                      # a hybrid functional
ks.run()

The same water molecule in Psi4, at the coupled-cluster level (not run here):

python
# Not run here: needs Psi4 installed.
import psi4

water = psi4.geometry("""
O
H 1 0.96
H 1 0.96 2 104.5
""")
psi4.set_options({"basis": "cc-pvtz"})
psi4.energy("ccsd(t)")

And an ORCA input file for a geometry optimisation and frequency calculation with a dispersion-corrected hybrid functional (not run here):

text
! B3LYP D3BJ def2-TZVP Opt Freq
* xyz 0 1
O   0.000   0.000   0.000
H   0.000   0.757   0.587
H   0.000  -0.757   0.587
*

Whatever the program, good practice is the same: state the method and basis, check that geometries are true minima (no imaginary frequencies) or true transition states (exactly one), test the sensitivity of the conclusion to the method, and compare with experiment wherever it exists, for example with the reference data in NIST's CCCBDB.

Machine-learned potentials. The newest tool sits between DFT and force fields. A neural network is trained on thousands to millions of DFT or coupled-cluster energies and forces, and then predicts them for new structures nearly as accurately, at a cost closer to a force field's, while still allowing bonds to break. Jörg Behler and Michele Parrinello's 2007 paper started the approach; by 2026, potentials trained on very large public datasets are used routinely for molecular dynamics of reactive systems. How they work and where they fail is a subject of AI for chemistry.

Common misconceptionsH

Common misconceptions

Misconception

"A calculation that converged is a correct one." Convergence means the SCF loop or the optimiser stopped changing. The answer can still be wrong because of the method, the basis, a missing dispersion correction, a wrong spin state or a structure that is a saddle point rather than a minimum.

Misconception

"DFT is a first-principles method, so it has no empirical content." The Hohenberg–Kohn and Kohn–Sham theory is exact, but every functional in use is an approximation, and many contain parameters fitted to data. Different functionals can disagree by tens of kJ/mol on the same reaction.

Misconception

"A bigger basis set always gives a better answer." It gives a better answer for that method. Hartree–Fock in a huge basis still misses the whole correlation energy, and a correlated method in a small basis can be closer to experiment than in a larger one by a lucky cancellation that disappears when the basis improves.

Misconception

"Total energies are the result." A total energy of −76.4 hartree for water is meaningless on its own. Chemistry lies in differences between total energies computed in the same way: reaction energies, barriers, conformer energies.

Exercises

Exercises

1. Computational chemistry

Warm-upHuman

In the Born–Oppenheimer approximation, what is held fixed while the electronic Schrödinger equation is solved?

Choose one

2. Computational chemistry

CoreHuman

A Hartree–Fock calculation of H₂ gives −1.1167 hartree with STO-3G and −1.1267 with 6-31G; the exact energy is −1.1745. Which statement is correct?

Choose one

3. Computational chemistry

CoreComputational

Benzene's six π electrons occupy six π molecular orbitals (three spin-up and three spin-down electrons). How many determinants does a full configuration-interaction treatment of just these electrons in just these orbitals need?

4. Computational chemistry

CoreComputational

CCSD(T) has formal cost proportional to N7N^7, where NN is the number of basis functions. A calculation takes one hour. Roughly how many hours would the same calculation take on a molecule three times as large (three times as many basis functions)?

5. Computational chemistry

CoreHuman

A student uses the B3LYP functional with no correction to study two benzene rings stacked face to face, and finds that they do not bind at all. What is the most likely fix?

Choose one

6. Computational chemistry

CoreHuman

You want to study how an enzyme breaks a C–O bond in its substrate. The enzyme with its surrounding water is about 50 000 atoms. Which approach fits?

Choose one

7. Computational chemistry

CoreComputational

The heart of every SCF iteration is the generalised eigenvalue problem FC=SCε\mathbf F\mathbf C = \mathbf S\mathbf C\boldsymbol\varepsilon. Write solve_roothaan(F, S) using symmetric orthogonalisation: form X=S−1/2\mathbf X = \mathbf S^{-1/2} from the eigen-decomposition of S\mathbf S, diagonalise F′=XTFX\mathbf F' = \mathbf X^\mathsf{T}\mathbf F\mathbf X with np.linalg.eigh, and return the eigenvalues (increasing) and C=XC′\mathbf C = \mathbf X\mathbf C'.

Runs entirely in your browser, in an isolated worker. Nothing is sent to a server.

8. Computational chemistry

Warm-upComputational

The lesson's force field uses the torsion term E(ϕ)=12[V1(1+cos⁡ϕ)+V2(1−cos⁡2ϕ)+V3(1+cos⁡3ϕ)]E(\phi) = \tfrac12[V_1(1 + \cos\phi) + V_2(1 - \cos 2\phi) + V_3(1 + \cos 3\phi)], with ϕ=180°\phi = 180° for the anti arrangement. Applied to the central bond of butane (as a united-atom model), it gives the conformational energy profile. Write torsion_energy(phi_deg) (accepting a number or a NumPy array) and gauche_minimum(), which scans ϕ\phi from 0° to 120° in steps of 0.01° and returns the angle and energy of the lowest point.

Runs entirely in your browser, in an isolated worker. Nothing is sent to a server.

Further reading and resources