QREChem: Quantum Resource Estimation Software for Chemistry Applications
Matthew Otten Byeol Kang Dmitry Fedorov Anouar Benali Salman Habib Yuri Alexeev Stephen K. Gray


AIP/123-QED




Corresponding author email here

 Materials and Microsystems Laboratory, HRL Laboratories, Malibu, CA 90265, USA




 School of Materials Science and Engineering, Gwangju Institute of Science and Technology, Gwangju, Republic of Korea







 Computational Science Division, Argonne National Laboratory, Lemont, IL 60439, USA




 Center for Nanoscale Materials, Argonne National Laboratory, Lemont, IL 60439, USA







As quantum hardware continues to improve, more and more application scientists have entered the field of quantum computing. However, even with the rapid improvements in the last few years, quantum devices, especially for quantum chemistry applications, still struggle to perform calculations
that classical computers could not calculate. In lieu of being able to perform specific calculations, it is important have a systematic way of estimating the resources necessary to tackle specific problems. Standard arguments about computational complexity provide hope that
quantum computers will be useful for problems in quantum chemistry but obscure the true impact of many algorithmic overheads.
These overheads will ultimately determine the precise point when quantum computers will perform better than classical computers. 
We have developed QREChem to provide
logical resource estimates for ground state energy estimation in quantum chemistry through a Trotter-based quantum phase estimation approach. QREChem provides resource estimates which 
include the specific overheads inherent to problems 
in quantum chemistry by including heuristic estimates of the number of Trotter steps and number of necessary ancilla, allowing for more accurate estimates of the
total number of gates. We utilize QREChem to
provide logical resource estimates for a variety of small molecules in various basis sets, obtaining estimates in the range of 10^7-10^15 for total number of T gates.
We also determine estimates for the FeMoco molecule and compare all estimates to other
resource estimation tools.







QREChem: Quantum Resource Estimation Software for Chemistry Applications
    Stephen K. Gray
    April 29, 2024
========================================================================





§ INTRODUCTION



Quantum chemistry is often quoted as a potential “killer app” for quantum computers, with grand targets such as solving nitrogen fixation <cit.>. While there 
is much promise for quantum computers in quantum chemistry, due to a potential for an exponential speed up in eigenvalue estimation in quantum chemistry via the quantum phase
estimation (QPE) algorithm <cit.>, realistic resource estimates,
both at the logical and physical level, point to extremely large numbers of quantum gates and qubits necessary for even small systems <cit.>. Alternate algorithms,
more suited to near-term, noisy intermediate scale quantum (NISQ) <cit.> devices, such as the variational quantum eigensolver (VQE) <cit.>, provide a potential reduction
in gate depth, but add additional complexity in optimization <cit.> and still require substantial gate depth for more interesting, classically intractable
systems. 
With fault-tolerant, error-corrected quantum computers capable of the required gate depth and numbers of qubits still potentially years away, accurate resource estimates will 
play a key role in understanding the progress of quantum algorithms and the trade-offs of various architectural choices. There already exists several tools for estimating 
resources to varying degrees of precision. For example, TFermion <cit.> provides estimates of a wide variety of quantum algorithms for quantum chemistry
but relies on strict error bounds, sometimes greatly overestimating the resources for certain algorithms, while OpenFermion provides estimates of certain specific quantum chemistry methods and 
also provides some tools for estimating surface code overhead <cit.>.  Microsoft has released a `full-stack' resource estimation
framework and tool <cit.>, which allows for a more general resource estimation, including many potential hardware overheads.



Here, we detail QREChem, which provides accurate logical
resource estimates with a specific focus on quantum chemistry. Within QREChem we have implemented a detailed resource estimation of
the Trotter algorithm <cit.>, using heuristic, rather than worst-case, estimates for various algorithmic overheads. 
We have also included minimal implementations of error correction 
and hardware overheads. To benchmark our method, we compare our resource estimates to both TFermion <cit.> and OpenFermion <cit.> by estimating
the total number of logical T gates for various small molecules and for the larger FeMoco molecule <cit.>.

QREChem was developed in mind as a tool for providing realistic estimations of  resources to simulate ab initio quantum chemistry calculations on various quantum 
computers, both existing and future ones. It serves multiple purposes, with a primary goal of eventual co-design of future quantum computers and development of 
new quantum algorithms. For example, given a molecule, QREChem will be able to predict the resources (the number of qubits, gates, fidelities, sampling rate) required 
to accurately estimate the ground state energy. Or another way around given quantum hardware and molecule, QREChem could calculate a potential success rate. The current version
of QREChem focuses on the algorithmic implementations; further development will involve adding more detailed implementations for the hardware and error correction overheads
to provide more precise estimates. 







§ METHODS



 §.§ Design of QREChem

QREChem is designed to allow for efficient and accurate logical resource estimates of ground state energy calculations in quantum chemistry problems. 
<ref> details the overall design. 
QREChem consists of several modules: the `Chemistry' module, which defines the chemical system of interest; the `Algorithm' module, which defines the quantum algorithm to be used; 
the `Hardware' module, which defines the target hardware; and the `Error Correction' module, which defines the quantum error correcting code. These modules work in tandem to produce 
the final resource estimates. Our primary
focus in this work was to provide detailed implementations of the `Chemistry' and `Algorithm' (focusing on Trotterization algorithms <cit.>) 
modules; the `Hardware' and `Error Correction' modules are relatively simple, by comparison.
In the following sections, we provide detailed descriptions of each module, as implemented in the initial version QREChem, as well as ways in which each module can be further developed.



  §.§.§ Chemistry Module

The first step in performing quantum chemistry calculations is to generate the chemical Hamiltonian, which describes the energy operator of the molecular system in terms of the positions
of its constituent atoms. In the Chemistry module of QREChem, we generate the Hamiltonian using the self-consistent field (SCF) methods implemented in the PySCF program <cit.>.

The Hamiltonian matrix elements, which represent the contributions of the various terms in the Hamiltonian, are defined in terms of one-electron integrals, h_pq, and two-electron integrals, 
h_pqrs <cit.>. These integrals depend on the molecular properties such as the atomic coordinates, the charge, and the choice of basis set.  SCF calculations, such as 
the restricted Hartree-Fock (RHF) method, are performed to obtain the one- and two-electron integrals for the chosen molecular system. QREChem requires the definition of the chemical system of interest,
in terms of the atomic coordinates, the charge, and the target basis set.

It is important to note that the SCF calculations can be time-consuming, especially for larger numbers of atoms and larger basis sets, and can be tricky to properly converge. However, 
QREChem supports the standard  file format, which stores the one- and two-electron integrals, allowing a user to generate these integrals using a different program and 
then interface with the other modules of QREChem. The  file format is a widely used format for storing quantum chemistry Hamiltonians <cit.>
and can be produced by other quantum chemistry packages, such as Gaussian <cit.>, MolPro <cit.>, or Psi4 <cit.>. 
Once the one- and 
two-electron integrals are obtained, the data is available to other modules within QREChem.



  §.§.§ Algorithm Module

There are many proposed quantum algorithms for solving for the ground state energy in chemical problems, including quantum phase estimation (QPE) <cit.>, 
the variational quantum eigensolver (VQE) <cit.>, combinations of the two <cit.>, and quantum machine learning methods <cit.>. Within each of these families of algorithms,
there are a substantial number of possible variations. In this work, we focus on QPE using Trotterization <cit.>. Here, we provide a brief overview of QPE using Trotterization.

QPE solves for the eigenvalue, λ_k, for
an eigenvector |v_k⟩ of some unitary matrix, U. Aside from its use in ground state
energy estimation in quantum chemistry, it also finds use in Shor's prime number factoring
algorithm <cit.> and the Hassidim–Harrow–Lloyd algorithm for matrix inversion <cit.>. 
Given a Hamiltonian generated by the Chemistry module, the unitary matrix, U is
can be written as:

    U |v_k⟩ = e^iĤτ |v_k⟩ = e^i 2πϕ |v_k ⟩,

where τ is a scale factor to map the eigenvalues of H τ onto (0, 2 π] or (-π, π]. Assuming |v_k⟩ is the ground state,
the ground state energy is then mapped to the phase acquired, E = 2πϕ/τ, 
where units have been chosen such that ħ=1. 
The computational complexity of QPE is dependent on how the unitary matrix of <ref>
is implemented. In QREChem, we focus on Trotterization <cit.>,
but many other strategies, such as Taylorization <cit.> and
qubitization <cit.> have been proposed. The Trotterized version of the 
propagator, U, is

    U = lim_n→∞(∏_j e^i H_j τ/n)^n.

