Open Source Variational Quantum Eigensolver Extension of the Quantum Learning Machine (QLM) for Quantum Chemistry

Quantum Chemistry (QC) is one of the most promising applications of Quantum Computing. However, present quantum processing units (QPUs) are still subject to large errors. Therefore, noisy intermediate-scale quantum (NISQ) hardware is limited in terms of qubits counts and circuit depths. Speciﬁc algorithms such as Variational Quantum Eigensolvers (VQEs) can potentially overcome such issues


INTRODUCTION
Solving the Schrödinger equation to obtain the many-electron wavefunction is the central problem of modern quantum chemistry 1,2 .In practice, it is possible to achieve full accuracy for systems that contain few electrons through methods like the Full Configuration Interaction (FCI) and the Full Coupled-Cluster (FCC), which include all the electron configurations.However, the computational cost grows exponentially-through the dimension of the FCI and FCC wave functions-when the number of electrons increases.For example, the number of possible Slater determinants increases as a function of the number of electrons and of orbitals 3 : Attempts to reach full accuracy on large systems clearly faces the so-called "exponential wall" that limits the applicability of the most accurate methods to more complex chemical systems.So far, the largest calculations performed with classical supercomputers have only included tens of billions of determinants 4 with 20 electrons and 20 orbitals, with hopes to solve problems of a size close to a trillion determinants (24 electrons, 24 orbitals) in a near future thanks to the advances of massively parallel supercomputer architectures 5 .Given such constraints, other classes of methods have to be used to approximate the ground state wavefunctions for larger many-electron systems.They include: (i) Density-Functional Theory (DFT), which relies on the use of a single Slater determinant, and has been shown to be extremely successful while failing to describe strongly correlated systems 6,7,8 ; (ii) post Hartree-Fock methodologies such as the truncated Coupled-Cluster (CC) and the Configuration Interaction (CI) approaches that, even though being still operational beyond the single Slater determinant, cannot be applied to large-size molecules, due to their extreme computational requirements in terms of Slater determinants 9,10,11,12,13,14,15,16 .A good example is provided by the "gold standard" methods denoted coupled-cluster single-, double-, plus perturbative triple-excitations CCSD(T).Indeed, CCSD(T) is able to handle a few thousand basis functions, but at the cost of an enormous operation count that is limited by the large requirements in term of data storage 17 .No matter the choice of chemical basis sets (STO-3G, 6-31G, cc-pVDZ, and beyond...), these methods are insufficient to reach accurate enough results for large molecules.
A paradigm shift proposed by Feynman 18,19 is to use quantum computers for simulating quantum systems.This has prompted the community to use quantum computers in order to solve quantum chemistry wavefunction problems.Intuitively, the advantage comes from the fact that quantum computers can process "exponentially" more information than classical computers 20 .Recent reviews provide background material about strategies for developing quantum algorithms dedicated to quantum chemistry.These approaches include techniques such as Quantum Phase Estimation (QPE), Variational Quantum Eigensolvers (VQE) or Quantum Imaginary Time Evolution (QITE) 21,22,23,24 .All methods generally include three key steps: (i) transforming the fermionic Hamiltonian and wavefunction into a qubit representation; (ii) constructing circuits with one and two-qubit quantum gates; (iii) using the circuits to generate a relevant wavefunction and measure the expectation value of a given Hamiltonian.Importantly, currently available quantum computers remain in the Noisy Intermediate-Scale Quantum (NISQ) era and are limited by two main resources: the number of qubits and the circuit depth (i.e.number of quantum gates) 25,26,27,28 .Among all available strategies, the VQE family of techniques is a very promising algorithm that can be applied to NISQ hardware 21,29,30,21,31 .Indeed, it is better suited to such devices than other algorithms such as QPE, thanks to its more modest requirements in terms of quantum processor coherence times.It has already been successfully executed on real NISQ quantum computers based on various technologies, including superconducting qubits 32,33 , photons 29 and trapped ions 34 .The performance of VQE algorithms is known to be highly dependent on the type of wavefunction ansatz.In practice, several types of ansätze can be used including: unitary coupled-cluster (UCC) wavefunctions 35,36 , hardware-efficient 33,37 , qubit coupled cluster (QCC) 38 , deep multi-scale entanglement renormalization ansatz (DMERA) 39 and Hamiltonian variational 40 .Furthermore, there are recent hybrid approaches such as adaptive ansätze 41 and the subspace expansion method 42 , which also utilize the basic VQE scheme to build the wavefunction of the system.
In this article, we provide a newly-designed software package named "OpenVQE" that extends the Atos Quantum Learning Machine ("QLM").QLM is a quantum computing platform that allows to write hardware-agnostic quantum programs, compile them in compliance with hardware constraints, and either emulate them classically with realistic noise models or execute them on actual quantum hardware.QLM is a mix between commercial tools and non-commercial ones provided by the Atos company.OpenVQE is fully compatible with the freely available open source component of QLM called "myQLM", which is available online 43 .myQLM is a quantum software stack for writing, simulating, optimizing, and executing quantum programs.It provides, through a Python interface: (i) powerful semantics for manipulating quantum circuits, with support for universal as well as custom gate sets, abstract parameters, advanced linking options, etc; (ii) a versatile execution stack for running quantum jobs, including an easy handling of observables, special plugins for carrying out NISQ-oriented variational methods (such as VQE or QPE), and an easy application programming interface (API) for writing customized plugins (e.g., for compilation or error mitigation), as well as for connecting to any Quantum Processing Unit (QPU); (iii) a seamless interface to available quantum processors and major quantum programming frameworks 44 .The capacity of QLM/myQLM to interoperate with other packages such as Qiskit 45 , Cirq 46 and PyQuil 47 allows researchers from different horizons to communicate, interact, exchange, and work more efficiently and faster.Furthermore, myQLM acts as a universal platform for users who want to access various quantum computers (IBM, Google etc...), providing them simple tools to run directly their jobs.myQLM comes with fermionic second quantization tools, which are helpful for solving quantum chemistry problems.These tools are now included in a new specialized open-source module dedicated to quantum chemistry called "myQLM-fermion".myQLM-fermion will be described in the present work; OpenVQE is designed to work synergistically with it.myQLM-fermion includes the key QLM resources that are important for quantum chemistry developments.More specifically, we use two important tools provided by myQLM-fermion which are useful for quantum resource reductions 35 : (i) an active space (AS) selection approach that is useful for the reduction of the number of qubits; (ii) an MP2 pre-screening approach that involves an implementation of second order Møller-Plesset perturbation (MP2) amplitudes as an input guess that is useful for faster parameter optimization.Therefore, by building on top of the initial myQLM blocks, we were able to design our OpenVQE package, which provides the community with advanced VQE tools dedicated to solve quantum chemistry problems.OpenVQE especially focuses on giving access to modules enabling the use of the UCC family and to adaptive ansatz algorithms.These modules include various features such as:  50,52 ).
These modules are structured in simple Python classes that require only to write a few lines of code and provide therefore examples enabling a rapid implementation of additional algorithms on the basis of myQLM basic tools.The goal of this paper is to showcase the novel OpenVQE/myQLM-fermion combined quantum simulator package that facilitates the test, development and measurement of the computational requirements of the different VQE flavors towards their future potential implementation on real supercomputers.In particular, it allows to compare the accuracy of the total molecular energies obtained thanks to various variants of the UCC method with popular quantum chemistry methods on classical computers.The GitHub websites of OpenVQE 53 and myQLM-Fermion 54 are public, under "MIT" and "Apache-2.0"licenses, respectively.
The paper is organized as follows: we review the theory of UCC ansätze including the different types of excitations, the ADAPT-VQE approach and the different steps needed to implement it (section 2).We then introduce the QLM library, specifically its myQLM-fermion open source extension, with a focus on its quantum chemistry tools, which we use develop OpenVQE (see section 3).Then, based on myQLM-fermion components, we describe the OpenVQE package, with its implementation of advanced UCC ansätze (static or adaptive) (section4).Finally, executing the OpenVQE library on our in-house HPC architecture (a Quantum Learning Machine at TotalEnergies), we simulate a full set of molecules ranging from 4 to 24 qubits.We first show the properties of the simulator applied to a set of molecules.Second, we describe how OpenVQE/myQLM-fermion can use active space selection and MP2 pre-screening initial guesses for different test molecules.Third, using our ADAPT-VQE module, we compare the fermionic and qubit-ADAPT-VQE results obtained on a set of molecules in terms of chemical accuracy, number of variational parameters, operators and quantum gates.Finally, we compare the group of "fixed-length" ansätze (using UCC modules) to the ADAPT-VQE method (section5).We conclude with a summary table comparing the features of the OpenVQE/myQLM-fermion packages with those implemented in other software packages, and we give some perspectives towards the development of new types of UCC ansätze and/or new variational algorithms within OpenVQE.

