Efficient symmetry-preserving state preparation circuits for the variational quantum eigensolver algorithm

The variational quantum eigensolver is one of the most promising approaches for performing chemistry simulations using noisy intermediate-scale quantum (NISQ) processors. The efficiency of this algorithm depends crucially on the ability to prepare multi-qubit trial states on the quantum processor that either include, or at least closely approximate, the actual energy eigenstates of the problem being simulated while avoiding states that have little overlap with them. Symmetries play a central role in determining the best trial states. Here, we present efficient state preparation circuits that respect particle number, total spin, spin projection, and time-reversal symmetries. These circuits contain the minimal number of variational parameters needed to fully span the appropriate symmetry subspace dictated by the chemistry problem while avoiding all irrelevant sectors of Hilbert space. We show how to construct these circuits for arbitrary numbers of orbitals, electrons, and spin quantum numbers, and we provide explicit decompositions and gate counts in terms of standard gate sets in each case. We test our circuits in quantum simulations of the H2\documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$${H}_{2}$$\end{document} and LiH\documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$LiH$$\end{document} molecules and find that they outperform standard state preparation methods in terms of both accuracy and circuit depth.


INTRODUCTION
Quantum simulation of fermionic systems, such as molecules, is one of the first envisioned applications of quantum computers, as famously proposed by Feynman. 1 The first protocol introduced for quantum chemistry simulations is based on the so-called phase estimation algorithm. 2,3This algorithm however requires a large number of quantum gates, leading to long quantum circuits that are challenging for existing and near-term noisy intermediate scale quantum (NISQ) devices. 4,5For such devices, alternative, hybrid algorithms are instead envisioned.In such algorithms, the work is shared between a quantum processor and a classical computer.[9][10][11][12] The VQE algorithm relies on preparing and measuring multiqubit states based on a variational ansatz, and using the classical computer to optimize and update the variational parameters in this ansatz.Some of the advantages of VQE are that its variational character can provide some degree of error mitigation in the gates, 7,[13][14][15] and that it features shallower circuits compared to the phase estimation algorithm.The form of the ansatz is a crucial ingredient of VQE and one that can determine its success on NISQ devices.There are two main approaches in determining the ansatz.One approach is based on a technique from chemistry, the unitary coupled cluster method, [16][17][18] translated into quantum gates by Trotterization. 18This approach tends to lead to deeper circuits than what is currently feasible on hardware, and is generally not exact.To address these issues, a new, iterative algorithm termed ADAPT-VQE, was recently put forward and was shown to enable a much more compact ansatz while simultaneously exhibiting higher accuracy. 19An alternative approach is to base the ansatz on the capabilities of the hardware and prepare states by combining parameterized gates available on the processor. 8,20Such an ansatz has the advantage of compatibility with the capabilities of the hardware, and as such is NISQ-friendly.On the other hand, in its simplest form it is an ad hoc ansatz that can cause the algorithm to get stuck on 'barren plateaus' 21 as the number of qubits increases and the Hilbert space correspondingly grows exponentially.Therefore, for hardware-based ansätze to be a viable approach for problems of interest, they must be selected in a way that guarantees they span the part of the Hilbert space where the solution lives, while avoiding generating unphysical states.
Two ways to guarantee that the desired part of the Hilbert space is accessed include adding terms in the VQE energy function that penalize symmetry violations 22,23 or carefully designing state preparation circuits so that they only produce states with the appropriate symmetries regardless of how their variational parameters are chosen.An early step toward the latter direction was taken by Wang et al., 24 who focused on the preparation of states with a well-defined number of occupied spin orbitals and showed that the number of CNOT gates required for this scales polynomially with the number of qubits in the limit where the number of electrons is much smaller than the number of qubits.More recently, Barkoutsos et al. 15 enforced particle number conservation by using the particle-hole representation in conjunction with a parametrized particle-conserving exchangetype gate, [25][26][27][28] which we also make use of here.However, important open questions remain, including how other symmetries can also be built into the circuits and whether more efficient circuits containing the minimal number of parameters necessary to span the symmetry subspace exist.
In this paper, we address these questions by introducing state preparation circuits that provide a systematic, economical way to generate states with well-defined symmetries, including particle number, total spin, spin projection, and time-reversal.Our circuits incorporate the minimal number of parameters needed to fully span the appropriate symmetry subspace while avoiding all states outside this subspace.This general approach has two key advantages: the first is that the true ground state is guaranteed to be contained within the space of states spanned by the circuit, and the second is that resources are not spent on generating irrelevant parts of the Hilbert space, reducing the complexity of the classical optimization step of the VQE algorithm.Eliminating extraneous parameters can dramatically speed up the optimization process and suppress the probability of getting trapped in local extrema or barren plateaus.We present circuits for arbitrary numbers of single-particle orbitals and electrons and for arbitrary spin quantum numbers.Our circuits are constructed with hardware constraint considerations, including a reduced number of CNOT gates that need only be applied between adjacent qubits in a linear array, making our work particularly suited for NISQ devices.In addition, since our construction conserves number and spin symmetries, symmetry verification techniques can be used to mitigate any errors which violate these symmetries. 13,14,27Our most general circuits, which conserve particle number, timereversal, and spin symmetries, are guaranteed to span the appropriate symmetry subspace by construction.We also present circuits that conserve particle number and time-reversal symmetries, but not total spin; the symmetry-preserving properties of these circuits are verified with numerical calculations.We test the performance of our circuits against standard state preparation ansätze by running VQE simulations of the H 2 and LiH molecules.We find that our circuits outperform the standard methods in terms of both accuracy and circuit depth.
The paper is organized as follows.In the Results section, we define the basic gate set we use to manipulate particle number on the quantum processor and show how these gates can be systematically assembled into circuits that preserve particle number symmetry.We also discuss how to respect time-reversal symmetry as well.In addition, in the Results section, we show how to create circuits that respect total spin and spin projection symmetries in addition to particle number.We give some concluding remarks in the Discussion section.An appendix contains additional details about gate decompositions.

Particle number and time-reversal symmetries
In this work, we focus on mapping chemistry problems onto quantum processors using the Jordan-Wigner mapping, 3,29 in which each qubit in the quantum processor corresponds to a particular spin-orbital, and the qubit states 0 j i and 1 j i encode the occupation of that spin-orbital.Any multi-electron state involving n spin-orbitals on the chemistry side can be mapped to a corresponding state of n qubits on the quantum processor.In this mapping, fixing the total number of electrons is tantamount to fixing the total number of qubits that are in the excited state 1 j i.Thus, the Jordan-Wigner mapping relates fixed-particle-number subspaces to fixed-excitation subspaces in the qubit Hilbert space.
Formally, we can define the qubit subspace corresponding to m electrons occupying n spin-orbitals as H n;m ¼ span s 1 ; s 2 ; :::; s n j i j s i 2 f0; 1g; This is the subspace of multi-qubit states containing m qubits in the 1 j i state and n À m qubits in the 0 j i state, so that dim . A general state in this subspace can be represented as an arbitrary superposition of these basis states with complex coefficients and is thus characterized by 2 dim ðH n;m Þ À 2 real parameters, where we have removed two parameters by fixing the normalization and neglecting a global phase.In the absence of any other symmetries, 2 dim ðH n;m Þ À 2 is the minimal number of real variational parameters needed to prepare arbitrary trial states describing the correct number of electrons.
An additional symmetry that often arises in chemistry problems is time-reversal symmetry.This symmetry is typically present, for example, when one wants to solve the stationary Schrödinger equation in the absence of any applied magnetic field.In this case, one can always choose the energy eigenstates to be strictly real functions.Under the Jordan-Wigner mapping, this means that the coefficients appearing in the multi-qubit superposition states we prepare as trial states for the VQE algorithm should be restricted to real values.This will reduce the dimensionality of the target symmetry subspace by a factor of two down to dim ðH n;m Þ À 1. Imposing this restriction on the trial states will prevent the classical optimizer from wasting time exploring a large portion of Hilbert space that does not contain any of the desired energy eigenstates.When we introduce our state preparation circuits below, we will see that time-reversal symmetry can be imposed easily after other symmetries are already built into the circuits, essentially just by fixing half of the variational parameters in the circuits in such a way that the resulting states are strictly real.
Before we introduce our general scheme for constructing particle-number-conserving state preparation circuits, we first present a few simple examples that may provide some intuition about the general structure of such circuits.First note that the cases m ¼ 0 and m ¼ n are trivial since in each case, there is only a single state spanning the subspace.Therefore, we restrict our attention to 0 < m < n throughout this work.The simplest nontrivial example is the case of m ¼ 1 electron in n ¼ 2 orbitals.(Since we are presently only concerned with particle-number symmetry, these could be spin-orbitals or spatial orbitals in the case of spinless fermions.Spin symmetries will be incorporated in the next section).A circuit that spans the corresponding subspace H 2;1 is shown in Fig. 1.
This circuit requires only two parameters to span the singleexcitation (one-electron) subspace, which is comprised of states of the form α 01 j i þ β 10 j i.Here, although α and β are complex, they contribute only two real parameters after we impose normalization jαj 2 þ jβj 2 ¼ 1 and discard a global phase.The key ingredient in this circuit is a two-qubit entangling gate that we have denoted as Aðθ; ϕÞ.In the basis 00 j i, 01 j i, 10 j i, 11 j i, it is defined as 15 Aðθ; ϕÞ ¼ 1 0 0 0 0 cos θ e iϕ sin θ 0 0 e Àiϕ sin θ Àcos θ 0 It is clear from the form of this exchange-type gate that it preserves particle number since it mixes 01 j i and 10 j i but does nothing to the 00 j i; 11 j i subspace.The initial X gate on the first qubit in Fig. 1 brings the two-qubit state into the one-excitation subspace, while the subsequent A gate generates all possible superpositions within this subspace, as can be seen by inspection in this case.If we wish to also impose time-reversal symmetry, then it suffices to set ϕ ¼ 0 in each of the A gates.This removes the phase from each coefficient in the resulting superposition state without restricting the magnitude, thus ensuring that the resulting state is an arbitrary real state.The A gate plays a central role in our state preparation circuits.It can be decomposed into a sequence of two single-qubit gates and three CNOT gates, as Fig. 1 2-Qubit A circuit.A simple example of a 2 qubit circuit which exactly spans the subspace defined by 1 excitation, α 01 j i þ β 10 j i, with two parameters ðθ; ϕÞ.This circuit saturates the lower bound on the number of real parameters required to construct arbitrary states in H 2;1 .
shown in Fig. 2.This decomposition is minimal in the number of CNOT gates.In operator form, the A gate is up to an irrelevant global phase. 30uilding upon the example of Fig. 1, we find that we can generate trial states corresponding to other particle and orbital numbers using a similar construction.Figure 3 shows another example circuit for the case of m ¼ 2 electrons in n ¼ 4 orbitals.In this case, we start with two X gates to bring the state into the two-excitation subspace, and we then apply a series of A gates between neighboring qubits to create arbitrary superpositions within this subspace.In this example, an arbitrary complex two-electron state is specified by 2 4 2 À Á À 2 ¼ 10 real parameters.Since each A gate introduces two parameters, one might expect that only five A gates would be needed to generate an arbitrary state.However, we find that at least six A gates are needed to do this, although two of the parameters can be fixed to reduce the total parameter count back down to 10.We can again impose time-reversal symmetry by setting all the ϕ i parameters to zero in the A gates, which reduces the parameter count down to 6-one more than the minimal number of 5. To remove this extra parameter, we find numerically that it works to set either θ 4 or θ 5 to zero.Note that setting both θ i and ϕ i to zero does not remove the ith A gate completely but instead reduces it to a CZ gate, as is evident from Eq. (2).
To confirm that this and all other circuits presented in this section indeed span the target subspace, we compute the fidelity where Ψ i j i is a random state within the chosen subspace, and ψ i j i is the state output by our circuit after we maximize jhΨ i jψ i ij 2 with respect to the variational parameters.We check numerically that F ¼ 1 can be achieved using the minimal number of parameters, 2 dimðH n;m Þ À 2. We choose enough random states, N ) dimðH n;m Þ, to ensure that the subspace is adequately represented.This is how we determine that, in the case of Fig. 3 with time-reversal symmetry, it works to set θ 4 or θ 5 to zero, but setting other θ parameters to zero instead does not achieve unit fidelity (although the fidelity still remains very high).Further details about the numerical verification of our circuits are given in the supplementary information. 31lthough we have found a circuit that prepares all states in the two-excitation subspace using the minimal number of variational parameters (Fig. 3), this solution is neither unique nor optimal in terms of the number of CNOT gates.To illustrate these points, we present another circuit that accomplishes the same task in Fig. 4. In addition to the A gate, this circuit also makes use of single-qubit gates beyond just X gates.This example is quite different from the one shown in Fig. 3 in that it does not first apply X gates to two qubits in order to bring the quantum processor into the appropriate particle-number subspace.Instead, the appropriate subspace is approached gradually as the circuit is performed, making it more challenging to understand and generalize the circuit.Since each A requires three CNOT gates to implement, we see that the circuit in Fig. 4 requires only 9 CNOT gates, while the one in Fig. 3 requires twice as many.However, it should be noted that the circuit of Fig. 3 requires only nearest-neighbor qubit coupling, which is not true of the one in Fig. 4.This example highlights the fact that further reductions in circuit depth are possible even if the circuit contains the minimal number of parameters, although this may require an increase in the qubit connectivity.
An efficient circuit for the general case of n orbitals and m fermions is shown in Fig. 5.This circuit builds on the approach of Fig. 3, where X gates are applied to m qubits to bring the system into the correct particle-number subspace, and then a sequence of A gates is performed to create different superpositions.Through trial and error, we find that the total number of A gates needed to produce all possible superpositions is n m À Á . Since each A gate contributes two parameters, we have a total of 2 n m À Á parameters; the ϕ parameters in the last two A gates can be fixed to reduce the number of parameters down to the minimal number, 2 n m À Á À 2, while still fully spanning the subspace.Our general recipe for constructing circuits for any n; m like that shown in Fig. 5 can be summarized into the following steps: 1. Apply X gates to m qubits.For an efficient circuit, avoid placing X gates on neighboring qubits.2. Apply a "first layer" of A gates on all adjacent pairs of qubits on which either X 1 or 1 X has been applied.3. Apply a "second layer" of A gates on adjacent pairs of qubits, where each pair includes one qubit acted on by an A gate from the previous step and a qubit free of A gates.Continue Fig. 2 A gate decomposition.Decomposition of the A gate in terms of elementary single and two-qubit gates.Rðθ; ϕÞ ¼ R z ðϕ þ πÞ R y ðθ þ π=2Þ, where R z ðθÞ ¼ expðÀiθσ z =2Þ, R y ðϕÞ ¼ expðÀiϕσ y =2Þ.
Fig. 3 4-Qubit A circuit.An example circuit for the case of n ¼ 4, m ¼ 2 which exactly spans the subspace defined by six basis states using the minimal number (10) of parameters.Note that ϕ 1 is used three times.
Fig. 4 Alternate 4-qubit circuit.Another example circuit for the case of n ¼ 4; m ¼ 2, which also spans the desired subspace with the minimal 10 parameters, but with fewer two-qubit gates than the circuit shown in Fig. 3.The single-qubit gates Rðθ; ϕÞ are as defined in Fig. 2.
Fig. 5 General A circuit.General construction of an efficient circuit which also enforces number symmetry for any number of qubits (orbitals) n and excitations (electrons) m and is constructed using the logic discussed in the text.Each A gate contributes two variational parameters θ i ; ϕ i to the ansatz, except the last two A gates, which each contribute one (see text).This general structure only requires single-qubit X gates and a cascade of two-qubit A gates and always generates circuits with the minimal number of required parameters to place A gates on adjacent qubits as necessary until all neighboring qubits are connected with A gates.The first and second layers define a primitive pattern.4. Repeat the primitive pattern until n m À Á A gates are placed.Any two A gates have ϕ as a free parameter and therefore the full circuit contains exactly 2 n m À Á À 2 parameters, the minimum required to span the subspace H n;m .In Step 1 above, we can see that this step simply places the full system into the proper m excitation subspace.The following two steps, which only involve applications of A gates, do not change the excitation number of the system but instead mix the 01 j i and 10 j i basis states of the two qubits on which they act, producing the desired subspace spanned by m, dependent on the parameters ð θ ! ; ϕ !Þ.Although we do not have an analytical argument for why this particular arrangement of A gates works, we have confirmed this through extensive numerical testing.We conjecture that this circuit pattern will continue to work for arbitrarily many fermions and orbitals.Another key point is contained in Step 4, specifically that this general construction always uses the minimal number of required parameters to span the desired space; increasing the gate depth any further is unnecessary, as unit fidelity is achievable at this gate depth.Timereversal symmetry can be imposed by setting all the ϕ parameters and one θ parameter in the A gates to zero as before.This yields a purely real ansatz with the minimal number of parameters needed.Numerical calculations of the fidelity as a function of the number of variational parameters for several different values of n and m are given in Fig. S4 of the supplement. 31We have numerically verified all cases for which (n) and all permutations of n ¼ f2; 3; 4; 5; 6g; m ¼ f1; 2; 3; 4; 5g.In all cases, the fidelity increases monotonically with the number of parameters and saturates at unity once this number equals the dimension of the symmetry subspace, confirming that the circuits fully span the subspace.
While this construction is not necessarily the most resource efficient in terms of the required number of gates, it is straightforward to extend to any desired subspace defined by n and m and only requires nearest-neighbor qubit coupling, which is typically more straightforward to engineer.This should be contrasted with the circuit of Fig. 4, where two-qubit gates between non-neighboring qubits are required.We also note that our general construction naturally exhibits the symmetries of binomial functions.For example, the number of gates used for the case of n p and n nÀp for 0 < p < n are identical, which is a reflection of particle-hole symmetry.This in turn means that we can focus on the case where m n=2 without loss of generality, so that in Step 1 above, we can always avoid applying X gates on two adjacent qubits.
It is worth comparing our general construction with existing state preparation algorithms in terms of gate counts.If we wished to span the full Hilbert space, then this would require Oð2 n Þ CNOT gates. 32,33Some previous state preparation algorithms involve transforming one arbitrary nÀqubit state into another arbitrary state, which requires 2 nþ1 À 2n À 2 CNOT gates. 34However, since we are interested in only spanning a subspace of the full Hilbert space, namely H n;m , we can span this subspace with significantly fewer CNOT gates.Wang et al. 24 and Ortiz et al. 35 also considered this restricted subspace, requiring no more than 2 mþ1 n m =m! and n m À Á 2 n 2 CNOT gates, respectively.In the case of our general construction for n qubits and m excitations, we find that our algorithm requires at most N CNOT ðn; mÞ ¼ 3 n m À Á CNOT gates.Since we always consider a fixed input state (the state with all qubits in 0 j i), simplifications of our required gates are always possible, which reduces the number of required CNOT gates.Specifically, if we eliminate the unnecessary CNOT gates, then the actual number of CNOT gates in the general circuit is Figure 6 shows how our approach to constructing state preparation circuits compares to existing works.We see that our scheme significantly decreases the required number of CNOT gates.
We noted earlier that our example of Fig. 4 contains only 9 CNOT gates, while our general construction uses N CNOT ð4; 2Þ ¼ 18 CNOT gates in this case.However, our general construction in terms of A gates is relatively straightforward for arbitrary H n;m , while it is not clear how to generalize the construction of Fig. 4. We stress that on a case by case basis, it may be possible to find circuits that more efficiently span a reduced Hilbert space, but finding a general procedure for constructing such circuits for arbitrary numbers of orbitals and electrons can be challenging, and it may require a more complicated qubit connectivity beyond just nearest-neighbor coupling.Further investigation of these differences and tradeoffs is an interesting topic for future work but beyond the scope of this paper.

Spin symmetries
Many systems that we are interested in simulating possess not only particle-number and time-reversal symmetries, but also spin symmetries.This can include both the net spin magnetization s z and also total spin s.To our knowledge, it remains an open problem to find state preparation circuits that respect all these symmetries at the same time.Here, we introduce a protocol for constructing circuits that achieve this.
We begin by first showing how our general scheme for conserving particle number described in the previous section can be extended to conserve s z as well with only minor modifications.The first step is to choose our fermion-qubit mapping such that the first n=2 qubits represent spin-up orbitals while the remaining n=2 represent spin-down orbitals.We follow the same general steps of forming a cascade of A gates as before, but now with the added constraint that the parameters of any A gate that bridges the two spin subspaces (those that entangle the n=2 qubit with the n=2 þ 1 qubit) are set to zero (θ i ¼ ϕ i ¼ 0).This prevents any mixing of the two spin subspaces.Therefore, if we start with the proper number of spin-up and spin-down orbitals occupied, then this sequence of gates guarantees that the final state also has the correct spin occupation numbers.We also require that these parameter-free A gates do not appear in the Fig. 6 CNOT scaling.Number of required CNOT gates as a function of particle number m for a fixed number of qubits n ¼ 40.Our general state preparation circuits that respect particle-number symmetry are shown in blue, while the results of Wang et al. 24 are shown in yellow, Bergholm et al. 34 in green and Ortiz et al. 35 in red.
first layer.This can effectively swap the first and second layers as outlined in the previous general protocol.For example, in the case of Fig. 3 and with our spin assignment, we only need to set the four parameters contained within the A gates that act between qubits 2; 3 to zero along with ϕ 5 ¼ ϕ 4 .This assignment then generates all states with n ¼ 4; m ¼ 2; s z ¼ 0 and with the minimal number of parameters (6) for this space.
We now move on to the case where total spin s is also a good quantum number.If we impose conservation of s, s z and particle number, then the size of the relevant symmetry subspace for a chosen n; m; s; s z is given by Here, we maintain the notation from the previous section where n is the number of qubits and m is the number of particles, but now we focus on the case in which each qubit encodes the occupancy of a particular spin-orbital.(In the previous section each qubit could correspond to either a spin-orbital or a spatial orbital in the case of spinless fermions.)Therefore, the n qubits encode n=2 spatial orbitals, and we omit the case of odd values for n.The first binomial coefficient in Eq. ( 4) counts the number of ways to assign doubly occupied spatial orbitals in the system, the second counts the number of ways to assign singly occupied orbitals, and the last factor is the number of s irreducible representations in a tensor product of m spin-1 2 particles.We show in Fig. 7 that exploiting all the symmetries may significantly reduce the dimension of the Hilbert space.For example, already for n ¼ 28 spin-orbitals, the relevant subspace when all symmetries are imposed is at least two orders of magnitude smaller than the full Hilbert space of 28 qubits.Taking advantage of this reduction can significantly reduce the demands on the quantum processor and improve the speed and accuracy of the classical optimization step of the VQE algorithm.We note that, while this reduction is significant, this scaling always remains exponential even when symmetries are imposed.Nevertheless, use of symmetries can simplify ansätze and thus reduce the required CNOT and parameter counts.
The problem of constructing circuits that also conserve total spin s is much more challenging compared to the symmetries we have discussed thus far.In the remainder of this section, we address this problem by developing a completely different approach to obtaining symmetry-preserving circuits.In addition to allowing for conservation of s, this approach also provides an alternative method for building circuits that respect particlenumber symmetry.In this new approach, we adopt the convention that the qubits alternate between spin-up and spin-down orbitals such that the first, third, fifth, etc. qubits encode spin up, while the second, fourth, sixth, etc. encode spin down.This choice of spin encoding leads to an efficient scaling in terms of number of gates, as we will see.
The starting point for this alternative circuit-building scheme is to find an n-qubit unitary that transforms the state n i¼1 0 j i into an arbitrary superposition of states that share the same value of m.This is of course exactly the problem of finding a circuit that respects particle-number symmetry that we discussed extensively in the previous section.The key idea here is that by starting with the explicit n-qubit unitary upfront instead of a decomposition of it in terms of A gates, we can control how circuit parameters appear in the coefficients of the final superposition states.If the circuit parameters appear in a sufficiently simple way, then it would be straightforward to impose constraints on them so that spin symmetries are also respected.We could attempt to use the particle-number circuits from the previous section and impose constraints on the circuit parameters to enforce total spin symmetry, but this would lead to complicated, highly non-linear conditions on the parameters that would be difficult to solve.
It is straightforward to construct an n-qubit unitary that transforms n i¼1 0 j i into an arbitrary state in a particular particlenumber subspace.In the simplest case of only two spin-orbitals and a single fermion, this unitary is just the A gate multiplied by a single X gate (see Fig. 1).In the case of four spin-orbitals and two fermions, the desired unitary should generate arbitrary superposition states formed from a total of 4

