Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fragment-wise True Cumulants #33

Open
mscho527 opened this issue Nov 27, 2024 · 6 comments
Open

Fragment-wise True Cumulants #33

mscho527 opened this issue Nov 27, 2024 · 6 comments
Assignees
Labels
enhancement New feature or request

Comments

@mscho527
Copy link
Member

(Per discussion w/ @lweisburn)

As it is currently implemented, it looks like we calculate the exact cumulant for the FCI solver and use the energy expression for approximate cumulant. Investigate if the mismatch causes particular issues, and resolve the mismatch.

@mscho527 mscho527 added the bug Something isn't working label Nov 27, 2024
@mcocdawc
Copy link
Contributor

mcocdawc commented Nov 27, 2024

Perhaps I am misinterpreting stuff here; but the following might be related:

The energy is exactly the same, regardless of the argument to approx_cumulant in

be.compute_energy_full(approx_cumulant=...

https://github.com/troyvvgroup/quemb/pull/30/files#diff-cfd62b5afc590cdc497c40dba3ec4f6bb7c2c05fac6e7ba6f4fbf7fc561e27a7R67

The molbe_octane_get_rdms_test.py works now¹ and might help, if it is relevant.

¹ For this I had to switch off the parallel execution, because this one still does not work, because of scratch issues.

@mscho527
Copy link
Member Author

mscho527 commented Nov 27, 2024

It might be related; we realized this while looking at the Frag.energy function (which we no longer call in this version of the code), but I haven't looked in detail how the compute_energy_full and/or get_frag_energy may or may not be affected in the same fashion.

Update: get_frag_energy + FCI combo would be affected (get_frag_energy + CCSD should be fine), compute_energy_full might be fine?

@lweisburn
Copy link
Contributor

Summarizing our @mscho527 conversation this week and some more digging about cumulant energy forms in the code for future reference:

In the CCSD solver (in the normal get_frag_energy function), we use pyscf's rdm2 build with the with_dm1=False option. This is equivalent to what we call the approximate cumulant (i.e. does not have the \delta P \delta P terms), so we use it with the approximate cumulant energy expression (exactly as written in the periodic BE paper). We do not have the true cumulant version included with get_frag_energy, which would require an updated fock matrix for the full system. We could add this, but the approximate cumulant works well here.

The current cumulant option for FCI is also the approximate cumulant, so it should be as-is correct with get_frag_energy. Again, we could easily update this function to be the true cumulant in the future.

in all: we need to update get_frag_energy if we want to use the true cumulant instead (which I think we can do, and I could do after the break).

TODO, either later or after break: go back through the energy and full system rdm construction

@mscho527 mscho527 added enhancement New feature or request and removed bug Something isn't working labels Nov 27, 2024
@mscho527 mscho527 changed the title FCI Approx Cumulant Fragment-wise True Cumulants Nov 27, 2024
@lweisburn
Copy link
Contributor

Looking at the compute_energy_full: this should be returning (a very slightly different) true and approximate cumulant energy correctly, right?

This expressly does update the fock matrix based on the constructed full-system 1rdm, which we need when using the true cumulant (i.e. EVeff, which is a function of veff from rdm1f) vs. the approximate version which uses self.hf_veff. I'll have to test it with some other larger systems and review the code more thoroughly, but I think it returning the same energies with and without the approximate flag could be more about those energies being almost identical (which they are/should be) than a bug... I will run some tests though to double check this!

@mscho527
Copy link
Member Author

Looking at the compute_energy_full: this should be returning (a very slightly different) true and approximate cumulant energy correctly, right?

This expressly does update the fock matrix based on the constructed full-system 1rdm, which we need when using the true cumulant (i.e. EVeff, which is a function of veff from rdm1f) vs. the approximate version which uses self.hf_veff. I'll have to test it with some other larger systems and review the code more thoroughly, but I think it returning the same energies with and without the approximate flag could be more about those energies being almost identical (which they are/should be) than a bug... I will run some tests though to double check this!

Yes, I agree. The only thing that is missing seems to be fragment-wise + true cumulant combo.

@mcocdawc
Copy link
Contributor

Looking at the compute_energy_full: this should be returning (a very slightly different) true and approximate cumulant energy correctly, right?

This expressly does update the fock matrix based on the constructed full-system 1rdm, which we need when using the true cumulant (i.e. EVeff, which is a function of veff from rdm1f) vs. the approximate version which uses self.hf_veff. I'll have to test it with some other larger systems and review the code more thoroughly, but I think it returning the same energies with and without the approximate flag could be more about those energies being almost identical (which they are/should be) than a bug... I will run some tests though to double check this!

Note that the numpy.isclose has a default absolute tolerance of 1e-8.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants