Skip to content

[FEATURE TRANSFER] Transfer MC-PDFT to the PySCF core modules #144

@MatthewRHermes

Description

@MatthewRHermes

Attempting to roughly follow #135


Authors

Matthew R Hermes (University of Chicago)
Dayou Zhang (University of Minnesota)
Thais R Scott (University of Chicago)
Matthew R Hennefarth (University of Chicago)
Bhavnesh Jangid (University of Chicago)
Shirong Wang (Fudan University)
Frédéric Chapoton (University of Strasbourg)

Feature Description

I propose to transfer the entire multiconfiguration pair-density functional theory (MC-PDFT) implementation from PySCF-Forge to the PySCF core modules, excluding dipole-moment features for which the corresponding implementations in other quantum chemistry methods are not currently hosted in the PySCF core modules. MC-PDFT refers to methods in which the total electronic energy is obtained or derived from a functional of the on-top pair density as well as the total electron density, and these densities are in turn obtained from a multiconfigurational self-consistent field (MCSCF) wave function or wave functions of some sort. The on-top pair density is the probability of two electrons existing simultaneously at one point in space.

The non-classical part of the MC-PDFT energy is called the "on-top energy" and is directly analogous to the exchange-correlation energy in standard density functional theory. In practice, the on-top energy functional is always a generalization or a "translation" of an exchange-correlation functional from Kohn-Sham DFT. MC-PDFT furnishes a practical and effective generalization of KS-DFT functionals from single Slater determinants to general multiconfigurational wave functions because the pair density, unlike the spin density, can simultaneously encode both strong electron correlation effects and spin symmetry constraints.

This feature implements theoretical developments discussed in the following publications:

MC-PDFT has been hosted on PySCF-Forge for approximately three years as of the time of this writing. It includes a full battery of example and unit test scripts. The most recent major extension, the implementation of the MC23 functional of Bao et al. PNAS 2024, 122, e2419413121, is nearly six months old as of this writing.

Relevant Modules and Files

Transfer the following to PySCF with the same path:

  • mcpdft/__init__.py
  • mcpdft/mcpdft.py
  • mcpdft/_libxc.py
  • mcpdft/_dms.py
  • mcpdft/otpd.py
  • mcpdft/otfnal.py
  • mcpdft/tfnal_derivs.py
  • mcpdft/pdft_eff.py
  • mcpdft/pdft_veff.py
  • mcpdft/pdft_feff.py
  • mcpdft/mspdft.py
  • mcpdft/cmspdft.py
  • mcpdft/xmspdft.py
  • mcpdft/lpdft.py
  • mcpdft/chkfile.py
  • mcpdft/test/test_cmspdft.py
  • mcpdft/test/test_pdft_veff.out
  • mcpdft/test/test_diatomic_energies.py
  • mcpdft/test/test_pdft_feff.py
  • mcpdft/test/test_xmspdft.py
  • mcpdft/test/test_pdft_veff.py
  • mcpdft/test/test_spingaps_atoms.py
  • mcpdft/test/test_mcpdft.py
  • mcpdft/test/test_mgga.py
  • mcpdft/test/test_otfnal.py
  • mcpdft/test/test_otpd.py
  • mcpdft/test/test_lpdft.py
  • mcpdft/test/test_mspdft.py
  • grad/mspdft.py
  • grad/mcpdft.py
  • grad/cmspdft.py
  • grad/lpdft.py
  • grad/test/h2co_tpbe66_631g_grad_num.npy
  • grad/test/h2co_sa2_tpbe66_631g_grad_num.npy
  • nac/mspdft.py
  • df/grad/mspdft.py
  • df/grad/mcpdft.py
  • df/grad/lpdft.py

Transfer the following to PySCF with a possible change of path:

  • grad/test/test_grad_mcpdft.py -> grad/test/test_mcpdft.py
  • grad/test/test_grad_cmspdft.py -> grad/test/test_cmspdft.py
  • grad/test/test_grad_h2co_slow.py -> grad/test/test_pdft_h2co_slow.py
  • grad/test/test_grad_metagga_mcpdft.py -> grad/test/test_metagga_mcpdft.py
  • grad/test/test_grad_h2co.py -> grad/test/test_pdft_h2co.py
  • grad/test/test_grad_lpdft.py -> grad/test/test_lpdft.py
  • grad/test/test_grad_mspdft.py -> grad/test/test_mspdft.py
  • grad/test/test_diatomic_gradients.py -> grad/test/test_pdft_diatomic_gradients.py
  • nac/test/test_nac_cmspdft.py -> nac/test/test_cmspdft.py
  • mcpdft/nr_numint.c -> lib/mcpdft/nr_numint.c
  • lib/dft/libxc_itrf2.c -> ??? (see below)
  • dft2/libxc.py -> ??? (see below)

Note that lib/mcpdft/nr_numint.c will compile into libpdft.so and depends on libxc; the relevant part of PySCF-Forge's pyscf/lib/CMakeLists.txt must be transferred to PySCF.

Documentation

See pyscf.github.io #166

Long-term Maintenance Plan

Matt Hermes (@MatthewRHermes) can take the lead on long-term maintenance of MC-PDFT. Dayou Zhang (@Dayou-Zhang) can also provide support for maintaining the LibXC interface re-implementation (as necessary; see below).

Additional Context

The MC-PDFT implementation in PySCF-Forge notably includes a complete reimplementation of the core module's LibXC interface (pyscf/dft/libxc.py and pyscf/lib/dft/libxc_itrf.c), which was necessary in order to access LibXC's API for defining custom functionals as variants of existing functionals with modified parameters. This, in turn, was necessary because the original work on translated meta-GGA functionals PNAS 2024, 122, e2419413121 was inseparable from a functional optimization project which resulted in the custom on-top functional known as MC23.

The proper way to implement the functional-modification features of LibXC has been a subject of extended discussion. See:

Given the above, there are at least three possible ways to proceed:

  1. Overwrite the PySCF LibXC interface with the MC-PDFT reimplementation.
  • lib/dft/libxc_itrf2.c -> lib/dft/libxc_itrf.c
  • dft2/libxc.py -> dft/libxc.py
  • Pros:
    • Consolidate nearly-duplicate code.
    • Enable LibXC functional-modification features for all users of PySCF in all contexts.
  • Cons:
    • Potentially disruptive and risky.
    • Requires experienced maintainers of PySCF core modules to re-learn the LibXC interface.
  1. Move the duplicated interface ("dft2") into the PySCF core modules.
  • lib/dft/libxc_itrf2.c -> lib/dft/libxc_itrf.c
  • dft2/libxc.py -> dft2/libxc.py
  • Or we could put them in the MC-PDFT folder.
  • Pros:
    • Really easy.
    • Nondisruptive.
  • Cons:
    • Bizarre near-duplication of code in PySCF will probably confuse new developers and give headaches.
    • Status quo labor-intensive manual synchronization of the two implementations still required.
  1. Omit the LibXC interface reimplementation, and therefore the MC23 functional, from the transfer, and host these features only on PySCF-Forge for now.
  • Pros:
    • Nondisruptive, at least to DFT.
    • Intuitively reasonable separation of concerns between the two projects.
  • Cons:
    • Requires potentially error-prone partitioning of the existing MC-PDFT code into two parts, since the LibXC interface reimplementation is currently used in all MC-PDFT calculations.
    • Status quo manual resynchronization of the two implementations.

Other issues:

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions