Skip to main content
Sandbox Physics

Build a Self-Consistent Hydrogen Molecule

How can an electron density agree with the field it creates? Start with a trial density, calculate its mean field, and solve for new orbitals. Repeat until the density changes negligibly and agrees with the field. This finds a self-consistent Hartree–Fock state; its energy still depends on the allowed orbitals.

Pull the two nuclei apart and follow the density as a Hartree–Fock calculation settles. Replay its actual iterations and see how the total energy and self-consistency residual change.

Interactive modelBuild a Self-Consistent Hydrogen Molecule
Total RHF energy−1.12-1.12
Self-consistency residual (hartree)5.94×10−105.94\times10^{-10}
Iteration3131
Electron number22

One density, one self-consistency test

Calculated in your browser · STO-3G

Total energyResidual

Current AO density matrix

P=(0.6030.6030.6030.603)P=\begin{pmatrix}0.603&0.603\\0.603&0.603\end{pmatrix}

A changing density changes the Fock operator. The residual measures whether the two agree.

Units, density and calculation detailsTr⁡(PS)=2\operatorname{Tr}(PS)=2

All total energies include nuclear repulsion. FCI solves the same finite Hamiltonian as HF. The saved calculation includes its geometry, method, density matrices and numerical diagnostics.

The logarithmic plot displays residuals below the following level at that floor; the numerical readout retains the calculated value. 10−1510^{-15}

Learn how the calculation works, from orbitals to a broken bond

Build a Self-Consistent Hydrogen Molecule

BackgroundIn Hartree–Fock theory, electrons move in a mean field built from the occupied orbitals. Changing an orbital changes that field, so a single diagonalization is usually only the beginning.

Why it mattersWatching the actual density and residual explains what a converged calculation has achieved.

One-sentence intuition
Self-consistency means the occupied orbitals agree with the mean field generated by their own density.

Core mathematical model

Solve in a nonorthogonal atomic basis

FC=SCε,Pμν=2∑i∈occCμiCνiFC=SC\varepsilon,\qquad P_{\mu\nu}=2\sum_{i\in\mathrm{occ}}C_{\mu i}C_{\nu i}

The overlap matrix accounts for atomic orbitals that overlap in space. Two electrons occupy each restricted spatial orbital.

Check whether density and field agree

r=12∥FPS−SPF∥F,N=Tr⁡(PS)=2r=\tfrac12\lVert FPS-SPF\rVert_{\mathrm F},\qquad N=\operatorname{Tr}(PS)=2

The residual is the root-mean-square matrix commutator for this two-orbital basis. It vanishes at self-consistency. The overlap-weighted trace counts electrons.

Common difficulties

Convergence and accuracy

Typical misconceptionA tiny residual means the molecular energy is exact.

Better mental modelThe residual checks self-consistency inside the chosen Hartree–Fock model. Missing configurations and basis functions still limit the answer.

Run the experiment

  1. 01

    Predict before stretching

    Choose Near the energy minimum, then Correlation grows. Say what you expect the density and the energy difference to do before changing the preset.

    What to observe: The molecular density separates into two lobes, and the restricted description loses accuracy as the bond stretches.
  2. 02

    Replay a numerical decision

    Press Replay iterations, then move the iteration slider. Compare an uneven initial guess with a nearly symmetric guess.

    What to observe: Different guesses take different paths. The converged restricted density agrees when the same solution is reached.
  3. 03

    Save a reproducible comparison

    Use Save calculation at two separations. Compare the saved basis, geometry, density matrices and total energies.

    What to observe: Every record identifies the finite electronic model. Comparing it with a larger basis tests a separate source of error.

Related experiments and articles

What this page links to directly

See every article series on the content map →

Continue exploring

Electrons and nuclei in molecules

How do electrons and nuclei move together in atoms and molecules?

  1. LabHydrogen Orbitals & SpectraChange the target angular momentum and compare an allowed and a forbidden line at one energy.
  2. You are hereBuild a Self-Consistent Hydrogen MoleculeDrag the gold nucleus to a new separation, then replay the iterations as the density settles.
  3. LabWhy Hartree–Fock Struggles to Break a BondPull the two nuclei apart and watch the RHF energy rise above the exact FCI curve.
  4. LabMap Electronic-Structure Errors Along a BondSwitch between RHF, UHF, MP2 and PBE and see where each energy error grows along the bond.
  5. LabCoupled Vibrations in Two-Dimensional IRCompare the coupled and independent-vibration presets and look for the cross peaks.
  6. LabThree Ways Through an Avoided CrossingDrag the incoming arrow to change momentum and compare how three methods split the packet.
  7. LabThrough a Conical IntersectionChange the off-centre displacement and watch how much probability switches surfaces.
  8. LabGeometric Phase Around a Conical IntersectionDrag the circuit off the intersection and watch the dark central fringe turn bright.

Molecular electrons and breaking bonds · Reading path

Orbitals, self-consistency, correlation and dissociation

Articles on this path that use this experiment, followed by the other experiments they suggest.

  1. ArticleChoosing an orbital for one hydrogen electron
  2. ArticleTurning a molecule into a small matrix problem
  3. ArticleMaking the density and its field agree
Something broken, confusing, or missing on this page?Tell us
What kind of feedback?

Sent with this page’s address, its Lab ID, the site language and your device type. Please leave out personal details. Feedback is kept for up to 12 months.Privacy policy