pycc.cphf

cphf.py: coupled-perturbed Hartree-Fock (CPHF) orbital response.

Solves the RHF first-order orbital-response (CPHF / CPSCF) equations in the MO basis. For a perturbation lambda, the occupied-virtual orbital rotations U^lambda_ia satisfy a single perturbation-independent linear operator (the singlet orbital Hessian G) applied to a perturbation-specific right-hand side B:

sum_jb  G_iajb  U_jb  =  B_ia

The occupied-occupied and virtual-virtual blocks of the response are fixed separately by the overlap derivative (orthonormality), so only the ov block is solved here.

The two-electron part of G is written with the spin-adapted integrals L = 2<pq|rs> - <pq|sr> (physicist’s/Dirac notation, already stored as H.L):

electric (real perturbations -- nuclear, electric field):
    G_iajb = (e_a - e_i) d_ij d_ab + L[a,j,i,b] + L[a,b,i,j]
magnetic (imaginary perturbations -- e.g. AATs):
    G_iajb = (e_a - e_i) d_ij d_ab + L[a,j,i,b] - L[a,b,i,j]

The simplest perturbation is the electric field: it does not move the basis functions, so its right-hand side is just the (negated) MO dipole integrals (B = -mu, since the field enters as -mu . E) with no overlap/Pulay terms – it exercises the solver in isolation.

Scope: this class computes only quantities intrinsic to the CPHF equations – the orbital Hessian, the perturbation right-hand sides (field / magnetic / nuclear), and the response coefficients U (and the cached nuclear by-products the Hessian reuses). The HF property tensors built from U – polarizability, dipole derivatives (APTs), molecular Hessian, atomic axial tensors – live on HFwfn, which asks this solver for the relevant U and contracts it with the property integrals.

Lives on the Wavefunction base (lazy self.cphf); it depends only on base state (o/v, the Fock diagonal, the orbital-Hessian integrals) plus the dipole integrals, and is shared by HF, MP2, and CC orbital response.

Reference code: tensor contractions route through the device-aware self.contract (ContractionBackend, shared from the wavefunction), while the explicit orbital Hessian is solved directly with numpy.linalg (a small dense solve, left on NumPy).

Classes

CPHF(wfn[, full_occ])

RHF coupled-perturbed Hartree-Fock orbital-response solver (MO basis).

Perturbation(kind, comp)