Notebooks · lib/hf/guess
Five initial densities for the SCF
The SCF is a fixed-point iteration, and like any fixed-point iteration it needs a starting point. When a molecule has more than one SCF solution, the start decides which one it lands on, so the guess is a strategy with its own registry, not a detail. Open shells make this concrete: from the core guess, UHF on OH converges to the excited 2Sigma+ state (0.155 Eh above the 2Pi ground state PySCF reports), and UHF on triplet water lands 0.082 Eh above PySCF's state. Both are genuine SCF solutions, with the unpaired electron in the wrong orbital.
Every member returns spin densities [2, n, n], Da and Db, each built
from orbitals occupied once. A closed-shell driver adds them.
gs_avg(member 0, production): an SCF on the spin-averaged density first. AllN = Na + Nbelectrons go into one set of orbitals, two per orbital, and the electrons left at the top are shared equally by the orbitals of the highest level that is only partly filled (a pi pair holding 3 electrons gets 1.5 in each orbital). Averaging keeps degenerate orbitals equivalent, so the iteration does not commit to one of them early. It starts from the GWH matrix below; when it converges (or afterGS_AVG_MAXITsteps), the lowestNaof its orbitals giveDaand the lowestNbgiveDb. Measured with CDIIS: from this guess UHF lands on PySCF's state for OH 6-31G, O2 STO-3G and triplet water 6-31G. Started from the core Hamiltonian instead, the averaged SCF sends OH and O2 to the same higher states the core guess reaches. It builds J and K withjk_packed, so it needs the packed integrals.gs_core: drop the electron-electron repulsion and diagonalize the core HamiltonianH = T + V, then occupy the lowest orbitals. PySCF calls this the1eguess. It ignores the electrons' repulsion entirely, but it is cheap and needs onlyHandS.gs_gwh: the generalized Wolfsberg-Helmholz guess, an extended-Huckel style matrixF_ij = K S_ij (H_ii + H_jj) / 2off the diagonal (withK = 1.75) andF_ii = H_ii.gs_zero: zero densities. The first Fock matrix is thenH, so the first iteration reproducesgs_coreone step later.gs_import: the densities the caller passes inD0, unchanged. This is how a PySCF density enters an SCF run (import mode).
Member signature: (H, S, Gp, D0, opts) -> [2, n, n], five arrays like the
J/K stage. D0 is [2, n, n] and only gs_import
reads it; Gp is the packed ERI vector and only gs_avg reads it. Electron
counts, the orthogonalizer (opts[OPT_ORTH]) and the eigensolver
(opts[OPT_EIGEN]) come from opts. The guesses PySCF uses by default
(minao, atom, huckel) need atomic data this library does not carry yet.
Used with import hf.guess.
Look inside this program
- Atlas
The program’s map: every function and which calls which.
There’s no recorded run of this program yet.
Shift+Enter in a cell runs it and moves to the next. Running a cell runs every cell above it too, as one program.