Skip to content

Fix FCI RDM tensor contraction in test_accessing_rdm - #72

Open
anishbhujbal7 wants to merge 1 commit into
quantumlib:mainfrom
anishbhujbal7:main
Open

Fix FCI RDM tensor contraction in test_accessing_rdm#72
anishbhujbal7 wants to merge 1 commit into
quantumlib:mainfrom
anishbhujbal7:main

Conversation

@anishbhujbal7

Copy link
Copy Markdown

Description

Fixes #52.

This PR resolves an energy mismatch assertion error in test_accessing_rdm() when verifying Full Configuration Interaction (FCI) Reduced Density Matrices (RDMs).

Root Cause

molecule.fci_one_rdm and molecule.fci_two_rdm in PyscfMolecularData return spatial-orbital RDMs matching the spatial convention used by cisd and ccsd RDMs. Previous test variations incorrectly treated these as spin-orbital tensors or applied incorrect cross-spin slicing, leading to tensor dimension mismatches or undercounted two-electron energy contributions.

Changes Made

  • Updated test_accessing_rdm() in openfermionpyscf/tests/_pyscf_molecular_data_test.py to contract spatial 1- and 2-body integrals ($h_1, h_2$) directly with molecule.fci_one_rdm and molecule.fci_two_rdm.
  • Ensured total calculated energy $E_{\text{tot}}$ matches the PySCF FCI ground-state reference energy $E_{\text{ref}}$ down to machine precision.

Verification

Ran full test suite using PyTest in WSL environment:

./venv_wsl/bin/pytest

@google-cla

google-cla Bot commented Sep 3, 2026

Copy link
Copy Markdown

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

View this failed invocation of the CLA check for more information.

For the most up to date status, view the checks section at the bottom of the pull request.

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.

Return none spin summed rdms

1 participant