Fundamentals / Physics / Quantum mechanics

Estimating a ground-state energy

Construct a variational upper bound, optimize the length of a trial orbital and evaluate what the bound says about its shape.

From first principles

Why minimizing a trial energy gives an upper bound

Take a self-adjoint Hamiltonian bounded below, with ground energy \(E_0\). Choose a nonzero trial state obeying the physical boundary conditions and having finite energy expectation. For a discrete spectrum, expand it in normalized eigenstates \(|n\rangle\). Orthonormality removes cross terms when the Hamiltonian acts on this expansion:

\[|\psi\rangle=\sum_n c_n|n\rangle,\]
\[\frac{\langle\psi|H|\psi\rangle}{\langle\psi|\psi\rangle}=\frac{\sum_n |c_n|^2E_n}{\sum_n|c_n|^2}.\]

Subtract \(E_0\). Each term now contains a nonnegative weight times a nonnegative excitation energy, giving

\[E[\psi]-E_0=\frac{\sum_n|c_n|^2(E_n-E_0)}{\sum_n|c_n|^2}\ge0 .\]

A continuum contribution gives the same inequality with an integral. Optimizing a trial length or mixing coefficient decreases the smallest accessible value of this quotient. Equality requires all weight to lie in the ground eigenspace; a low estimated energy alone does not specify which local features of the wave function are accurate. Checking a width, contact density or other independent observable tests the adequacy of the chosen trial family.

Background · Variational energy
\[E[\psi]=\langle\psi|H|\psi\rangle/\langle\psi|\psi\rangle\]

For an admissible nonzero trial state and a Hamiltonian bounded below, this is an upper bound on the lowest energy. A good energy can hide a less accurate state.

Derivation and applications

Optimize a superposition when the trial functions overlap

A single variational length can improve the size of a trial orbital, but it cannot reproduce every possible shape. A second trial function introduces a mixing coefficient. Frequently two convenient functions are individually normalized yet overlap. Let the linearly independent functions be \(\phi_1,\phi_2\), let \(H_{ij}=\langle\phi_i|H|\phi_j\rangle\), and define the overlap matrix \(S_{ij}=\langle\phi_i|\phi_j\rangle\). In a trial superposition \(\psi=\sum_i c_i\phi_i\), normalization depends on the cross term:

\[\langle\psi|\psi\rangle=c^\dagger Sc,\]
\[E[c]=\frac{c^\dagger Hc}{c^\dagger Sc}.\]

To find stationary values, minimize \(c^\dagger Hc-E(c^\dagger Sc-1)\) with respect to the complex conjugates \(c_i^*\). Differentiation of each bilinear form removes a single row factor, giving two homogeneous equations for the same coefficients:

\[\sum_j(H_{ij}-ES_{ij})c_j=0,\]
\[\det(H-ES)=0.\]

Because \(S\) is positive definite, the quotient is well defined for every nonzero trial vector. Its smallest root is an upper bound to the exact ground energy. Adding an independent trial function cannot raise this optimum, since setting its coefficient to zero recovers the original trial state. For two equivalent sites with \(H_{11}=H_{22}=h\), \(H_{12}=H_{21}=v\) and real \(S_{12}=s\), add and subtract the rows to obtain

\[E_{\rm sym}=(h+v)/(1+s),\]
\[E_{\rm anti}=(h-v)/(1-s).\]

The signs label symmetry, not a universal ordering. The denominator records the actual norm of each combination. As \(|s|\to1\) one combination becomes nearly redundant; estimating its energy then becomes sensitive to small matrix-element errors.

Worked example

Estimate two trial energies from overlapping orbitals

Take \(h=3.00\) eV, \(v=-0.500\) eV and \(s=0.250\). The symmetric combination yields \(2.50/1.25=2.00\) eV; the antisymmetric combination gives

\[3.50/0.750=4.67\,\mathrm{eV}.\]

The first improves the single-orbital bound by \(1.00\) eV. Normalization of its coefficient vector gives \(c_1=c_2=1/\sqrt{2(1+s)}=0.632\), even though the basis functions are individually normalized.

Second application

Change the energy reference to test an implementation

