Skip to content

propSAPT's own CPSCF solver; Psi4 supplies only the orbital-Hessian products - #6

Merged
btyrcha merged 3 commits into
mainfrom
feature/cpscf-solver
Nov 19, 2026
Merged

btyrcha merged 3 commits into
mainfrom
feature/cpscf-solver

Conversation

@btyrcha

@btyrcha btyrcha commented Nov 9, 2026

Copy link
Copy Markdown
Owner
  • New prop_sapt/cpscf_solver.py: a batched, preconditioned conjugate-gradient solver. It replaces Psi4's internal p4util.cg_solver and Matrix.apply_denominator, which propSAPT no longer uses. Like before, it starts from the uncoupled amplitudes, each vector converges on its own relative residual, and each iteration applies the Hessian to all unconverged vectors in one call.
  • New orbital_hessian_product(monomer, vectors) on the dimer: the positive definite orbital Hessian, from Psi4's cphf_Hx (which returns its negative), with the cpscf_type J/K object swapped in for each product. cpscf_batch solves H t = -omega, so the amplitudes keep their convention.
  • A solve that has not converged in cpscf_maxiter iterations now raises a RuntimeWarning and writes a line to the output file, where it used to go on silently. The CPSCF log in the output file has a new format.

Tested: unit tests of the solver on small dense systems (no SCF); new He–H2 tests that the amplitudes solve their equations and that the Hessian product is symmetric and positive; the cpscf_type failure test now fails the Hessian product. The full suite passes locally (477 passed, 2 skipped, 2 xfailed). In one process on He–H2 (RHF and PBE0, SCF and DF J/K), the amplitudes agree with the old solver to 4e-13, with the same Hessian-product calls.

🤖 Generated with Claude Code

btyrcha and others added 3 commits November 19, 2026 12:10
… equations

`prop_sapt.cpscf_solver.conjugate_gradient` solves H x = b for several right-hand sides,
taking the products of all unconverged vectors in one call, each vector converging on its
own. It starts from b / diagonal and stops at a relative residual below `r_convergence`,
as Psi4's `p4util.cg_solver` does, and warns when a vector has not converged or meets a
direction of non-positive curvature. Unit tests on small dense systems, no SCF.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…l-Hessian products

`cpscf_batch` solves H t = -omega with `conjugate_gradient`, where H is the positive
definite orbital Hessian of the new `orbital_hessian_product`. That wraps `cphf_Hx`, which
returns -H, and swaps in the CPSCF J/K object for each product. `p4util.cg_solver` and
`Matrix.apply_denominator` are no longer used. The amplitudes agree with the old solver
to 4e-13 for He-H2 (RHF and PBE0, SCF and DF J/K), with the same iterations.

Tests: the amplitudes solve their equations, the Hessian is symmetric and positive, and
the J/K restore after a failure now fails the Hessian product instead of the solver.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@btyrcha
btyrcha force-pushed the feature/cpscf-solver branch from abdae0b to a63a0a7 Compare November 19, 2026 11:20
@btyrcha
btyrcha merged commit 7d6cbcf into main Nov 19, 2026
4 checks passed
@btyrcha
btyrcha deleted the feature/cpscf-solver branch November 19, 2026 12:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant