A quantum alternating operator ansatz with hard and soft constraints for lattice folding

Mark Fingerhuth∗ ProteinQure Inc., Toronto, Canada and University of KwaZulu-Natal, Durban, South Africa

Tomas Babej and Christopher Ing ProteinQure Inc., Toronto, Canada (Dated: November 1, 2018) Gate-based universal quantum computers form a rapidly evolving field of quantum computing hardware technology. In previous work [4], we presented a quantum algorithm for lattice on a cubic lattice, tailored for quantum annealers. In this paper, we introduce a novel ap- proach for solving the lattice protein folding problem on universal gate-based quantum computing architectures. Lattice protein models are coarse-grained representations of that have been used extensively over the past thirty years to examine the principles of protein folding and design. These models can be used to explore a vast number of possible protein conformations and to infer structural properties of more complex atomistic protein structures. We formulate the problem as a quantum alternating operator ansatz, a member of the wider class of variational quantum/classical hybrid algorithms. To increase the probability of sampling the ground state, we propose splitting the optimization problem into hard and soft constraints. This enables us to use a previously under- utilised component of the variational algorithm to constrain the search to the subspace of solutions that satisfy the hard constraints. Keywords: Quantum computing, variational algorithms, protein folding, lattice folding

I. INTRODUCTION ture database [8]. Coarse-grained lattice models have the advantage that they can be utilized to enumerate and Proteins are molecular machines which serve a vast score a vast number of candidate protein folds, which number of functions within living organisms. Each pro- can be useful for analyzing general sequence-structure tein consists of a chain of amino acids which can sponta- properties and verifying analytical models [1, 24]. In the neously fold into three-dimensional shapes that defines its hydrophobic-polar (HP) model, all amino acids in a se- function. For most natural proteins, three-dimensional quence are classified as either hydrophobic (H) or po- structure cannot be predicted from the amino-acid se- lar (P), enabling the study of the fundamental energetic quence alone due to the large space of available folds [9]. principles of folding [7, 20]. In the Miyazawa-Jernigan This limitation results in a significant number of clini- (MJ) model, all twenty natural amino acids are uniquely cally relevant proteins having unknown structures [10], represented, each of which has distinct pairwise interac- preventing the rational discovery of treatments for dev- tions parameterized using known structural data [25, 26]. astating diseases like cancer, cardiovascular and neurode- Both of these models involve the representation of pro- generative diseases. Over the past several decades, com- tein chains as a self-avoiding walk on a grid, which can putational modeling has served as an invaluable tool for vary in geometric complexity (planar, cubic, hexagonal). studying and function. In this work The energy of a fold is determined by the sum of pair- we introduce a new algorithmic approach for the com- wise interactions between amino acids as determined by putational modeling of proteins on quantum computing a look-up table, and the native state of the protein is the devices that may offer significant improvements as these configuration with the lowest energy. Despite the sim- plicity of the model, finding the minimum energy lattice arXiv:1810.13411v1 [quant-ph] 31 Oct 2018 devices scale in computing capability. Numerous computational methods exist for the deter- fold is an NP-complete problem [5, 16, 35]. As such, new mination of protein structure from an arbitrary input se- computational methods need to be developed to deter- quence, although all of these techniques have significant mine the minimum energy lattice fold of larger length computational limitations [19]. High-resolution atomistic proteins (greater than 100 amino acids). structures can be determined using both physics-based In past years, superconducting implementations of or knowledge-based methods, but both these methods gate-based quantum computers have scaled drastically are fundamentally restricted in the space of structures with Google’s Bristlecone processor leading the newest they can search, due to either the timescale of simula- generation of chips with more than 50 qubits and the ca- tions required for folding or the size of the protein struc- pacity of running quantum algorithms with a quantum circuit depth of up to 40 CNOT operations [14]. In al- most all current hardware implementations, the qubits are arranged in a planar lattice structure as illustrated ∗ All correspondence to [email protected] in the example in Fig. 1 which shows the topology of 2

Rigetti’s Acorn quantum processing unit with 19 qubits. encoded turns designed for universal quantum comput- Even though the planar lattice layout allows for the im- ing architectures. This encoding produces Hamiltonians plementation of the surface code, a promising quantum that can be minimized with quantum alternating oper- error correction protocol, it limits the connectivity of in- ator ansatz circuits, while enabling the usage of several dividual qubits to nearest neighbour interactions [6, 38]. different mixer Hamiltonians that enforce varying subsets Due to the immense resource requirements of quantum of optimization constraints. error correction, most likely none of these qubits will be fully error corrected in the near future. For this rea- son, these near-term quantum devices are referred to A. Quantum/classical variational algorithms as Noisy Intermediate-Scale Quantum (NISQ) technol- ogy [31]. Despite the presence of errors, it is widely be- Variational algorithms are an active field of research lieved that NISQ computers will be able to outperform due to their promising applicability during the NISQ classical computers in certain tasks and achieve ’quan- era. These hybrid algorithms consist of a fixed-length tum computational supremacy’ or ’quantum advantage’ sequence of parametrizable quantum gates that are exe- in the near future [14]. One of the main reasons be- cuted on a quantum computer whilst the gate parameters hind this believe are recent developments in a family are variationally optimized by a classical computer. An of quantum algorithms known as variational algorithms. important property of this approach is that it is robust These algorithms combine quantum and classical com- against systematic errors on the quantum computer since puters in a hybrid scheme in which the classical com- the classical optimization step of the algorithm can cor- puter optimizes the parameters of a quantum circuit. rect for them in parameter space [12]. Furthermore, their They have the potential to demonstrate quantum com- requirements for quantum circuit depth (and therefore putational supremacy due to algorithm design decisions qubit coherence time) are highly flexible, which makes specifically aimed to compensate for some of the disad- them particularly attractive for NISQ era quantum com- vantages of NISQ computers [13]. As a result, a lot of puters. The two cornerstones of variational algorithms recent attention has been focused on applying variational are the quantum approximate optimization algorithm by quantum algorithms to supervised classification, neural Farhi et al. [11] and the variational quantum eigensolver network training, prime factorization as well as quantum by Peruzzo et al. [30]. The quantum approximate opti- chemistry [2, 18, 32, 33, 37]. mization algorithm was later generalized to the quantum This work will establish a framework for finding ground alternating operator ansatz by Hadfield et al. [15] which states of lattice proteins by means of variational quantum we will refer to as QAOA. algorithms on universal gate-based quantum computers. QAOA circuits can be seen as trotterized quantum an- In order to use a variational algorithm, the problem first nealing where the order of trotterization p determines the needs to be encoded as a Hamiltonian, whose ground required quantum circuit depth and quality of the result- state corresponds to the correct lattice fold of the pro- ing solutions. Note that in the limit of p → ∞ the QAOA tein. Perdomo et al. [28] first developed a Hamiltonian circuits are equivalent to adiabiatic quantum computa- encoding by imposing an absolute coordinate system onto tion [11]. QAOA-type algorithms sequentially apply al- the lattice. In subsequent work, Babbush et al. [3] de- ternating circuits to the initial quantum state; the two vised three novel encodings, one of which was used by parametrized circuits implementing the cost Hamiltonian Perdomo-Ortiz et al. [29] to establish a proof-of-concept HC and the mixer (or driver) Hamiltonian HM . Fig. 2 by folding the 6-amino-acid protein PSVKMA on the shows a QAOA circuit of depth p whereby the i-th appli- quantum annealing processor D-Wave One. In previ- cation of HC and HM is parametrized by parameter γi ous work, we have generalized their Hamiltonian encod- and βi respectively. Let us denote the resulting quantum ings from two-dimensional to three-dimensional lattices state |γ, βi where γ = {γ1, ..., γp} and β = {β1, ..., βp}. whilst decreasing circuit complexity from quadratic to A classical minimization algorithm such as Nelder-Mead quasilinear [4]. In this paper we report a novel encod- [27] is then used to optimize the parameters γi and βi on ing of the lattice protein folding problem using one-hot a classical computer such that the expectation value, hγ, β| C |γ, βi , (1) is maximized. Traditionally, the cost Hamiltonian en- codes the entire cost function representing the optimiza- tion problem at hand. HC separates the possible solu- tions by phase and consists only of Z terms. It follows that HC is a purely classical Hamiltonian. The mixer Hamiltonian HM is ’mixing’ the amplitudes between dif- ferent solution states and can be regarded as the QAOA component exploring the solution space. To mix am- FIG. 1. Visualization of the planar lattice layout of the 19 plitudes between states with different eigenvalues, HM qubit Acorn quantum processor by Rigetti Computing should be chosen in a way such that it does not commute 3

