QREChem: Quantum Resource Estimation Software for Chemistry Applications

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.


I. INTRODUCTION
Quantum chemistry is often quoted as a potential "killer app" for quantum computers, with grand targets such as solving nitrogen fixation [1].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 [2,3], 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 [1,4].Alternate algorithms, more suited to near-term, noisy intermediate scale quantum (NISQ) [5] devices, such as the variational quantum eigensolver (VQE) [6], provide a potential reduction in gate depth, but add additional complexity in optimization [7] and still require substantial gate depth for more interesting, classically intractable systems.With faulttolerant, 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 tradeoffs of various architectural choices.There already exists several tools for estimating resources to varying degrees of precision.For example, TFermion [8] 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 [9].Microsoft has released a 'full-stack' resource estimation framework and tool [10], 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 [11,12], 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 [8] and OpenFermion [9] by estimating the total number of logical T gates for various small molecules and for the larger FeMoco molecule [1].
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.

A. Design of QREChem
QREChem is designed to allow for efficient and accurate logical resource estimates of ground state energy calculations in quantum chemistry problems.Figure 1 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 [11,12]) 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 selfconsistent field (SCF) methods implemented in the PySCF program [13,14].
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 [15].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 oneand 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 timeconsuming, especially for larger numbers of atoms and larger basis sets, and can be tricky to properly converge.However, QREChem supports the standard fcidump 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 fcidump file format is a widely used format for storing quantum chemistry Hamiltonians [16] and can be produced by other quantum chemistry packages, such as Gaussian [17], MolPro [18], or Psi4 [19].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) [2,3], the variational quantum eigensolver (VQE) [6], combinations of the two [20,21], and quantum machine learning methods [22].Within each of these families of algorithms, there are a substantial number of possible variations.In this work, we focus on QPE using Trotterization [11,12].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 [23] and the Hassidim-Harrow-Lloyd algorithm for matrix inversion [24].Given a Hamiltonian generated by the Chemistry module, the unitary matrix, U is can be written as: 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 h = 1.The computational complexity of QPE is dependent on how the unitary matrix of Equation 1 is implemented.In QREChem, we focus on Trotterization [11,12], but many other strategies, such as Taylorization [25] and qubitization [26] have been proposed.The Trotterized version of the propagator, U, is By choosing some finite number of Trotter steps, n, U is only represented approximately.A first-order Trotter formula truncates Equation 2 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 [27] 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 [28] 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) [29], 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) [15,30] 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 3/2 o , where n o is the number of orbitals used in the Hamiltonian which is based on heuristic estimates [1,31].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, where ∆E R is a scaling factor that estimates the spectral range (i.e., ∆E R ≈ E max − E min ) [21] 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 , [32] 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 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 [13] to estimate the gap.In cases where CCSD becomes too expensive, other methods with tunable cost and accuracy, such as selected configuration interaction [34] (which can be as cheap as Hartree-Fock) can be used.We also use a target Trotter error of chemical accuracy (ε t = 1.6mHa), 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 3/2 o ) 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 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 [8] and OpenFermion [9] to provide comparison logical resource estimates.TFermion provides estimates of a variety of quantum algorithms, including variants of Trotterization [35] and Taylorization [36], 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 [37].
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 [38] 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 [9].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) [39] and due to the physical error rate.The physical error rate, p P , logical error rate, p L , and distance are approximately related via [40,41] 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. [42]), as well as estimates for other QEC codes (such as color codes [43]).

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 [7].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 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, errorcorrected quantum computers [44,45], we use estimates of the circuit synthesis cost of arbitrary rotations from Clifford+T gates [46] n t = n r (10 + 12 log 2 (ε −1 ss )), (7) 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 [47], 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.

A. Benchmark Molecules
Using QREChem, TFermion, and OpenFermion, we estimated the required logical quantum resources for the Trotterbased QPE algorithm to compute the ground state properties of various small molecules, including H 2 , HF, H 2 O, NH 3 , CH 4 , Be 2 , and C 2 .The geometries of these molecules were taken from the NIST database [48].For these molecules, we investigated the relationship between the number of orbitals and the quantum resources by considering several Gaussiantype 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) [49], to more complete basis functions (6-31G*) [50] to more consistent basis sets designed for converging post-Hartree-Fock calculations (cc-pVDZ, cc-pVTZ) [51] 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 [1].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 [1] and [52].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 Figure 2. "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 [37] 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 [37]."TF-Trot" uses TFermion [8] to estimate the number of T gates in the qDRIFT algorithm [35] 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 worstcase 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).

B. Resource Estimates
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 [1] and [52] to obtain a precise comparison with other works.Table I shows the comparison of the number of T gates between QREChem's Trotter estimation ("This Work") and others from [1,8,37].Ref. [1] provided the first theo-retical 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. [1], which is reasonable, given that both works used similar heuristic estimates.The single factorization algorithm [37] performs the best out of those studied.
All estimates presented in Figure 2 and Table Iare 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 [53,54], which are summarized in Table II.The results are plotted in Figure 3 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 Figure 2 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/.

IV. 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 com-Figure 3.Estimated total resources with hardware and surface code error correction overheads included for QREChem's Trotter algorithm.The total space-time volume (shown in (a)), in qubit-seconds, is larger for a trapped ion system compared with a superconducting qubit system.While the number of physical qubits is smaller for a trapped ion system due to the lower error rates (see (b)), the total time (see (c)) is much higher due to the slower error correction cycle time.
puters 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.

TABLES
Table I.The number of T gates for FeMoco molecule as estimated by various sources.The Hamiltonians were taken from the repository of [55] used in [1] and [52].See text for definitions of the algorithms.

FIGURE CAPTIONS
Table II.Hardware parameters used in the error correction calculations.*Error rates used are two orders of magnitude lower than reported in Refs.[53] and [54], due to the need to be below the standard surface code threshold of 1e-3.† The cycle time of 70ms for the trapped ion is a third of that reported in Ref. [54] as their protocol was a more complicated color code protocol.

Figure 2 .
Figure 2.Estimated total numbers of logical T gates for various algorithms over many molecules at many basis set levels.See text for the definitions of the algorithms.