By choosing some finite number of  Trotter steps, n, U is only represented approximately. 
A first-order Trotter formula truncates <ref> at some number of steps. Choosing
a sufficient number of Trotter steps for a given accuracy is important for obtaining an accurate estimate of the total resources.
Higher-order Trotter-Suzuki formulas <cit.> can be used to decrease the number of steps at the cost of increasing
the complexity of each step.
The standard fermionic quantum chemistry Hamiltonian
has O(N^4) terms. A fermion-to-spin mapping is required to implement each fermionic term on qubits. Using the Jordan–Wigner <cit.>
transformation introduces an O(N) overhead, leading to a total complexity of O(N^5) for the Trotterized evolution.
The evolution of the phase is mapped to an ancilla register (introducing limits on the precision, based upon the number of ancilla)
and, using the quantum Fourier
transform (QFT) <cit.>, the ground state energy can be read out. 
In realistic settings, the true eigenstate |v_k⟩ is unknown and an approximation must be used. This 
introduces an additional overhead in the success probability which scales as the overlap of the approximate state, |ϕ⟩,
with the true eigenstate, i.e., |⟨ϕ |  v_k ⟩|^2.

Within QREChem, we provide resource estimates for Trotterized QPE by first estimating the resources required for a single Trotter time step and then
estimating the total number of Trotter steps. The resource estimation tools within Microsoft Quantum Development Kit (QDK) <cit.> are 
able to efficiently provide such logical gate estimates, even for very large systems. 
We estimate the total number of Trotter steps necessary as n_o^3/2, where n_o is the number of orbitals used in the Hamiltonian which is based on heuristic estimates <cit.>.
Beyond number of Trotter steps, we also need to accurately compute the number of 
ancilla necessary to reach the a user-defined desired precision ϵ_p (which, by default, we take to be 1 mHa). This allows us to 
calculate the base number of binary digits necessary, n_b = -log_2(ϵ_p/Δ E_R), where Δ E_R is a scaling factor that estimates the spectral range (i.e., Δ E_R ≈ E_max - E_min) <cit.> and is taken to be 1 Ha (a number chosen heuristically to cover all studied molecules). The phase resulting from a QPE is given as a binary fraction and the number of bits in this 
fraction (the precision) is determined by the number of ancilla qubits used in the QPE algorithm. If the eigenvalue is not exactly representable with n_b bits of precision,
the returned value will, instead, be mapped into the finite precision of n_b bits, causing a chance for error. To increase the QPE success probability, additional ancilla
can be used. If the eigenvector is known precisely, the total number of ancilla, n_a, is a function of the desired failure probability, p_f, <cit.>

    n_a = n_b + log_2(2 + 1/2p_f).


It is very unlikely to know the true eigenstate a priori. More accurate formulas can be derived which take into account errors in the Trotterization, ϵ_t,
as well as the true gap Δ E = E_1 - E_0 <cit.>

    n_a = n_b+log_2(2+ϵ_t^2/2p_f(Δ E)^2).

Since the true gap, Δ E, is generally unknown, we instead use equation-of-motion (EOM) coupled-cluster with singles and doubles (CCSD) as implemented in PySCF <cit.> to estimate the gap. 
In cases where CCSD becomes too expensive, other methods
with tunable cost and accuracy, such as selected configuration interaction <cit.> (which can be as cheap as Hartree-Fock) can be used.
We also use a target Trotter error of chemical accuracy (ϵ_t = 1.6 mHa), rather than an observed Trotter error. 


