Skip to content

Conversation

@brianz98
Copy link
Contributor

@brianz98 brianz98 commented Dec 9, 2025

This PR implements picture change corrections for properties, currently only dipole integrals can be picture changed. Picture change here means consistently applying the one-electron decoupling transformation that was applied to the Dirac Hamiltonian to other one-electron operators, such as the dipole operator here. Currently only even operators (those that don't couple large and small components, i.e., all non-relativistic operators) can be picture changed.

The X2C routines are refactored into the X2CHelper class, with the hcore_x2c method now a cached_property so no recalculation is needed.

@brianz98 brianz98 marked this pull request as ready for review December 9, 2025 01:28
Copilot AI review requested due to automatic review settings December 9, 2025 01:28
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR implements picture change corrections for dipole integrals in X2C (exact two-component) relativistic calculations. Picture change corrections ensure that property operators are transformed consistently with the one-electron decoupling transformation applied to the Dirac Hamiltonian. The implementation refactors X2C routines into a X2CHelper class with hcore_x2c as a cached property to avoid redundant computations.

Key Changes:

  • Refactored X2C implementation from module-level functions into an X2CHelper class with cached computation
  • Added picture change correction support for dipole operators via new electric_dipole_moment and picture_change_even_operator methods
  • Introduced cint_sprsp integral function for small-component dipole integrals needed for picture change corrections

Reviewed changes

Copilot reviewed 11 out of 11 changed files in this pull request and generated 6 comments.

Show a summary per file
File Description
forte2/x2c/x2c.py Refactored X2C code into X2CHelper class; added methods for picture-changed dipole integrals; converted hcore_x2c to cached property
forte2/x2c/__init__.py Updated export from get_hcore_x2c function to X2CHelper class
forte2/system/system.py Integrated X2CHelper instance and updated to use x2c_helper.hcore_x2c property
forte2/props/props.py Added skip_picture_change parameter; implemented picture change logic for dipole calculations
forte2/integrals/integrals.py Added cint_sprsp function for computing small-component dipole integrals
forte2/integrals/libcint_two_center.h Added declaration for int1e_sprsp integral with 12 components
forte2/api/integrals_api.cc Exposed cint_int1e_sprsp_sph to Python API
forte2/helpers/matrix_functions.py Added i_sigma_dot function for constructing spin-orbit coupling matrices; improved block_diag_2x2 logic
forte2/helpers/__init__.py Exported new i_sigma_dot function
tests/props/test_props.py Added tests for dipole calculations with sfx2c1e and sox2c1e
tests/integrals/test_libcint.py Added test for cint_sprsp with shifted origin

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@codecov
Copy link

codecov bot commented Dec 9, 2025

Codecov Report

❌ Patch coverage is 93.98148% with 13 lines in your changes missing coverage. Please review.
✅ Project coverage is 92.55%. Comparing base (056f299) to head (5a7871c).

Files with missing lines Patch % Lines
forte2/x2c/x2c.py 93.33% 4 Missing and 6 partials ⚠️
forte2/props/props.py 76.92% 2 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #132      +/-   ##
==========================================
+ Coverage   92.48%   92.55%   +0.06%     
==========================================
  Files         141      141              
  Lines       11647    11735      +88     
  Branches      943      949       +6     
==========================================
+ Hits        10772    10861      +89     
+ Misses        659      658       -1     
  Partials      216      216              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

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.

2 participants