REVIEW: UNITARY COUPLED CLUSTER (UCC) AND ADAPTIVE DERIVATIVE-ASSEMBLED PSEUDO-TROTTER (ADAPT) WITHIN THE VQE ALGORITHM
We will use the following notations in the article: the indices i and j refer to the occupied spin-orbitals in the Hartree-Fock (HF) state; indices a and b refer to the unoccupied (or virtual) spin-orbitals in the HF state.Indices p,q,r and s are always related to spin-orbitals unless mentioned otherwise.When the orbitals are associated to an -like symbol ( , . . ..) they refer to spin-up electrons, and those with a -like ( , . . ..) refer to spin-down electrons.and (as given in the introduction) represent the number of electrons and orbitals, respectively.We also denote by and the number of active electrons and number of active spin-orbitals, respectively, and by the number of qubits.In qubit representation, | ref ⟩ denotes the -qubit initial state.It is usually a computational basis state | 0 , 1 , 2 , 3 , ... ⟩.We call | ( )⟩ the trial wave function and its variational parameter, while ( ) denotes a parameterized unitary operator.

The Variational Quantum Eigensolver (VQE) with the Unitary Coupled Cluster (UCC) Ansatz 2.1.1 VQE-UCC in a Nutshell
The Variational Quantum Eigensolver (or VQE) has been first developed by Peruzzo et al. 29 This hybrid quantum classical algorithm aims at finding the ground state energy 0 of a given Hamiltonian .In the context of quantum chemistry, the Hamiltonian is often written in the following fermionic second-quantized form: where † ( ) are anti-commuting operators that create (annihilate) electrons in spin-orbital ( ), respectively.The symbols ℎ and ℎ denote the one-and two-body integrals of the corresponding operators and spin-orbitals in Dirac notation, respectively.These integrals can be easily computed on a classical computer.
The VQE method is based on quantum variational theory, whose starting point is the Rayleigh-Ritz variational principle, which states that namely the energy of the normalized "trial" or "ansatz" wave function | ( )⟩ provides an upper bound for the ground state energy 0 .Variational methods leverage this principle through an iterative process that minimizes the expectation value ( ) = ⟨ ( )| | ( )⟩ with respect to the parameterized trial state | ( )⟩.This process is supposed to converge to an optimal parameter set * and hence give an approximation ( * ) of 0 .One of the core challenges of VQE is the choice of the ansatz | ( )⟩.One popular ansatz is the unitary coupled cluster (UCC) approach.It is inspired from the classical coupled cluster (CC) computational method 55,56,9,15 , which has been shown to be a good choice for reaching accurate results.The unitary version of CC, UCC, was originally introduced in the field of quantum chemistry computations 14 .It was later brought to the field of quantum computing 57,29 because of its unitary character (as opposed to the CC method).A comprehensive review of the UCC method is given in 35,36 .UCC yields variational states prepared by using unitary evolution under a sum of fermionic terms representing excitations of the initial Hartree-Fock (HF) state.The UCC wavefunction can be expressed as follows: where is the so-called cluster operator and † is its Hermitian conjugate.As is the sum of the excitations at different levels = 1 + 2 + . . .+ until excitations, then where , ∈ , , ∈ , and are variational parameters.This form of variational state ensures that UCC applied within VQE can systematically approximate the true ground eigenstate of the system.This is not guaranteed in the case for example of the hardware efficient ansätze 33,58,59,60 , whose form is not inspired by chemistry considerations.Moreover, the hardware-efficient ansatz includes many optimization parameters, and can therefore suffer from the "barren plateau" 61,62 problem.The UCC optimization is not straightforward on a classical computer even for low-order cluster operators, due to the non-truncation of the Baker-Campbell-Hausdorff (BCH) series 63 .On the other hand, a UCC state can be easily prepared on a quantum device, with first experimental demonstrations on a trapped-ion quantum simulator 57,64 .There, UCC-VQE was shown to be able to reach a final state with a good overlap |⟨ | 0 ⟩| between the converged UCC solution and the FCI solution | 0 ⟩ (see for example Figure 3 in 57 ).
The implementation of the UCC wavefunction on a quantum computer is an important step in the VQE process.Further implementation aspects are described in section 3.In particular, Figure 1 summarizes all the VQE process.
The UCC wavefunction in Eq. ( 4) is implemented on a quantum device by first constructing a circuit corresponding to the qubit representation of the HF state, by using (for instance) the Jordan Wigner (JW) representation 65 , | ⟩ = |11110000...⟩ where |0∕1⟩ refers to a single qubit being in the state 0 or 1.In the multi-qubit register, we assign each qubit to a spin-orbital, with orbital energies ranging from low to high.The |0⟩ state refers to an unoccupied spin-orbital, while |1⟩ refers to an occupied spin-orbital.The JW transformation relates spin-1/2 operators to fermionic creation and annihilation operators.We will use JW throughout the article.After having prepared | ⟩ on the device, the unitary operator ( ) = − † has to be implemented as well.This is done following these steps: ( ) must be decomposed into operations that can be implemented as circuits compatible with present available quantum computers.To do this, in practice, ( ) is approximated using the Trotter decomposition 66,67,68 , which breaks up the exponential of a sum as an ordered product of individual exponentials.Such transformation provides a reasonable approximation to the full unitary operator that is disassembled into local unitary operators.The formula of the trotterized ( ) with ( ) − ( ) † (Eq.( 5)) is: where is the number of Trotter steps and corresponds to the elements of excitations introduced in Eq. 5. Using > 1 can, on paper, decrease the Trotterization error.Yet, for the current available NISQ devices, it is not recommended since it would involve additional gates induced by the UCC ansatz translation into a quantum circuit 58,36 .For instance, in reference 58 (Figure 5), increasing the number of Trotter steps using a UCCSD ansatz for the H 2 molecule does not improve the convergence and the UCCSD energy.In the present work, we use a UCC ansatz truncated at the single and double excitation levels with a single Trotter step.Once these approximations are performed, each exponential of a fermionic excitation operator (see Eq. ( 6)) can be directly implemented as a sequence of gates.This is done using the standard "CNOT staircase method" 21,25,34 or a more advanced method 69,70,71 to reduce the CNOT counts.Further details about the implementation of the VQE-UCC method will be given in subsection 3.2.