À Á
¼ 6 basis states.While many different unitaries transform n i¼1 0 j i into such superposition states, here we desire a unitary which generates these states with specific coefficients that are easily adjusted to respect the appropriate spin symmetries.The unitary we choose to use, referred to as the E 4 gate, is based on hyperspherical coordinates: E 4 0000 j i¼ sin u 1 sin u 2 sin u 3 sin u 4 sin u 5 0101 j i þsin u 1 sin u 2 sin u 3 sin u 4 cos u 5 1001 j i þsin u 1 sin u 2 sin u 3 cos u 4 0011 j i þsin u 1 sin u 2 cos u 3 0110 j i þsin u 1 cos u 2 1010 j i þcos u 1 1100 j i: (5) The E 4 gate clearly generates any two-particle state in a system with four spin-orbitals.Notice that we have also imposed timereversal symmetry by purposely choosing the coefficients to be real.This can be easily generalized to problems without timereversal symmetry by inserting additional arbitrary phase factors on any five of the six terms in Eq. ( 5).The use of hyperspherical coordinates provides a simple parameterization that automatically ensures normalization and facilitates the incorporation of spin symmetries.For example, if we want to restrict to the subspace with s ¼ 1; s z ¼ 0, then there is only one state: This state can be created from the E 4 gate by setting We summarize this case and the other spin subspace of interest s ¼ 0; s z ¼ 0, which is given by the general superposition (6) in Table 1.Fig. 7 Hilbert space scaling.Hilbert space dimension as a function of number of qubits, n, when relevant symmetries are enforced.We show the dimension of the full Hilbert space (blue), the largest particle-number subspace with m ¼ n=2 (yellow), the subspace with m ¼ n=2 and s z ¼ 0 (red), and the subspace with m ¼ n=2 and s ¼ 0 (green).Lines are included only as a guide.All cases remain an exponential scaling Hilbert space, where use of symmetries reduces the exponential factor.
The advantage of this construction is that we can easily fix parameters in the E 4 gate to generate any desired spin subspace in this n ¼ 4; m ¼ 2 space.There are of course many unitaries that satisfy Eq. ( 5).Once we have settled on a particular choice for E 4 , we can then decompose it into more elementary gates.Note that in Eq. ( 5) we have chosen a basis ordering which leads to an efficient Gray code decomposition 36 (there are only two bit changes from term to term).A specific choice for E 4 and its corresponding decomposition are shown in the appendix.
The case of n > 4 spin-orbitals can be treated in a similar fashion.We begin by constructing a unitary E n that transforms n i¼1 0 j i into an arbitrary superposition of n m À Á fixed-particle-number basis states.For example, in the case n ¼ 6; m ¼ 3, we have (8) This ordering results in minimal (2) bit changes per step of the Gray code, which facilitates the decomposition of E 6 .We list the specific spin subspaces and summarize how to generate them by fixing the parameters of E 6 in Table 2.
An example of a gate decomposition for a specific choice of E 6 is given in the appendix along with explicit gate counts for E 4 , E 6 , and E 8 .
Extrapolating from these examples, we can then form a general procedure for constructing symmetry-preserving state preparation circuits for any valid choice of the quantum numbers n; m; s; s z for a time-reversal-symmetric system as follows: 1.For a given choice of n, m, there are n m À Á basis states ðjp j1 ; p j2 ; :::; p jn iÞ that span the corresponding particle-number subspace, such that P n k¼1 p jk ¼ m.Assign hyperspherical coefficients to these basis states according to i¼1 sin u i p j1 ; p j2 ; :::; p jn , where u n m ð Þ ¼ 0, and the basis states are ordered such that there are only two bit changes per step in the Gray code.2. Determine the constraints that must be imposed on the u i such that the appropriate spin subspace labled by s and s z is obtained.3. Construct a unitary E n such that the first column contains the coefficients in Step 1.The remaining columns can be chosen as desired so long as they respect unitarity.4. Decompose E n using a Gray code scheme or alternative gate decomposition technique.
Following this procedure, we can enforce arbitrary spin and particle-number symmetries for any choice of n; m; s; s z .Step 2 is facilitated by the use of hyperspherical coordinates because various basis states are easily eliminated from the final superposition by setting the corresponding u j to π=2, yielding another hypersphere parameterization of lower dimension.This recursive structure in the coefficients maintains regularity and simplicity as the effective Hilbert space dimension is reduced.Note that in cases where it is necessary to fix some of the u j in terms of the others (see e.g., the case of 2), use of inverse functions without a restricted realdomain (e.g.tan À1 ; cot À1 ) are desirable for optimization stability and enforcement of time-reversal symmetry, while the use of other inverse trigonometric functions could yield complex-valued coefficients in the trial states.Finally, we emphasize that here it is not necessary to numerically compute fidelities to confirm that the resulting circuits indeed span the appropriate symmetry subspace as in the previous section because this is guaranteed by construction in the present approach.
To demonstrate the efficiency of our state preparation circuits, we use them in a VQE simulation to compute the ground state energy of the H 2 molecule.We work in the STO-3G basis and map to qubits using the Jordan-Wigner transform.
We note that there are many choices of qubit mappings and unitary transformations that can be used to reduce the complexity of molecular simulations. 37However, we have formulated our ansätze to preserve symmetries in the natural basis where each qubit represents a physical spin orbital.There are also several techniques to tailor an ansatz to efficiently describe the allowed transitions in H 2 , but here we are concerned with constructing general ansätze, applicable to any molecule, which only utilize particle number and spin symmetries, to reduce the complexity of the resulting circuits.Incorporation of particle number, spin projection and total spin symmetries in conjuction with other qubit mappings and reduction methods is an interesting topic, but beyond the scope of the present work.The results are given in Fig. 8, which shows the difference between the computed ground state energy and the exact ground state energy.For comparison, we also show the results obtained from standard ansätze (SWAPRZ, RY, RYRZ, and UCCSD) included in IBM's Qiskit software package. 38ble 1.Two particle spin symmetry.
By fixing the coefficients of Eq. 5, we can generate the two spin subspaces defined by their quantum numbers for the n ¼ 4; m ¼ 2 space.In the case of s ¼ 1, s z ¼ 0, the subspace is spanned by a single state, so all the u i are fixed.The subspace with s ¼ s z ¼ 0 is three-dimensional, and so two of the u i are left unspecified By fixing the coefficients of Eq. 7, we can generate the four spin subspaces defined by their spin quantum numbers for the n ¼ 6; m ¼ 3 space.Here The order of basis states for this space is defined in the text Furthermore, we show the variational parameter and CNOT gate counts in Table 3, accompanying Fig. 8 for all ansätze considered.It is clear that our proposed circuits obtain the ground state energy with high accuracy using the minimal number of variational parameters and a low number of CNOT gates.For the RY, RYRZ, and SWAPRZ ansätze, we choose a circuit depth of three, while for UCCSD, we use a circuit depth of one.In all cases, we use the BFGS optimizer (run several times with random initial conditions) included in Qiskit and consider an ideal, noiseless simulation.Figure 9 shows the results of a similar simulation, but this time with noise included.This noise is characterized by the physical parameters of IBM's Poughkeepsie device.Here we only take the standard ansatz that has reasonable parameter and CNOT scaling, RY, and compare it to our ansätze.Contrary to the noiseless case, the RY ansatz here is chosen to have linear connectivity (nearestneighbor CNOT connectivity) and a circuit depth of one as this configuration performs best under these noisy conditions.With these settings, the RY ansatz has 8 parameters and 3 CNOT gates.The CNOT and parameter counts for our ansätze are the same as in Fig. 8 since these are determined by the ground state symmetries of the molecule.Even though the RY ansatz has fewer costly CNOT gates than our A gate ansatz and is over parameterized for the target ground state, it is outperformed by the A gate ansatz.This is due to the fact that at this low depth, the RY ansatz does not have sufficient coverage of the target Hilbert space.Increasing the depth of the RY ansatz will increase its coverage of the target space, but also increases the number of CNOT gates.This is not an equivalent trade-off and actually decreases the ability of the ansatz to approximate the ground state.In the case of both E gate ansätze, their relatively larger number of CNOT gates can be seen to hinder their performance.However, as these gates are constructed in terms of arbitrary state generation, these gate counts could be improved with more efficient state generation algorithms.In addition, mitigation of CNOT errors may be possible with the use of Richardson extrapolation, 39,40 a technique we will pursue in future work.
An interesting feature in Fig. 9a) can be seen where the E 4;2 ansatz crosses the E 4;2;s¼0;sz ¼0 ansatz.In principle, the spin symmetry ansatz should always have a better ability to target the ground state in a VQE algorithm.This is explained in Fig. 9b), where as we see that the E 4;2 ansatz abruptly changes the total spin value of its lowest energy state.Indeed, the triplet states (s ¼ 1) are nearly degenerate with the singlet state (s ¼ 0, Eq. 6) at large bound distances.At an interatomic distance near two Angstroms, the energy difference between the lowest energy singlet and triplet states is Oð10 À2 Þ Hartree.The optimization landscape becomes much more difficult to navigate when there are many nearly equal local minima, as is the case here at large bond distances.Therefore since the algorithm attempts to find the lowest energy eigenvalue and the singlet and triplet states are nearly degenerate at longer bond distances, the optimizer will frequently return a minimum (triplet state) rather than the global minimum (singlet state).In the presence of noise, this issue is blurred further as both energies are not exactly attainable, but a triplet state is trivial to produce (e.g.s ¼ 1; s z ¼ 1, 1010 j i), so finding the triplet state as the lowest energy state is frequently encountered.Additionally, this issue grows more difficult to navigate with larger molecules and strongly correlated systems, which have many more nearly degenerate ground states.Naturally one could also enforce a spin eigenvalue constraint on the optimizer by modifying the objective function, but this places stricter requirements on the optimizer and requires a physical measurement of spin eigenvalues, through tomography or additional circuit elements.However, enforcing symmetry in the ansätze lessens the burden on the optimizer and does not directly require spin measurements.
We also perform similar noisy simulations on LiH.LiH in the STO-3G basis maps to 12 qubits but we follow the same methods as ref.
, 8 removing two non-interacting orbitals and freezing the core orbital, reducing LiH to 6 qubits.We show in Fig. 10 and Table 4 that our ansätze perform comparably for LiH as they do for H 2 with notably more error for the E gate ansatz as it requires significantly more CNOTs.As in the noisy H 2 case, the RY ansatz is chosen to have a fixed depth (one) and connectivity (nearest-neighbor).These settings give the best performance under these noisy conditions but the same coverage-CNOT trade off issue arises as before.From both the H 2 and LiH results we can see that the A-gate circuit finds a middle-ground in terms of CNOT and parameter count and has good performance, while the E-gate circuit exactly minimizes parameter count based on particle number, spin projection, and total spin, but its performance suffers due to a large CNOT count.Thus, in the presence of noise, we find that it can be favorable to relax some of the symmetry constraints to reduce the circuit depth at the expense of more variational parameters.
Since our constructions maintain number and spin symmetries, potentially any noise sources which violate these symmetries can be mitigated through post-selection or symmetry verification. 13,14,27This will be a topic of future work.Another interesting question for future work is whether it is possible to find circuits that minimize the number of CNOT gates while respecting spin symmetries and while using the minimal number of parameters necessary to span the symmetry subspace.
Fig. 8 H 2 Noiseless VQE.Energy difference from the exact ground state of H 2 for various ansätze.All ansätze perform well below chemical accuracy, but vary significantly in their number of required parameters and CNOT gates (shown in the accompanying table).Our proposed ansätze (A 4;2 and E 4;2 ) achieve very small energy differences and have low to modest CNOT counts.The UCCSD ansatz also performs very well with low parameters (3), but has a fairly large CNOT count in this example.In the ideal, noiseless case, we compare many standard ansätze to our new proposed ansätze and find that our proposed ansätze are more compact in terms of CNOT count and parameter count

