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

Build your own SCF

Quantum Chemistry

Below is the complete output of a converged Hartree-Fock calculation on H₂ — the same one the live wasm SCF on this site produces, the same numbers the course's lessons keep quoting. Your assignment, in six projects: rebuild this output, line by line, in a live Python editor, until your own code prints the final answer.

the target — H₂ / STO-3G, R = 1.4 bohr
S: [[1, 0.659318], [0.659318, 1]] project 2 → T: [[0.760032, 0.236455], [0.236455, 0.760032]] project 3 → V: [[-1.88044, -1.19483], [-1.19483, -1.88044]] project 3 → H_core: [[-1.12041, -0.95838], [-0.95838, -1.12041]] project 3 → eri: [0.774606, 0.444108, ..., 0.297029, ..., 0.774606] project 4 → X: [[1.24479, -0.468479], [-0.468479, 1.24479]] project 5 → E_nuc: 0.714286 project 6 → iter: 0 E_total: -1.79131 delta: 0.602657 project 6 → iter: 1 E_total: -1.11671 delta: 4.4e-16 project 6 → E_total: -1.11671 project 6 →

Each project is a function or two. Tests check your numbers against the run; passing unlocks a short quiz that asks you to explain what your code is doing, because running code is not the same as understanding it. Every starter ships the previous milestones as a toolkit, so a rough patch never blocks the path.

  1. 1 The Boys function you write: boys_f0(T) rebuilds the number inside every Coulomb line: F₀(1) = 0.746824
  2. 2 Overlap you write: prim_overlap + overlap(μ,ν) rebuilds the S line
  3. 3 The core Hamiltonian you write: kinetic + nuclear + H_core rebuilds the T, V, and H_core lines
  4. 4 Electron repulsion you write: prim_eri + eri(μ,ν,λ,σ) rebuilds the eri line
  5. 5 Orthogonalization you write: x_matrix() = S^(−1/2) rebuilds the X line
  6. 6 The SCF loop you write: scf_energy() rebuilds the iterations — and the final answer

Beyond the run

The output above is mean-field, fixed-geometry, one molecule. Three more projects go where it never went: past Hartree-Fock, off the fixed bond length, and onto the textbook's own test molecule — with Szabo & Ostlund's published tables as the answer key.

  1. 7 MP2: buying back correlation you write: mo_ovov + mp2_report() E₂ = −0.013158 — below the run’s final answer
  2. 8 The dissociation curve you write: scf_energy_r(R) E(6.0) = −0.645 vs two atoms at −0.933: RHF caught failing
  3. 9 HeH⁺: the transfer test you write: per-atom basis + heh() E = −2.8607 — Szabo & Ostlund’s own table
  4. 10 UHF: fixing the curve you write: uhf_report(R) E(6.0) = −0.9332 ≈ two atoms — at the price ⟨S²⟩ → 1
  5. 11 Charges & dipole you write: charges() + dipole_z() q_He = +0.47, μ = 0.889 a.u. — properties, finally

Lineage: the discipline of a checkable milestone after every function is borrowed, with admiration, from the Crawford group's quantum chemistry programming projects. The rebuild-the-run framing, in-browser execution against this site's own artifact, and the explain-your-code gates are this course's additions.