Unitary Coupled Cluster Approaches Truncated at Single and Double Excitations Levels
In this subsection, we list the different versions of UCC that are truncated at the single and double excitation levels, by defining the excitation generator in each UCC version.We also review their recent use within variational algorithms.We first focus on the UCCSD and QUCCSD ansätze to compare their gate complexity and CNOT counts.We then focus on a second group of methods that includes UCCGSD and k-UpUCCGSD which, as shown in some reviews, perform better than the first group of ansätze in terms of chemical accuracy.However, such approaches require an increased circuit depth compared to the first group of techniques.These features have motivated us to implement these versions of UCC together with ADAPT-VQE (presented in the next section) in our OpenVQE package (see sec 4).Unitary Coupled Cluster Single and Double was the first commonly used ansatz by the quantum chemistry community for quantum computing, and it was successfully tested experimentally on quantum computers using VQE 57,34 .Chemically, the UCCSD ansatz includes few excitations of fermionic single and double operators, which occur only from occupied to unoccupied (virtual) spin-orbitals on the top of the HF state as given in Eq. (5).By assuming a single-step Trotter approximation (Eq.( 6)), UCCSD is given by the product of single and double fermionic evolutions , , , ) .( The Qubit Unitary Coupled Cluster Single and Double method is a simplified version of the UCCSD ansatz (Eq.( 7)) in which the single and double excitations † ( ) used to construct the trial wavefunction , , , are the creation (annihilation) operators without the inclusion of Pauli-terms after JW transformation (see their expressions in chapter two, section 2.2 (Eqs.2.11 and 2.12) of 72 ).These excitations can be achieved by particle-preserving exchange rotation gates in the qubit space.The actual role of Pauli-is to conserve the parity from fermionic creation (annihilation) † ( ) operators, while preserving the time and particle symmetries.By comparing QUCCSD to UCCSD ansatz VQE performance for a few simple molecules, it has been shown 51 that the two ansätze could achieve a nearly identical accuracy in the estimation of the ground state energies.Even though the parity property is missed in the qubit evolution excitations, it was found, as is described in Figures 1 and 2 of 51 , that the advantage of using QUCCSD is to reduce the CNOT counts with respect to the CNOT staircase circuit to implement fermionic evolutions.This demonstrates that QUCCSD is sufficient to approximate the exact FCI wavefunction with a smaller number of gates in the circuit and it might therefore be more favorable to use on current NISQ devices.However it has been shown that the operators in UCCSD and QUCCSD ansätze may not be ordered in practice and could decrease the precision in energy.Attempts for keeping ordered operators have been recently proposed. 35,38,41,73.Moreover it has been shown that an unnecessarily large number of parameters and operators occur when these ansätze were used, especially when system size gets larger.This is because the information about the specific chemical system such as point group symmetry were not taken into account.For example, as is shown in Table I of 74 , when the point group symmetry is used in UCCSD, the number of parameters reduce by at least 20%, which accelerates the optimization procedure and even brings little improvement, compared to UCCSD energies calculated without parameter reduction.The Unitary Coupled Cluster Generalized Single and Double (UCCGSD) ansatz state has been first mentioned in Reference 48 , then later in Reference 49 for using it in quantum computing applications.It consists into excitations that occur from occupied to occupied, and occupied to unoccupied levels, as is expressed in Equation7, or from unoccupied to unoccupied levels: -UpCCGSD stands for Unitary Pair Coupled Cluster with Generalized Single and Double Product 49 , where denotes the products of unitary paired generalized double excitations, along with the full set of generalized single excitations.In other words, in -UpCCGSD, single excitation operators are fully generalized without any specific constraint on the choice of occupied and virtual orbitals, but the double excitation operators are generalized and restricted to transitions of pair electrons acting on the same orbital: It was recently demonstrated 49,75 that the UCCGSD ansatz leads to more accurate results for ground state energies than the simpler UCCSD.In the same work, it was shown that starting from = 3 (i.e3-UpCCGSD) brings better accuracy than the UCCSD ansatz (see for example table 4 for H 4 molecule using 6-31G basis set).Indeed, such approaches were also engineered not only for ground states but also to tackle excited states.They have been used in the Variational Quantum Deflation algorithm (VQD), which is used to determine the energies of the ground and excited states 76 .

Adaptive Derivative-Assembled Pseudo-Trotter-VQE (ADAPT-VQE)
Instead of a fixed-length ansatz, i.e.where one chooses UCCSD, UCCSDT or UCCSDTQ anszatz (length equal 2, 3 or 4 respectively), variational algorithms with a variable-length ansatz have been proposed by the community 77,78,79,80,81 There are two reasons for that: (1) the fixed-length ansätze use unnecessary excitations that can be considered as redundant terms as they do not contribute to a better approximation of the FCI wavefunction.This creates longer circuits and consumes a greater number of variational parameters; (2) fixed-length ansätze such as UCCSD or QUCCSD cannot provide a good chemical accuracy for strongly correlated systems 51 (i.e.see for example the H 6 molecule in section 5).This problem occurs at long bond lengths and could be solved by including higher-order excitations and/or using multiple-step Trotterization in the UCCSD or QUCCSD ansatz.Yet, both suggestions are problematic since they would necessarily deepen the circuits and increase the number of variational parameters.Fixed-length ansätze like 3-UpCCGSD (or k>3) and UCCGSD might also provide very good accuracy at these bond lengths, because the excitations considered are general.However, this yields many redundant terms during optimization, and as the system size increases, the number of operators and parameters, as well as the circuit depth, increase.The ADAPT-VQE approach is an important step toward solving these issues 41,50 .
The ADAPT-VQE algorithm constructs the molecular system's wavefunction dynamically and can in principle avoid redundant terms.It is grown iteratively in the form of a disentangled UCC ansatz as given in Eq. (11).At each step, an operator or a few operators are chosen from a pool: the operator(s) contributing to the largest energy deviations is (are) chosen and added gradually to the ansatz until the exact FCI wavefunction has been reached which is in the form of a long product of one-̂ , and two-body ̂ , operators generated from the pool of excitations, where each of the variational parameters { , } is associated to an operator.Let us describe briefly the procedure to implement the ADAPT-VQE (see details in 41 ).A reference Hartree-Fock | ⟩ state needs to be chosen first in the qubit representation that preserves the number of electrons of the system, which is an essential component for implementing the algorithm.At this stage, it is then possible to construct the ansatz by starting the ADAPT-VQE-iteration at = 1.The circuit is initialized by the identity (0) ( ) = , corresponding to the HF state as an initial state.Then to start constructing the ADAPT wavefunction, the algorithm starts (by a "while loop" until exit): 1) Then the trial state with the current ansatz on the quantum simulator where −1 comes from the previous VQE iteration, has to be prepared; 2) In order to obtain the gradient (i.e the energy derivative with respect to −1 ), one measures the commutator (in the qubit representation) between the Hamiltonian (Eq.14) and each of the operators in the pool, of size , which is defined by = { ( , ), ( , , , )}.The energy gradient formula reads 3) If the norm of the gradient vector becomes smaller than a threshold, , then the algorithm exits the loop.If not, the operator with the largest gradient max is selected, and added to the left end of the ansatz, with a new variational parameter = .The wavefunction corresponding to ADAPT-VQE is given by 4) Perform a VQE experiment to re-optimize all parameters { , −1 , … , 2 , 1 } in the ansatz and when this is over we go back to step 1.
Historically, fermionic-ADAPT-VQE 41 was the first algorithm in the family of adaptive ansätze.The name "fermionic" comes from the excitation pool operators formed as spin-complement pairs of single and double fermionic evolutions (see Eqs. S1 and S2 are given in the Supplementary Material 82 ).The fermionic-ADAPT-VQE has been shown to bring accurate chemical results for several molecules such as for H 4 , LIH and H 6 molecules (as shown in figure 2 of 41 ) by using an ansatz constituted of fewer parameters and shorter circuit depth than for the corresponding UCCSD results.
After this fermionic version, qubit-ADAPT-VQE 50,52 was introduced to reduce the number of gates compared to fermionic-ADAPT-VQE.In qubit-ADAPT-VQE, the pool used is a collection of anti-Hermitian operators where each operator is a tensor product of Pauli matrices.Each such operator is transpiled into a defined number of CNOT gates using the CNOT staircase method, but unlike the fermionic-ADAPT-VQE, the qubit-ADAPT-VQE produces a smaller number of gates at the end of the process.Qubit-ADAPT-VQE has been tested for several molecules 50 and lowers the gate counts by one order of magnitude compared to fermionic-ADAPT-VQE.However, qubit-ADAPT-VQE requires a higher number of parameters and iterations in order to reach a given level of accuracy.
The cost of fermionic-and qubit-ADAPT-VQE is the number of measurements needed to compute the energy gradients.It scales as ( 8 ) 41,50 (where represents the number of qubits).The choice of pool in qubit-ADAPT-VQE has also been important in the research to reach and approximate the FCI wavefunction, with a view to not only reduce the circuit depth compared to fermionic-ADAPT-VQE but also to minimize the number of operators in the pool without losing the completeness properties of operators.Reducing the pool size from ( 4 ) into 2 − 2 operators and maintaining the necessary and sufficient conditions for completeness has been achieved in a recent work 52 .This new pool size reduces the number of measurements from ( 8 ) to ( 5 ) for a given molecular system.In the same reference, it was shown that incorporating symmetries into the pool solves the convergence problems caused by the lack of symmetries.

ALGORITHMS FOR QUANTUM CHEMISTRY ON THE ATOS QUANTUM LEARNING MACHINE
In this section, we briefly review the tools of the Atos Quantum Learning Machine (QLM) that are relevant to quantum chemistry computations.We will then describe in the next section (sec.4) how we built an advanced chemistry module upon these tools.

A Quantum Programming Environment and a Powerful Simulator
QLM is a complete environment designed for quantum software programmers, engineers and researchers 83 .It includes a wide variety of low-level tools useful for writing, compiling and optimizing quantum circuits 84,85,86,87,88 .These tools come in the form of so-called "plugins" that can be combined or stacked upon another to construct a quantum compilation chain.

FIGURE 1
The QLM workflow for quantum chemistry.Top row: Steps to prepare a variational quantum job containing a parameterized circuit and the Hamiltonian whose ground state energy one wants to approximate.The leftmost (grey) box uses standard third-party quantum chemistry modules.Orange boxes stand for QLM libraries.Bottom row: QLM stack, with plugins (orange boxes) that pre-and post-process the job and results, and a QPU (green box) that executes the quantum job and returns a result.QLM can simulate quantum circuits in a noiseless or noisy fashion.The noiseless simulators come in different flavors, with "Schrödinger style" simulators (storing the wavefunction either in a dense fashion or using Matrix Product States 89 ), a "Feynmanstyle" simulator 90 , a binary decision diagram simulator 91 , a Clifford simulator, etc.The Schrödinger-style dense simulator can reach up to 41 qubits for any circuit, while the other simulators can reach much larger qubit counts depending on the circuit properties (entanglement, gateset, etc).The noisy simulators enable the emulation of realistic quantum noise, a crucial tool in the current NISQ era.Gate noise, State Preparation and Measurement (SPAM) noise and idling noise can be taken into account via density-matrix (resp.stochastic) simulations that can handle circuit with up to 20 (resp.40) qubits.Most importantly, the interface of the simulators (also called "Quantum Processing Units" or QPUs) is such that they can easily be swapped for actual experimental QPUs without modifying the quantum program.QLM provides an interface to various hardware processors including those constructed by IBM, Rigetti etc... Its circuits are also interoperable 44 with other quantum circuit descriptions like Qiskit 45 , Cirq 46 and PyQuil 47 , as described in more detail in section SI in the Supplementary Material 82 .Moreover, QLM comes with quantum application libraries that enable the easy exploration of potential use cases of quantum computing.These libraries help generate quantum programs in fields ranging from combinatorial optimization to quantum chemistry and condensed-matter physics.A summary of the QLM workflow for quantum chemistry is provided in Figure 1 .The top row represents the steps one has to go through to handle a quantum chemistry problem using myQLM-fermion (bracketed terms represent optional steps), including the transformation of the electronic structure Hamiltonian (Eq.2) to a spin representation: , and a Pauli matrix applied on qubit .At the end of these steps, one obtains a "job" comprising a parameterized quantum circuit (that implements a UCC ansatz) ( ⃗ ) and a Hamiltonian sp represented as a sum of Pauli terms.This job can then be fed to the QLM stack.
This stack, represented in the bottom row, can be constructed by the user at will depending on the QPU they want to execute the job on.A minimal stack consists of a QPU (without plugins), which can handle minimal jobs containing native quantum circuits (with gates native to the hardware and compliant with its connectivity) and -axis observables.To handle more sophisticated jobs, one can stack "plugins" on top of the QPU.Each plugin has a well-defined role, such as compiling the circuit to a given gateset, rewriting it to comply with a given connectivity (see "Compilation plugins"), or generating all the elementary jobs required to compute the expectation value of a general observable (see "Observable Splitter plugin").Finally, some plugins can handle variational jobs corresponding to the VQE algorithm.Such "variational plugins" handle the update of the variational parameters based on the result of the previous steps.They can optionally generate jobs to compute the gradient of a given expectation value if gradient-based optimization is asked for.In practice, the QLM environment is composed of software modules and a powerful classical HPC hardware appliance, as described in figure 2 .Among the software modules, some are available and downloadable for free as Python packages.They come under the name of myQLM 43 .myQLM includes modules for programming quantum circuits, with quantum libraries (for performing e.g quantum arithmetic operations, etc), for describing quantum observables and analog quantum schedules.It also comes with a basic noiseless simulator for quantum circuits, basic plugins (e.g for splitting observables depending on the commutation relations of the Pauli operators), and modules for interacting with other quantum frameworks like Qiskit, Cirq, etc. Finally, myQLM contains the aforementioned myQLM-fermion module.
myQLM can be installed on a laptop or on a local cluster.The size of the circuits that can be simulated with the QPU simulator of myQLM is limited by the available Random Access Memory (RAM) (for a standard laptop, this corresponds to about 25 qubits).The Quantum Learning Machine is also a powerful HPC appliance.It comes with extra software in addition to myQLM: advanced noiseless simulators, modules for describing hardware models, noisy simulators (both gate-based and analog), advanced compilers, tomography and error mitigation modules, among others.The appliance itself can simulate circuits with up to 41 qubits when using state vector simulators, and more when using more specific representations of the wave function (like Matrix Product States or stabilizers).The software module we present below, OpenVQE, relies only on myQLM modules, which means it can be used by simply downloading myQLM on one's personal machine.Therefore, the results shown for small qubit counts can be (up to the run times) reproduced on a personal laptop.In practice, to execute the simulations, we used the QLM advanced noiseless statevector simulator so as to reach large qubit counts and gain speed.

myQLM-fermion: An Open Source QLM module for Fermionic Many-body Problems
The tools for quantum chemistry are collected into an open-source module called "myQLM-fermion", which is part of myQLM.myQLM-fermion provides general tools for dealing with fermionic problems: representations of fermionic Hamiltonians (including usual Hamiltonians like the electronic structure Hamiltonian (Eq.( 2)), the Hubbard and Anderson Hamiltonians), transformations from fermion operators to qubit operators (Jordan-Wigner, Bravyi-Kitaev, parity), generation of quantum evolution circuits via Trotterization, implementation of the quantum phase estimation algorithm, as well as various modules for variational algorithms such as VQE (see subsection 2.1): libraries of variational ansätze (like hardware-efficient ansätze, matchgate circuits, Low-Depth Circuit ansatz (LDCA) circuits), various optimization plugins (including the standard optimizers implemented in scipy 92 (COBYLA, BFGS, etc) as well as the Simultaneous Perturbation Stochastic Algorithm (SPSA) and Particle-Swarm Optimizer (PSO)).
A submodule of myQLM-fermion 54 is specifically devoted to quantum chemistry.It provides tools for selecting active spaces (based on natural-orbital occupation numbers), generating cluster operators (and thus, via the aforementioned Trotterization tools, UCC-type ansätze), and initial guesses for their variational parameters.The architecture of QLM and myQLM-fermion allows for experts in a given field to construct their own advanced modules with the QLM building blocks.
The key building block of quantum chemistry computations is the Hamiltonian, Eq. 2. On QLM, it is described by an object ElectronicStructureHamiltonian

from qat . fermion import E l e c t r o n i c S t r u c t u r e H a m i l t o n i a n hamiltonian = E l e c t r o n i c S t r u c t u r e H a m i l t o n i a n (h , g )
where h and g are the tensors ℎ and ℎ of Eq. ( 2).Such an object also describes cluster operators such as the ones described in Eq. ( 5) truncated at = 2.For instance, the following snippet from qat .fermion import g et _c l us te r _o ps cluster_ops = get_c l us te r _o p s ( n_electrons , nqbits = nqbits ) creates the list containing the sets of single excitations { † − † , ∈ , ∈ } and double excitations { † † − † † , , ∈ , , ∈ }.These objects can be readily converted to a spin (or qubit) representation using various fermion-spin transforms: The transformed objects are now in the form of Eq. (14).With these qubit operators, one can then easily contruct a simple UCCSD ansatz via trotterization red(as given Eq. ( 6)) of the exponential of the parametric cluster operator defined as cluster_ops_jw: The simulated QPU used in the previous code snippet can be readily replaced by an actual QPU by using the qat-interop module.For instance, in the following snippet, we use a transmon QPU by IBM: from qat .interop .qiskit import BackendToQPU qpu = get_default_qp u () qpu = BackendToQPU ( token = MY_IBM_TOKEN , ibmq_backend = " ibm q_guad alupe " ) Conversely, circuits created using other quantum programming frameworks can be converted to the QLM format.For instance, here we convert a circuit written in the Google Cirq format to a QLM circuit (that can then be fed to a QLM simulator): from qat .interop .cirq import cirq_to_qlm qlm_circ = cirq_to_qlm ( y o u r _ g o o g l e _ c i r c )

THE OPENVQE PACKAGE
OpenVQE facilitates the development of new algorithms on quantum computers.It consists of a couple of new modules that extend the main myQLM/myQLM-fermion implementations (see section 3 above).Those modules allow to build normal UCCSD algorithm, its variants and ADAPT-VQE algorithms as reviewed in section 2. To explain in another fashion, OpenVQE allows to perform calculations using new types of UCC methods that are different from the QLM predefined ones such as the regular UCCSD ansatz.
OpenVQE consists of two main modules that are inside the "openvqe" folder: • UCC Family denoted in the code by "ucc_family": this module includes different classes and functions to generate the fermionic cluster operators (fermionic pool) and the qubit pools, and to get the VQE optimized energies in the cases of active and non-active orbital selections.
• ADAPT denoted by "adapt": it includes two sub-modules: -Fermionic-ADAPT: containing functions performing the fermionic-ADAPT-VQE algorithmic steps in the active and non-active space selections; -Qubit-ADAPT: containing functions that perform the qubit-ADAPT-VQE algorithmic steps calculation in the active and non-active space orbital selections.
Additionally, "openvqe" contains a subfolder named "common_files" that stores all the internal functions needed to be imported for executing the two modules.OpenVQE also contains a "notebooks" folder that allows the user to run and test the above two modules (which are theoretically described in the review section 2).A brief sketch of the OpenVQE implementation is explained in the flow chart presented in Figure 3 .We remind the reader that we will describe below the code of OpenVQE for the full space selections and some internal function examples such as those related to "generator_excitations" and "fermionic_adapt_vqe.The codes related to active space selections can be found in the GitHub website 53 inside "notebooks" with prefix "active_space".
In order to develop a new algorithm using our OpenVQE package, it is important to list the different parameters and return variables contained in its main functions.
The first crucial parameters are the ones specifying the characteristics of the molecules such as the symbol of the molecule; the type of excitation generator (generators to produce the excitations, see sec.2.1.2):UCCSD (Eq.7), QUCCSD (Eq.8), UCCGSD (Eq.9), K-UpCCGSD (Eq.10) and spin-complemented pair (Eqs.S1 and S2 in the Supplementary Material 82 ); the spin transformation mapping (JW, Bravi-Kitaev, parity basis), choice of active or non-active space selection, denoted respectively in our code as molecule_symbol, type_of_generator, transform, and active.
# molecule examples : H2 , H4 , H6 , LiH , H2O , CO , CO2 , NH3 etc ... m ol e cule_symbol = ' H2O ' # suppose user choose the spin -complemented generalized singlet and doublet denoted as s p i n _ c o m p l e m e n t _ g s d t y p e _ of_ gen era to r = ' s p i n _ c o m p l e m e n t _ g s d ' # user can type other type of generators , such as : uccsd , quccsd , uccgsd , k -upccgsd , etc ... # we type Jordan wigner ( JW ) , user can also type Bravyi -Kitaev or Parity basis transform = ' JW ' # no active space selection , set : active = False # for active space ( AS ) , switch to " active = True " The user specifies these parameters in a class called MoleculeFactory.This class takes those parameters as input: define a function named as generate_hamiltonian that generates the electronic structure Hamiltonian (hamiltonian) and other properties such as the spin hamiltonian (for example hamiltonian_jw), number of electrons (n_els), the list contains the number of natural orbital occupation numbers (noons_full), the list of orbital energies (orb_energies_full) where the orbital energies are doubled due to spin degeneracy and info which is a dictionary that stores energies of some classical methods( such as Hartree-Fock, CCSD and FCI): Hamiltonian , hamiltonian_jw , n_els , noons_full , orb_energies_full , info = M ol ec u le F ac to r y .g e n e r a t e _ h a m i l t o n i a n ( molecule_symbol = ' H2O ' , active = False , transform = ' JW ') In addition to that, we define another function named as generate_cluster_ops() that takes as input the name of excitation generator user need (e.g., UCCSD, QUCCSD, UCCGSD, etc.) and internally it calls the file name generator_excitations.py which allows generate_cluster_ops() to return as output the size of pool excitations, fermionic operators, and JW transformed operators denoted in our code respectively as pool_size, cluster_ops and cluster_ops_jw: Once these are generated, we import them as input to the UCC-family and ADAPT modules.
In the example of fermionic-ADAPT sub-module, we call the function fermionic_adapt_vqe() that takes as parameters the fermionic cluster operators, spin Hamiltonian, maximum number of gradients to be taken per iteration, the type of optimizer, tolerance, threshold of norm ( ) and the maximum number of adaptive iterations: fermionic_adapt_vqe() calls internally other functions allowing the execution of the steps from 1th to 4th given in subsection 2.2: (1) prepare the trial state through prepare_state(); (2) compute analytically the commutator between the hamiltonian and the fermionic operator through compute_gradient() (or numerically by using the command hamiltonian_jw | cluster_ops_sp ); (3) collect and arrange the gradients in a list from maximum to minimum (with avoiding the zeros) through sorted_gradient(); (4) if the norm is less than the ( ), the program exits returning the generated values, else it will continue calculating the maximum gradient(s) of operator(s) depending on the number of maximum gradient in the input, after that, we append the operator(s) associated with their parameter(s) to the left of the previous trial state (step (1)) during which we apply VQE using function ucc_action(), in order to optimize the parameter(s) until satisfying the threshold's condition; fermionic_adapt_vqe() returns at the end: (i) the number of classical parameters for the final ansatz, (ii) the number of CNOT gates in the ansatz circuit, (iii) number of other gates, (iv) list of optimized energies corresponding to external iterations and (v) energy subtracted from the full configuration interaction (FCI).The qubit-ADAPT sub-module is globally similar to the fermionic-ADAPT in terms of the code structure, some key steps are different and makes it unique in its nature.Those steps can be summarized in the following sequence: (i) we use qubit pool generators using QubitPool class instead of fermionic ones; (ii) the preparation of the trial state is different from the fermionic-ADAPT one; (iii) the gradients calculation is not the same.It returns the same properties as that of fermionic-ADAPT-VQE.

SYSTEMATIC BENCHMARKING OF THE PERFORMANCES OF THE UCC AND ADAPT-VQE ALGORITHMS ON SEVERAL MOLECULES USING THE OPENVQE PACKAGE
In this section, we used OpenVQE to perform numerical estimations of ground state energies of various molecules using the VQE-UCC-family and ADAPT-VQE modules.The studied molecules require a number of qubits ranging from 4 to 24 (see Figure 4 ).We perform only noiseless simulations in order to minimize computational runtime.All simulations were performed using TotalEnergies's in-house HPC computing platform 1 .We validated our results by comparing some of them with other works obtained with similar methodologies.For each numerical simulation in the UCC-family or ADAPT-VQE modules, we use the following common functions implemented in OpenVQE to calculate: (i) the molecular orbital integrals using the PYSCF package 93 with the STO-3G, 6-31G and cc-pVDZ basis sets; (ii) the molecular Hamiltonian mapping, obtained by applying the Jordan-Wigner transformation; (iii) the ansatz circuits, based on the CNOT staircase method, except for QUCCSD version for which we use the two circuits representing the single and double qubit evolutions (see Figure 1 and 2 in 71 , respectively).For optimization, we used both optimzers BFGS and SLSQP from the scipy.optimizelibrary 94 .We also set the commonly accepted threshold for chemical accuracy, which is 1 kcal/mol (i.e 1.59×10 −3 Hartees(Ha)).This accuracy represents the error difference between the predicted energy and FCI energy.We use this value as a standard reference in all our results.
In order to show how openVQE performs, we split our results into four main subsections: (i) subsection 5.1 displays the timings of the QLM simulator for constructing the UCCSD ansatz on a simulator as well as for obtaining the expectation value of the electronic structure Hamiltonian for a set of molecules (STO-3G basis set) ranging from 4 to 24 qubits; (ii) subsection 5.2, dedicated to the UCC-family module, describes the performance of UCCSD-VQE for H 6 with the STO-3G basis set and for LiH using 6-31G basis set, with different sizes of active spaces, using Møller-Plesset wavefunction in second order (MP2 pre-screening) as initial guess; (iii) subsection 5.3 uses the ADAPT-VQE module.It describes the comparison between the fermionic and qubit-ADAPT-VQEs, in terms of the number of operators as well as the chemical accuracy, by benchmarking the three molecules H 4 , LiH and H 6 , in the STO-3G orbital basis set, by assuming a full space selection approximation in each molecule.(iv) subsection 5.4 introduces a brief Table summarizing the comparison of UCC-family methods involving fermionic excitations (UCCSD and UCCGSD) with the fermionic-ADAPT-VQE approach.Several molecules are considered and the results are discussed in terms of number of parameters, CNOT counts, chemical accuracy, and computational time.
In addition to the results presented below in this section, there are also additional interesting results obtained using the Open-VQE UCC family module.Indeed, we simulated several other test molecules, using a larger number of qubits and different chemical basis sets assuming both full and active space selections.Such computations were performed in order to demonstrate further the capabilities of our module to perform large calculations and to reach chemical accuracy despite the molecular size increase.These results are detailed in Section 2 of the Supplementary Materials 82 .

The Standard UCCSD Ansatz: Representative Computational Performances with OpenVQE
To illustrate the performance of our OpenVQE package on CPUs, we chose to use a standard laptop 2 to evaluate the time to solution required to perform two operations that are common to most of the variational algorithms: (i) the application of the ansatz; (ii) the computation of the expectation value of a molecular Hamiltonian or another observable.Examples of such operations are: the implementation of a hardware efficient ansatz, or a unitary coupled cluster ansatz.Observables are for example the electronic structure Hamiltonian, a commutator operator, Pauli string terms etc, which can be applied with either of these ansätze to measure their expectation value.As a test, we chose here the UCCSD method to evaluate the timing associated to various computations.It is important to note that, in practice, for the particular case of the simple UCCSD, OpenVQE and the native QLM (QLM simulator version: 1.2.1) timings are identical.To measure such timings, we conducted benchmarks with a set of molecules using OpenVQE and the STO-3G basis set (H 2 , H 4 , LiH, H 2 O, NH 3 , CH 4 , CO, HCN, and C 2 H 2 ).
Figure 4 (a) displays the timings associated to the generation of a state-vector corresponding to the UCCSD ansatz (see Eq. 7) from OpenVQE.The computational cost for this generation grows sub-exponentially with the number of qubits.We observe that the package can compute the UCCSD wavefunction within less than a second for a molecule requiring 4 to 12 qubits, between a second and 10 seconds for molecules associated to a 14-20 qubits range and up to a few minutes for larger molecules (22-24 qubits).Figure 4 (b) represents the timings required to measure the expectation value of the JW transformed Hamiltonian (see Equation 14) of each of these molecules using UCCSD ansatz.This measurement increases linearly with the number of qubits and is performed using the UCCSD circuit together with the "Job" class which will be submitted to QPU to obtain the expectation value.The process is described by the code function called UCC_action() which can be found in the UCC module openVQE 53 .We observe that the computational cost of performing the measurement increases exponentially with the number of qubits.In

UCCSD: Active Space Selections and MP2 Pre-screening
We test the active space (AS) selection approach by simulating H 6 linear geometry type within STO-3G basis set and LiH within 6-31g basis set, for a range of bond lengths for both molecules.We use MP2 pre-screening as initial guesses in the BFGS optimizer.For the H 6 molecule, which has a Hilbert space spanned by 12 Hartree-Fock orbitals, 6 occupied and 6 virtual (i.e., unoccupied) we choose two different active spaces: (i) First 2 spin orbitals where the lowest energies are always filled and 2 spin orbitals where the highest energies are always empty, as these 4 spin-orbitals are not considered in the active space selection, the system consists of 8 active spin orbitals with 4 active electrons, which means a 8-qubit Hamiltonian; (ii) when we consider that only the first two spin-orbitals are always filled, the system has then 4 active electrons and 10 spin-orbitals corresponding to 10 qubit Hamiltonian.Figure 5 (a) shows the error of ground state energies of the H 6 molecule at different dissociation profiles, with different sizes of the active spaces ranging from a minimum of 8 qubits to the full space of 12 qubits.This error corresponds to absolute value of VQE-UCCSD results substracted from FCI energy.By increasing the active space from 8 to 10 qubits, we observe only little improvement of the accuracy and both sizes are still far from approaching the chemical accuracy (see the blue line which was set at 10 −3 Ha).However in the full space case, the VQE results approach the chemical accuracy before a bond length equal to 1.5 Å.Interestingly, for bond length ≥ 1.5 Å, even with full space, the error deviates well beyond the chemical accuracy but it seems to be curving again toward the blue line beyond 3.0 Å.This error means that triple excitations are probably required.Results comparable to our findings for H 6 can be seen in Figure 7 of 51 , but this work only considered the non-active case.Figure 5 (b) shows the same energy profile but for the LiH molecule.Using the 6-31G basis set, LiH has a Hilbert space spanned by 22 HF orbitals, 4 occupied and 18 virtual (i.e., unoccupied).But five active space selections are chosen, leading to 4, 6, 8, 10 and 12 qubit Hamiltonians.For all choices of active spaces here, the error decreases steadily as the the bond length increases.The 10 and 12 qubit Hamiltonians are below the chemical accuracy for bond length > 1.0Å, while the largest deviation measured is in the intermediate bond lengths range between 1 and 2.4 Å.Interestingly, the 8, 10 and 12 qubit results fall within a narrow range, at bond length before 1.0 and at bond length beyond 2.2Å.Surprisingly, we noticed some jumps in the accuracy for the three cases 6, 8 and 10 qubits at some bond lengths, for example around 2.2Å.A similar analysis has been made in 58 for two different molecules than ours, by changing the number of qubits in different basis set: (6-31G) in H 2 and (STO-3G) in H 2 O.In particular they observed similar jumps we also observed for H 2 O at intermediate range, which as mentioned there it might correspond to geometries close to the so-called Coulson-Fisher point where spin-symmetry breaking can occur 95 .

Performance of ADAPT-VQE Module in OpenVQE
In Figure 6 , we represent the energy convergence for LiH, H 4 and H 6 , which are (8-12) qubit systems, obtained with the fermionic-ADAPT-VQE and qubit-ADAPT-VQE algorithms.The three molecules are at bond lengths Li-H = 1.45Å,H-H = 0.85Å, and H 6 at bond distance H-H = 1.0 Å, respectively.All convergence plots are terminated when the norm value of the

f)
FIGURE 6 Energy convergence plots for the near equilibrium ground states of LiH, H 4 and H 6 using the STO-3G orbital basis set, at bond distances Li-H = 1.45Å,H-H = 0.85Å, and H-H = 1.0Å.The red plots are obtained with a fermionic-ADAPT-VQE algorithm and the blue plots are obtained with qubit-ADAPT-VQE.Top panels (a,b,c) present the energy accuracy as a function of the ansatz parameters (note that for both ADAPT-VQE, the number of parameters are the same as the number of operators taken per iteration).Bottom panels (d,e,f) present the energy accuracy as a function of the CNOT count of the ansatz circuit.The blue area corresponds to the chemical accuracy.
gradient is below the threshold (see section 2.2), which is between 10 −3 and 10 −4 for fermionic-ADAPT-VQE, and between 10 −3 and 10 −6 for qubit-ADAPT-VQE, depending on the molecule.Since we find SLSQP and BFGS optimizers behave comparably for energy convergence (after using MP2 initial guess) as is noticed in Figure .S3 in the Supplementary Material 82 , we used SLSQP optimizer for fermionic-ADAPT-VQE and the BFGS optimizer for qubit-ADAPT-VQE.The plots in Figure 6 present the two ADAPT algorithms in terms of two important conditions, required to construct an ansatz and to achieve a specific chemical accuracy : (i) the number of iterations (or parameters); (ii) the number of CNOT gates.Figures 6 (a,b,c)show that the fermionic-ADAPT-VQE converges faster than the qubit-ADAPT-VQE, requiring systematically fewer number of iterations and thus variational parameters.However as it is shown in Figures 6 (d,e,f)-the CNOT counts from the fermionic-ADAPT-VQE required to reach convergence, are higher by more than one-order of magnitude compared to qubit-ADAPT-VQE.Such results make sense with the fermionic-ADAPT-VQE approach since the type of operators is spin-complemented pairs (see Eqs. S1 and S2 in the Supplementary Material).Indeed, the JW transformation of single and double operators will lead to sets of two and eight Pauli strings, respectively, where each Pauli string is a tensor product of Pauli matrices.According to theory, there are four CNOT staircases (for a single excitation) and sixteen (for a double excitation) 70 .The qubit-ADAPT-VQE anszatz (see section 2.2) states that the pool consists of many individual Pauli strings.This means the qubit-ADAPT-VQE needs more ansatz elements (i.e operators or parameters) to reach convergence.However, at the same time, the CNOT counts are strongly reduced compared to fermionic-ADAPT-VQE.Similar CNOT counts results, number of parameters and chemical accuracy for fermionic-ADAPT-VQE involving LiH and H 6 molecules are presented in Figure 2 of 41 .For the LiH molecule, we match these results.For H 6 some differences occur since we have converged our computations beyond the 10 −3 threshold.This added additional parameters to the ansatz, providing therefore a better accuracy.In 50 (Figure 1) results of fermionic and qubit-ADAPT-VQE involving LiH ( = 2.0Å), H 4 ( = 1.5Å) and 6 ( = 2.0Å) are also comparable to our findings despite some small differences are noted due to slightly different geometries in the three molecules, and convergence threshold.