DISCUSSION
In this work, we presented general schemes to construct state preparation circuits for quantum simulation that respect a number of symmetries that commonly arise in systems of interest, including particle number, time-reversal, total spin, and spin magnetization.
In each case, we provide general construction procedures, explicit examples of circuits, and gate counts.In the case of particlenumber symmetry, for which state preparation circuits have been proposed previously by other authors, our circuits outperform existing methods in terms of the number of two-qubit entangling gates they contain.Enforcing spin symmetries in addition to particle number can significantly enhance the performance of the VQE by preventing the algorithm from wasting time exploring vast, irrelevant regions of Hilbert space.Also, our ansätze are guaranteed to contain the ground state of interest, with the minimal number of parameters defined by the symmetry subspace.It is important to emphasize, however, that the number of variational parameters still grow exponentially with system size even when all symmetries are imposed.Thus, spanning the entire symmetry subspace will become impractical as the size of the quantum processor is increased beyond a few tens of qubits.However, we expect that our symmetry preservation techniques will continue to play an important role for larger NISQ devices as systematic methods to further reduce the search to still smaller regions of Hilbert space are developed.This could be done, for example, by looking for ways to freeze large sets of the variational parameters appearing in our circuits without sacrificing the accuracy of the ansatz.In addition, as a general state creation circuit with a particular symmetry, one can imagine applications for these circuits in the Phase Estimation Algorithm (PEA).

