@yuichirominato 2018.11.25更新 153views

Solve the Ising Many-body problem of protein folding problem efficiently (?) With Blueqat

Blueqat protein foldings QAOA QUBO VQE

Introduction

I tried quantum annealing on a simple problem to solve the protein folding problem with D-Wave and wildqat.js and made an application.

http://blog.mdrft.com/post/414

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

The original document was a 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)
https://www.nature.com/articles/srep00571

In the above blog, I picked up an example of a simple protein folding and tried to implement the D-Wave and web application only for the last part, but this time I would like to try Hamiltonian folding six amino acid I.Hamiltonian is in the Appendix of the Nature paper above.

Hamiltonian

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. For QAOA, please refer to the following.

QAOA implementation to solve combinatorial optimization problem
http://blog.mdrft.com/post/229

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.

https://github.com/mdrft/Blueqat

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 Blue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.34375*Z[1]*Z[3]*Z[4] - 0.0625*Z[1]*Z[3]*Z[4]*Z[5] - 0.453125*Z[1]*Z[3]*Z[4]*Z[5]*Z[6] - 0.078125*Z[1]*Z[3]*Z[4]*Z[6] + 1.234375*Z[1]*Z[3]*Z[5] - 0.0625*Z[1]*Z[3]*Z[5]*Z[6] - 0.28125*Z[1]*Z[4] - 0.078125*Z[1]*Z[4]*Z[5]*Z[6] + 0.109375*Z[1]*Z[4]*Z[6] + 0.234375*Z[1]*Z[5] + 0.0625*Z[1]*Z[6] - 3.046875*Z[1] - 0.28125*Z[2]*Z[3] + 0.265625*Z[2]*Z[3]*Z[4] - 0.078125*Z[2]*Z[3]*Z[4]*Z[5] - 0.0625*Z[2]*Z[3]*Z[4]*Z[6] - 0.078125*Z[2]*Z[3]*Z[5]*Z[6] + 0.109375*Z[2]*Z[3]*Z[6] - 2.171875*Z[2]*Z[4] + 0.109375*Z[2]*Z[4]*Z[5] - 0.0625*Z[2]*Z[4]*Z[5]*Z[6] + 0.125*Z[2]*Z[4]*Z[6] + 0.0625*Z[2]*Z[5] + 0.109375*Z[2]*Z[5]*Z[6] + 0.359375*Z[2]*Z[6] + 0.09375*Z[2] - 0.28125*Z[3]*Z[4] + 2.671875*Z[3]*Z[4]*Z[5]*Z[6] + 0.109375*Z[3]*Z[4]*Z[6] - 2.515625*Z[3]*Z[5] + 0.0625*Z[3]*Z[6] - 0.671875*Z[3] + 0.0625*Z[4]*Z[5] + 0.109375*Z[4]*Z[5]*Z[6] - 2.390625*Z[4]*Z[6] + 0.21875*Z[4] + 0.0625*Z[5]*Z[6] - 0.203125*Z[5] - 0.125*Z[6]

result = Vqe(QaoaAnsatz(hamiltonian,8)).run()    
print(result.most_common(10))  

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.


...

params: [0.88655361 0.41914504 0.96542813 0.20695551 0.77300442 0.12601914
 0.11899099 0.87285336 0.70352873 0.91151805 0.26923012 0.98264302
 0.91944822 0.3097855  0.88654577 0.74455706] val: 5.131692398138156

...

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.


(((0, 0, 0, 1, 0, 1, 1), 0.0526207005085115), ((0, 1, 0, 1, 0, 1, 1), 0.0509613913647074), ((0, 0, 1, 0, 1, 0, 0), 0.04083238349765797), ((0, 1, 0, 1, 0, 1, 0), 0.03858710306550349), ((1, 0, 1, 0, 0, 1, 0), 0.03797289965489858), ((1, 0, 0, 0, 0, 0, 1), 0.03159655384832289), ((1, 1, 1, 0, 1, 0, 0), 0.028299534909668748), ((1, 0, 0, 0, 0, 0, 0), 0.026228368428091498), ((1, 0, 1, 1, 1, 1, 0), 0.025016295668237147), ((1, 1, 1, 0, 1, 0, 1), 0.02392454173189753))
313.90521216392517

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.

Recommend

SERVICE

汎用量子コンピュータ向けアプリケーション開発SDK

詳しく見る Githubで入手する(無料)

汎用量子コンピュータ向け高速シミュレータ

詳しく見る

量子コンピュータ向けクラウドサービス(準備中)

詳しく見る

イジングマシン向けアプリケーション開発SDK

詳しく見る Githubで入手する(無料)

COMMUNITY

量子コンピュータのことを学びたい、仕事としたいなどの情報交換の場を設け、コミュニティの形成を進めています。オフラインの勉強会と、オンラインのチャットコミュニティの2種類あります。オフラインのConnpassは1400名、オンラインのSlackは880名を超える参加があります。どちらも無料ですのでお気軽にご参加ください。

CONNPASS SLACK

CONTACT

弊社あての連絡はinfo@mdrft.comより用件を明記の上、メールで連絡を頂けますと幸いです。

Back To Top

Recent Posts