Comparison of Fixed-length Ansätze with ADAPT-VQE Methods
In this subsection, we want to determine how many parameters (i.e.CNOT gates) are needed and which energy accuracy is reached by the "fixed-length ansätze" as opposed to the fermionic-ADAPT-VQE.To do so, we choose the LiH (1.45Å) and H 6 (1.0Å) molecules as benchmarks.In Figures 6 (a,b,d and f), and in Figures (S4.a and S4.c in the Supplementary Material 82 ), the attempt to reach chemical accuracy is displayed alongside with the number of CNOTs for both the fermionic-ADAPT-VQE and UCCSD, respectively.The UCCGSD (see Eq. 9) method remains to be characterized.We do so using the BFGS optimizer in a similar VQE loop.Table 1 and Table 2 summarize the results obtained from calculations with each of the methods for LiH and H 6 , respectively.We observe from Table 1 that fermionic-ADAPT-VQE brings the most accurate values for the ).This means that as the norm threshold decreases, the ADAPT-VQE approach reaches a better accuracy.
Remarkably, the number of parameters/CNOTs (30/4624) is still small compared to UCCSD and UCCGSD even though the considered threshold is 10 −3 .Results displayed in Table 2 demonstrate again that ADAPT-VQE yields to the most accurate energy for the H 6 molecule, by at least two orders of magnitude as compared to UCCGSD and UCCSD.Although UCCSD requires a fewer number of parameters and CNOTs than with ADAPT-VQE, the latter brings better accuracy.This is again due to the fact that we controlled the norm threshold to 10 −4 .A comparable accuracy between UCCSD and ADAPT-VQE in H 6 occurs when a norm threshold 10 −1 is used in ADAPT-VQE as noticed in Figure 2(h) of reference 41 ).It shows the fact that, at this level of threshold, ADAPT-VQE decreases the counts of CNOTs and parameters.For UCCGSD, its energy lies between UCCSD and ADAPT-VQE ones, while its number of CNOTs and parameters remain very high.
With those results, one can deduce that ADAPT-VQE brings more accurate results than UCCSD by several order of magnitudes, depending on how the user can control the threshold value, but the cost associated to the use of ADAPT-VQE with and increased threshold is linked to the associated higher number of iterations and CNOTs.These latter increase with the number of qubits, which consequently leads to higher computational requirements in term of gradient computations which could be a practical problem on a real QPU.For UCCGSD (together with UCCSD), the analysis of numerical simulations applied to H 4 , H 2 and N 2 were shown in reference 49 , illustrating the fact that although the UCCGSD ansatz yields very accurate results, the problem in using this method is linked to its high circuit depth.This is the opposite to the UCCSD case (or even k-UpCCGSD with at least k>2, see 49 ).

