Where exact solutions stop¶
Four model systems have carried the course so far, and each was solved exactly:
| system | potential | solved in |
|---|---|---|
| particle in a box | walls | Lecture 3.2 |
| harmonic oscillator | Lecture 4.2 | |
| rigid rotor | none, fixed distance | Lecture 4.5 |
| hydrogenlike atom | Lecture 5.1 |
The list ends there. Add one electron to hydrogen and the Hamiltonian of helium, written in the atomic units of Lecture 5.1 (), is
The first two pieces are hydrogenlike atoms with , which Lecture 5.1 solved. The last piece, the repulsion between the electrons a distance apart, ties the coordinates of one electron to those of the other. The equation no longer separates, and no one has found a formula for its solutions. The same term appears between every pair of electrons in every atom and molecule.
Source
# synced: approx_roadmap
import numpy as np
import matplotlib.pyplot as plt
from matplotlib.animation import FuncAnimation
from IPython.display import HTML
TEAL, CARDINAL, GRAY, PURPLE, ORANGE = "#107895", "#C8102E", "#6c757d", "#6a3d9a", "#e07b00"
from matplotlib.patches import FancyBboxPatch
W, Ht = 10.1, 4.1
fig = plt.figure(figsize=(W, Ht))
ax = fig.add_axes([0, 0, 1, 1]); ax.set_xlim(0, W); ax.set_ylim(0, Ht); ax.axis("off")
tint = {GRAY: "#f1f3f5", PURPLE: "#f1ecf7", TEAL: "#e3f1f5", ORANGE: "#fdf0e0", "k": "#f8f9fa"}
def box(x, y, w, h, lines, col, sizes=(13, 11.5)):
ax.add_patch(FancyBboxPatch((x - w / 2, y - h / 2), w, h, boxstyle="round,pad=0,rounding_size=0.12",
fc=tint[col], ec=col, lw=1.6, zorder=2))
n = len(lines)
for k, line in enumerate(lines):
dy = (n - 1) / 2 - k
ax.text(x, y + 0.31 * dy, line, ha="center", va="center", fontsize=sizes[0] if k == 0 else sizes[1],
color=col if k == 0 else "k", weight="bold" if k == 0 else None, zorder=3)
arrow = lambda p, q, col=GRAY: ax.annotate("", xy=q, xytext=p, zorder=1, arrowprops=dict(
arrowstyle="-|>", color=col, lw=1.5, mutation_scale=15, shrinkA=2, shrinkB=2))
x1, x2, x3, x4 = 1.15, 3.45, 6.15, 8.9
yt, yb, ym = 3.1, 1.0, 2.05
box(x1, ym, 1.9, 1.3, ["solved exactly", "box, spring, rotor", "hydrogen atom"], GRAY)
box(x2, ym, 2.0, 1.3, ["everything else", "helium, atoms,", "molecules"], "k")
box(x3, yt, 2.75, 1.25, ["variational method", r"guess $\phi$, minimize $\langle E\rangle$",
r"$\langle E\rangle \geq E_0$: Lecture 6.1"], TEAL)
box(x3, yb, 2.75, 1.25, ["perturbation theory", r"$\hat{H} = \hat{H}^{(0)} + \hat{H}^{(1)}$",
"correct in steps: 6.2, 6.3"], PURPLE)
box(x4, ym, 2.0, 1.3, ["chemistry", "orbitals, bonds, spectra", "Chapters 7 and 8"], ORANGE)
arrow((x1 + 0.95, ym), (x2 - 1.0, ym))
arrow((x2 + 1.0, ym + 0.25), (x3 - 1.38, yt - 0.1), TEAL)
arrow((x2 + 1.0, ym - 0.25), (x3 - 1.38, yb + 0.1), PURPLE)
arrow((x3 + 1.38, yt - 0.1), (x4 - 1.0, ym + 0.25), TEAL)
arrow((x3 + 1.38, yb + 0.1), (x4 - 1.0, ym - 0.25), PURPLE)
plt.show()
Fig. The plan of the chapter. Beyond the exactly solved models there are two ways forward: guess the wavefunction and improve the guess (the variational method), or start from a solved problem and correct it step by step (perturbation theory). Both lead to the atoms and molecules of Chapters 7 and 8.
The variational method asks for a guess of the wavefunction. It returns an energy that is guaranteed to be too high, so guesses can be ranked and improved.
Perturbation theory asks for a solved problem close to the real one. It returns corrections to the energies and states, order by order (Lecture 6.2), and with a perturbation that changes in time it explains how light moves molecules between levels (Lecture 6.3).
An idea already used twice¶
Two earlier lectures found a ground-state energy by trying a family of states and keeping the one of lowest energy.
The spring (Lecture 4.2). Gaussians of every width , centered in the well, have the average energy . The lowest value is , the zero-point energy.
The hydrogen atom (Lecture 5.1). Exponentials of every size have the average energy . The lowest value is eV, at .
Both answers were exact, because in each case the family happened to contain the true ground state. This lecture asks what the minimum means when it does not. The answer is the variational theorem: the minimum is then too high, and never too low.
The variational theorem¶
Any state is a mixture of the exact states¶
Let be any normalized function that obeys the boundary conditions of the problem: a guess, called a trial function. Its average energy is . Three steps bound it from below.
Expand the guess in the exact states. The eigenfunctions of form a complete set (Lecture 3.6), whether or not anyone can write them down:
Since is normalized, .
The average energy is a weighted average of the levels. A measurement of the energy returns with probability (the Born rule of Lecture 3.6), so
An average cannot lie below its smallest entry. Every is at least , so
Here stands for the lowest level, whatever its quantum number is called: for the box and for hydrogen, for the spring.
Source
# synced: weights_ladder
import numpy as np
import matplotlib.pyplot as plt
from matplotlib.animation import FuncAnimation
from IPython.display import HTML
TEAL, CARDINAL, GRAY, PURPLE, ORANGE = "#107895", "#C8102E", "#6c757d", "#6a3d9a", "#e07b00"
plt.rcParams.update({"axes.spines.top": False, "axes.spines.right": False})
x = np.linspace(0, 1, 2001)
phi = x**3 * (1 - x) # a trial state in the box, pushed to the right
phi = phi / np.sqrt(np.trapezoid(phi**2, x))
psi = lambda n: np.sqrt(2) * np.sin(n * np.pi * x)
c2 = np.array([np.trapezoid(phi * psi(n), x) ** 2 for n in range(1, 5)])
Eavg = 0.5 * np.trapezoid(np.gradient(phi, x) ** 2, x) / (np.pi**2 / 2) # average energy in units of E_1
fig, (ax, bx) = plt.subplots(1, 2, figsize=(9.6, 4.2), gridspec_kw={"width_ratios": [1, 1.15], "wspace": 0.32})
ax.plot([0, 0], [0, 2.5], color="k", lw=2.4); ax.plot([1, 1], [0, 2.5], color="k", lw=2.4)
ax.plot([0, 1], [0, 0], color="k", lw=2.4)
ax.plot(x, psi(1), color=GRAY, lw=2.2, ls=(0, (4, 3)))
ax.fill_between(x, 0, phi, color=TEAL, alpha=0.25, lw=0)
ax.plot(x, phi, color=TEAL, lw=2.6)
ax.text(0.28, 1.36, r"$\psi_1$", color=GRAY, fontsize=14, ha="center")
ax.text(0.9, 2.05, r"$\phi$", color=TEAL, fontsize=15, ha="center")
ax.set_xlim(-0.06, 1.06); ax.set_ylim(-0.05, 2.5)
ax.set_xticks([0, 1]); ax.set_xticklabels(["0", "$L$"]); ax.set_yticks([])
ax.spines["left"].set_visible(False); ax.spines["bottom"].set_visible(False); ax.tick_params(labelsize=12, length=0)
for n in range(1, 5):
E = n * n
bx.hlines(E, 0, 1.0, color="#ced4da", lw=1.2, zorder=1)
bx.plot([0, c2[n - 1]], [E, E], color=PURPLE, lw=9, solid_capstyle="butt", zorder=3)
bx.text(c2[n - 1] + 0.025, E, f"{c2[n - 1]:.2f}" if c2[n - 1] > 0.006 else f"{c2[n - 1]:.3f}", va="center",
fontsize=12, color=PURPLE)
bx.axhline(Eavg, color=CARDINAL, lw=1.8, ls=(0, (5, 3)), zorder=2)
bx.text(1.0, Eavg + 0.35, rf"$\langle E\rangle = {Eavg:.2f}\,E_1$", color=CARDINAL, fontsize=13, ha="right", va="bottom")
bx.set_xlim(0, 1.0); bx.set_ylim(0, 17.5)
bx.set_yticks([1, 4, 9, 16]); bx.set_yticklabels(["$E_1$", "$E_2$", "$E_3$", "$E_4$"], fontsize=13)
bx.set_xticks([0, 0.5, 1]); bx.tick_params(axis="x", labelsize=11)
bx.set_xlabel(r"weight $|c_n|^2$", fontsize=12.5)
fig.subplots_adjust(left=0.04, right=0.97, top=0.96, bottom=0.14)
plt.show()
Fig. Left: a trial state in a box (teal), pushed toward the right wall, beside the true ground state (dashed). Right: the weights of on the exact levels. An energy measurement returns in 68% of trials, in 29%, higher levels in the rest. The average, , lies above because every single reading does.
Every guess gives an upper bound. The true energy is never above the computed one. No knowledge of the exact solution is needed to say so.
Lower is better. Of two trial functions, the one with the lower is closer to the truth in energy. That turns guessing into a method: change the guess, keep the change if the energy drops.
The energy forgives a poor guess. Let the guess be the true ground state plus a small error, , with normalized and orthogonal to . Then
An error of size in the function costs only in the energy. A guess that is 10% wrong can give an energy good to about 1%. The reverse also holds: a good energy does not certify the wavefunction, and other properties computed from it are less accurate.
The theorem is about the ground state. For an excited state the same argument works only if the trial function is orthogonal to every state below it. Symmetry can arrange that: an odd trial function in a symmetric well bounds the lowest odd state (Problem 7).
The recipe: guess, compute, minimize¶
Guess. Choose a trial function with the right boundary conditions and a sensible shape: no more nodes than a ground state should have, large where the potential is low. Put adjustable parameters in it.
Compute. Evaluate as a function of the parameters.
Minimize. Set the derivative with respect to each parameter to zero. The minimum is the best energy that family of functions can give, and it is still an upper bound.
One formula saves work in step 2. Integrating by parts, with vanishing at the ends of the range,
so the kinetic energy needs only the first derivative: it is large wherever the function is steep.
No parameter: a parabola in a box¶
Source
# synced: box_trials
import numpy as np
import matplotlib.pyplot as plt
from matplotlib.animation import FuncAnimation
from IPython.display import HTML
TEAL, CARDINAL, GRAY, PURPLE, ORANGE = "#107895", "#C8102E", "#6c757d", "#6a3d9a", "#e07b00"
plt.rcParams.update({"axes.spines.top": False, "axes.spines.right": False})
x = np.linspace(0, 1, 1001)
exact = np.sqrt(2) * np.sin(np.pi * x)
unit = lambda f: f / np.sqrt(np.trapezoid(f**2, x))
trials = [("(a) tent", unit(np.minimum(x, 1 - x)), 12 / np.pi**2),
("(b) parabola", unit(x * (1 - x)), 10 / np.pi**2),
("(c) two terms", unit(x * (1 - x) + 1.13314 * x**2 * (1 - x) ** 2), 4.93487481 / (np.pi**2 / 2))]
fig, axes = plt.subplots(1, 3, figsize=(9.6, 3.5), gridspec_kw={"wspace": 0.12})
for ax, (name, f, E) in zip(axes, trials):
ax.plot([0, 0], [0, 1.95], color="k", lw=2.2); ax.plot([1, 1], [0, 1.95], color="k", lw=2.2)
ax.plot([0, 1], [0, 0], color="k", lw=2.2)
ax.fill_between(x, exact, f, color=CARDINAL, alpha=0.35, lw=0)
ax.plot(x, exact, color=GRAY, lw=4.5, alpha=0.55)
ax.plot(x, f, color=TEAL, lw=2.2)
ax.set_title(name, fontsize=13.5, color=TEAL, weight="bold")
err = 100 * (E - 1)
ax.text(0.5, 0.42, rf"$\langle E\rangle = {E:.3f}\,E_1$" if err > 0.05 else rf"$\langle E\rangle = {E:.5f}\,E_1$",
ha="center", fontsize=13)
ax.text(0.5, 0.14, f"{err:.1f}% high" if err > 0.05 else f"{err:.4f}% high", ha="center", fontsize=12, color=CARDINAL)
ax.set_xlim(-0.05, 1.05); ax.set_ylim(-0.04, 1.95)
ax.set_xticks([0, 1]); ax.set_xticklabels(["0", "$L$"]); ax.set_yticks([])
ax.spines["left"].set_visible(False); ax.spines["bottom"].set_visible(False); ax.tick_params(labelsize=12, length=0)
fig.subplots_adjust(left=0.02, right=0.98, top=0.9, bottom=0.09)
plt.show()
Fig. Three guesses (teal) for the ground state of a box, drawn over the exact one (gray), with the area between them in red. (a) A tent, with a kink in the middle. (b) The parabola of the example. (c) The parabola plus a second term, built below. Each energy lies above , and the closer the shape, the lower the energy.
The theorem ranks the guesses. The tent (Problem 1) is 21.6% high, the parabola 1.3%, the two-term function 0.0015%. No comparison with the exact answer was needed to put them in that order.
Shape decides. The tent overlaps the true state almost as well as the parabola does, but its kink is steep, and steepness is kinetic energy.
One parameter: hydrogen with a Gaussian¶
The ground state of hydrogen is , with . Suppose the guess is a Gaussian instead, , with the exponent free. In atomic units , and the recipe runs as follows.
Normalize. .
Compute the two parts of the energy. The integrals are in the dropdown below; divided by the normalization they give
Minimize. A large is a tight Gaussian: the kinetic energy grows in proportion to , the attraction only as . Setting :
Source
# synced: gaussian_hydrogen
import numpy as np
import matplotlib.pyplot as plt
from matplotlib.animation import FuncAnimation
from IPython.display import HTML
TEAL, CARDINAL, GRAY, PURPLE, ORANGE = "#107895", "#C8102E", "#6c757d", "#6a3d9a", "#e07b00"
plt.rcParams.update({"axes.spines.top": False, "axes.spines.right": False})
fig, (ax, bx) = plt.subplots(1, 2, figsize=(9.6, 4.2), gridspec_kw={"width_ratios": [1.15, 1], "wspace": 0.3})
a = np.linspace(0.01, 1.0, 400)
T, V = 1.5 * a, -2 * np.sqrt(2 * a / np.pi) # hartree, for the trial state exp(-alpha r^2)
ax.axhline(0, color=GRAY, lw=0.8, ls=":")
ax.plot(a, T, color=ORANGE, lw=2.4); ax.plot(a, V, color=TEAL, lw=2.4); ax.plot(a, T + V, color="k", lw=2.8)
ax.axhline(-0.5, color=GRAY, lw=1.6, ls=(0, (5, 3)))
a0 = 8 / (9 * np.pi)
ax.plot([a0], [-4 / (3 * np.pi)], "o", color=CARDINAL, ms=9, zorder=5)
ax.text(a0, -0.36, r"$-0.424$", color=CARDINAL, fontsize=13, ha="center", va="bottom")
ax.text(0.99, -0.56, r"exact $-\frac{1}{2}$", color=GRAY, fontsize=13, ha="right", va="top")
ax.text(0.72, 1.16, "kinetic", color=ORANGE, fontsize=13, ha="right")
ax.text(0.3, -1.3, "potential", color=TEAL, fontsize=13, ha="left", va="top")
ax.text(0.98, 0.0, "total", color="k", fontsize=13, ha="right", va="bottom")
ax.set_xlim(0, 1.0); ax.set_ylim(-1.7, 1.6)
ax.set_xlabel(r"exponent $\alpha$ ($a_0^{-2}$)", fontsize=12.5); ax.set_ylabel(r"average energy ($E_h$)", fontsize=12.5)
ax.set_yticks([-1.5, -1, -0.5, 0, 0.5, 1, 1.5]); ax.tick_params(labelsize=10.5)
r = np.linspace(0, 5, 500)
bx.plot(r, np.exp(-r) / np.sqrt(np.pi), color=GRAY, lw=4.5, alpha=0.55)
bx.plot(r, (2 * a0 / np.pi) ** 0.75 * np.exp(-a0 * r**2), color=TEAL, lw=2.4)
bx.text(0.42, 0.47, r"exact $e^{-r/a_0}$", color=GRAY, fontsize=13)
bx.text(1.75, 0.16, r"best Gaussian", color=TEAL, fontsize=13)
bx.set_xlim(0, 5); bx.set_ylim(0, 0.6)
bx.set_xlabel(r"$r$ ($a_0$)", fontsize=12.5); bx.set_ylabel(r"$\psi(r)$", fontsize=12.5); bx.tick_params(labelsize=10.5)
fig.subplots_adjust(left=0.085, right=0.98, top=0.96, bottom=0.14)
plt.show()
Fig. Hydrogen with the trial function . Left: the average kinetic, potential and total energy for every exponent . The total has its minimum, , at and stays above the exact (dashed) everywhere. Right: the best Gaussian against the exact , both normalized.
15% too high, and above the exact value for every . No Gaussian reaches , because no Gaussian is the true state.
What the Gaussian gets wrong. The true function has a cusp at the nucleus and a long tail . The Gaussian is flat at the nucleus and its tail dies too fast.
Why chemists use Gaussians anyway. Integrals over products of Gaussians centered on different atoms have simple formulas, and exponentials do not. The cure for the poor shape is to add several Gaussians together, which is the linear method below.
Going further: the integrals behind
The recipe does not need a formula for the exact answer. Pick a well and tune the width of a Gaussian trial function; the dashed level is the exact ground state, solved numerically for comparison.
In the spring the family contains the exact state, and the teal level touches the dashed one at one width: the bound becomes an equality.
In the V-shaped well no Gaussian is exact. The best one stops 0.5% above the dashed level.
The Morse well is lopsided, and a Gaussian centered at the minimum cannot follow it. Move the center as well: a second parameter lowers the bound further.
Helium: a charge that is not 2¶
Helium is where the exact solutions stopped. Drop the repulsion from its Hamiltonian, and what is left is a sum of two He Hamiltonians, one for each electron. A Hamiltonian that is a sum separates: the energies add and the wavefunctions multiply. Both electrons then sit in the 1s orbital of He, in atomic units, and the state of the atom is the product
This independent-electron product is not an eigenfunction of the true Hamiltonian, which still contains the repulsion. It is a guess, and the variational method can improve it.
Source
# synced: helium_screening
import numpy as np
import matplotlib.pyplot as plt
from matplotlib.animation import FuncAnimation
from IPython.display import HTML
TEAL, CARDINAL, GRAY, PURPLE, ORANGE = "#107895", "#C8102E", "#6c757d", "#6a3d9a", "#e07b00"
plt.rcParams.update({"axes.spines.top": False, "axes.spines.right": False})
Eh = 27.2114
z = np.linspace(1.15, 2.35, 300)
fig, ax = plt.subplots(figsize=(8.0, 4.2))
ax.plot(z, (z**2 - 27 * z / 8) * Eh, color="k", lw=2.8)
ax.axhline(-79.01, color=GRAY, lw=1.6, ls=(0, (5, 3)))
ax.text(2.34, -79.25, "exact $-79.0$ eV", color=GRAY, fontsize=13, ha="right", va="top")
ax.plot([2], [-2.75 * Eh], "o", color=GRAY, ms=9, zorder=5)
ax.text(2.03, -2.75 * Eh - 0.1, r"$\zeta = 2$: $-74.8$ eV", color=GRAY, fontsize=13, ha="left", va="top")
zb = 27 / 16
ax.plot([zb], [-zb**2 * Eh], "o", color=CARDINAL, ms=9, zorder=5)
ax.text(zb, -zb**2 * Eh + 0.45, r"$\zeta = \frac{27}{16}$: $-77.5$ eV", color=CARDINAL, fontsize=13, ha="center", va="bottom")
ax.set_xlim(1.15, 2.35); ax.set_ylim(-80.6, -68)
ax.set_xlabel(r"effective nuclear charge $\zeta$", fontsize=12.5); ax.set_ylabel(r"average energy (eV)", fontsize=12.5)
ax.tick_params(labelsize=10.5)
fig.subplots_adjust(left=0.11, right=0.97, top=0.96, bottom=0.14)
plt.show()
Fig. The average energy of helium for the trial function . The bare nuclear charge, , gives -74.8 eV. The minimum is at , with -77.5 eV. The exact energy, -79.0 eV, lies below both.
| trial function | energy () | energy (eV) | above the exact value |
|---|---|---|---|
| with | -2.750 | -74.8 | 4.2 eV |
| the same with | -2.848 | -77.5 | 1.5 eV |
| Hylleraas, three parameters (1929) | -2.9024 | -78.98 | 0.04 eV |
| exact | -2.9037 | -79.01 |
Screening. The best charge is less than 2. Each electron spends part of its time between the other electron and the nucleus, so each sees a nucleus of charge about 1.69. The effective nuclear charge of general chemistry is a variational parameter.
More parameters, lower energy. Hylleraas added terms that depend on itself, which lets the electrons avoid each other, and came within 0.04 eV. Every row is above the exact value.
Orbitals for many electrons. A product of one-electron functions with adjusted charges is the orbital approximation, the starting point for every atom in Chapter 7.
Going further: where comes from
Each electron in the orbital is a round cloud of charge with the density . Electrostatics gives the potential that such a cloud creates at a distance from its center:
Far away it is , the potential of a point charge; inside the cloud it is weaker, and at the center it levels off at . The repulsion energy is the potential of one cloud averaged over the density of the other:
Linear combinations: the method chemists use¶
Mix fixed functions¶
Nonlinear parameters such as and sit inside exponentials, and each new one makes the minimization harder. A second kind of trial function avoids that. Choose a set of fixed functions , the basis functions, and let only the mixing coefficients vary:
Minimizing the energy with respect to the coefficients needs no searching. It leads to a matrix eigenvalue problem, the kind Lecture 3.5 solved with eigh.
Two functions, step by step¶
Take and real functions and coefficients.
Write the energy. Insert into and multiply out:
The are the matrix elements of the Hamiltonian, the sandwiches of Lecture 3.5. The are overlaps: the basis functions need not be orthogonal or normalized. is Hermitian, so .
Minimize. Clear the fraction, , and differentiate both sides with respect to . At the minimum , which leaves
Collect the terms, and do the same for :
Solve. These are two linear equations for and . They always have the useless solution . Another solution exists only if the determinant of the coefficients vanishes, and that condition fixes .
numpy solves it in one line.
eigh(H)handles an orthonormal basis, as in Lecture 3.5, andscipy.linalg.eigh(H, S)handles overlaps.Adding a basis function never raises the lowest root. The old answer is still available, with the new coefficient set to zero, so the new minimum can only be equal or lower.
The higher roots are bounds too. Each is an upper bound to the corresponding excited level, the second root to the second level and so on.
The two-level problem¶
The smallest case, two orthonormal basis functions, is worth solving once and keeping: it returns in every remaining lecture of this chapter. Call the energies of the two functions and , with , and the matrix element that connects them . The secular determinant is the quadratic equation .
Source
# synced: mixing_angle
import numpy as np
import matplotlib.pyplot as plt
from matplotlib.animation import FuncAnimation
from IPython.display import HTML
TEAL, CARDINAL, GRAY, PURPLE, ORANGE = "#107895", "#C8102E", "#6c757d", "#6a3d9a", "#e07b00"
plt.rcParams.update({"axes.spines.top": False, "axes.spines.right": False})
H11, H22, H12 = 0.0, 1.0, -0.6
mean, half = 0.5 * (H11 + H22), np.sqrt(0.25 * (H11 - H22) ** 2 + H12**2)
Em, Ep = mean - half, mean + half
fig, (ax, bx) = plt.subplots(1, 2, figsize=(9.6, 4.2), gridspec_kw={"width_ratios": [1, 1.5], "wspace": 0.12})
# left: the two diagonal elements, and the two roots they turn into
for y, lab in ((H11, "$E_1$"), (H22, "$E_2$")):
ax.hlines(y, 0.0, 0.9, color=GRAY, lw=3.2)
ax.text(-0.08, y, lab, ha="right", va="center", fontsize=14, color=GRAY)
for y, lab, col in ((Em, "$E_-$", TEAL), (Ep, "$E_+$", ORANGE)):
ax.hlines(y, 1.9, 2.8, color=col, lw=3.2)
ax.text(2.88, y, lab, ha="left", va="center", fontsize=14, color=col)
for y0, y1 in ((H11, Em), (H22, Ep)):
ax.plot([0.9, 1.9], [y0, y1], color=GRAY, lw=1, ls=":")
ax.set_xlim(-0.75, 3.5); ax.set_ylim(-0.55, 1.55); ax.axis("off")
# right: the energy of cos(theta) f1 + sin(theta) f2
th = np.linspace(-90, 90, 721); t = np.radians(th)
E = H11 * np.cos(t) ** 2 + H22 * np.sin(t) ** 2 + H12 * np.sin(2 * t)
for y, col in ((H11, GRAY), (H22, GRAY), (Em, TEAL), (Ep, ORANGE)):
bx.axhline(y, color=col, lw=1, ls=":")
bx.plot(th, E, color="k", lw=2.8)
tp = np.degrees(0.5 * np.arctan2(2 * H12, H11 - H22)) # the angle of the highest mixture
tm = tp + 90 if tp < 0 else tp - 90 # the lowest one is perpendicular to it
bx.plot([tm], [Em], "o", color=TEAL, ms=10, zorder=5); bx.plot([tp], [Ep], "o", color=ORANGE, ms=10, zorder=5)
bx.plot([0], [H11], "o", color=GRAY, ms=8, zorder=5); bx.plot([-90, 90], [H22, H22], "o", color=GRAY, ms=8, zorder=5, clip_on=False)
bx.text(tm, Em - 0.09, r"lowest", color=TEAL, fontsize=13, ha="center", va="top")
bx.text(tp, Ep + 0.07, r"highest", color=ORANGE, fontsize=13, ha="center", va="bottom")
bx.text(5, H11 + 0.05, r"$f_1$ alone", color=GRAY, fontsize=12.5, ha="left", va="bottom")
bx.text(86, H22 + 0.06, r"$f_2$ alone", color=GRAY, fontsize=12.5, ha="right", va="bottom")
bx.set_xlim(-90, 90); bx.set_ylim(-0.55, 1.55)
bx.set_xticks([-90, -45, 0, 45, 90]); bx.set_xticklabels(["-90°", "-45°", "0°", "45°", "90°"])
bx.set_yticks([]); bx.spines["left"].set_visible(False); bx.tick_params(labelsize=11.5)
bx.set_xlabel(r"mixing angle $\theta$ in $\phi = \cos\theta\,f_1 + \sin\theta\,f_2$", fontsize=12.5)
fig.subplots_adjust(left=0.02, right=0.97, top=0.96, bottom=0.15)
plt.show()
Fig. The two-level problem. Left: the levels and before mixing, and the roots and after. Right: the energy of every normalized mixture . Its lowest and highest points are the two roots; alone and alone lie in between.
Mixing pushes the levels apart. lies below both starting levels and above both. The lower state gains exactly what the upper one loses.
The roots are the extremes of the energy. The curve on the right is the variational energy of every possible mixture. Finding its minimum and solving the eigenvalue problem are the same task.
Equal levels make the chemical bond. Two identical atomic orbitals on neighboring atoms have . Chemists write their energy and their coupling , so the two levels are , and the lower mixture is the bond (Chapter 8).
Distant levels give perturbation theory. The small push , coupling squared over gap, is the second-order shift of Lecture 6.2. Lecture 6.3 then drives the same two levels with light.
The box again, with two polynomials¶
import numpy as np
from scipy.linalg import eigh
# f1 = x(1 - x) and f2 = x^2 (1 - x)^2, energies in units of hbar^2 / m L^2
H = np.array([[1/6, 1/30], [1/30, 1/105]]) # <f_i|H|f_j>
S = np.array([[1/30, 1/140], [1/140, 1/630]]) # overlaps <f_i|f_j>
E, C = eigh(H, S) # solves H c = E S c
print("roots :", np.round(E, 5))
print("exact E1, E3 :", np.round([np.pi**2 / 2, 9 * np.pi**2 / 2], 5))
print("c2 / c1 :", round(C[1, 0] / C[0, 0], 4))roots : [ 4.93487 51.06513]
exact E1, E3 : [ 4.9348 44.41322]
c2 / c1 : 1.1331
The lowest root is 4.93487, against the exact : 0.0015% too high. One extra function cut the error of the parabola by a factor of about 900. This is panel (c) of the figure above.
The second root, 51.07, is an upper bound to , not to . Both basis functions are symmetric about the middle of the box, so they can build only symmetric states, and the next symmetric state after is .
Hydrogen from several Gaussians¶
One Gaussian gave hydrogen 85% of its binding energy. A sum of Gaussians with different exponents does better, and the coefficients come from the same matrix equation. For s-type Gaussians and the matrix elements are known formulas (atomic units):
alpha = np.array([0.15137, 0.68128, 4.5004]) # three exponents, in 1/a0^2
a, b = np.meshgrid(alpha, alpha)
S = (np.pi / (a + b))**1.5 # overlaps
# kinetic energy plus Coulomb attraction, in hartree
H = 3 * a * b / (a + b) * S - 2 * np.pi / (a + b)
E, C = eigh(H, S)
print("lowest root:", round(E[0], 5), "hartree (exact: -0.5)")lowest root: -0.49698 hartree (exact: -0.5)
Source
# synced: gaussian_basis
import numpy as np
import matplotlib.pyplot as plt
from matplotlib.animation import FuncAnimation
from IPython.display import HTML
TEAL, CARDINAL, GRAY, PURPLE, ORANGE = "#107895", "#C8102E", "#6c757d", "#6a3d9a", "#e07b00"
from scipy.linalg import eigh
plt.rcParams.update({"axes.spines.top": False, "axes.spines.right": False})
sets = {1: [0.28294], 2: [0.20153, 1.3325], 3: [0.15137, 0.68128, 4.5004], # best exponents for N Gaussians
4: [0.12195, 0.44454, 1.9623, 13.011], 5: [0.10307, 0.32723, 1.1647, 5.1236, 34.061]}
r = np.linspace(0, 3.2, 600)
Es, curves = {}, {}
for N, al in sets.items():
a, b = np.meshgrid(al, al)
S = (np.pi / (a + b)) ** 1.5 # overlap of exp(-a r^2) and exp(-b r^2)
H = 3 * a * b / (a + b) * S - 2 * np.pi / (a + b) # kinetic plus Coulomb, hartree
E, C = eigh(H, S)
Es[N] = E[0]
curves[N] = abs(sum(c * np.exp(-e * r**2) for c, e in zip(C[:, 0], al)))
fig, (ax, bx) = plt.subplots(1, 2, figsize=(9.6, 4.2), gridspec_kw={"width_ratios": [1, 1.05], "wspace": 0.3})
ax.axhline(-0.5, color=GRAY, lw=1.6, ls=(0, (5, 3)))
ax.text(5.45, -0.5035, r"exact $-\frac{1}{2}$", color=GRAY, fontsize=13, ha="right", va="top")
for N, E in Es.items():
ax.hlines(E, N - 0.32, N + 0.32, color=TEAL, lw=3.4)
ax.text(N, E + 0.004, rf"${E:.4f}$", ha="center", va="bottom", fontsize=11.5, color=TEAL)
ax.set_xlim(0.45, 5.55); ax.set_ylim(-0.512, -0.41)
ax.set_xticks([1, 2, 3, 4, 5]); ax.set_yticks([-0.5, -0.48, -0.46, -0.44, -0.42]); ax.tick_params(labelsize=10.5)
ax.set_xlabel("number of Gaussians", fontsize=12.5); ax.set_ylabel(r"lowest root ($E_h$)", fontsize=12.5)
bx.plot(r, np.exp(-r) / np.sqrt(np.pi), color=GRAY, lw=4.5, alpha=0.55)
for N, ls in ((1, (0, (1, 1.5))), (2, (0, (4, 2))), (3, "-")):
bx.plot(r, curves[N], color=TEAL, lw=2.2, ls=ls)
bx.text(0.2, 0.55, "exact", color=GRAY, fontsize=13, ha="left")
for N, (xx, yy) in ((1, (0.05, 0.245)), (2, (0.05, 0.385)), (3, (0.3, 0.475))):
bx.text(xx, yy, f"{N}", color=TEAL, fontsize=13, ha="left", va="center")
bx.set_xlim(0, 3.2); bx.set_ylim(0, 0.6)
bx.set_xlabel(r"$r$ ($a_0$)", fontsize=12.5); bx.set_ylabel(r"$\psi(r)$", fontsize=12.5); bx.tick_params(labelsize=10.5)
fig.subplots_adjust(left=0.105, right=0.98, top=0.96, bottom=0.14)
plt.show()
Fig. Hydrogen from one to five Gaussians, each set with its best exponents. Left: the lowest root steps down toward the exact and never passes it. Right: the sums of one, two and three Gaussians against the exact . Tight Gaussians build up the cusp at the nucleus.
Three Gaussians recover 99.4% of the energy, -0.4970 of -0.5 hartree, and five recover 99.96%.
This is a basis set. The name STO-3G on a quantum chemistry program’s menu means three Gaussians standing in for each exponential orbital, exactly as here.
Every electronic-structure program solves . The basis functions are Gaussians on each atom, the matrices have thousands of rows, and the eigenvectors are the molecular orbitals (Hartree-Fock, Chapter 8).
The variational method needs a guess and returns a bound, with no estimate of how far above the truth the bound lies. When the problem is a small change to one that is already solved, no guess is needed: perturbation theory corrects the known answer directly.
Problems¶
Problem 1: A tent in a box¶
Use the tent function, for and for , as a trial function for the ground state of a particle in a box. Find and compare it with and with the parabola of the first example.
Solution
The tent has a kink, so is zero everywhere except at one point. Use the first-derivative form of the kinetic energy, . The slope is +1 on the left half and -1 on the right, so throughout:
The tent is 21.6% too high, against 1.3% for the parabola. Both obey the boundary conditions and both have one maximum in the middle, but the tent stays steep all the way to its peak, and counts steepness. The theorem ranks the parabola as the better guess without any reference to the exact solution.
Problem 2: A Lorentzian in a spring¶
Use , with as the parameter, as a trial function for the ground state of the harmonic oscillator, . Show that , minimize it, and compare the result with . Why does this trial function do so much worse than a Gaussian? Useful integrals over all :
Problem 3: Where the 1.3% comes from¶
The normalized parabola has the expansion coefficients for odd and zero for even in the states of the box. (a) Find the probabilities of measuring , and . (b) Compute the average energy from and check it against the example. (c) How large is the error in the wavefunction, and how large is the error in the energy?
Solution
(a) for odd :
The even states are missing because the parabola is symmetric about the middle of the box and they are antisymmetric.
(b) With ,
the value found directly in the example. The first two terms alone give .
(c) The guess is 99.86% ground state. The part that is wrong has weight , an amplitude : the wavefunction is off by about 4%. The energy is off by 1.3%, which is times the cost of the admixed states, mostly at above the ground state: . The error in the energy is second order in the error of the function.
Problem 4: A V-shaped well¶
A particle moves in the well . Use the Gaussian as a trial function. With and for this function, write , minimize it, and show that the best energy is . The exact ground-state energy is . How close is the bound, and which way is it off? Check your value against the widget above, which uses .
Problem 5: Two orbitals that overlap¶
Two identical basis functions on neighboring atoms have , and an overlap , with . Solve the secular determinant and find the two energies and their coefficients. Which level moves farther from ?
Solution
The secular determinant is
Insert each root into the first equation, . For , and so : the mixture . For , : the mixture .
With the levels are , split evenly. With an overlap, measure both from :
The two shifts have the same numerator and opposite signs, but the second is divided by the smaller number . For a bond, is negative: is the bonding orbital, lowered by , and is the antibonding orbital, raised by the larger amount . That asymmetry is why filling both orbitals, as in He, gives no bond (Chapter 8).
Problem 6: Two-electron ions¶
The helium example gives hartree for any nucleus of charge with two electrons. (a) Show that the best exponent is and the best energy . (b) Evaluate it for H () and Li () and compare with the exact energies, -0.5278 and -7.2799 hartree. (c) A hydrogen atom plus a free electron at rest has the energy -0.5 hartree. Does this trial function predict that H is stable? It is, in fact. What does that tell you about the difference between a bound and an estimate?
Problem 7: A bound for an excited state¶
The first excited state of the box, , is antisymmetric about the middle. Use the antisymmetric trial function to bound . Why is the result an upper bound to and not merely to ?
Solution
Set and use units of . Then and :
The bound is 6.4% high. It bounds because is antisymmetric about the middle of the box, and every symmetric state, included, is orthogonal to it. In the expansion only the antisymmetric states appear, and the lowest of them is . The proof of the theorem then runs as before, with in the role of the lowest level.
Problem 8: One more Gaussian¶
(a) Explain in two sentences why adding a basis function to a linear variational calculation can never raise the lowest root. (b) Test it. In the three-Gaussian cell above, add a fourth exponent of your choice and rerun; then try several values between 0.05 and 50. Does the energy ever rise above -0.49698? (c) Which values of the fourth exponent help most, very small ones, very large ones, or ones between those already present? Relate your answer to the two things a Gaussian gets wrong about the hydrogen atom.