This site is version 0.0.1. Most of the code on this site is drafted by an agent and needs review. I apologize for the AI-speak, we are working on rewriting it!
viv-lang.org

Notebooks · lib/hf/rhf

Restricted Hartree-Fock, one set of orbitals with two electrons in each

For a closed shell, with as many alpha as beta electrons, RHF puts both spins in the same orbitals. The state is one total density D = 2 C_occ C_occ^T (PySCF's make_rdm1), the Fock matrix is F = H + J - K/2 and the energy E = E_nuc + (1/2) Tr D (H + F). The loop that solves it is lib/hf/scf_loop's, shared with UHF and ROHF; this page holds the RHF checks against PySCF 2.5.0, on the reference integrals of lib/hfref:

  • every combination of guess, accelerator, orthogonalizer, eigensolver, J/K member, level shift and DIIS size the presets list lands on PySCF's water 6-31G energy and density;
  • DIIS converges water 6-31G from the core guess in 6 to 19 iterations, plain iteration in 31 to 99;
  • water STO-3G, water 6-31G* in 6D and 5D, helium in STO-3G and cc-pVDZ, the bare helium dication and PySCF's atom-free model;
  • the diffuse H4 chain, where canonical orthogonalization drops a vector;
  • stretched water, which has two RHF states: the run lands on one, and the plain step from each of PySCF's densities moves it as little as PySCF's own step does;
  • 200 iterations past convergence stay on the solution.

A run here is

p = scf_setup(H, S, G, na, na, enuc, scf_defaults())
r = scf(p)

with the options changed by a record update, for example ScfOptions { guess: GS_CORE, ..scf_defaults() }. Programs that start from a molecule use lib/hf/scf instead.

Used with import hf.rhf.

Look inside this program

  • Atlas

    The program’s map: every function and which calls which.

  • There’s no recorded run of this program yet.

This program declares a record type (RhfPresets), and records run only in compiled C for now, so the Run buttons here are off. Open it in the workbench and use its C tab to compile it.

Shift+Enter in a cell runs it and moves to the next. Running a cell runs every cell above it too, as one program.

[1]lines 37–349