CONCLUSION AND FUTURE WORK
In this article, we discussed in detail our newly introduced open source package, OpenVQE.OpenVQE allows one to perform quantum chemistry computations based on the Quantum Learning Machine (QLM) thanks to the newly introduced myQLMfermion open-source library that gather the key QLM resources that are important for quantum chemical developments.The OpenVQE/myQLM-fermion combined quantum libraries facilitate the implementation, testing and overall development of variational quantum algorithms dedicated to quantum chemistry problems and provide state-of-the-art quantum computing methods (see Table 3 which summarizes the GitHub links of the open-source quantum chemistry packages available to the community).
We have shown that OpenVQE enables users to construct modules in a few lines of Python code using simple class structures × × 54 related to the adaptive UCC family ansätze that we reviewed in the article.We also presented how to easily implement efficient circuits related to fermionic and qubit evolutions with the goal of reducing the number of CNOT gates.Using these modules, we generated benchmarks on a range of molecular computations from 4 to 22 qubits and obtained reliable results that appeared consistent with those previously obtained in reference literature (see 35,116,117,72 for the UCC and 41,72,50,52 for the ADAPT-VQE approaches).It is worth noting that technically the QLM machine is designed to simulate up to 41 Qubits on a large memory classical computer systems.OpenVQE is thus designed to simplify the researchers' work, providing simple code modules facilitating the construction of new algorithms and ansätze.Furthermore, OpenVQE benefits from the myQLM-fermion tools and allow to exchange/interact with other software, like quantum chemistry-oriented quantum computing packages (see Figure .S1 in the Supplementary Material 82 ), thus enhancing the community's capacity to work collectively and faster.We also intend to forge an efficient module that could merge the few keys tools required to run jobs on quantum computers (IBM, Rigetti etc...).For example, Figure .S2 show examples of simple code structure classes that involve the interoperability between different open source packages and QPUs.
We plan to further extend OpenVQE/myQLM-fermion tools towards reducing the quantum resources by building new modules describing functions that enable: (i) to taper off the number of qubits in VQE (alongside active space selection) through using penalty functions 118 , using point-group symmetry in small molecules 119 and in large molecules 120 and studying new functions that could preserve spatial symmetry of molecules (rotational and translational); (ii) to reduce the number of CNOT gates (alongside with MP2 guesses, efficient circuits, fermionic and qubit-ADAPT-VQE) through implementing other adaptive algorithms such as permute qubit-VQE 121 .
Concerning chemical accuracy, we want to implement further methods to go beyond the chemically inspired UCC ansätze described in 36 (i.e. the implemented UCCSD, UCCGSD, spin-complement-gsd, k-UpCCGSD etc...).Equally we are interested in other types of UCC ansätze that involve higher-order correlation effects, such as MP3 or MP4, or triple excitation UCCSD(T), which could be important for strongly correlated systems and could further improve the accuracy as mentioned earlier 49 .We are also motivated to implement additional algorithms going beyond VQE, such as VQD (ADAPT-VQD) and QITE (ADAPT-QITE) that allow to determine excited state energies 122,75,76,123,124 .
Concerning optimization effects in the UCC family of methods, since we have demonstrated in the present work that some convergence problems might appear in ADAPT-VQE when targeting certain levels of accuracy, we want to make use of more efficient optimizer methods to overcome this problem.Of course, the practical use of VQE algorithms on present quantum computers will require to make Darwinian choices in link with qubit/operator counts and circuits depths restrictions: not all algorithms will "make the cut" to the real quantum computing world.We believe that the present OpenVQE/myQLM-Fermion approach will help the community to study and design new accurate VQE algorithmic "champions" able to efficiently run on present and near-future NISQ quantum computers towards performing accurate quantum chemical computations on complex molecular systems.

