Updated: Sunday, November 26,2023-11-26 16:50:59
parent
1428d074dc
commit
c6a1647e18
|
@ -1,8 +1,28 @@
|
|||
{
|
||||
"recentFiles": [
|
||||
{
|
||||
"basename": "QRE",
|
||||
"path": "QRE.md"
|
||||
"basename": "0. INTRO Choose Your Hero! er, Algo",
|
||||
"path": "Machine Tips (Quantum)/Math/Algorithms/0. INTRO Choose Your Hero! er, Algo.md"
|
||||
},
|
||||
{
|
||||
"basename": "1. First Step is Matrix Math",
|
||||
"path": "Machine Tips (Quantum)/Math/1. First Step is Matrix Math.md"
|
||||
},
|
||||
{
|
||||
"basename": "Anti Charm Meson",
|
||||
"path": "Machine Tips (Quantum)/Physics/Anti Charm Meson.md"
|
||||
},
|
||||
{
|
||||
"basename": "Open Fermion QRE",
|
||||
"path": "Machine Tips (Quantum)/Resources/QRE/Open Fermion QRE.md"
|
||||
},
|
||||
{
|
||||
"basename": "What is QRE?",
|
||||
"path": "Machine Tips (Quantum)/Resources/QRE/What is QRE?.md"
|
||||
},
|
||||
{
|
||||
"basename": "Quantum spaces",
|
||||
"path": "Machine Tips (Quantum)/Quantum spaces.canvas"
|
||||
},
|
||||
{
|
||||
"basename": "Making Machines",
|
||||
|
@ -14,11 +34,11 @@
|
|||
},
|
||||
{
|
||||
"basename": "GPU",
|
||||
"path": "Machine Tips (Quantum)/QIS/GPU.md"
|
||||
"path": "Machine Tips (Quantum)/Resources/QIS/GPU.md"
|
||||
},
|
||||
{
|
||||
"basename": "QIS XML",
|
||||
"path": "Machine Tips (Quantum)/QIS/QIS XML.md"
|
||||
"path": "Machine Tips (Quantum)/Resources/QIS/QIS XML.md"
|
||||
},
|
||||
{
|
||||
"basename": "Intro to Quantum Technologies",
|
||||
|
@ -26,11 +46,11 @@
|
|||
},
|
||||
{
|
||||
"basename": "Quantum Ethics",
|
||||
"path": "Machine Tips (Quantum)/QIS/Quantum Ethics.md"
|
||||
"path": "Machine Tips (Quantum)/Resources/QIS/Quantum Ethics.md"
|
||||
},
|
||||
{
|
||||
"basename": "Qyte vs Byte",
|
||||
"path": "Machine Tips (Quantum)/QIS/Qyte vs Byte.md"
|
||||
"path": "Machine Tips (Quantum)/Resources/QIS/Qyte vs Byte.md"
|
||||
},
|
||||
{
|
||||
"basename": "Key Terms - What is Quantum Mechanics?",
|
||||
|
@ -179,26 +199,6 @@
|
|||
{
|
||||
"basename": "Alt. Obsidian",
|
||||
"path": "Coding Tips (Classical)/Project Vault/About Obsidian/Alt. Obsidian.md"
|
||||
},
|
||||
{
|
||||
"basename": "Command Shortcuts",
|
||||
"path": "Coding Tips (Classical)/Terminal Tips/2. CLI Tools/CLI Tool Collection/Commands + Settings/Command Shortcuts.md"
|
||||
},
|
||||
{
|
||||
"basename": "Git",
|
||||
"path": "Coding Tips (Classical)/Terminal Tips/2. CLI Tools/CLI Tool Collection/Commands + Settings/Git.md"
|
||||
},
|
||||
{
|
||||
"basename": "Linear Algebra Basics",
|
||||
"path": "Machine Tips (Quantum)/Math/Linear Algebra Basics.md"
|
||||
},
|
||||
{
|
||||
"basename": "Anti Charm Meson",
|
||||
"path": "Machine Tips (Quantum)/Physics/Anti Charm Meson.md"
|
||||
},
|
||||
{
|
||||
"basename": "Choosing a Name for Your Computer",
|
||||
"path": "Coding Tips (Classical)/Terminal Tips/System Client/Choosing a Name for Your Computer.md"
|
||||
}
|
||||
],
|
||||
"omittedPaths": [],
|
||||
|
|
|
@ -25,7 +25,19 @@
|
|||
"state": {
|
||||
"type": "markdown",
|
||||
"state": {
|
||||
"file": "QRE.md",
|
||||
"file": "Machine Tips (Quantum)/Resources/QRE/What is QRE?.md",
|
||||
"mode": "source",
|
||||
"source": false
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "09f056633e5646f0",
|
||||
"type": "leaf",
|
||||
"state": {
|
||||
"type": "markdown",
|
||||
"state": {
|
||||
"file": "Machine Tips (Quantum)/Math/Algorithms/0. INTRO Choose Your Hero! er, Algo.md",
|
||||
"mode": "source",
|
||||
"source": false
|
||||
}
|
||||
|
@ -152,7 +164,7 @@
|
|||
}
|
||||
}
|
||||
],
|
||||
"currentTab": 1
|
||||
"currentTab": 2
|
||||
}
|
||||
],
|
||||
"direction": "vertical"
|
||||
|
@ -211,7 +223,7 @@
|
|||
}
|
||||
],
|
||||
"direction": "horizontal",
|
||||
"width": 200
|
||||
"width": 219.5
|
||||
},
|
||||
"right": {
|
||||
"id": "4bd9c02fbfe6785f",
|
||||
|
@ -227,7 +239,7 @@
|
|||
"state": {
|
||||
"type": "backlink",
|
||||
"state": {
|
||||
"file": "QRE.md",
|
||||
"file": "Machine Tips (Quantum)/Math/Algorithms/0. INTRO Choose Your Hero! er, Algo.md",
|
||||
"collapseAll": false,
|
||||
"extraContext": false,
|
||||
"sortOrder": "alphabetical",
|
||||
|
@ -244,7 +256,7 @@
|
|||
"state": {
|
||||
"type": "outgoing-link",
|
||||
"state": {
|
||||
"file": "QRE.md",
|
||||
"file": "Machine Tips (Quantum)/Math/Algorithms/0. INTRO Choose Your Hero! er, Algo.md",
|
||||
"linksCollapsed": false,
|
||||
"unlinkedCollapsed": true
|
||||
}
|
||||
|
@ -267,7 +279,7 @@
|
|||
"state": {
|
||||
"type": "outline",
|
||||
"state": {
|
||||
"file": "QRE.md"
|
||||
"file": "Machine Tips (Quantum)/Math/Algorithms/0. INTRO Choose Your Hero! er, Algo.md"
|
||||
}
|
||||
}
|
||||
},
|
||||
|
@ -303,16 +315,21 @@
|
|||
"obsidian-excalidraw-plugin:Create new drawing": false
|
||||
}
|
||||
},
|
||||
"active": "f410d36b53003244",
|
||||
"active": "dbad7b010371d947",
|
||||
"lastOpenFiles": [
|
||||
"Machine Tips (Quantum)/Math/1. First Step is Matrix Math.md",
|
||||
"Machine Tips (Quantum)/Physics/Anti Charm Meson.md",
|
||||
"Machine Tips (Quantum)/Resources/QRE/Open Fermion QRE.md",
|
||||
"Machine Tips (Quantum)/Resources/QRE/What is QRE?.md",
|
||||
"Machine Tips (Quantum)/Resources/QRE",
|
||||
"Machine Tips (Quantum)/Quantum spaces.canvas",
|
||||
"Machine Tips (Quantum)/Project Vault/Constructions/Making Machines.md",
|
||||
"QRE.md",
|
||||
"Machine Tips (Quantum)/Project Vault/rubiks cube/Research Rubiks Cube.md",
|
||||
"Machine Tips (Quantum)/QIS/GPU.md",
|
||||
"Machine Tips (Quantum)/QIS/QIS XML.md",
|
||||
"Machine Tips (Quantum)/Resources/QIS/GPU.md",
|
||||
"Machine Tips (Quantum)/Resources/QIS/QIS XML.md",
|
||||
"Machine Tips (Quantum)/Resources/Technologies, Orgs, & Apps/Intro to Quantum Technologies.md",
|
||||
"Machine Tips (Quantum)/QIS/Quantum Ethics.md",
|
||||
"Machine Tips (Quantum)/QIS/Qyte vs Byte.md",
|
||||
"Machine Tips (Quantum)/Resources/QIS/Quantum Ethics.md",
|
||||
"Machine Tips (Quantum)/Resources/QIS/Qyte vs Byte.md",
|
||||
"Machine Tips (Quantum)/Resources/Concepts Review/Key Terms - What is Quantum Mechanics?.md",
|
||||
"Coding Tips (Classical)/Project Vault/About Obsidian/Obsidian Guides/Obsidian-gitea process.md",
|
||||
"Coding Tips (Classical)/Terminal Tips/System Client/OSX Apple Macbook/IDEs & APIs/BBEdit/Launchd.md",
|
||||
|
@ -328,9 +345,6 @@
|
|||
"Coding Tips (Classical)/Project Vault/Current Occupations/Website Projects/hi.shwethajayaraj/pdf.md",
|
||||
"Coding Tips (Classical)/Project Vault/Current Occupations/Website Projects/hi.shwethajayaraj/Credits.md",
|
||||
"Coding Tips (Classical)/Terminal Tips/2. CLI Tools/Languages/Python/code/More data types/Generator Functions.md",
|
||||
"Coding Tips (Classical)/Terminal Tips/2. CLI Tools/Languages/Python/code/More data types/Explicitly Defining datatype in python function.md",
|
||||
"Coding Tips (Classical)/Terminal Tips/2. CLI Tools/Languages/Python/code/Lists/Lists.md",
|
||||
"Coding Tips (Classical)/Terminal Tips/System Client/OSX Apple Macbook/OSX Apps.md",
|
||||
"Coding Tips (Classical)/Terminal Tips/2. CLI Tools/Languages/Middle/More Misc",
|
||||
"Coding Tips (Classical)/Terminal Tips/1. Terminals",
|
||||
"Coding Tips (Classical)/Terminal Tips/1. Terminals/Text & Editors",
|
||||
|
@ -344,14 +358,12 @@
|
|||
"Coding Tips (Classical)/Project Vault/About Obsidian/imgFiles/Pasted image 20231120104008.png",
|
||||
"Coding Tips (Classical)/Project Vault/About Obsidian/imgFiles/Pasted image 20231120103937.png",
|
||||
"Coding Tips (Classical)/Project Vault/About Obsidian/imgFiles/Pasted image 20231120103915.png",
|
||||
"Coding Tips (Classical)/Project Vault/Current Occupations/Manhattan Youth/web design/WD Resources",
|
||||
"Coding Tips (Classical)/Project Vault/About Obsidian/imgFiles/FCFL 3D prints call 1.jpg",
|
||||
"Coding Tips (Classical)/Project Vault/About Obsidian/imgFiles/FCFL 3D prints call.jpg",
|
||||
"Coding Tips (Classical)/Project Vault/About Obsidian/imgFiles/Pasted image 20231101131959.png",
|
||||
"Coding Tips (Classical)/Project Vault/About Obsidian/imgFiles/Untitled.png",
|
||||
"Coding Tips (Classical)/Project Vault/About Obsidian/imgFiles/Pasted image 20231028152700.png",
|
||||
"Coding Tips (Classical)/Project Vault/About Obsidian/imgFiles/Pasted image 20231022162536.png",
|
||||
"Machine Tips (Quantum)/Quantum spaces.canvas",
|
||||
"Untitled.canvas"
|
||||
]
|
||||
}
|
|
@ -0,0 +1,139 @@
|
|||
|
||||
via their public [github](https://github.com/quantumlib/OpenFermion/blob/master/src/openfermion/resource_estimates/README.md).
|
||||
### Disclaimer: testing, dependencies, etc.
|
||||
|
||||
Code is system tested on Debian GNU/Linux with Python 3.8.5. All the code comes with tests (use `pytest`), but not unit tested with GitHub worflows.
|
||||
|
||||
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](https://pyscf.org/) and is not installed by default. To install it do:
|
||||
|
||||
```
|
||||
pip install openfermion[resources]
|
||||
```
|
||||
|
||||
For THC factorization, it also requires [BTAS](https://github.com/ValeevGroup/BTAS) and the [PyBTAS](https://github.com/ncrubin/pybtas) wrapper, which require their own installation + depends.
|
||||
|
||||
### Overview
|
||||
|
||||
Module `openfermion.resource_estimates` to facilitate fault-tolerant (FT) resource estimates for chemical Hamiltonians.
|
||||
|
||||
The following factorizations are included:
|
||||
* The [single](https://arxiv.org/abs/1902.02134) [factorization](https://arxiv.org/abs/1808.02625) (SF) method
|
||||
* The [double factorization](https://arxiv.org/pdf/2007.14460) (DF) method
|
||||
* The [tensor hypercontraction](https://arxiv.org/abs/2011.03494) (THC) method
|
||||
|
||||
For the methods listed above, there are sub-routines which:
|
||||
* factorize the two-electron integrals, `factorize()`
|
||||
* compute the lambda values, `compute_lambda()`
|
||||
* estimate the number of logical qubits and Toffoli gates required to simulate with this factorization, `compute_cost()`
|
||||
|
||||
There are also some costing routines for the [sparse factorization](https://arxiv.org/abs/1902.02134), 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:
|
||||
|
||||
```python
|
||||
from pyscf import gto, scf
|
||||
|
||||
# input is just like any other PySCF script
|
||||
mol = gto.M(
|
||||
atom = '''O 0.000000 -0.075791844 0.000000
|
||||
H 0.866811829 0.601435779 0.000000
|
||||
H -0.866811829 0.601435779 0.000000
|
||||
''',
|
||||
basis = 'augccpvtz',
|
||||
symmetry = False,
|
||||
charge = 1,
|
||||
spin = 1
|
||||
)
|
||||
mf = scf.ROHF(mol)
|
||||
mf.verbose = 4
|
||||
mf.kernel() # run the SCF
|
||||
```
|
||||
|
||||
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](https://pubs.acs.org/doi/10.1021/acs.jctc.7b00128). Continuing our example:
|
||||
|
||||
```python
|
||||
from openfermion.resource_estimates.molecule import stability, localize, avas_active_space
|
||||
|
||||
# make sure wave function is stable before we proceed
|
||||
mf = stability(mf)
|
||||
|
||||
# localize before automatically selecting active space with AVAS
|
||||
mf = localize(mf, loc_type='pm') # default is loc_type ='pm' (Pipek-Mezey)
|
||||
|
||||
# you can use larger basis for `minao` to select non-valence...here select O 3s and 3p as well
|
||||
mol, mf = avas_active_space(mf, ao_list=['H 1s', 'O 2s', 'O 2p', 'O 3s', 'O 3p'], minao='ccpvtz')
|
||||
```
|
||||
|
||||
In each case, the input is the mean-field `mf` object, and the output is a modified `mf` object. The `mf` 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 using `molecule.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:
|
||||
|
||||
```python
|
||||
from openfermion.resource_estimates import sf
|
||||
|
||||
# make pretty SF costing table
|
||||
sf.generate_costing_table(mf, name='water', rank_range=[20,25,30,35,40,45,50])
|
||||
```
|
||||
which outputs to a file called `single_factorization_water.txt`, and contains:
|
||||
|
||||
```
|
||||
Single low rank factorization data for 'water'.
|
||||
[*] using CAS((5a, 4b), 11o)
|
||||
[+] E(SCF): -75.63393088
|
||||
[+] Active space CCSD(T) E(cor): -0.08532629
|
||||
[+] Active space CCSD(T) E(tot): -75.71925716
|
||||
============================================================================================================
|
||||
L ||ERI - SF|| lambda CCSD(T) error (mEh) logical qubits Toffoli count
|
||||
------------------------------------------------------------------------------------------------------------
|
||||
20 1.7637e-01 212.7 -2.97 298 4.3e+08
|
||||
25 5.7546e-02 215.0 1.53 298 4.7e+08
|
||||
30 2.9622e-02 216.1 0.11 298 5.1e+08
|
||||
35 1.3728e-02 216.5 -0.07 301 5.5e+08
|
||||
40 2.1439e-03 216.7 0.00 460 5.8e+08
|
||||
45 2.8662e-04 216.8 0.00 460 6.0e+08
|
||||
50 1.1826e-04 216.8 0.00 460 6.2e+08
|
||||
============================================================================================================
|
||||
```
|
||||
|
||||
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
|
||||
|
||||
```python
|
||||
from openfermion.resource_estimates import df, thc
|
||||
|
||||
# make pretty DF costing table
|
||||
df.generate_costing_table(mf, name='water', thresh_range=[1e-2,5e-3,1e-3,5e-4,1e-4,5e-5,1e-5])
|
||||
|
||||
# make pretty THC costing table
|
||||
# if you want to save each THC result to a file, you can set 'save_thc' to True
|
||||
thc.generate_costing_table(mf, name='water', nthc_range=[20,25,30,35,40,45,50], save_thc=False)
|
||||
```
|
||||
|
||||
Which generate similar outputs, e.g. the above would generate tables in `double_factorization_water.txt` and `thc_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
|
||||
|
||||
```python
|
||||
factorized_eris, df_factors, _, _ = df.factorize(mf._eri, cutoff_threshold)
|
||||
df_lambda = df.compute_lambda(mf, df_factors)
|
||||
_, number_toffolis, num_logical_qubits = df.compute_cost(num_spin_orbitals, df_lambda, *args)
|
||||
```
|
||||
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,
|
||||
|
||||
```python
|
||||
sf.factorize()
|
||||
df.factorize()
|
||||
thc.factorize()
|
||||
```
|
||||
|
||||
are all valid, as are the methods `compute_lambda()` and `compute_cost()` for the factorizations.
|
||||
|
||||
|
||||
For THC factorization, it also requires [BTAS](https://github.com/ValeevGroup/BTAS) and the [PyBTAS](https://github.com/ncrubin/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.
|
|
@ -0,0 +1,7 @@
|
|||
|
||||
|
||||
QRE or Quantum Resource Estimation is a tool employed in order to efficiently benchmark the required energy between test runs. There are multiple variables being considered so it will be helpful to map this to a many-to-many type of graph model.
|
||||
|
||||
|
||||
### Examples:
|
||||
- OpenFermion's [Resource Estimator](https://github.com/quantumlib/OpenFermion/tree/master/src/openfermion/resource_estimates)
|
|
@ -1,3 +0,0 @@
|
|||
|
||||
|
||||
QRE or
|
Loading…
Reference in New Issue