Skip to content

Pull Request for Multireference Methods Using Nonorthogonal Orbitals: GBCI, GB-PDFT, and XMS-GB-PDFT. - #200

Merged
MatthewRHermes merged 33 commits into
pyscf:masterfrom
qchemlab-snu:master
Aug 3, 2026
Merged

Pull Request for Multireference Methods Using Nonorthogonal Orbitals: GBCI, GB-PDFT, and XMS-GB-PDFT. #200
MatthewRHermes merged 33 commits into
pyscf:masterfrom
qchemlab-snu:master

Conversation

@Ohhminseok

@Ohhminseok Ohhminseok commented Jul 23, 2026

Copy link
Copy Markdown
Contributor

M. Oh, J. Park, B. Kim, H. Lim, and S. Lee, Orbital-Relaxed Bath Theory for Charge-Transfer Processes in Transition-Metal Complexes, PCCP, 28, 13294 (2026)

Detailed Description

Overview

This PR introduces grouped-bath configuration interaction (GBCI) and
GBCI-based pair-density functional theory methods to PySCF-forge.

The previous pyscf.sfnoci implementation has been renamed and reorganized as
pyscf.gbci. In addition to the namespace change, routines that were previously
embedded in sfnoci.py and direct_sfnoci.py have been separated into reusable
modules, and new GBPDFT, MS-GBPDFT, and XMS-GBPDFT drivers are added.


Main Changes

1. GBCI core (gbci/gbci.py, gbci/direct_gbci.py)

Renames and reorganizes the previous SFNOCI implementation as GBCI:

  • renames the user-facing sfnoci.py workflow to gbci.py
  • renames direct_sfnoci.py to direct_gbci.py
  • keeps the grouped-bath CI solver structure
  • supports molecular-orbital, atom-based, and occupation-based grouping
  • updates the C contraction library naming from libsfnoci to libgbci

2. Frozen active-space SCF utilities (gbci/fasscf.py)

Separates the frozen active-space SCF routines previously embedded in
sfnoci.py into a standalone reusable module.

This module is used by the GBCI orbital-relaxation workflow and includes:

  • frozen active-space SCF updates
  • relaxation of the complementary orbital space
  • a Newton-based optimization path for the orbital-relaxed bath procedure

3. Density-matrix utilities (gbci/rdm.py)

Separates and extends the density-matrix routines previously embedded in
direct_sfnoci.py.

The previous state-specific spin-separated 1-RDM and 2-RDM routines were
refactored and optimized. This PR also adds transition 1-RDM construction
between GBCI states and exposes reusable intermediates for GBPDFT and
XMS-GBPDFT calculations.

These intermediates are important because GBPDFT avoids explicitly constructing
full 2-RDM/2-CDM objects when evaluating the translated on-top pair density.

4. GBPDFT and on-top pair density (gbci/gbpdft.py, gbci/otpd.py)

Adds GBCI-reference pair-density functional theory:

  • translated on-top pair-density functional energies
  • direct construction from an SCF object or an existing GBCI object
  • on-top pair-density evaluation using GBCI intermediates
  • C helper routines for efficient GBPDFT contractions

5. MS-GBPDFT and XMS-GBPDFT (gbci/msgbpdft.py, gbci/xmsgbpdft.py)

Adds multi-state GBPDFT variants:

  • effective Hamiltonian construction in the GBCI model space
  • GBPDFT diagonal energies
  • XMS state-averaged Fock rotation
  • final adiabatic state energies and effective Hamiltonian output

6. C library updates (lib/gbci/)

Updates and extends the C helper code:

  • renames lib/sfnoci/SFNOCI_contract.c to lib/gbci/gbci_contract.c
  • adds OpenMP parallelization to the GBCI contraction routines
  • adds lib/gbci/otpd_contract.c for GBPDFT on-top pair-density contractions
  • updates CMake configuration for libgbci and libgbpdft

Verification Results

The GBCI test suite was run locally:

env PYTHONPATH=/home/Qchem_OMS/pyscf \
    PYSCF_EXT_PATH=/home/Qchem_OMS/pyscf-forge \
    python pyscf/gbci/test/test_gbci.py

Result:

Ran 4 tests

OK

The tests cover:

  • GBCI reference calculations
  • GBPDFT calculations
  • XMS-GBPDFT calculations
  • molecular-orbital, atom-based, and occupation-based grouping modes

Example Usage

from pyscf import gto, scf
from pyscf.gbci import gbpdft

mol = gto.M(
    atom='''
    N  0.000000  0.000000  0.000000
    H  0.000000 -0.937700 -0.381600
    H  0.812100  0.468800 -0.381600
    H -0.812100  0.468800 -0.381600
    ''',
    basis='sto-3g',
)

mf = scf.RHF(mol).run()

mc = gbpdft.GBCI(mf, 'tPBE', ncas=4, nelecas=4)
mc.fcisolver.nroots = 2
e_tot, e_ot, e_gbci, e_cas, ci = mc.kernel()

xms = mc.multi_state((0.5, 0.5), 'xms')
e_xms, e_ot, e_gbci, e_cas, ci, mo_coeff, mo_energy = xms.kernel()

Additional examples are provided in:

  • examples/gbci/00-gbci.py
  • examples/gbci/01-gbpdft.py
  • examples/gbci/02-xmsgbpdft.py

