quantumlib / OpenFermion

The electronic structure package for quantum computers.
Apache License 2.0
1.51k stars 373 forks source link

Anti-symmetrized integrals, coulomb and exchange integrals #681

Closed Emieeel closed 3 years ago

Emieeel commented 3 years ago

Added functionality to extract anti-symmetrized integrals, coulomb and exchange integrals.

google-cla[bot] commented 3 years ago

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

:memo: Please visit https://cla.developers.google.com/ to sign.

Once you've signed (or fixed any issues), please reply here with @googlebot I signed it! and we'll verify it.


What to do if you already signed the CLA

Individual signers
Corporate signers

ℹ️ Googlers: Go here for more info.

Emieeel commented 3 years ago

@googlebot I signed it!

Emieeel commented 3 years ago

Ah, so, maybe there is some confusion here. Chemists often mean with the coulomb/exchange matrix: in the AO basis, where is the 1-RDM. I implemented instead in the MO basis.

Do you want to return the first or the second option? In standard quantum chemistry codes as psi4 and pyscf, usually the first case is returned when calling a function as get_jk().

ncrubin commented 3 years ago

I think as a first pass we'll want spin-orbital antisymmeterized 2-electron integrals. 1) we can formulate the Hamiltonian this way (with the 1/4 coeff out front) 2) we can use it to calculate overlaps of the 2-body operator and computational basis states that differ by 2 or fewer occupations. this also let's us calculate the fock operator (when it is not supplied by a computation) as einsum('ijjk', antisymm_spin_orb_tei[:, :occ, :occ, :]). So I think having spin-orbital antisymm 2 electron integrals will be nice to have.

Emieeel commented 3 years ago

The newest commit contains the following changes:

ncrubin commented 3 years ago

@Emieeel Thanks for adding the tests. It looks like formatting and linting are failing. You can use the ./check/pylint script and ./check/format-incremental scripts to help pass this check. ./check/format-incremental --apply will reformat your code according to our style guide.

google-cla[bot] commented 3 years ago

All (the pull request submitter and all commit authors) CLAs are signed, but one or more commits were authored or co-authored by someone other than the pull request submitter.

We need to confirm that all authors are ok with their commits being contributed to this project. Please have them confirm that by leaving a comment that contains only @googlebot I consent. in this pull request.

Note to project maintainer: There may be cases where the author cannot leave a comment, or the comment is not properly detected as consent. In those cases, you can manually confirm consent of the commit author(s), and set the cla label to yes (if enabled on your project).

ℹ️ Googlers: Go here for more info.

googlebot commented 3 years ago

All (the pull request submitter and all commit authors) CLAs are signed, but one or more commits were authored or co-authored by someone other than the pull request submitter.

We need to confirm that all authors are ok with their commits being contributed to this project. Please have them confirm that by leaving a comment that contains only @googlebot I consent. in this pull request.

Note to project maintainer: There may be cases where the author cannot leave a comment, or the comment is not properly detected as consent. In those cases, you can manually confirm consent of the commit author(s), and set the cla label to yes (if enabled on your project).

ℹ️ Googlers: Go here for more info.

ncrubin commented 3 years ago

@googlebot I consent.

google-cla[bot] commented 3 years ago

CLAs look good, thanks!

ℹ️ Googlers: Go here for more info.

googlebot commented 3 years ago

CLAs look good, thanks!

ℹ️ Googlers: Go here for more info.

ncrubin commented 3 years ago

Hi @Emieeel you have to run the ./check/format-incremental --apply for the script to automatically reformat the code. As for the coverage I checked the lines not covered and it seems that one was a residual if/else in the test and the others were code paths (MissingCalculations) that were not touched. I added coverage for those lines and resubmitted to your branch. It looks like everything is passing now.

Thank you for the commits. Feel free to open a PR editing the readme with your name and affiliations. You are now officially an OpenFermion developer! Welcome!