#
Jordan -Wigner from qat .fermion .transforms import t r a n s f o r m _ t o _ j w _ b a s i s ham iltonian_jw = t r a n s f o r m _ t o _ j w _ b a s i s ( hamiltonian ) clu ster_ops_jw = [ t r a n s f o r m _ t o _ j w _ b a s i s ( t_o ) for t_o in cluster_ops ] # Bravyi -Kitaev from qat .fermion .transforms import t r a n s f o r m _ t o _ b k _ b a s i s ham iltonian_bk = t r a n s f o r m _ t o _ b k _ b a s i s ( hamiltonian ) clu ster_ops_bk = [ t r a n s f o r m _ t o _ b k _ b a s i s ( t_o ) for t_o in cluster_ops ]

1 ∏|
from qat .lang .AQASM import Program , X from qat .fermion .trotte risati on import m a k e _ t r o t t e r i s a t i o n _ r o u t i n e prog = Program () reg = prog .qalloc ( nqbits ) # Create Hartree -Fock state ( assuming JW rep resent ation ) for qb in range ( n_electrons ) : prog .apply (X , reg [ qb ]) # Define the full cluster operator with its parameters theta_list = [ prog .new_var ( float , " \\ theta_ {% s } " % i ) for i in range ( len ( clus ter_op s_jw ) ) ] cluster_op = sum ([ theta * T for theta , T in zip ( theta_list , clust er_ops _jw ) ]) # Trotterize the Hamiltonian ( with 1 trotter step ) qrout = m a k e _ t r o t t e r i s a t i o n _ r o u t i n e ( cluster_op , n _ tr o tt er _ st ep s =1 , final_time =1) prog .apply ( qrout , reg ) circ = prog .to_circ () The circuit we constructed, circ, is a variational circuit that creates a variational wavefunction | ( )⟩.Its parameters can be optimized to minimize the variational energy ( ) = ∑ ℎ ⟨ ( )| −=0 ( )⟩.This is done by a simple VQE loop: # create a quantum job containing the variational circuit and the Hamiltonian job = circ .to_job ( observable = hamiltonian_jw , nbshots =0) # import a plugin to perform the optimization from qat .plugins import s c i p y M i n i m i z e P l u g i n o pt i mizer_scipy = s c i p y M i n i m i z e P l u g i n ( method = " COBYLA " , tol =1 e -3 , options ={ " maxiter " : 1000} , x0 = theta_init ) # import a QPU to execute the quantum circuit from qat .qpus import g et _ de fa u lt _q p u # define the quantum stack stack = optimizer_s c ip y | g et _ de fa u lt _q p u () # submit the job and read the result result = stack .submit ( job ) print ( " Minimum energy = " , result .value )