FIG. 2. A quantum alternating operator ansatz circuit of depth p. The quantum circuit alternates between implementing the cost Hamiltonian HC parametrized by parameters γi and the mixer Hamiltonian HM parametrized by parameters βi. The minimization algorithm on the classical computer then optimizes the parameters γi and βi based on the measured outcomes. This effectively maximizes the expectation value hγ, β| C |γ, βi where C is the cost function of the optimization problem.

with HC , that is [HC ,HM ] 6= 0. In the original work by Farhi et al. [11] a pure X mixer of the form

X HM = Xi, (2) i where the sum is over all qubits, was chosen. However, in QAOA implementations on universal quantum com- puting architectures we can freely choose HM depending on the problem at hand. This stands in contrast with current quantum annealing hardware, where the mixer Hamiltonian is fixed by the chosen hardware implementa- tion and cannot be defined by the user [15]. Recent work by Hadfield et al. [15] has shown that a custom mixer FIG. 3. Visualization of the six one-hot encoded spatial direc- Hamiltonian can be used to encode parts of the optimiza- tions for cubic lattice protein folding. The sequence of images tion problem. More specifically, if the constraints of the shows an example of the encoding using a low-energy cubic optimization problem can be broken up into hard and lattice fold for a protein with 9 residues. Note, that due to soft constraints (defined below) the mixer Hamiltonian mirror and rotational symmetries we can always fix the ze- can be used to encode the hard constraints whilst the cost roth turn to 100000, the second turn to q0q10000, which only Hamiltonian encodes the remaining soft constraints. Af- allows RIGHT or UP, and finally the second turn to q2q3q4q5q60 ter measuring the resulting quantum state, the solutions such that it cannot go to the BACK. to the encoded optimization problem are represented as n-bit bitstrings. An optimization problem can be defined as the prob- consecutive”. Note, that optimal solutions to the opti- lem of finding the best solution from all feasible (or mization problem satisfy both hard and soft constraints. candidate) solutions. However, based on the properties of the problem’s encoding not every possible bitstring x ∈ {0, 1}n represents a feasible solution. In other words, II. ONE-HOT ENCODED LATTICE PROTEINS the space of all feasible solutions to the given optimiza- tion problem projected under the encoding often forms a This section formulates the lattice protein folding proper subspace of {0, 1}n. The size of the space of all problem in a way that allows the separation of optimiza- unfeasible solutions varies depending on the constraints tion constraints into hard and soft constraints. The pro- used. Yet, speedups can be often obtained by modify- posed encoding requires 6N − 17 ∈ O(N) qubits in order ing the optimization algorithm as to avoid the space of to encode a lattice protein with N amino acids. We will unfeasible solutions. first discuss the case of protein folding on cubic lattices Hard constraints are conditions that must be satisfied and subsequently simplify our encoding to planar lattices for a solution to be a feasible solution e.g. ”every solu- with near-term implementation in mind. tion string must have a Hamming weight of three”. We define the feasible subspace as the space of all feasible solutions. Soft constraints are additional constraints in A. Cubic lattices the optimization problem that do not necessarily need to be satisfied for a solution to be feasible e.g. ”low en- In our previous work [4], we introduced two turn-based ergy solutions require the three 1’s in the bitstring to be encodings of the lattice protein folding problem on a cu- 4 bic lattice that use dense, three-qubit representations of number of bits in the string that are equal to 1 or, equiv- spatial directions on the lattice. Turn-based encodings of alently, the Hamming distance between the bitstring and the lattice protein folding problem represent the lattice the all-zero bitstring of the same length. Therefore, each fold as a sequence of moves that constitutes a walk on the turn will increment the total expected Hamming weight lattice, rather than encoding the absolute lattice coordi- of the solution string by 1. nates of each individual . In this work, we pro- pose a sparser turn-based encoding that uses 6 qubits to Construction of the mixer Hamiltonian HM . We represent each of the six spatial directions. One-hot en- define the hard constraint that for every turn t that is coding data is a commonly used preprocessing technique represented by n bits all n bits must sum to one in order in machine learning where each element of a discrete set for the string to represent a one-hot encoded direction. of N elements is encoded as a bitstring of length N with Hence, a Hamming weight of 1. Fig. 3 illustrates the one-hot en- n−1 coding that is used in the remaining parts of this paper. X Due to rotational and mirror symmetries of the cubic lat- qt,b = 1 . (9) tice, we can, without loss of generality, fix 11 qubits in b=0 the prefix of the solution string. First of all, the choice of From this we can derive the more general second hard the direction of the first turn is arbitrary, as the lattice constraint that for every protein of size N all N − 1 fold can be rotated on the lattice with no change to its turns must only contain a single one. Thus, a valid solu- energy (since the set of nearest neighbour contact pairs tion string for a protein of size N must have a Hamming remains the same). Hence the entire zeroth turn can be weight of N − 2 (since the first fixed turn is not repre- fixed - in our derivations, we chose the RIGHT (100000) sented in the solution string): direction. The only two valid situations that can be dis- tinguished under rotation for the next move are either N−2 n−1 a move in the same direction, or a perpendicular move, X X qt,b = N − 2 . (10) which corresponds to RIGHT and UP moves in our formu- t=1 b=0 lation. This allows us to fix 4 qubits in the first move. The second move can exploit the last remaining degree These two statements determine the feasible subspace of of freedom - mirror symmetry with respect to the plane our problem and allow us to define mixer Hamiltonians defined by the RIGHT and UP move. In this situation, the which ensure that the search stays within the feasible FRONT and BACK moves are mirror-symmetric and as such subspace. In the next sections we will define two distinct we can prohibit one of them. We prohibit the move to types of mixer Hamiltonians, referred to as XZ and XY the BACK by fixing its qubit in the sextuple to 0. mixers, which we will ultimately benchmark in Section An obvious advantage of using one-hot encoded direc- III. tions is that there exists a straightforward algorithm to determine whether a particular turn went into a partic- Simple XY mixer Ideally, the mixer Hamiltonian ular direction. Namely, within each sextuple that repre- should preserve Hamming weight and only move the 1 sents one turn, each possible direction uses exactly one within each sextuplet encoding a turn. To achieve this, qubit which serves as a binary flag indicating that this the SWAPi,j operation is an ideal building block since it turn went its way. For every qubit sextuple that encodes preserves Hamming weight. SWAPi,j maps |00i → |00i, a turn t we can thus define the mapping, |01i → |10i, |10i → |01i and |11i → |11i. Hen and Spedalieri [17] define the generalized SWAPi,j as right → k = 0, (3) 1 up → k = 1, (4) SWAP = (1 + X X + Y Y + Z Z ). (11) i,j 2 i j i j i j front → k = 2, (5) left → k = 3, (6) The mixer Hamiltonian should not commute with the down → k = 4, (7) cost Hamiltonian (which consists purely of Z terms) but in the current definition of the SWAP operation, the iden- back → k = 5, (8) tity operation as well as the ZiZj component both com- mute with the cost Hamiltonian. Thus, we drop these where for each of the six directions k is a pointer to the components and redefine SWAPi,j as qubit (binary flag) that indicates whether turn t went in this direction. For the remainder of this paper we will use 1 SWAP = (X X + Y Y ). (12) the shorthand notation qt,k = q6t+k−11. Furthermore, we i,j 2 i j i j use notationq ¯ to denote a qubit that represents the op- posite direction as the one represented by qubit q within For a more rigorous analysis of the properties of this SWAP the same move. For example, q4,1 = q4,4. operation the interested reader is referred to [15]. The As previously mentioned, a one-hot encoded turn has a mixer Hamiltonian should sample from the distribution Hamming weight of 1. Hamming weight is defined as the over all possible combinations of turns and, thus, we need 5 to apply a SWAP operation to each pair of qubits within Given the adapted notion of the feasible subspace for a turn t: XZ mixers and an initial state that is either a feasible bitstring or a superposition of such, XZ only allows n−2 n−1 simple X X for state transitions within the feasible subspace. Mt = SWAPi,j. (13) i=0 j=i+1 Construction of the cost Hamiltonian HC . The By simply summing over all N −2 turns for a protein with cost Hamiltonian encodes the objective function of our N amino acids we get the final XY mixer Hamiltonian, problem. In lattice protein folding, the goal is to find minimum energy self-avoiding walks on the lattice. The N−2 energy of a given protein fold is computed as the sum X HM = XYsimple = Mt. (14) of interaction energies of non-bonded nearest neighbour t=1 amino acids. We enforce both objectives in the final cost Hamiltonian: to avoid self intersections we will introduce Given that the initial state is a feasible bitstring or a the component H , and to account for the interac- superposition of such, XY ensures that the search overlap simple tion between amino acids we introduce another compo- only takes place in the feasible subspace. nent, Hpair. Hence, the total cost Hamiltonian is defined Simple XZ mixer Instead of swapping the values of by, two qubits within an n-tuple we can flip individual qubits conditioned on the fact that all other qubits in the n- HC = Hoverlap + Hpair. (21) tuplet are 0. For this purpose, we define the conditional bit flip operator, In previous work [4], we derived both components for a more dense bit encoding of the directions. However, to Y Ft,k = Xt,k q¯t,ko . (15) construct the components Hoverlap and Hpair we had to

