SCESS-LISP
Where SCESS started, a restricted Hartree–Fock solver written from scratch in Common Lisp.
- Common Lisp
- SBCL
- Quantum chemistry
- LLA (LAPACK)
- Lisp-Stat
- ASDF
Gaussian basis sets, the one- and two-electron integrals and the self-consistent field procedure, implemented from the textbook formulas in Common Lisp. It computes the ground-state energy of water in the STO-3G basis, and later became the C++ SCESS.
SCESS-LISP is the first version of SCESS: a restricted Hartree–Fock (RHF) program written in Common Lisp while I was learning both the language and the method. It has everything an SCF calculation needs, built from scratch: Gaussian basis functions, every integral, and the self-consistent field loop.
What it computes
The program builds a water molecule (0.957 Å bonds, a 104.5° angle), loads the STO-3G basis set from JSON and runs RHF to convergence:
- Integrals. Overlap \(S\), kinetic \(T\) and nuclear attraction \(V\) matrices, plus the two-electron integrals \((ij|kl)\).
- Orthogonalisation. \(X = S^{-1/2}\), from the eigendecomposition of \(S\) (through LLA and LAPACK).
- SCF loop. Build the Fock matrix \(F = H^{\text{core}} + G(P)\), transform it, diagonalise it, rebuild the density matrix \(P\), and repeat until \(P\) changes by less than \(10^{-5}\).
The integrals
The integrals use the Taketa–Huzinaga–O-ohata expansion over Cartesian Gaussians: binomial polynomial coefficients, A-factors for the nuclear attraction and B-coefficients for electron repulsion. The Boys function comes from the incomplete gamma function. Two-electron integrals are stored once each in a hash table, under a Yoshimine index that folds in their eightfold permutational symmetry:
(defun YoshimineIndex (i j k l)
(if (< i j)
(let ((swapVar i))
(setf i j)
(setf j swapVar)))
(if (< k l)
(let ((swapVar k))
(setf k l)
(setf l swapVar)))
(let ((ij (+ (* i (/ (+ i 1) 2)) j))
(kl (+ (* k (/ (+ k 1) 2)) l)))
(if (< ij kl)
(let ((swapVar kl))
(setf kl ij)
(setf ij swapVar)))
(return-from YoshimineIndex (+ (* ij (/ (+ ij 1) 2)) kl))))
What came next
The same THO expansion lives on. SCESS reimplemented the method in C++ and
grew to coupled cluster, explicitly correlated F12 methods and quantum Monte Carlo.
dhERI now generates GPU kernels for exactly these electron-repulsion integrals.
SCESS-LISP is built with ASDF's program-op into standalone SBCL executables.