FIGURE 3
FIGURE 3 Flow chart of the OpenVQE package.The code is given in our Github repository and documentation 53 .
from openvqe .common_files .m o l e c u l e _ f a c t o r y import M o le c ul eF a ct or y # returns the properties of a molecule : r , geometry , charge , spin , basis = Mo le c ul eF a ct o ry .ge t_para meters ( m o le cu l e_ s ym bo l = ' H2O ') from .g e n e r a t o r _ e x c i t a t i o n s import ( uccsd , quccsd , singlet_gsd , singlet_sd , singlet_upccgsd , spin_complement_gsd , s p i n _ c o m p l e m e n t _ g s d _ t w i n ) pool_size , cluster_ops , clust er_ops _jw = Mo l ec ul e Fa ct o ry .g e n e r a t e _ c l u s t e r _ o p s ( m ol ec u le _ sy mb o l = ' H2O ' , ty pe_ of_ gen er at o r = ' s p i n _ c o m p l e m e n t _ g s d ' , transform = ' JW ' , active = False ) # in our example ' s p i n _ c o m p l e m e n t _ g s d ': def g e n e r a t e _ c l u s t e r _ o p s () : pool_size , cluster_ops , clust er_ops _jw = None , None , None if t ype _of _g ene r a t o r == ' s p i n _ c o m p l e m e n t _ g s d ': pool_size , cluster_ops , clust er_op s_jw = s p i n _ c o m p l e m e n t _ g s d ( n_el , n_orb , ' JW ') # elif for other excitations ( uccsd , quccsd , s in gl e t_ up c cg s d ...) # :::: return pool_size , cluster_ops , clus ter_op s_jw from openvqe .adapt .f e r m i o n i c _ a d a p t _ v q e import f e r m i o n i c _ a d a p t _ v q e # choose maximum number of gradients needed (1 ,2 ,3....) n_max_grads = 1 # choose optimizer needed ( COBYLA , BFGS , SLSQP , Nelder -Mead etc ...) optimizer = ' COBYLA ' tolerance = 10**( -6) # according to a given norm value we stop the ADAPT -VQE loop type_conver = ' norm ' t h r e shold_needed = 1e -2 # the maximum external number of iterations to complete the ADAPT -VQE under a given t h r e s h o l d _ n e e d e d max _iterations = 35 fci = info [ ' FCI '] # sparse the Hamiltonian and cluster operators using myQLM -fermion tools obtained from MoleculeFactory , which are explicitly : h a m i lt o ni a n_ s pa r se = hami ltonia n_jw .get_matrix ( sparse = True ) c l u s te r _o p s_ s pa r se = cluster_ops .get_matrix ( sparse = True ) # reference_ket and hf_init_sp can be obtained from class M o le cu l eF a ct or y () : reference_ket , hf_init_sp = M ol ec u le Fa c to ry .g e t _ r e f e r e n c e _ k e t ( hf_init , nbqbits , ' JW ') # when all these parameters are satisfied , then fermionic -ADAPT -VQE function is : f e r m i o n ic _ a d a p t _ v q e ( cluster_ops , hamiltonian_sparse , cluster_ops_sparse , reference_ket , h_sp , cluster_ops_jw , hf_init_sp , n_max_grads , fci , optimizer , tolerance , type_conver = type_conver , t h r e s h o l d _ n e e d e d = threshold_needed , m a x _ e x t e r n a l _ i t e r a t i o n s = max _itera tions )