ko∈[0,n] introduce a boolean expression for each spatial direction, ko6=k RIGHT (+x), LEFT (−x), UP (+y), DOWN (−y), BACK (−z) and FRONT (+z), that yields TRUE if a particular turn Substitutingq ¯ = 1 (1 + Z ) yields t,ko 2 t,ko went into that direction. The new one-hot encoding sim- plifies this step since each qubit serves as a binary flag Y 1 Ft,k = Xt,k (1 + Zt,k ). (16) directly indicating if a particular turn went into a partic- 2 o ko∈[0,n] ular direction. Eq. 3 - 8 already introduced a mapping ko6=k between qubit indices within a turn t and the six spa- Using this operator, the Hamming weight of the total tial directions. Thus, to determine if turn t went into bitstring does not remain constant as in the XY mixer. direction k we define the simple function: However, it can still be bounded since any n-tuplet can  now either have a Hamming weight of 0 or 1. Hence, we qk if t = 1 and k ∈ {0, 1},  0 if t = 1 and k∈ / {0, 1}, need to adjust Eq. 9 to dt = (22) k 0 if t = 2 and k = 5,  n−1 (  X 0 q6t+k−10 otherwise. q = . (17) t,b 1 b=0 For the new one-hot encoding introduced in this paper, As a result, the sum over the entire solution string in we will use the same ’sum string’ approach to generate Eq. 10 must now satisfy Hoverlap as in Babej et al. [4]. A sum string s contains the number of turns the lattice protein has taken in the k N−2 n−1 direction between any two residues i and j (for a detailed X X qt,b ≤ N − 2. (18) description see [4]). Given this, we can define: t=1 b=0 j−1 X To allow for transitions between all feasible bitstrings we sr (i, j) = rth digit of dp, (23) take the sum over all bits within a given turn t: k k p=i n−1 X Mt = Ft,k. (19) The purpose of Hoverlap is to determine if any two k=0 residues overlap and subsequently penalize the overlap by increasing the energy for this particular bitstring. As Similar to Eq. 14 we obtain the final XZ mixer Hamilto- in [4] we define, nian by summing over all turns

b (N−i−1) c N−2 N−3 2 X X X HM = XZsimple = Mt. (20) Holap = λolap Holap(i, i + 2j). (24) t=1 i=0 j=1 6 where for D spatial dimensions,

D dlog2(j−i)e Y  Y r r  Holap(i, j) = XNOR(sk(i, j), sk¯(i, j)) . k=1 r=1 (25) and XNOR(p, q) = 1 − p − q + 2pq. Note, that k¯ was FIG. 4. Visualization of the four one-hot encoded spatial directions for planar lattice protein folding. The figure also previously defined as the direction opposite to k. shows an example of a low-energy lattice fold on a planar In order to account for the interaction between two lattice and its corresponding bitstring. non-bonded nearest neighbour residues i and j we need to determine if they are nearest-neighbours, that is, if their lattice distance is equal to 1. For this reason, we second turn consists of only two rather than four qubits introduce the same adjacency function as in [4]: since we can fix it to go either to the RIGHT or UP due to rotational symmetry. " dlog (j−i)e # Y  Y2  The mapping between qubit indices and directions a (i, j) = XNOR(sr (i, j), sr (i, j)) k w w¯ within a turn t is given as right→ k = 0, up→ k = 1, w6=k r=1 left→ k = 2 and down→ k = 3. From this the analogue " 1 1 of Eq. 22 follows immediately: ∗ XOR(sk(i, j), s¯(i, j)) k   qk if t = 1 and k ∈ {0, 1}, dlog (j−i)e t 2 dk = 0 if t = 1 and k∈ / {0, 1}, (28) Y r r ∗ XNOR(sk(i, j), sk¯(i, j))  q4t+k−6 otherwise. r=2

dlog2(j−i)e The remainder of the equations from the previous section X  p−1 p is derived analogously with the number of dimensions D + XOR(sk (i, j), sk(i, j)) p=2 set to D = 2 in Eq. 35 and 27. The various mixer Hamil- p−2 tonians also remain unchanged since we derived them in a Y ∗ XNOR(sr (i, j), sr+1(i, j)) general manner. Note again, that the only major change k k between cubic and planar lattices is that a single turn is r=1 p encoded with n = 4 qubits rather than n = 6. Y r r ∗ XOR(sk(i, j), sk¯(i, j)) r=1 III. RESULTS & DISCUSSION dlog2(j−i)e # Y r r  ∗ XNOR(sk(i, j), sk¯(i, j)) . (26) r=p+1 In the current implementation the XY mixer Hamilto- nian enforces the hard constraint of preserving a Ham- From this we can define Hpair in D dimensions as, ming weight of 1 within each n-tuple of qubits that en- codes a turn whilst the XZ mixer also allows for n-tuples n−3 (N−i−1)/2 D X X X with Hamming weight 0. We will now discuss possible Hpair = Pi,1+i+2j ak(i, 1+i+2j). (27) modifications to the mixer Hamiltonians derived in the i=1 j=1 k=1 previous section that increase the number of hard con- straints while decreasing the number of soft constraints where Pi,1+i+2j is the interaction strength between the i- in the cost Hamiltonian. th and the (1+i+2j)-th residue defined by the interaction The Hoverlap component in the current cost Hamilto- matrix of either the HP or the MJ model. nian penalizes short as well as long-range overlaps. An overlap (self-intersection of the amino-acid chain on the lattice) is called short-range if it occurs between the i-th B. Planar lattices and (i + 2)-th residue. All other overlaps are referred to as long-range. Considering the limitations of current quantum com- XY short-range overlap mixer. Short-range over- puting hardware, we focus on planar rather than cubic laps can be avoided in the XY formulation of the mixer lattice proteins in the experimental implementation of Hamiltonian by introducing the controlled SWAP opera- this work. On a planar lattice we only deal with four tion spatial directions and hence each direction requires only four qubits to be one-hot encoded. The one-hot encoding (¯qt−1,k¯ , q¯t+1,k¯ ) SWAP(qt,k, qt,kn ), (29) of a protein of size N on a planar lattice requires a total n n of 4N − 10 ∈ O(N) qubits. Fig. 4 shows the chosen one- which swaps turn t from encoding the k direction to the hot encoding for the planar lattice including the fact that kn direction conditioned on the fact that the previous ¯ we fix the first turn to 1000 (RIGHT). Furthermore, the (t − 1) and the next (t + 1) turn are not encoding the kn 7 direction. Writing out the product over control qubits which return the x, y, z coordinates of the a-th amino explictly, we write acid respectively. Using these three expressions we can 1 define the squared lattice distance between residues j and Y k: j SWAP(qt,k, qt,kn ) q¯t+(−1) ,k¯n . (30) j=0 2 2 2 Dj,k = (xj − xk) + (yj − yk) + (zj − zk) . (39) Using the fact thatq ¯ = (1 − q) and substituting qi = 1 2 (1 − Zi) we obtain The squared lattice distance Dj,k is zero iff residues j and 1 k occupy the same lattice point. Hence, the Dj,k can be 1 Y bounded by Mt,k,k = SWAP(qt,k, qt,k ) (1 + Z j ¯ ) , (31) n 4 n t+(−1) ,kn j=0 2 0 ≤ Dj,k ≤ (j − k) . (40) 1 where SWAP(qt,k, qt,kn ) = 2 (XkXkn + YkYkn ). By sum- ming over all N − 2 turns and all directions within each This allows us to control SWAP operations in a way that turn we obtain the new mixer Hamiltonian, also prevents long-range overlaps since we can simply multiply with the squared lattice distance that would be N−2 n−1 X X the result of turn t moving into the proposed direction HM = XYshort = Mt,k,kn , (32) kn. In case of an overlap, Di,t+1 = 0 and, hence, the t=1 k6=kn SWAP operation will not be applied. Hence, the XY mixer which now includes the new hard constraint that solu- Hamiltonian that prevents long-range overlaps reads, tions with short-range overlaps are not feasible and is N−2 n−1 thus referred to as XYshort. X X XZ short-range overlap mixer. The XZ mixer that XYlong = Mt,k,kn t=1 k6=k prevents short-range overlaps is obtained by replacing the n (41) SWAP operation in Eq. 34 with the conditional bit flip N−5 Y  operator such that 1 + (Di,t+1 − 1)[(i − t) mod 2] . 1 i=0 1 Y Mt,k = Ft,k (1 + Z j ¯ ). (33) 4 t+(−1) ,kn A convenient property of this expression is that it does j=0 not only prevent long-range overlaps but also promotes The resulting mixer Hamiltonian will be referred to as the swapping of directions if pairs of residues have a large XZshort and is given by, squared lattice distance since in those cases Dj,k is large. N−2 n−1 This means that the transitions from extended protein X X H = XZ = M . (34) chains to folded protein states are incentivized through a M short t,k large multiplicative factor. We will refer to this particular t=1 k=0 definition of HM as XYlong. In both cases, XZ and XY, moving the short range XZ long-range overlap mixer. Once again, we ob- overlaps into the mixer Hamiltonian reduces the number tain the XZ mixer equivalent by replacing SWAP with the of terms in the Hoverlap component of the cost Hamilto- conditional bit flip operator in Eq. 41 which results in nian such that,

(N−i−1) N−2 n−1 N−3 b 2 c X X X X XZlong = Mt,k Holap = λolap Holap(i, i + 2j), (35) t=1 k=0 (42) i=0 j=2 N−5 Y  where the second sum now starts at j = 2 instead of 1 + (Di,t+1 − 1)[(i − t) mod 2] . j = 1. i=0 XY long-range overlap mixer. We now incorporate To evaluate the effectiveness of the various definitions the entire Hoverlap into the mixer Hamiltonian. For this we need to define the three functions, of HM , we performed extensive numerical experiments. For these experiments, we used the quantum computing ( 0, if a=0, simulator that is available as part of Forest, the quan- xa = Pa−1 j j  tum full-stack library developed by Rigetti Computing 1 + q0 + j=2 dk=0 − dk=3 , otherwise, Inc. [34]. Fig. 5 shows the probabilities of obtaining (36) the ground state solution for the two-dimensional lat- ( 0, if a=0, tice protein PSVK with the seven different definitions of y = (37) a q + Pa−1 dj − dj , otherwise, the mixer Hamiltonian. In this first experiment, the ini- 1 j=2 k=1 k=4 tial state was a uniform superposition over all bitstrings a−1 of length 6 and the size of the cost Hamiltonian was X j j  za = dk=2 − dk=5 . (38) kept constant. For example, this means that when us- j=2 ing the XZback mixer Hamiltonian we would not remove 8

0.201 0.2 0.196

0.15

0.112

0.1 0.087 0.085 0.082

0.062 0.055 −2 5 · 10 0.036 Ground state probability 0.031 0.027 0.028 0.021 0.019

0 0.004 0 0 0 0 0 0

Xmixer XYsimple XZsimple XYback XZback XYoverlap XZoverlap constant/ constant/ constant/ constant/ constant/ constant/ constant/

all all all all all all all

FIG. 5. Comparison of the ground state probabilities for the folding of PSVK on a planar lattice with various mixer Hamil- tonians. In this experiment the size of the cost Hamiltonian remained constant. QAOA circuits were initialized to a uniform superposition over all bitstrings. The classical optimizer was set to 0.001 error tolerance and results were obtained with Rigetti’s quantum computing simulator without noise. For each mixer Hamiltonian a box plot for QAOA depth p = 1 is shown whereby the statistics were collected from 100 runs.

0.5 0.477

0.4 0.385 0.367

0.335 0.316

0.3 0.283 0.278 0.263 0.247 0.22 0.221 0.2 0.191 0.194

0.145 0.13 0.131 0.119 0.121 0.089 0.09 0.1 0.078 0.08 Ground state probability 0.073 0.1 0.06 0.048 0.04 0.034 0.032 0 0 0 0 0.002 0 0.003 0.007 0 0 0 0 0 0

Xmixer XYsimple XZsimple XYback XZback XYoverlap XZoverlap constant/ constant/ constant/ constant/ constant/ constant/ constant/

feasible feasible feasible feasible feasible feasible feasible

FIG. 6. Comparison of the ground state probabilities for the folding of PSVK on a planar lattice with various mixer Hamil- tonians. In this experiment the size of the cost Hamiltonian also remained constant. Yet, QAOA circuits were initialized to a uniform superposition over all feasible bitstrings with the initialization circuit I. The classical optimizer was set to 0.001 error tolerance and results were obtained with Rigetti’s quantum computing simulator without noise. For each mixer Hamiltonian a box plot for QAOA depth p = 1 (blue) and p = 2 (red) is shown whereby the statistics were collected from 100 runs and 50 runs respectively. the short-range overlap component from the cost Hamil- depth p = 1 are shown. The reported probabilities were tonian. This allows for an accurate baseline comparison averaged over 100 runs on a hypothetical all-to-all con- between the pure X mixer and the other mixer Hamiltoni- nected quantum computer without any noise. From the ans. The error tolerance of the classical Nelder-Mead op- plot in Fig. 5 it becomes evident that none of the other timizer was chosen to be 0.001 and the results for QAOA mixer Hamiltonians significantly outperforms the tradi- 9

0.5 0.477

0.4 0.352 0.321 0.3 0.296 0.274 0.27 0.259 0.263 0.234 0.22 0.2 0.19 0.185 0.164 0.139 0.13 0.158 0.13 0.111 0.103 0.1 0.121 0.09

Ground state probability 0.074 0.071 0.041 0.047 0.042 0.034 0.027 0.045 0.045 0.012

0 0.009 0 0 0.001 0.004 0 0 0 0.001 0 0.001 0.004 0 0

Xmixer XYsimple XZsimple XYback XZback XYoverlap XZoverlap Reference reduced/ reduced/ reduced/ reduced/ reduced/ reduced/ reduced/ XZsimple feasible feasible feasible feasible feasible feasible feasible constant/

feasible

FIG. 7. Comparison of the ground state probabilities for the folding of PSVK on a planar lattice with various mixer Hamilto- nians. In contrast to previous experiments, the size of the cost Hamiltonian was reduced depending on the mixer Hamiltonian used. QAOA circuits were initialized to a uniform superposition over all feasible bitstrings with the initialization circuit I. The classical optimizer was set to 0.001 error tolerance and results were obtained with Rigetti’s quantum computing simulator without noise. For each mixer Hamiltonian a box plot for QAOA depth p = 1 (blue) and p = 2 (red) is shown whereby the statistics were collected from 100 runs and 50 runs respectively. tional X mixer in this setting. The median ground state The Nelder-Mead error tolerance remained unchanged probabilities range between 0.055 for the XYsimple and and the simulations were performed without noise. We 0.019 for the XZoverlap. The pure Xmixer has a median again used 100 runs to average for QAOA depth p = 1 ground state probability of 0.036 and a maximum value but only used 50 runs for p = 2 due to the exponen- of 0.112. Interestingly, when comparing maximum val- tial runtime scaling of the simulation. Note that, almost ues the XYsimple and XZsimple mixer slightly outperform all six XY and XZ mixers dominate the performance of the Xmixer with maxima of 0.196 and 0.201 respectively. the traditional X mixer at QAOA depths p = 1 (blue The explanation for why the new mixers are not per- box plots) and p = 2 (red box plots) in this setting. forming well in this baseline setting is that both, XY and From all mixer definitions, the XZsimple at depth p = 2 XZ mixers, preserve Hamming weight to various extent. clearly performs the best with a maximum ground state SWAP-based mixers such as the XY mixers keep Hamming probability of 0.477 and a median of 0.263 compared to weight constant whereas XZ mixers either keep Ham- the Xmixer with a maximum of 0.148 and a median of ming weight constant or increase/decrease the original 0.048. The fact that the maximum ground state probabil- Hamming weight by 1. This also holds for the unfeasible ity three-folded clearly demonstrates the power of mixer states |00 0000i and |11 1111i contained in the uniform Hamiltonians that are custom to a particular problem en- superposition over all 6-bit strings. Yet, the XY and coding. Interestingly, the simple XY and XZ mixer gen- XZ mixers fail at converting these strings into feasible erally perform better than the more complicated mixer solutions whilst the X mixer can achieve this by simply Hamiltonians which take the short- and long-range inter- flipping the respective bits. actions into account. This can be best explained by the To analyse the full potential of the new mixer Hamilto- fact that the increased complexity leads to less ’mixing’ nians we repeat the previous experiment but rather than of the amplitudes since a lot of the SWAP and conditional initializing the QAOA circuit with a uniform superposi- bit-flip operations are being prevented since they would tion over all bitstrings we initialize a superposition over otherwise lead to overlaps. However, based on our sim- all feasible bitstrings instead. The desired initial state ulation results it seems that a simple ’blind’ approach should look like: to amplitude mixing has a higher chance of finding the ground state than a more controlled one. All in all, this |ψii = |10 1000i + |10 0100i + ... + |01 0001i , (43) experiment showed that when initializing a uniform su- which can be achieved with a relatively shallow circuit I. perposition over all feasible solutions any of the XY or XZ mixers (but XZback with p = 2) will almost certainly Using |ψii as the initial state for the QAOA circuit we obtain the ground state probabilities shown in Fig. 6. improve the ground state probabilities compared to the 10 traditional X mixer. Lastly, the experiment was repeated once more with an initial superposition over all feasible solutions and with cost Hamiltonians of varying size. More specifically, de- pending on the mixer Hamiltonian used, parts of the cost Hamiltonian were left out since e.g. the XZoverlap mixer would account for short- and long-range overlaps. This effectively reduces the size of the cost Hamiltonian whilst increasing the size of the mixer Hamiltonian. Yet, the mixer Hamiltonian’s increase is not necessarily propor- FIG. 8. Quantum circuit implementing the three-local Hamil- tional to the decrease in size of HC . Most importantly, tonian H = α(Z0 ⊗ Z1 ⊗ Z2) with four CNOT operations and Eq. 24 and 25 tend to inflate the cost Hamiltonian due one single-qubit gate to the many XNOR operations involved. It follows that using the mixer Hamiltonian to prevent overlaps can re- duce the circuit depth required to solve the optimization SWAP consists of three additional CNOT operations which problem. Furthermore, depending on the quantum chip in turn further inflate the depth of the quantum circuit architecture at hand this could potentially further reduce at hand. the required CNOT depth if the proposed XY or XZ mixer Unfortunately, the quantum circuit requirements for Hamiltonians lead to less topological SWAP operations. folding the planar model protein PSVK make it impossi- Keeping the circuit depth low is of particular importance ble to directly implement the corresponding QAOA cir- since NISQ era quantum computers, today as well as cuit on Rigetti’s 19Q-Acorn processor. For this rea- in the near future, will only allow for relatively shallow son, we implement a divide-and-conquer approach for the quantum circuits. Fig. 7 shows the obtained simulation QPU implementation of this problem. Folding PSVK on results for all seven mixer Hamiltonians with varying cost a planar lattice normally requires 6 qubits since the ze- Hamiltonians. All other parameters were kept constant roth turn is fixed, the first turn requires 2 qubits and with respect to the two previous experiments. Overall, the last turn requires 4 qubits. The divide-and-conquer the ground state probabilities clearly decreased in all XY approach consists of splitting the problem into two in- and XZ cases compared to the previous experiment with stances. One in which the first turn is fixed to moving to constant cost Hamiltonian size. The traditional X mixer, the RIGHT and one in which it is fixed to moving UP. In unsurprisingly, yields the same results since its use does this way we reduce the problem such that the cost and not affect the size of the cost Hamiltonian (it does not mixer Hamiltonian each only consist of 4 qubits. These prevent any overlaps). The best performance is again two problems were separately solved on the QPU with observed with the XYback and XZback mixer with max- QAOA circuits of depth p = 1 that were classical opti- imum ground state probabilities of 0.352 (p = 1) and mized with a Nelder-Mead optimizer with an error toler- 0.296 (p = 2) respectively. This again is an almost three- ance of 0.5. The initial state was a uniform superposition fold improvement compared to the pure X mixer under- over all bitstrings since preparing |ψii would have pushed lining the importance of problem-specific mixer Hamil- the quantum circuit depth beyond feasibility. We used tonians in QAOA circuits. In summary, the last exper- 10.000 samples to approximate the expectation value of iment demonstrates a compromise typical for the NISQ each term in the cost function and used the XYsimple era. Trading reduced circuit depth with slightly worse mixer. In both runs we obtained a total of 2000 sam- ground state probabilities might well be preferential on ples of which 121 yielded the correct ground state |0010i. near-term devices since we likely will not have the ability Even though PSVK is a tiny 2D model protein, to our to execute deep quantum circuits. knowledge, this proof-of-principle experiment is the first A major issue with the one-hot encoding strategy is the time that a lattice protein was folded on a gate-based locality of the cost Hamiltonian HC which is maximally quantum computing architecture. local. This means that HC is (6N − 17)-local for a pro- This work was focused on a newly introduced one-hot tein of size N on a cubic lattice. As shown in Fig. 8 each encoding of lattice proteins in order to investigate the term in the cost Hamiltonian translates to a sequence of use of various mixer Hamiltonians. It remains to be in- controlled-NOT (CNOT) operations and one single-qubit vestigated if more dense encodings as published in [3], [4] quantum gate. More specifically, for a k-local term in or [28] in conjunction with a plain X mixer Hamiltonian HC we need to implement exactly 2k − 2 CNOT opera- might result in the folding of larger proteins with QAOA tions. Additionally, some of these CNOT operations might circuits. The main bottlenecks are current hardware lim- not be directly implementable in the hardware due to itations, especially in terms of CNOT depth and qubit con- connectivity restrictions of the qubit hardware graph. nectivity. Since qubit connectivity can be mitigated us- This problem can be mitigated through the implemen- ing schemes such as LHZ-QAOA [21], the hardware met- tation of topological SWAP operations, which move qubits ric with the biggest potential for providing performance to locations where the CNOT operation between the de- increase is the two-qubit gate depth, determined by the sired qubits can be applied. However, each topological qubit coherence and gate application time. Since this 11 has already been observed by the hardware manufactur- linearly with the size of the protein. The new encod- ers, it is indeed the available circuit depth which is likely ing was designed such that the protein folding problem to be tackled next, since the size of the state space of the can be separated into hard and soft constraints in or- hardware system in terms of qubits already surpassed the der to make use of the fact that universal gate-based simulatable range of classical computers [14]. quantum computers enable us to freely choose a mixer Hamiltonian for the QAOA circuits. We showed how this approach can be used to incorporate various parts IV. FUTURE WORK of the cost Hamiltonian into the mixer Hamiltonian and derived six novel problem-specific mixer Hamiltonians. Using extensive numerical simulations, we demonstrated Future work will investigate the effects of noise on the that the use of these problem-specific mixer Hamiltoni- proposed algorithm as well as explore the most efficient ans as well as initial states can lead to a three-fold in- implementation of the variational algorithm for lattice crease in the probability of obtaining the correct pro- protein folding on fixed qubit architectures with the tech- tein fold. Across all experiments, the XY and XZ nique introduced by Farhi et al. [12]. Furthermore, ad- back back mixer Hamiltonians performed the best with a maximum ditional work is needed in optimizing the QAOA circuits ground state probability of 0.477. Additionally, we per- for lattice protein folding with e.g. temporal planners formed a proof-of-concept QPU implementation. Using as proposed by Venturelli et al. [36] since current quan- a divide-and-conquer approach together with the XY tum computing hardware enforces strict upper bounds back mixer Hamiltonian we successfully folded the mini pro- on the quantum circuit depth. Lechner [22] proposed yet tein PSVK on a planar lattice with a QAOA circuit on another way of decreasing the depth of QAOA cir- CNOT Rigetti’s 19Q-Acorn processor. With respect to near- cuits at the cost of using additional ancilla qubits which term NISQ computers, the new encoding as well as the are used to implement all-to-all connectivity through the new mixer Hamiltonians might not only improve the so- use of a lattice gauge model. In recent work, McClean lution quality but also be beneficial in terms of practi- et al. [23] pointed out that variational algorithms should cality depending on the chip topology and the available not be initialized with random circuits since it gets ex- universal gate set. ponentially difficult for the classical optimizer to find a non-zero gradient when using large numbers of qubits. Proposed solutions include structured initial guesses or Acknowledgments pre-training of quantum circuit segments which should be investigated in the context of lattice folding. Special thanks to Reed McBride, Ryan Karle, Matt Harrigan and Nima Alidoust at Rigetti Computing Inc. for continued support, fruitful discussions and access to V. CONCLUSIONS the 19Q-Acorn quantum processor. We are grateful for the support of the Rotman School of Business Creative This work introduced a novel encoding of the lattice Destruction Lab, especially Daniel Mulet, Hassan Bhatti protein folding problem on cubic and planar lattices using and Khalid Kurji. We acknowledge financial support a one-hot encoding of turns on the employed lattice. The from Data Collective, Spectrum28, Bloomberg Beta and number of required qubits in this new encoding scales private investors.

[1] Agozzino, L. and Dill, K. A. (2018). Protein evolution [5] Berger, B. and Leighton, T. (1998). Protein folding in speed depends on its stability and abundance and on the hydrophobic-hydrophilic (hp) model is np-complete. chaperone concentrations. Proceedings of the National Journal of Computational Biology, 5(1):27–40. Academy of Sciences, page 201810194. [6] Bravyi, S. B. and Kitaev, A. Y. (1998). Quantum [2] Anschuetz, E. R., Olson, J. P., Aspuru-Guzik, A., and codes on a lattice with boundary. arXiv preprint quant- Cao, Y. (2018). Variational quantum factoring. arXiv ph/9811052. preprint arXiv:1808.08927. [7] Dill, K. A. (1985). Theory for the folding and stability [3] Babbush, R., Perdomo-Ortiz, A., O’Gorman, B., of globular proteins. Biochemistry, 24(6):1501–1509. Macready, W., and Aspuru-Guzik, A. (2012). Construc- [8] Dill, K. A. and MacCallum, J. L. (2012). The Protein- tion of energy functions for lattice heteropolymer mod- Folding Problem, 50 Years On. Science, 338(6110):1042– els: a case study in constraint satisfaction programming 1046. and adiabatic quantum optimization. arXiv preprint [9] Dill, K. A., Ozkan, S. B., Shell, M. S., and Weikl, T. R. arXiv:1211.3422. (2008). The Protein Folding Problem. Annual Review of [4] Babej, T., Fingerhuth, M., and Ing, C. (2018). Coarse- Biophysics, 37:289–316. grained lattice protein folding on a quantum annealer. [10] Edwards, A. (2009). Large-scale structural biology of Internal ProteinQure whitepaper. the human proteome. Annual Review of Biochemistry, 78(1):541–568. PMID: 19489729. 12

[11] Farhi, E., Goldstone, J., and Gutmann, S. (2014). A nealing. Scientific reports, 2:571. quantum approximate optimization algorithm. arXiv [30] Peruzzo, A., McClean, J., Shadbolt, P., Yung, M.-H., preprint arXiv:1411.4028. Zhou, X.-Q., Love, P. J., Aspuru-Guzik, A., and Obrien, [12] Farhi, E., Goldstone, J., Gutmann, S., and Neven, H. J. L. (2014). A variational eigenvalue solver on a photonic (2017). Quantum algorithms for fixed qubit architec- quantum processor. Nature communications, 5:4213. tures. arXiv preprint arXiv:1703.06199. [31] Preskill, J. (2018). Quantum computing in the nisq era [13] Farhi, E. and Harrow, A. W. (2016). Quantum and beyond. arXiv preprint arXiv:1801.00862. supremacy through the quantum approximate optimiza- [32] Ryabinkin, I. G., Yen, T.-C., Genin, S. N., and Izmaylov, tion algorithm. arXiv preprint arXiv:1602.07674. A. F. (2018). Qubit coupled-cluster method: A system- [14] Google (2018). Personal communication. atic approach to quantum chemistry on a quantum com- [15] Hadfield, S., Wang, Z., O’Gorman, B., Rieffel, E. G., puter. arXiv preprint arXiv:1809.03827. Venturelli, D., and Biswas, R. (2017). From the quantum [33] Schuld, M., Bocharov, A., Svore, K., and Wiebe, N. approximate optimization algorithm to a quantum alter- (2018). Circuit-centric quantum classifiers. arXiv nating operator ansatz. arXiv preprint arXiv:1709.03489. preprint arXiv:1804.00633. [16] Hart, W. E. and Istrail, S. (1997). Robust proofs of np- [34] Smith, R. S., Curtis, M. J., and Zeng, W. J. (2016). hardness for protein folding: general lattices and energy A practical quantum instruction set architecture. arXiv potentials. Journal of Computational Biology, 4(1):1–22. preprint arXiv:1608.03355. [17] Hen, I. and Spedalieri, F. M. (2016). Quantum annealing [35] Unger, R. and Moult, J. (1993). Finding the lowest free for constrained optimization. Physical Review Applied, energy conformation of a protein is an np-hard problem: 5(3):034007. proof and implications. Bulletin of Mathematical Biology, [18] Kandala, A., Mezzacapo, A., Temme, K., Takita, 55(6):1183–1198. M., Brink, M., Chow, J. M., and Gambetta, J. M. [36] Venturelli, D., Do, M., Rieffel, E., and Frank, J. (2018). (2017). Hardware-efficient variational quantum eigen- Compiling quantum circuits to realistic hardware archi- solver for small molecules and quantum magnets. Nature, tectures using temporal planners. Quantum Science and 549(7671):242. Technology, 3(2):025004. [19] Kmiecik, S., Gront, D., Kolinski, M., Wieteska, L., [37] Verdon, G., Broughton, M., and Biamonte, J. (2017). A Dawid, A. E., and Kolinski, A. (2016). Coarse-grained quantum algorithm to train neural networks using low- protein models and their applications. Chemical Reviews, depth circuits. arXiv preprint arXiv:1712.05304. 116(14):7898–7936. PMID: 27333362. [38] Wang, D. S., Fowler, A. G., and Hollenberg, L. C. (2011). [20] Lau, K. F. and Dill, K. A. (1989). A lattice statisti- Surface code quantum computing with error rates over cal mechanics model of the conformational and sequence 1%. Physical Review A, 83(2):020302. spaces of proteins. Macromolecules, 22(10):3986–3997. [21] Lechner, W. (2018). Quantum Approximate Optimiza- tion with Parallelizable Gates. ArXiv e-prints. [22] Lechner, W. (2018). Quantum approximate opti- mization with parallelizable gates. arXiv preprint arXiv:1802.01157. [23] McClean, J. R., Boixo, S., Smelyanskiy, V. N., Babbush, R., and Neven, H. (2018). Barren plateaus in quan- tum neural network training landscapes. arXiv preprint arXiv:1803.11173. [24] Mirny, L., , and Shakhnovich, E. (2001). Protein folding theory: From lattice to all-atom models. Annual Review of Biophysics and Biomolecular Structure, 30(1):361–396. PMID: 11340064. [25] Miyazawa, S. and Jernigan, R. L. (1985). Estimation of effective interresidue contact energies from protein crys- tal structures: quasi-chemical approximation. Macro- molecules, 18(3):534–552. [26] Miyazawa, S. and Jernigan, R. L. (1996). Residue-residue potentials with a favorable contact pair term and an un- favorable high packing density term, for simulation and threading. Journal of Molecular Biology, 256(3):623–644. [27] Nelder, J. A. and Mead, R. (1965). A simplex method for function minimization. The computer journal, 7(4):308– 313. [28] Perdomo, A., Truncik, C., Tubert-Brohman, I., Rose, G., and Aspuru-Guzik, A. (2008). Construction of model hamiltonians for adiabatic quantum computation and its application to finding low-energy conformations of lattice protein models. Physical Review A, 78(1):012320. [29] Perdomo-Ortiz, A., Dickson, N., Drew-Brook, M., Rose, G., and Aspuru-Guzik, A. (2012). Finding low-energy conformations of lattice protein models by quantum an-