Add ROHF GDM#453
Conversation
There was a problem hiding this comment.
Pull request overview
This PR enables ROHF (restricted open-shell) support in the SCF GDM/DIIS_GDM convergence path by adding ROHF-specific convergence matrix handling to the SCFAlgorithm base and extending GDM to handle ROHF orbital rotations/gradients.
Changes:
- Allow ROHF runs to use
SCFAlgorithmName::GDMandSCFAlgorithmName::DIIS_GDM(previously blocked). - Centralize ROHF “effective Fock + total density” convergence-matrix caching in
SCFAlgorithmand reuse it from DIIS/convergence checks. - Add ROHF-specific kappa packing, orbital rotation, pseudo-canonical transformations, and gradient computation in GDM.
Reviewed changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| cpp/tests/test_scf.cpp | Removes the test that asserted ROHF+GDM is invalid (no replacement added). |
| cpp/src/qdk/chemistry/algorithms/microsoft/scf/src/scf_algorithm/scf_algorithm.cpp | Enables ROHF+GDM/DIIS_GDM in the factory; adds ROHF convergence-matrix caching in base algorithm. |
| cpp/src/qdk/chemistry/algorithms/microsoft/scf/src/scf_algorithm/gdm.cpp | Implements ROHF-specific rotations, gradients, and pseudo-canonical/Hessian logic for GDM line search + iteration. |
| cpp/src/qdk/chemistry/algorithms/microsoft/scf/src/scf_algorithm/diis.h | Removes DIIS-owned ROHF cache API and updates internal helper signature. |
| cpp/src/qdk/chemistry/algorithms/microsoft/scf/src/scf_algorithm/diis.cpp | Switches DIIS ROHF handling to use SCFAlgorithm’s shared ROHF convergence cache. |
| cpp/src/qdk/chemistry/algorithms/microsoft/scf/src/scf/scf_impl.h | Exposes core Hamiltonian accessor and a J/K build helper for use by GDM ROHF gradient code. |
| cpp/src/qdk/chemistry/algorithms/microsoft/scf/src/scf/scf_impl.cpp | Updates trial-density Fock build to treat ROHF like unrestricted; implements build_jk_matrices. |
| cpp/src/qdk/chemistry/algorithms/microsoft/scf/include/qdk/chemistry/scf/core/scf_algorithm.h | Adds ROHF convergence-matrix hook + cache accessors and stores ROHF caches in base class. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
📊 Coverage Summary
Detailed Coverage ReportsC++ Coverage DetailsPython Coverage DetailsPybind11 Coverage Details |
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 9 out of 9 changed files in this pull request and generated 3 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| num_molecular_orbitals) * | ||
| C.block(num_molecular_orbitals * i, 0, num_molecular_orbitals, | ||
| num_molecular_orbitals); | ||
| if (cfg->scf_orbital_type == SCFOrbitalType::RestrictedOpenShell) { |
There was a problem hiding this comment.
This ROHF branch rebuilds a full alpha/beta J/K from the SCF density every iteration, whereas RHF/UHF reuse the existing Fock F with no two-electron build. If the separate-spin J/K genuinely can't be recovered from the effective Fock, please add a one-line comment saying so; otherwise reuse the J/K already built in SCFImpl::iterate_.
No description provided.