“Know how to solve every problem that has been solved.” “What I cannot create, I do not understand.” — Richard Feynman

McMurchie-Davidson: change basis to where Coulomb is diagonal

Quantum Chemistry

What you need to know first 5 concepts, 4 layers

The requisite-knowledge inventory for this page, bottom-up: the primitives at the base, combined upward until you reach what this page assumes. Skim the layers you already own; start wherever the ground gets unfamiliar.

  1. base
  2. L1
  3. L2
  4. L3
  5. you are here

McMurchie-Davidson is the alternative recurrence scheme for Gaussian-basis molecular integrals. The structure: instead of climbing the Cartesian-Gaussian angular-momentum ladder directly (as Obara-Saika does), change basis to Hermite Gaussians on the product center, where the Coulomb integral is essentially diagonal. The work splits into two cleanly separated pieces: a Cartesian-to-Hermite expansion (cheap, geometric) and a Hermite-integral table (Boys-function ladder). Contract the two to recover the original integral.

The conceptual reason this is worth doing: the Hermite expansion is structurally tidy — once you've built the coefficients for a shell pair, they're reused across the whole contraction set. And the auxiliaries depend only on the geometry of the product centers and the combined exponent , not on angular momentum, so a single -table per shell-block feeds every Cartesian recombination on that block. Total work decouples into two independent recurrences instead of one intertwined one.

What's a Hermite Gaussian

A Hermite Gaussian centered at with exponent and Hermite indices is defined by differentiating a centered Gaussian with respect to the center:

These are conveniently called "Hermite Gaussians" because the partial derivatives generate Hermite polynomials in times the original Gaussian — specifically in one convention. They form a basis for Gaussian-modulated polynomials just like Cartesian Gaussians do, but they're better-suited to multi-center integration because differentiation under the integral sign is clean.

The MD strategy in three steps

The full algorithm:

  1. Cartesian → Hermite expansion. Each pair of Cartesian Gaussians on different centers, , is written as a finite sum of Hermite Gaussians on the product center :

The coefficients are independent products, , each computed by a small 1D recursion (below). They're geometric — pure functions of the centers, exponents, and angular-momentum indices, not of any Coulomb operator. Two-electron integrals get two such expansions, one for the pair on and one for the pair on .

  1. Hermite-integral auxiliaries. The integral of Hermite Gaussians weighted by has a closed form in terms of derivatives of the Boys function. Define

with base case and a three-term recurrence

(analogous on and ). This recurrence descends in indices while ascending in level , exactly as the Obara-Saika one does for Cartesian indices. The base case is the Boys function at increasing levels; everything is geometric (depends only on centers and exponents), not on the original angular-momentum vectors. So one table works for every shell on a given () pair.

  1. Contraction. The final integral is

A finite sum of products: each coefficient times each coefficient times the value at the index sum. The factor arises because the Hermite derivatives on electron 2 are with respect to , which flips sign relative to the -derivatives that build the table.

The E-coefficient recurrence (1D)

The Hermite expansion factor in the direction satisfies

where and , starting from and for . The recurrence raises one of the Cartesian angular-momentum indices while building up the Hermite index . After climbing to the target , the values for are what you need. Analogous recurrences run independently on directions.

Worked example:

Compute the same integral as the Obara-Saika page, with identical parameters ( on with , on with , etc.).

# Same integral as the Obara-Saika page: (p_x s | s s) on four distinct centers.
import math, numpy as np
from scipy.special import hyp1f1

def boys(n, T):
    return (1.0 / (2 * n + 1)) * hyp1f1(n + 0.5, n + 1.5, -T)

alpha, A = 0.5, np.array([0.0, 0.0, 0.0])     # p_x on A
beta_, B = 0.3, np.array([1.0, 0.0, 0.0])     # s   on B
gamma_, C = 0.4, np.array([0.0, 1.0, 0.0])    # s   on C
delta, D = 0.6, np.array([0.0, 0.0, 1.0])     # s   on D

p = alpha + beta_                              # = 0.8
q = gamma_ + delta                             # = 1.0
P = (alpha * A + beta_ * B) / p                # = (0.375, 0, 0)
Q = (gamma_ * C + delta * D) / q               # = (0, 0.4, 0.6)
eta = p * q / (p + q)                          # = 0.4444
K_AB = math.exp(-alpha * beta_ / p * np.sum((A - B)**2))   # = 0.8290
K_CD = math.exp(-gamma_ * delta / q * np.sum((C - D)**2))  # = 0.6188
T = eta * np.sum((P - Q)**2)                               # = 0.2936
prefactor = 2 * math.pi**2.5 / (p * q * math.sqrt(p + q)) * K_AB * K_CD

