Notebooks · lib/hf/casida
Excitation energies from the Casida equation
Linear response of a closed-shell RHF ground state: the singlet or triplet excitation energies, in the Tamm-Dancoff approximation (TDA) and in time-dependent Hartree-Fock (TDHF, also called the random-phase approximation), from the orbital energies and the two-electron integrals in the molecular-orbital basis.
import basis.pople631g
from hf.mole import molecule
from hf.opts import scf_defaults
from hf.scf import integrals
from hf.scf_loop import scf
from hf.casida import CASIDA_SINGLET, casida_mo, casida_solve
mol = molecule("O 0 0 0; H 0 -0.757 0.587; H 0 0.757 0.587", "6-31g")
p = integrals(mol, scf_defaults())
mo = casida_mo(p, scf(p))
singlets = casida_solve(mo, CASIDA_SINGLET)
show singlets.tdhf[0]
With orbital energies and integrals over real orbitals (chemists' notation), for occupied and virtual ,
A_ia,jb = d_ij d_ab (e_a - e_i) + c (ia|jb) - (ij|ab)
B_ia,jb = c (ia|jb) - (ib|ja)
with c = 2 for singlets and c = 0 for triplets. TDA diagonalizes .
TDHF solves the non-symmetric problem of size through the symmetric
one of size , , which
needs positive definite: the ground state must be stable against
these orbital rotations.
The integrals are dense, [m, m, m, m], from lib/hf/stab's four quarter
transforms, and and are dense too: meant for small molecules.
posts/2026-09-25-casida-tdhf-and-tda-for-water.viv holds all 160 energies of
water in 6-31G to PySCF's.
Used with import hf.casida.
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 (CasidaMo), 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.