-
Notifications
You must be signed in to change notification settings - Fork 376
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
fault-tolerant resource estimates for chemical hamiltonians #763
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
…cks for resource_estimates for now, as the resource_estimates module requires additional dependencies we don't want to burden the user with.
ncrubin
approved these changes
Jan 20, 2022
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. Needs a code comment removal sweep but other than that it is good.
ncrubin
previously approved these changes
Jan 20, 2022
ncrubin
approved these changes
Jan 26, 2022
ncrubin
pushed a commit
to ncrubin/OpenFermion
that referenced
this pull request
Jul 25, 2022
…ib#763) * Initial commit of resource_estimates. Ignore testing and coverage checks for resource_estimates for now, as the resource_estimates module requires additional dependencies we don't want to burden the user with. * clean up imports * clean up imports * readme for resource_estimates * fixup some old comments * fixup more comments * more comment cleanup * Update README.md
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Overview
Add new module
openfermion.resource_estimates
to facilitate fault-tolerant (FT) resource estimates for chemical Hamiltonians. Addresses #723.The following factorizations are included:
For the methods listed above, there are sub-routines which:
factorize()
compute_lambda()
compute_cost()
There are also some costing routines for the sparse factorization, but this is a work in progress.
Details
The philosophy for this new module is to rely on PySCF to generate, store, and manipulate molecular information. The data (integrals, etc) is stored as a PySCF mean-field (
mf
) object. As an example, one could input an ionized water molecule like so:Then, given the
mf
object,resource_estimates.molecule
has routines to further manipulate the molecule, such as testing for stability (and reoptimizing), as well as localizing orbitals and performing automated active space selection with AVAS. Continuing our example:In each case, the input is the mean-field
mf
object, and the output is a modifiedmf
object. Themf
object is not updated in-place, so it is possible to create additional copies in memory.At this point, we have a stable wave function, localized the orbitals, and selected an active space. At any point, the molecular Hamiltonian (e.g. active space) can be written out to HDF5 using
molecule.save_pyscf_to_casfile()
, or, if it exists, read in usingmolecule.load_casfile_to_pyscf()
.Once an active space is selected/generated, costing is relatively straightforward. There are helper functions for the SF, DF, and THC factorization schemes that will make a nice table given some parameters. For example:
which outputs to a file called
single_factorization_water.txt
, and contains:Note that the automated costing relies on error in CCSD(T) - or CCSD, if desired - as the metric, so this may become a bottleneck for large active spaces.
The philosophy is that all costing methods are captured in the namespace related to the type of factorization (e.g., . So if one wanted to repeat the costing for DF or THC factorizations, one could
Which generate similar outputs, e.g. the above would generate tables in
double_factorization_water.txt
andthc_factorization_water.txt
.More fine-grained control is given by subroutines that compute the factorization, the lambda values, and the cost estimates. For example, considering the double factorization, we could have
which, unlike the pretty tables above, require the user to handle and input several molecular quantities and intermediates, but at the gain of more functionality and control. Switching between factorization schemes is generally as easy as swapping out the namespace, for example to perform different factorizations on the ERIs,
are all valid, as are the methods
compute_lambda()
andcompute_cost()
for the factorizations.Testing (+ dependencies)
All the code comes with tests (use
pytest
) and has been tested on Debian GNU/Linux with Python 3.8.5.Since the FT costing is closely tied to manipulation of molecular integrals (localization, active space selection, benchmarking against CCSD(T), ...) the code depends on PySCF. Since we do not want to burden all OpenFermion users with this dependency, testing is disabled in the GitHub workflow. Moreover, the
resource_estimates
functionality requires the dependenciesFor THC factorization, it also requires BTAS and the PyBTAS wrapper, which require their own installation + depends.
Again, since we do not wish to burden all OpenFermion users with these dependencies, testing with GitHub workflows is disabled, but if you install the dependencies, running
pytest
should pass.