quantumlib / OpenFermion

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

Calculating the error from low rank approximation #708

Closed PabloAMC closed 3 years ago

PabloAMC commented 3 years ago

I am trying to replicate similar calculations as those performed in arXiv:1902.02134 page 12 where the authors calculate the error in the calculation of the ground state energy using methods such as CISD, MP2 (and in later papers, it was also suggested to use CCSD) from the low-rank approximation of the two-body Hamiltonian term. The question they (and I) aim to answer is: what rank approximation can we perform that does not damage the energy calculations to chemical accuracy?

I have also seen that OpenFermion supports the very convenient Low-Rank approximation of the Hamiltonian but it is unclear how to run the classical methods on the new Hamiltonian since the class mediating for such calculations, for example using OpenFermion-Psi4, is not the Hamiltonian itself but the MolecularData class. Perhaps @babbush knows how to do it?😅

I ask because there are no obvious ways to perform this rank approximation on Psi4 or PySCF (or perhaps it is just that I have not found it).

babbush commented 3 years ago

This is a good question. In that paper (and later ones where we explore the low rank truncation) we had to write additional code that would feed the rank truncated Hamiltonian integrals back to the electronic structure packages. We will talk about adding some of that code to OpenFermion but it might take a while since it is kind of complicated to do in a fashion that will work for any system.

ncrubin commented 3 years ago

@PabloAMC you can use pyscf or psi4 (through numpypsi4) to add a custom Hamiltonian. Here's an example of a custom RHF Hamiltonian created in pysf (https://github.com/pyscf/pyscf-doc/blob/master/examples/scf/40-customizing_hamiltonian.py). Note that the integral ordering in pyscf is different than in OpenFermion. Numpypsi4 (https://github.com/psi4/psi4numpy) has many implementation of standard post-hf methods. You can pretty easily sub in your low-rank two-electron integrals into one of these.