Shift the Hamiltonian by \(C I\) with \(C=2.00\) eV. In the overlapping basis this changes the matrix to \(H+CS\), because the matrix elements of the identity are \(S_{ij}\). The new diagonal is \(5.00\) eV and the off-diagonal is zero. The two roots become

\[5.00/1.25=4.00,\]
\[5.00/0.750=6.67\,\mathrm{eV}.\]

Both shifted by exactly \(2.00\) eV; leaving the off-diagonal unchanged would fail this energy-reference test.

Try it · Overlap eigen

Vary the physical parameters in the derived relation. Use the units and assumptions in the readout to connect the curves to the two worked examples. A parameter study can test the forward prediction; the same relation can then be inverted to infer a parameter from a measurement.

OneSimulation laboratory

Turn spatial eigenvalues into confinement energies

Start from this chapter. The lowest eigenvalue minimises the Rayleigh quotient. Compare refinements for a polygonal domain and convert the converged spatial eigenvalue to energy using the particle mass and a physical length.

Compare recorded OneSimulation runs on this page. To test your own inputs, download the notebook and model files and run the model in an activated OneSimulation environment.

The isospectral drums notebook solves the Dirichlet eigenproblem on two polygons. It reports lam, the dimensionless squared wave number \(\lambda_n=k_n^2\ell^2\). Its length unit is 0.1 m for the drum. To interpret a geometrically similar quantum well, assign that unit a quantum length \(\ell\) in metres. Read the shapes and eigenvalues from the spatial solve; quantum time evolution and measurement probabilities for a chosen state follow analytically. Dirichlet spectra for two different outlines.

Run through the notebook’s results, then add this cell. It converts all ten computed eigenvalues into electron energies. sizes[-1] selects the supplied 0.005 m mesh.

from scipy.constants import hbar, electron_mass, electron_volt

def energies_eV(shape, length_unit_m):
    lam = runs[shape, sizes[-1]]["lam"]
    k_squared = lam / length_unit_m**2             # 1/m²
    return hbar**2 * k_squared / (2 * electron_mass * electron_volt)

print(energies_eV("drum A", 1e-9))
print(energies_eV("drum B", 1e-9))
print(energies_eV("drum A", 2e-9))
  1. Baseline. Assign 1 nm to the length unit in shape A. Check that the lowest dimensionless value agrees with 2.537944 within 0.01%, giving \(E_1\) near 0.09670 eV. The 1 nm unit sets the geometric scale of the polygon.
  2. Change the outline. Select shape B at the same scale. Compare the ground energies within 0.01% and inspect the first-mode maps. Equal eigenvalues can coexist with different spatial distributions.
  3. Change the confinement length. Keep shape A and set its quantum length unit to 2 nm. Check \(E_1(2\,\mathrm{nm})/E_1(1\,\mathrm{nm})=1/4\) and verify the ratio for an excited state. No new mesh is required for this exact uniform scaling.
Numerical Dirichlet eigenvalues mapped to electron ground-state energies
Quantum wellLowest eigenvalue λ₁Mapped energy (eV)
Shape A, 1 nm unit2.5379610.09669586
Shape B, 1 nm unit2.5379660.09669606
Shape A, 2 nm unit2.5379610.02417397
Both polygonal wells give nearly the same ground energy at the 1 nm length scale. Doubling the scale quarters the energy inferred from the spatial eigenvalue.
Both polygonal wells give nearly the same ground energy at the 1 nm length scale. Doubling the scale quarters the energy inferred from the spatial eigenvalue.
Download experiment files (ZIP) Extract the files together and open isospectral_drums.ipynb in a local OneSimulation environment.

Problem sheet 6 · Which energy change really establishes a length change?

Read the model setup and preparatory problems

Can changing a Gaussian width repair a missing cusp?

A good variational parameter can optimise the extent of a bound state without correcting its local shape. A one-dimensional attractive contact has a precisely known derivative jump. Compare two trial families and test which aspect of their shape the energy notices.

Start from the jump that the potential enforces

Use length and energy units in which \(\hbar=m=1\), and take \(V(x)=-g\delta(x)\) with \(g>0\). Integrating the stationary Schrödinger equation between \(-\epsilon\) and \(+\epsilon\) and taking the limit gives

\[\psi'(0^+)-\psi'(0^-)=-2g\psi(0).\]

The wavefunction itself is continuous. Outside the contact a bound eigenstate decays as \(e^{-\kappa|x|}\), and the derivative jump fixes \(\kappa=g\). Its exact energy is \(-g^2/2\).

For a normalised admissible trial function the quadratic form is \(E[\psi]=\tfrac12\int|\psi'|^2dx-g|\psi(0)|^2\). This form permits smooth trials that do not obey the eigenstate jump: they have finite energy and give legitimate upper bounds. Consider the normalised Gaussian \(\psi_b=(b^2/\pi)^{1/4}e^{-b^2x^2/2}\) with \(b>0\). Its mean \(x^2\) is \(1/(2b^2)\), and its derivative is \(-b^2x\psi_b\). The two contributions yield

\[E_G(b)=\frac{b^2}{4}-\frac{gb}{\sqrt{\pi}},\]
\[b_{\rm opt}=\frac{2g}{\sqrt{\pi}},\]
\[E_G^{\min}=-\frac{g^2}{\pi}.\]

Compare with \(\psi_a=\sqrt{a}e^{-a|x|}\). Here the two half-lines both contribute to a total kinetic term \(a^2/2\) and the contact samples \(|\psi_a(0)|^2=a\). Minimising \(a^2/2-ga\) gives \(a=g\), the exact solution. For \(g=1\) the Gaussian optimum is about \(-0.31831\), whereas the exact value is \(-0.5\). The negative Gaussian energy suffices to prove binding below the free continuum. Its magnitude still underestimates the binding energy by about 36 per cent.

Optimised Gaussian and cusp probability densities next to variational energies as each inverse length is varied.Open full-size diagram
Both energy curves are upper bounds. Only the family capable of reproducing the correct derivative jump reaches the exact ground energy.
Try it · Cusp trial

Change the inputs and compare the recalculated curves with the preceding derivation and baseline figure. The axes give the units; the numerical readout states the model assumptions and any limiting cases. Reset the inputs to return to the reference setting.

Download the corresponding editable notebook. The browser recalculates the reduced equations directly; the notebook exposes the full calculation and its checks.

The notebook separates trial-width error from the limitation of the trial family. Retune both widths together and observe the quadratic rise near each minimum. At the exact cusp width, a ten per cent fractional width error raises the cusp energy by just one per cent of the binding energy. That energetic insensitivity does not mean that contact observables are equally accurate: the central probability density changes linearly with \(a\). A variational energy can therefore look well converged before a highly local observable has converged.

An optimiser gives \(E=-0.315\) at \(g=1\) within the Gaussian family. Could a better scalar width alone bring it within one per cent of the true binding energy? What further check would distinguish optimisation error from model error?

Work through the solution

The minimum possible within the family is \(-1/\pi\), already far above \(-0.495\), the target upper bound for one-per-cent accuracy. Optimising \(b\) can recover only the difference between \(-0.315\) and \(-0.31831\). Check the analytic minimum or sample the curvature around it. Then enrich the family with a cusp degree of freedom and compare both the energy and the derivative jump or contact density.

A calculation that can be wrong in one direction

An exact time-independent Schrödinger equation can be difficult to solve even when the Hamiltonian is known. The variational principle allows a trial state to make a precise claim about the lowest energy. Suppose the Hamiltonian is self-adjoint and bounded below. Expand any normalized trial state of finite energy in its energy eigenbasis. For a discrete spectrum, with continuum terms replaced by integrals when needed,

\[\langle H\rangle_\psi=\sum_n|c_n|^2E_n\ge E_0\sum_n|c_n|^2=E_0.\]

Lowering an expectation value inside the trial family improves the upper bound. Trial functions must obey the physical boundaries and give finite relevant energy integrals. A smooth function confined to the wrong symmetry sector can converge to the lowest state of that sector while missing the true ground state. To estimate an excited level one needs additional orthogonality or a suitable subspace principle.

OneSimulation · How much can a larger trial space lower an energy?

Confine an electron to an infinite 10 nm well and apply a linear potential rising by twelve untilted ground-state energies from left to right. Expand the wavefunction in the first \(N\) sine functions of the untilted box. They satisfy both boundary conditions exactly. A larger basis contains every earlier trial function, so the lowest Ritz energy can only decrease. The min–max principle gives the corresponding bound for the ordered excited levels.

\[H_{mn}=E_0 n^2\delta_{mn}+\Delta V\int_0^L \frac{2}{L}\sin\frac{m\pi x}{L}\,\frac{x}{L}\,\sin\frac{n\pi x}{L}\,dx,\]
\[E_0=\frac{\hbar^2\pi^2}{2m_eL^2}.\]

OneSimulation diagonalises nested sections of this matrix. The two errors are measured against a 64-function reference, itself a variational approximation. Successive functions improve the ability to concentrate probability near the low-potential wall. Change the tilt to see how the basis size required for a given energy accuracy changes.

"""Rayleigh–Ritz bounds for an electron in a tilted infinite square well."""
import matplotlib.pyplot as plt
import numpy as np
from onesim.numerics.linear.matrices.dense_linear_algebra import symmetric_eigenvalues

width_nm = 10.0
hbar, mass, electronvolt = 1.054571817e-34, 9.1093837e-31, 1.602176634e-19
energy_unit = 1e3 * np.pi**2 * hbar**2 / (2 * mass * (width_nm * 1e-9)**2 * electronvolt)
tilt = 12.0  # end-to-end potential rise in units of the untilted ground energy
basis = np.arange(1, 65)
i, j = basis[:, None], basis[None, :]
position = np.eye(len(basis)) / 2  # matrix of x/L in the sine basis
odd = (i - j) % 2 == 1
position[odd] = 2 / np.pi**2 * (1 / (i+j)[odd]**2 - 1 / (i-j)[odd]**2)
hamiltonian = np.diag(basis**2) + tilt * position
reference = symmetric_eigenvalues(hamiltonian)[:2] * energy_unit
sizes = np.arange(2, 13)
energies = np.array([symmetric_eigenvalues(hamiltonian[:n, :n])[:2] for n in sizes]) * energy_unit
errors = energies - reference
assert np.all(errors > 0) and np.all(np.diff(energies, axis=0) <= 1e-10)
print("64-state reference energies (meV):", reference.round(4))
fig, ax = plt.subplots(figsize=(6.6, 3.5), layout="constrained")
for index, label in enumerate(("Ground state", "First excited state")):
    ax.semilogy(sizes, errors[:, index], "o-", label=label)
ax.set(xlabel="Number of sine functions", ylabel="Excess above 64-state reference (meV)")
ax.grid(alpha=0.2)
ax.legend()
fig.savefig("quantum-mechanics.png", dpi=180)
The ground- and first-excited-state energy excesses decrease on a logarithmic scale as the trial space enlarges.
The reference energies are 21.495 and 38.379 meV. The excited state initially needs more basis functions to reach the same absolute accuracy.

Try it · Ritz basis

Change the inputs and compare the recalculated curves with the preceding derivation and baseline figure. The axes give the units; the numerical readout states the model assumptions and any limiting cases. Reset the inputs to return to the reference setting.

Download the Python example

Choose a length and compute two energies

As an example estimate a hydrogen-like electron bound to a fixed proton by \(V=-\kappa/r\), with \(\kappa=e^2/(4\pi\epsilon_0)\). The exact ground state has a cusp at the origin; deliberately choose the smooth, normalized Gaussian \(\psi=(\pi a^2)^{-3/4}\exp[-r^2/(2a^2)]\). The parameter \(a\) permits expansion and contraction but cannot repair the cusp or the large-radius shape. It therefore tests how much energy a simple length-scale argument can recover.

For a decaying state integration by parts expresses kinetic energy as \(\hbar^2\int|\nabla\psi|^2/(2m)\). Since \(\nabla\psi=-\mathbf r\psi/a^2\) and \(\langle r^2\rangle=3a^2/2\), the result is \(3\hbar^2/(4ma^2)\). For potential energy the radial measure \(4\pi r^2dr\) cancels one power of \(1/r\), leaving \(\langle 1/r\rangle=2/(\sqrt\pi a)\). Thus

\[E(a)=\frac{3\hbar^2}{4ma^2}-\frac{2\kappa}{\sqrt\pi a}.\]

As \(a\) becomes small, kinetic localization costs energy faster than attraction can reduce it. At very large \(a\) the state becomes weakly bound. These limiting trends guarantee an intermediate minimum.

Optimize and assess the answer

With \(a_0=\hbar^2/(m\kappa)\), differentiation gives \(a_*=(3\sqrt\pi/4)a_0=1.329a_0\) or \(0.0703\) nm. The minimized energy is \(-4m\kappa^2/(3\pi\hbar^2)\), about \(-11.55\) eV compared with the fixed-proton result \(-13.61\) eV. It lies above the exact energy by about 2.06 eV, as required. At the optimum the two terms satisfy

\[2\langle T\rangle=-\langle V\rangle.\]

That scaling relation follows from extremization over a length and can hold even with an imperfect wavefunction.

Energy is stationary near an optimum, so a good energy estimate alone cannot certify other observables. For example, sampling the contact probability \(|\psi(0)|^2\) is sensitive to the cusp missing here. One can enlarge the basis using several Gaussian widths and diagonalize the Hamiltonian in their span. The old optimum remains an allowed choice, so the improved lowest eigenvalue can only fall or stay equal.

To see why the energy can be forgiving, resolve a normalized trial state as \(\sqrt{1-\eta^2}|0\rangle+\eta|1\rangle\) using two exact eigenstates. Its energy error is \(\eta^2(E_1-E_0)\), quadratic in the admixture. An observable with a nonzero off-diagonal matrix element between these levels can already change at first order in \(\eta\). Comparing several independent observables therefore tests more of the trial wavefunction than repeating the energy comparison.

Vary an effective nuclear charge for two electrons

Helium presents a variational problem in which the main missing physics can itself be identified. Fix a nucleus of charge \(+Ze\) and use atomic units, where \(\hbar=m_e=e^2/(4\pi\epsilon_0)=1\), length is measured in Bohr radii and energy in hartrees. Ignoring relativity, use \(H=\sum_{i=1}^2[-\nabla_i^2/2-Z/r_i]+1/r_{12}\). Try two identical normalized exponential orbitals \(\phi=(\zeta^3/\pi)^{1/2}e^{-\zeta r}\) with a spin singlet so that the complete electronic state is antisymmetric. The trial parameter \(\zeta\) lets both orbitals expand in response to repulsion.

For either electron the kinetic expectation is \(\zeta^2/2\) and \(\langle1/r\rangle=\zeta\). The two one-body terms together give \(\zeta^2-2Z\zeta\). To compute the interaction, spherical averaging the Coulomb kernel for the isotropic densities gives \(1/\max(r_1,r_2)\), the shell-potential result. Split the radial domain at \(r_1=r_2\) and double the part with \(r_1>r_2\). With radial probability \(P(r)=4\zeta^3r^2e^{-2\zeta r}\) this gives

\[\left\langle\frac1{r_{12}}\right\rangle=2\int_0^\infty\frac{P(r_1)}{r_1}\,dr_1\int_0^{r_1}P(r_2)\,dr_2=\frac{5\zeta}{8}.\]

For the last integration, set \(x=2\zeta r_1\). The inner integral is \(1-e^{-x}(1+x+x^2/2)\), so the remaining integral involves only exponential moments. The repulsion is positive and linear in \(\zeta\): squeezing both clouds together increases typical electrostatic repulsion while the faster quadratic kinetic cost eventually prevents collapse.

Estimate the first ionization energy of helium

For \(Z=2\), minimize \(E(\zeta)=\zeta^2-4\zeta+5\zeta/8\). Setting its derivative to zero gives \(\zeta_*=2-5/16=1.6875\) and \(E_{\rm trial}=-\zeta_*^2=-2.84766\) hartrees, or \(-77.49\) eV relative to a bare nucleus and two free electrons. An unscreened choice \(\zeta=2\) gives \(-2.750\) hartrees. Allowing the cloud to expand lowers the trial energy by about \(2.66\) eV.

The one remaining electron in He\(^+\) is a hydrogenic ion with exact fixed-nucleus energy \(-Z^2/2=-2.000\) hartrees in this model. The trial estimate for removing one electron is therefore \(0.84766\) hartree, or \(23.1\) eV. Because the final one-electron energy is exact while the neutral trial energy is an upper bound, this difference is a lower bound on the model's ionization energy. The trial state allows average screening but leaves the electrons statistically independent in position. Multiplying the product orbital by a factor depending explicitly on \(r_{12}\) can favour configurations where the electrons avoid one another and lower the bound further.

The effective size can be compared directly with the unscreened hydrogenic model. For one exponential orbital \(\langle r\rangle=3a_0/(2\zeta)\), so the optimum mean radius for either electron is \(0.889a_0\), compared with \(0.750a_0\) at \(\zeta=2\). The increased radius and reduced energy come from the same variation, but they have different error guarantees. Variational minimization bounds energy, while no analogous inequality requires this mean radius to be either above or below its exact value. Comparing the inferred radius with scattering or density data therefore probes trial-wavefunction quality beyond the energy test.

Diagnose the missing electron correlation locally

The optimum product state gives a useful upper bound yet treats the positions of the two electrons as statistically independent. A short-distance diagnostic follows by asking what happens when the electrons approach each other while remaining away from the nucleus. Introduce relative coordinate \(\mathbf r=\mathbf r_1-\mathbf r_2\) and a centre coordinate. In atomic units the relative part of their kinetic Hamiltonian has the term \(-\nabla_r^2\), since the reduced mass is one half. The Coulomb repulsion is \(1/r\). For a singlet with nonzero amplitude at coincidence, expand its spherical average near \(r=0\) as \(\psi(r)=\psi(0)(1+cr+\cdots)\).

The radial Laplacian of the linear term is \(2c\psi(0)/r\). If the Schrödinger equation is to admit a finite eigenvalue without an uncancelled \(1/r\) term, the relative kinetic and repulsive singularities must cancel:

\[-2c\,\psi(0)/r+\psi(0)/r=0,\]
\[c=\tfrac12 .\]

Thus the spherical average of the amplitude initially rises away from pair coincidence. The positive slope quantifies a correlation hole. A simple product of smooth one-electron orbitals has no such first-order slope at an ordinary coincident position. Optimizing its single length scale can reproduce average screening without satisfying this local condition.

For a separation of \(0.10a_0\), the leading cusp term predicts a relative amplitude roughly five percent above its coincident value at fixed electronic centre, before quadratic corrections. Squared probability density therefore rises by about ten percent to first order. This compares local densities, not the count per radial shell, which also contains the shell area factor. A trial factor \(1+r_{12}/(2a_0)\) supplies the required initial slope while leaving a separate orbital scale available for long-distance screening. Its potential to improve the energy is motivated by a local equation, rather than simply by the fact that adding another variational parameter cannot worsen a minimum.

Choose a variational length in a linear trap

Take \(H=-\tfrac12d^2/dx^2+|x|\) and a normalised trial amplitude proportional to \(\exp[-x^2/(2s^2)]\). Integration of the gradient and potential terms gives \(1/(4s^2)\) and \(s/\sqrt\pi\). Use their sum as a ground-state upper bound.

Choose a variational length in a linear trap. Horizontal axis: Gaussian trial width (scaled length). Vertical axis: Energy (scaled units). Data follow the figure.
The minimum occurs at s³ = √π/2, or s ≈ 0.961, giving a variational energy near 0.813. At this optimum twice the kinetic contribution equals the potential contribution, a useful independent check on the scaling calculation.
Try it · Linear variational

Change the inputs and compare the recalculated curves with the preceding derivation and baseline figure. The axes give the units; the numerical readout states the model assumptions and any limiting cases. Reset the inputs to return to the reference setting.

Read values from the plot
Energy (scaled units) at selected values of Gaussian trial width (scaled length).
Gaussian trial width (scaled length)Total trial energyKineticPotential
0.41.78821.56250.22568
0.851510.825210.34480.48041
1.3030.882390.147250.73514
1.74851.06830.0817730.98648
2.21.29290.0516531.2412

Download all 300 plotted samples (CSV)

Study the full derivation

Two electrons, exchange splitting and the cost of localisation · Quantum states, dynamics and measurement

Build a two-electron state that respects exchange, derive its charge and spin correlations, and then solve a two-site model exactly. The two examples reveal when a triplet is favoured and when an apparently weak hopping lowers the singlet instead.