Solving the Ising Many-body problem of protein folding problem using Blueqat and QAOA

Yuichiro Minato
May 19 · 5 min read


The way to solve the protein folding problem is a optimization problem on ising model implementation using two quantum bits of 00, 01, 10, and 11.

The original document isa Nature paper from the laboratory of Professor Alan Aspuru-Guzic of Harvard University in 2012.

Finding low-energy conformations of lattice protein models by quantum annealing Alejandro Perdomo-Ortiz, Neil Dickson, Marshall Drew-Brook, Geordie Rose & Alán Aspuru-Guzik Scientific Reports volume 2, Article number: 571 (2012)


Hamiltonian is written in QUBO, QUBO is expressed in bits of {0, 1}, not {1, -1} finally solved in Ising. It is necessary to fix the bit representation to the Ising representation.

Hamiltonian is below.

H = −q2 + 8q1q2 + 15q2q3 − 18q1q2q3 − 3q1q4 + 12q1q2q4 + 4q3q4 + 3q1q3q4 − 6q2q3q4 − 12q1q2q3q4 + 4q2q5 + 3q1q2q5 − 15q2q3q5 + 15q4q5 + 3q1q4q5 − 6q2q4q5 − 12q1q2q4q5 − 15q3q4q5 + 28q2q3q4q5 − 2q1q2q6 − 4q3q6 + 2q2q3q6 + 13q1q2q3q6 − 2q1q4q6 + 4q1q2q4q6 + 2q3q4q6 + 13q1q3q4q6 + 4q2q3q4q6 − 37q1q2q3q4q6 + 7q5q6 + 2q2q5q6 + 13q1q2q5q6 + 4q3q5q6 + 9q2q3q5q6 − 33q1q2q3q5q6 − 20q4q5q6 + 13q1q4q5q6 + 4q2q4q5q6 − 37q1q2q4q5q6 + 9q3q4q5q6 − 33q1q3q4q5q6 − 37q2q3q4q5q6 + 99q1q2q3q4q5q6 − 4q2q7 + 4q2q3q7 + 7q4q7 + 2q2q4q7 + 13q1q2q4q7 + 4q3q4q7 + 9q2q3q4q7 − 33q1q2q3q4q7 + 4q2q5q7 − 18q4q5q7 + 9q2q4q5q7 − 33q1q2q4q5q7 − 33q2q3q4q5q7 + 62q1q2q3q4q5q7 + 7q6q7 + 2q2q6q7 + 13q1q2q6q7 + 4q3q6q7 + 9q2q3q6q7 − 33q1q2q3q6q7 − 20q4q6q7 + 13q1q4q6q7 + 4q2q4q6q7 − 37q1q2q4q6q7 + 9q3q4q6q7 − 33q1q3q4q6q7 − 37q2q3q4q6q7 + 99q1q2q3q4q6q7 − 18q5q6q7 + 9q2q5q6q7 −33q1q2q5q6q7–33q2q3q5q6q7 + 62q1q2q3q5q6q7 + 53q4q5q6q7–33q1q4q5q6q7–37q2q4q5q6q7 + 99q1q2q4q5q6q7–33q3q4q5q6q7 + 62q1q3q4q5q6q7 + 99q2q3q4q5q6q7–190q1q2q3q4q5q6q7

I would like to seek the lowest ground state of this equation. The number after q is the serial number of the qubit, and the number at the head of each term is a coefficient.

I would like to try solving combinatorial optimization problem with algorithm like QAOA like simulation of quantum adiabatic calculation for general purpose quantum computer.

In QAOA, using the time evolution simulation of a unitary operator with the method of quantum adiabatic calculation, start from the ground state of superposition of |+> and exchange it to the Hamiltonian you want to calculate which is written in classical Z-spin.

Tools to use

We now use Blueqat SDK, a free development kit for QC. It can be installed easily with pip.

First thing to do

First of all it is difficult to get the preprocess, to convert this hamiltonian to 2-body Ising model hamiltonian. This part was automated by the engineer’s tinkle. I will not touch it deeply this time. . .

With QAOA, we calculate the minimum ground state of each Hamiltonian by the technique called VQE. Also, QAOA can determine the number of simulation steps for adiabatic quantum computation to improve accuracy.

Since the QAOA step number is 8 and we have 2 angle parameter for replacing the Hamiltonian, we optimize totally of 2 * 8 = 16 parameters. Optimization would like to rely on classical optimization algorithm implemented on Blueqat VQE. The execution code has been simplified by the developer,

Execution result

The execution result is as follows. Calculation requires a lot of iteration calculation and step number, so it takes a lot of time. The optimization process of 16 parameters and the expected value energy of the final Hamiltonian are displayed.

After a certain optimization is completed, a solution is obtained. It is quite difficult without a high-speed simulator, it takes several minutes to several tens of minutes. This time I finished with HPC in 313 seconds. The state vector has reached the answer slightly better than the local minimum.

The answer is 0100001011, the first 010 is clear, so it is successful if we get the sequence 0001011. QAOA is a quantum adiabatic calculation, it is easy to pass through the part of the energy gap and it depends on the setting of the initial parameters, so it tends to fall into the local solution, so you can solve it with some accuracy though there is luck.

What is Blueqat?

Blueqat is an open source library for quantum computer.

How to install Blueqat?

Blueqat is provided as Python (ver 3.6+) library. You can install by pip.

pip install blueqat

The overlayed state has shifted so that 0 and 1 come to q2 in about half probability.

If you have any questions or suggestions, please feel free to contact us by our Slack community. (Join from here)

Yuichiro Minato

Written by

MDR, Quantum Computing@Tokyo,