References

  • SF-NOCI
    N. J. Mayhall, P. R. Horn, E. J. Sundstrom, and M. Head-Gordon,
    "Spin-flip non-orthogonal configuration interaction: a variational and almost black-box method for describing strongly correlated molecules",
    Phys. Chem. Chem. Phys. 16, 22694 (2014).

  • SF-GNOCI (GBCI) / Grouped-Bath Ansatz
    J. Park and S. Lee,
    "Efficient grouped-bath ansatz for spin-flip non-orthogonal configuration interaction in transition-metal charge-transfer complexes",
    J. Chem. Theory Comput. 21, 2988–2997 (2025).

  • Orbital-Relaxed Bath Theory (GBPDFT)
    M. Oh, J. Park, B. Kim, H. Lim, and S. Lee,
    "Orbital-relaxed bath theory for charge-transfer processes in transition-metal complexes",
    Phys. Chem. Chem. Phys. 28, 13294–13303 (2026).

  • MC-PDFT
    G. Li Manni, R. K. Carlson, S. Luo, D. Ma, J. Olsen, D. G. Truhlar, and L. Gagliardi,
    "Multiconfiguration Pair-Density Functional Theory",
    J. Chem. Theory Comput. 10, 3669–3680 (2014).

  • Multi-State PDFT / XMS-PDFT
    J. J. Bao, C. Zhou, Z. Varga, S. Kanchanakungwankul, L. Gagliardi, and D. G. Truhlar,
    "Multi-state pair-density functional theory",
    Faraday Discuss. 224, 348–372 (2020).


Files Changed

  • pyscf/sfnoci/sfnoci.pypyscf/gbci/gbci.py
  • pyscf/sfnoci/direct_sfnoci.pypyscf/gbci/direct_gbci.py
  • pyscf/gbci/fasscf.py
  • pyscf/gbci/rdm.py
  • pyscf/gbci/gbpdft.py
  • pyscf/gbci/msgbpdft.py
  • pyscf/gbci/xmsgbpdft.py
  • pyscf/gbci/otpd.py
  • pyscf/gbci/test/test_gbci.py
  • examples/gbci/00-gbci.py
  • examples/gbci/01-gbpdft.py
  • examples/gbci/02-xmsgbpdft.py
  • pyscf/lib/sfnoci/SFNOCI_contract.cpyscf/lib/gbci/gbci_contract.c
  • pyscf/lib/gbci/otpd_contract.c
  • pyscf/lib/CMakeLists.txt

Testing

The following tests and example scripts were run successfully:

python pyscf/gbci/test/test_gbci.py
python examples/gbci/00-gbci.py
python examples/gbci/01-gbpdft.py
python examples/gbci/02-xmsgbpdft.py

All tests and example scripts completed successfully.

Comment thread pyscf/gbci/otpd.py Outdated
return np.ascontiguousarray(arr, dtype=dtype)


def _grid_ao2mo(mol, ao, mo_coeff, non0tab=None, shls_slice=None, ao_loc=None):

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks the same as _grid_ao2mo in pyscf.mcpdft.otpd

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for pointing this out. I refactored the GBCI OTPD code to reuse pyscf.mcpdft.otpd._grid_ao2mo instead of keeping a duplicate local implementation.

@matthew-hennefarth

Copy link
Copy Markdown
Contributor

Move pyscf/gbci/examples to pyscf/examples to conform with current project structure.

@Ohhminseok

Copy link
Copy Markdown
Contributor Author

Thanks for your comment. I moved GBCI examples to examples/gbci to conform with current project structure.

@matthew-hennefarth matthew-hennefarth left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There seems to be a lot of copy-paste from the main MC-PDFT repo but with some genuine modification in places. However, with regard to the MS-PDFT stuff, I think there is a chance for reuse of the existing code as must as possible, rather than copy/pasting. You can explore making the MSGBPDFT a child class of the MS-PDFT class in the core repo, but then modify/delete functions as necessary.

Also, you have only a few tests for a rather large amount of feature implemented (ie GBCI, GBPDFT, GBMSPDFT). And as I mentioned with regard to the TDM/DM etc, there might be additional untested features in the current PR.

Comment thread pyscf/gbci/gbpdft.py
Comment thread pyscf/gbci/gbpdft.py Outdated
Comment thread pyscf/gbci/gbpdft.py Outdated
Comment thread pyscf/gbci/gbci.py Outdated
Comment thread pyscf/gbci/gbpdft.py Outdated
Comment thread pyscf/gbci/gbpdft.py Outdated
Comment thread pyscf/gbci/gbpdft.py Outdated
Comment thread pyscf/gbci/gbpdft.py Outdated
Comment thread pyscf/gbci/msgbpdft.py Outdated
Comment thread pyscf/sfnoci/sfnoci.py
@Ohhminseok

Copy link
Copy Markdown
Contributor Author

Thank you for the detailed review. I will narrow the scope of this PR by removing the unvalidated property/TDM wrappers, refactor the MS-GBPDFT implementation to reuse the core MS-PDFT machinery where possible, and add focused tests for GBCI, GBPDFT, and XMS-GBPDFT, including a hybrid functional case(tPBE0).

@Ohhminseok

Copy link
Copy Markdown
Contributor Author

Thank you for the detailed review. I pushed an update addressing these points.

I removed the property/TDM-related wrappers from this PR, refactored MS-GBPDFT to subclass the core MS-PDFT implementation and reuse its driver code, and added tests covering the GBCI RDM paths, GBPDFT, XMS-GBPDFT, and a tPBE0 hybrid case.

Following the suggestion about not immediately breaking existing scripts, I kept pyscf.sfnoci and pyscf.sfnoci.direct_sfnoci as deprecated compatibility wrappers, so existing sfnoci imports warn while forwarding to the GBCI implementation. The new/updated tests are mainly in pyscf/gbci/test/test_gbci.py, pyscf/gbci/test/test_gbpdft.py, and pyscf/gbci/test/test_msgbpdft.py.

Comment thread pyscf/gbci/test/test_gbpdft.py
@MatthewRHermes
MatthewRHermes merged commit 7a1bdab into pyscf:master Aug 3, 2026
6 checks passed
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.

6 participants