The MD pipeline for this case is short because most coefficients are zero. For the pair on :

For the pair on , only is non-zero. So the contraction reduces to

Two terms. Build the auxiliaries needed: , , and the recurrence gives . Plug in:

# ─── McMurchie-Davidson: Hermite expansion + R_tuv recurrence ──────────────
# Step 1: Cartesian-to-Hermite expansion coefficients for (p_x, s) on (A, B).
#         The s on B contributes nothing extra; (s, s) on (C, D) gives E^{0,0}_0 = 1.
#         Recurrence for E^{i+1, j}_t (in the i direction):
#             E^{i+1, j}_t = X_PA · E^{i, j}_t + (1/(2p))·E^{i, j}_{t-1} + (t+1)·E^{i, j}_{t+1}
#         At i = 0, j = 0:   E^{0,0}_0 = 1, all others zero.
#         Raise i to 1 (with j = 0, single x-step):
E_10_0 = P[0] - A[0]      # = 0.375  (the X_PA piece, since E^{0,0}_{-1}, E^{0,0}_1 are zero)
E_10_1 = 1.0 / (2 * p)    # = 0.625  (the 1/(2p) piece picks up E^{0,0}_0 = 1)

# Step 2: Hermite-integral auxiliaries R^n_{tuv}(eta, P-Q).
#         Base case:  R^n_{0,0,0} = (-2 eta)^n · F_n(T)
#         Recurrence: R^n_{t+1, u, v} = t · R^{n+1}_{t-1, u, v} + (P_x - Q_x) · R^{n+1}_{t, u, v}
R0_000 = boys(0, T)                               # = 0.9101805
R1_000 = (-2 * eta) * boys(1, T)                  # = -0.1027020
R0_100 = (P[0] - Q[0]) * R1_000                    # = -0.03851324

# Step 3: contract. Only t=0,1 and τυν=000 contribute (everything else multiplied by zero).
md_val = prefactor * (E_10_0 * R0_000 + E_10_1 * R0_100)
print(f"(p_x s | s s)  via MD  =  {md_val:.10e}")
(p_x s | s s)  via MD  =  4.7309112359e+00

Same as the Obara-Saika page, computed via completely different intermediates: OS used auxiliary integrals and ; MD used Hermite-expansion coefficients and Hermite-integral values . Two different sets of intermediate quantities, two different recurrences, same number to machine precision.

What scales when you go to higher angular momentum

For a generic integral, MD needs:

  1. 1D tables in each Cartesian direction, dimension up to in the direction etc. Computed by the small 3-term recurrence above. One pair of tables per shell pair on the side, one pair on the side.
  2. 3D table on the geometry, dimensions up to in each Hermite index where . Climbs from via the 3-term recurrence on while descending in .
  3. Final contraction: a sum of products of coefficients with values. For an shell pair times an shell pair, this is term sums.

The amortization advantage of MD is in step 2: the table is computed once per shell-block geometry and reused for every Cartesian recombination on that block. With many contracted primitives per basis function (typical for cc-pVDZ and beyond), this amortization can dominate the total cost.

Why the Hermite basis makes the Coulomb integral easy

The structural fact: the Coulomb kernel has the Laplace-transform identity

so the 2-electron Coulomb integral becomes a 1D integral of a product of two Gaussian integrals — one for each electron, both evaluated against a third Gaussian . After completing the squares (which invokes the Gaussian product theorem in 6D), the integrand reduces to a function of and the combined exponent. The Hermite-Gaussian definition above — acting on a centered Gaussian — converts the dependence into derivative operations on the Boys function. That decouples the angular momentum from the radial integral cleanly, which is what makes the recurrence so much simpler than the OS one.

The OS vertical recurrence does essentially the same thing in Cartesian-Gaussian language, but it has to carry the polynomial pieces around explicitly through every step, which is why the eight-term form is so dense. MD pre-organizes the work into Hermite intermediates, runs the Boys ladder once, and only re-introduces the Cartesian structure at the very end via the coefficients.

When to use MD vs OS

Use McMurchie-Davidson when:

For routine low-angular-momentum work, Obara-Saika is usually faster (less storage, fewer auxiliary tables, simpler bookkeeping). Modern production codes typically use OS for the SCF inner loop and switch to MD for derivative integrals and high- shells.

Related on this site

References