To calculate the total number of rotation gates, CNOT gates, and the total depth, we combine the estimates for a single Trotter step (using Q# and the Microsoft QDK) with the
estimate of the total number of Trotter steps (n_o^3/2) and multiply that by the number of ancilla, n_a, as each ancilla will require evolution to some long time, giving,
for example, the total number of rotation gates

    n_r,tot = n_r n_o^2/3 n_a,

where n_r is the number of rotation gates for a single Trotter step. Similar equations are used for the total depth and total number of CNOTs.

Using the same Hamiltonians generated in the Chemistry module, we utilized TFermion <cit.> and OpenFermion <cit.> to provide
comparison logical resource estimates. 
TFermion provides estimates of a variety of quantum algorithms, including variants of Trotterization <cit.> and Taylorization <cit.>, among others. 
It uses properties of the computed Hamiltonians, such as the 1-norm, combined with analytic formulas derived from the literature.
OpenFermion provides estimation of more advanced algorithms, such as qubitization with low rank factorization <cit.>.

Future improvements to the Algorithm module would involve the implementation of resource estimates for other evolution algorithms with explicit circuit constructions,
such as qubitization and Taylorization, as well as other algorithms, such as VQE. Furthermore, overheads relating to the preparation of sufficient overlap initial
states will also be implemented.



  §.§.§ Error Correction Module

Quantum error correction (QEC) is an essential feature of any viable quantum computing system due to the intrinsic susceptibility of quantum systems to errors. 
These errors can be caused by a variety of factors, including decoherence and operational imperfections. 
In simple terms, QEC codes encode a logical qubit into several physical qubits, 
and through the process of measurement and classical post-processing, corrects the inevitable errors, extending the effective processing time before errors
destroy the quantum state.

There are many proposed codes within QEC. Among them, the surface code <cit.> stands out due to its high error threshold, relative ease of implementation, and 
planar geometry, which matches many proposed quantum architectures. Like any QEC code, the implementation of surface code necessitates a large number of physical qubits
to encode a single logical qubit and presents a significant overhead in terms of resource requirements. Various implementations of the surface code have a given distance, d, which
refers to the minimum number of physical qubits that must be affected by errors in order to cause a logical error. Within QREChem, we provide estimates of the 
QEC space and time overheads of the surface code using OpenFermion <cit.>. The surface 
code cost estimator takes in the number of Toffoli gates, the number of logical qubits, a physical error rate, and the estimated surface code cycle 
time. It then estimates the total error, including error contributions from both magic state distillation (which is necessary to produce the Toffoli gates) <cit.> and due to the physical error rate. 
The physical error rate, p_P, logical error rate, p_L, and distance are approximately related via <cit.>

    p_L = 0.1(100p_P)^(d+1)/2.

The total error and space-time (number of qubits times number of seconds) is estimated for a various distances d of the surface code. The best, in terms of space-time, distance d estimate which has total error below a threshold ϵ_sc (which we by default take to be 0.1) is returned as the optimal surface code.

QREChem allows a user to input the desired total algorithmic success probability. Along with the total depth, which is estimated 
in the Algorithm module, and the physical error rate and cycle time, which is provided by the Hardware module, the error correction module provides the best surface code distance d. This provides an initial estimate of the QEC overhead in terms of the number of physical qubits and total runtime. 
Future module development will include more accurate estimates of the 
overhead in numbers of gates
needed for the surface code (via, for example, the methods in Ref. <cit.>), as well as estimates for other QEC codes 
(such as color codes <cit.>).



  §.§.§ Hardware Module

The underlying quantum computing architecture plays a pivotal role in the overall resource estimates. Various quantum hardware can have vastly different 
error rates, gate times, connectivities, native gate sets, etc <cit.>. The Hardware module captures several hardware-specific factors that can significantly affect the performance 
and resources of quantum algorithms. Within the initial release of QREChem, the Hardware module consists of a high-level description of the underlying hardware, including 
gate times and physical error rates. With this simplistic Hardware module, we estimate the logical depth by assuming that all single qubit gates can be performed in parallel batches
using n_o, the number of orbitals, qubits, and the CNOT gates cannot be performed in parallel (d=n_r/n_o + n_c, where n_r is the number of rotation gates and n_c
is the number of CNOTs). To estimate the number of T gates n_t, which are likely to be the most expensive gate for fault-tolerant, error-corrected quantum computers <cit.>, we
use estimates of the circuit synthesis cost of arbitrary rotations from Clifford+T gates <cit.>

    n_t = n_r (10 + 12log_2(ϵ_ss^-1)),

where ϵ_ss is the synthesis error, which we take to be 10^-9. We choose this value of the threshold to keep the synthesis error well below the standard 1/√(N_g) bound, where N_g is the number of gates <cit.>, for all circuits studied. This is a tunable parameter which can be varied by a user.
Total runtime is computed by interfacing with the Error Correction module, which requires a surface code cycle time, physical error rate, number of Toffoli gates (which is related to the number of T gate) and number of logical qubits. In the initial release of QREChem, we use experimentally demonstrated cycle times to abstract away the hardware details.


Future development of this module will incorporate underlying connectivity, specific noise models, and compilation to native gate sets, along with gate times, to computer the surface code cycle time, as it is evident from the results 
of this work that a fault-tolerant quantum computer will be required to execute QPE quantum circuits.





§ RESULTS




 §.§ Benchmark Molecules
 
Using QREChem, TFermion, and OpenFermion, we estimated the required logical quantum resources for the Trotter-based QPE algorithm to compute the ground state properties of various small molecules, 
including H_2, HF, H_2O, NH_3, CH_4, Be_2, and C_2. The geometries of these molecules were taken from the NIST database <cit.>. 
For these molecules, we investigated the relationship between the number of orbitals and the quantum resources 
by considering several Gaussian-type orbital basis sets for the smaller molecules (STO-6G, 6-31G*, cc-pVDZ, and cc-pVTZ).
All orbitals were included in the active space.
These small molecule benchmarks represent some of the most commonly found molecules, while stressing different types of molecular bonding. The choice of basis sets follows a progression of complexity, starting from where Gaussian orbitals are fit to a single Slater orbital (STO-6G) <cit.>, to more complete basis functions (6-31G*) <cit.> to more consistent basis sets designed for converging post-Hartree-Fock calculations (cc-pVDZ, cc-pVTZ) <cit.> to the complete basis set limit.

We also consider the much larger 
FeMoco molecule, also known as the iron-molybdenum cofactor, which is crucial for biological nitrogen fixation; however, its fixation mechanism is not 
fully understood <cit.>. FeMoco is a well-known benchmark molecule that has been used in previous resource estimations. 
To compare our results with those of other studies, we used the same Hamiltonians (i.e., active spaces) 
as used in <cit.> and <cit.>. 



 §.§ Resource Estimates



Using QREChem, we obtained the total number of logical T gates necessary for various algorithms for each molecule at different basis set levels. The data for all molecules is shown in <ref>. 
“This Work" represents the QREChem estimate of number of Trotter gates, as described above. “SF" uses OpenFermion's resource estimation tools for the single factorization algorithm <cit.>
to estimate the number of Toffoli gates, which is then scaled by 4, as that is the number of T gates necessary for one Toffoli gate <cit.>. “TF-Trot" uses TFermion <cit.> 
to estimate the number of T gates in the qDRIFT algorithm <cit.> and “TF-SF" uses TFermion to estimate the single factorization algorithm. Most striking is the comparison between
TFermion's Trotter algorithm (“TF-Trot") and the one estimated in QREChem (“This Work"). This is likely due to the fact the qDRIFT estimates use worst-case error bounds to calculate the total number
of operations. In QREChem's Trotter estimates, we instead use heuristic estimates, which result in orders of magnitude lower number of necessary Trotter steps
and, thus, orders of magnitude lower resource estimates. Furthermore, QREChem uses explicit gate counting
provided by the Microsoft QDK, rather than the more pessimistic estimates used in the formula of TFermion. These more realistic estimates put Trotter close to the estimates
of the more advanced single factorization algorithm
(which requires additional ancilla qubits).


We further compare the resource estimates of the number of logical T gates for various algorithms using FeMoco, which is the standard benchmark molecule for evaluation of quantum algorithms. We used the same Hamiltonian as in previous studies <cit.> and  <cit.> to obtain a precise comparison with other works. <ref> shows the comparison of the number of T gates between QREChem's Trotter estimation
(“This Work") and others from <cit.>. Ref. <cit.> provided the first theoretical estimates for FeMoco, which were approximately 10^15 T gates. Again, we see that QREChem's Trotter estimation lines up with the estimation from Ref. <cit.>, which is reasonable, given that both works used similar heuristic estimates. The single factorization algorithm <cit.> performs the best out of those studied. 

All estimates presented in <ref> and <ref>are only for the number of logical T gates required, not including additional overheads from hardware or error correction. 
To provide more realistic estimates, we estimated the surface code overhead for two benchmark systems: a 
superconducting qubit system and a trapped ion system. To parameterize the hardware, we use slight variations of 
parameters from recent demonstrations of error correction in each system <cit.>, 
which are summarized in <ref>. The results are plotted in <ref> for our benchmark small molecules. The much lower error 
rates of the trapped ion system used (3e-5 vs 5e-4 for the superconducting qubit system) allow for smaller surface code distances, d, and, hence, smaller numbers of physical qubits. The total runtime is several orders of magnitude higher, due to the increased cycle time (70ms vs 1μs for the superconducting qubit system). This leads to several orders of magnitude increase in the total space-time (measured in qubit-seconds) of the algorithm. These results point to the need for fast cycle times to achieve reasonable runtimes for quantum chemistry algorithms on quantum computers. Tabulated data for both physical qubit count and total runtime can be found in the Supplementary Materials for both architectures.





The data used in <ref> in collated in tabular form in the Supplementary Materials. Further tables, including our parameter settings, the number of rotation and CNOT
gates and the number of physical qubits and runtime assuming a surface code error correction scheme on both superconducting qubit and trapped ion hardware can also be found in the Supplementary Materials as can details about the code and how to reproduce the results. The code is available from https://github.com/Argonne-QIS/QREChem/.









 




§ DISCUSSION

We utilized the QREChem to provide accurate logical and physical resource estimations of a simple Trotter based algorithm over a broad range of molecules.
Our heuristic-based Trotter estimates offers a more realistic estimate of the true cost of using Trotter, compared
with more pessimistic estimates based on worst case bounds. On large systems such as the FeMoco molecule, the resource estimates are still large and do not include the 
necessary overheads of initial state preparation. The initial estimates of the overheads of quantum error correction and hardware limitations are significant and point to the need to have fast operations.

Accurate logical resource estimates, as currently implemented in QREChem, is a necessary first step for the larger goal of co-desiging future fault-tolerant quantum quantum computers 
capable of executing high-depth quantum chemistry circuits. 
Co-design allows for the optimization of both the hardware and algorithmic aspects of future quantum computers to facilitate the optimization of performance, scalability, accuracy, 
and energy efficiency. Moreover, co-design using a future version of QREChem will ensure that the simulation algorithms are tailored to the specific characteristics of the target quantum computers, ultimately 
enabling more effective and realistic quantum simulations.  Future developments will include a detailed examination and implementation of advanced features 
in the Hardware and Error Correction modules, as well as inclusion of additional quantum algorithms. These enhancements will allow QREChem to continue to provide accurate, comprehensive,
and actionable resource estimates for quantum chemistry.










































§ CONFLICT OF INTEREST STATEMENT

The authors declare that the research was conducted in the absence of any commercial or financial relationships that could be construed as a potential conflict of interest.



§ AUTHOR CONTRIBUTIONS


M.O., B.K., and D.F. performed the simulations. M.O., B.K., D.F, and Y.A. contributed to the code. All authors contributed important ideas during initial discussions and contributed to writing the manuscript.



§ ACKNOWLEDGMENTS


 This research used resources of the Argonne Leadership Computing Facility, which is a U.S. Department of Energy Office of Science User Facility operated under contract DE-AC02-06CH11357. This material is based upon work supported by the Defense Advanced Research Projects Agency under Contract No. HR001122C0074. Any opinions, findings and conclusions or recommendations expressed in this material are those of the author(s) and do not necessarily reflect the views of the Defense Advanced Research Projects Agency. This research was supported by the quantum computing technology development program of the National Research Foundation of Korea (NRF) funded by the Korean government (Ministry of Science and ICT(MSIT)) (No.2021M3H3A103657313) and by the National Research Foundation of Korea (NRF) grant funded by the Korea government(MOE) (No. 2020R1I1A2074957). This research is based on work supported by Laboratory Directed Research and Development (LDRD) funding from Argonne National Laboratory, provided by the Director, Office of Science, of the U.S. Department of Energy under Contract no. DE-AC0206CH11357. Work performed at the Center for Nanoscale Materials, a U.S. Department of Energy Office of Science User Facility, was supported by the U.S. DOE, Office of Basic Energy Sciences, under Contract No. DE-AC02-06CH11357.











apsrev4-1










§ TABLES

















§ FIGURE CAPTIONS




















   