FIGURE 4
FIGURE 4 Panel(a): timings for the application of a UCCSD circuit by OpenVQE while increasing the number of qubits.Panel (b): timings for the evaluation of increasing size molecular Hamiltonians (summed over Pauli strings and using using JW transformation) for the following molecules: H 2 , H 4 , LiH, H 2 O, NH 3 , CH 4 , CO, HCN, C 2 H 2 .Panel (c) shows the number of CNOT gates required to complete the UCCSD circuit and the number of Pauli strings in the Hamiltonian.
Errors for the H6 molecule ground state Errors for the LiH molecule ground state.

FIGURE 5
FIGURE5 VQE results for the H 6 molecule using the STO-3G basis set (a) and for LiH with the 6-31G basis (b).The dissociation profile is showed, using different active space selections and are calculated by using the first order trotterization UCCSD ansatz.The size of qubits represents the number of active spin-orbitals.The blue line indicates the chemical accuracy.

TABLE 1
LiH ( Li-H ) = 1.45Å molecule at the STO-3G basis set level.Comparison between UCCSD and UCCGSD fixedlength ansätze with fermionic-ADAPT-VQE in terms of number of parameters, CNOT-gates and energies.Accuracy is displayed as the absolute value of the difference between the ansatz Energy and the FCI energy in Hartree (Ha).

TABLE 2
Linear H 6 ( H-H ) = 1.0Å molecule at the STO-3G basis set level.Comparison between UCCSD and UCCGSD fixedlength ansätze and fermionic-ADAPT-VQE in terms of number of parameters, CNOT-gates and Energy.Accuracy is displayed as the absolute value of the difference between the ansatz Energy and the FCI energy in Hartree (Ha).

TABLE 3
36ailable implementations of individual approaches in a list of most recent open sources quantum chemistry simulation packages (Table referred from36) including OpenVQE and myQLM-fermion packages.Note: PNO-UpCCGSD stands for pair-natural orbitals-UpCCGSD and SPA for Separable Pair Approximation.The × notation means that the method is NOT implemented in a given package.