METHODS
Confirmation of circuit compilation was performed in Mathematica software as well as numerical optimization to confirm that the proposed circuits span any state in the desired Hilbert space.In numerical optimization testing, we find that Mathematica's NMaximize method "Simulated Annealing" performs best for our purposes, when run over many samples of a randomly chosen state in the Hilbert space.Gate decomposition was performed using the method of Gray codes, was done "by hand" and confirmed in Mathematica.
Our VQE simulations were done using IBM's Qiskit software, coding in our own proposed ansätze, which enforce relevant symmetries.Noisy simulations were simulated using the noise parameters of IBM's Poughkeepsie device.Included is Qiskit's state preperation and measurement error mitigation for all ansätze.b) Total spin eigenvalues for the same dissociation curve (left axis).The total spin values indicate that some ansätze drift outside the singlet subspace (s ¼ 0) and begin to instead find a (nearly degenerate) triplet state (s ¼ 1) at large bond distances.Since the E 4;2;s¼0;sz ¼0 ansatz is restricted to a fixed total spin, it is the only displayed ansätze which always attempts to find the true ground state across the full dissociation curve.The energy difference between this triplet state and the true singlet ground state as a function of interatomic distance is also shown for comparison (orange dashed line, right axis).

Fig. 10
Fig.10LiH Noisy VQE.Energy difference from the exact ground state of LiH in the presence of noise characterized IBM's Poughkeepsie device.With appropriate orbital reductions, LiH is run on 6 qubits and has two excitations.The A-gate ansatz continues to perform well utilizing particle number and spin projection symmetries and relatively low CNOT count for this dimension.

Fig. 9 H
Fig.9H 2 Noisy VQE.a) Energy difference from the exact ground state of H 2 in the presence of noise characterized by IBM's Poughkeepsie device.Included is Qiskit's state preperation and measurement error mitigation for all ansätze.b) Total spin eigenvalues for the same dissociation curve (left axis).The total spin values indicate that some ansätze drift outside the singlet subspace (s ¼ 0) and begin to instead find a (nearly degenerate) triplet state (s ¼ 1) at large bond distances.Since the E 4;2;s¼0;sz ¼0 ansatz is restricted to a fixed total spin, it is the only displayed ansätze which always attempts to find the true ground state across the full dissociation curve.The energy difference between this triplet state and the true singlet ground state as a function of interatomic distance is also shown for comparison (orange dashed line, right axis).

Table 4 .
6-qubit ansätze comparison.count for the case of estimating the ground state of LiH in the presence of typical device noise