Skip to article frontmatterSkip to article content
Site not loading correctly?

This may be due to an incorrect BASE_URL configuration. See the MyST Documentation for reference.

水素分子のための変分量子固有値ソルバー(VQE)

タグ: algorithm chemistry variational

このチュートリアルでは、水素分子(H₂)の基底状態エネルギーを求めるための変分量子固有値ソルバー(VQE)アルゴリズムの実装について解説します。分子ハミルトニアンの生成には OpenFermion を使用します。

ワークフローは以下の通りです:

  1. 分子ハミルトニアンを量子ビット演算子へ変換

  2. パラメータ化された量子回路(アンザッツ)の作成

  3. VQEによる最適化の実装

  4. 原子間距離ごとのエネルギー地形の解析

量子コンピューティングを用いた量子化学問題の解法を紹介し、特にH₂分子の最小エネルギー構造の探索に焦点を当てます。

水素分子のハミルトニアンの作成

Qamomile ハミルトニアンへの変換

このセクションでは、OpenFermionのハミルトニアンをQamomileフォーマットに変換します。Jordan-Wigner変換を適用してフェルミ粒子演算子を量子ビット演算子へ変換し、その後、カスタム変換関数を用いてQamomileに適したハミルトニアン表現を作成します。

VQE アンザッツの作成

このセクションでは、VQEアルゴリズムのための Hardware Efficient SU(2) アンザッツを @qkernel デコレータを用いて作成します。アンザッツとは、試行波動関数を準備するパラメータ付き量子回路です。ry_layer、rz_layer および線形 CX エンタングル層を組み合わせて構築し、最後に expval でハミルトニアンの期待値を計算します。

Qiskitを用いたVQEの実行

このセクションでは、QiskitTranspiler を使って VQE カーネルを実行可能オブジェクトにトランスパイルします。デフォルトの executor がこのオブジェクトを実行し、qkernel で定義した expval による期待値を返します。そのため、ユーザーは最適化ループのみ実装すれば問題ありません。

<Figure size 2210.55x785.944 with 1 Axes>
         Current function value: -1.105860
         Iterations: 50
         Function evaluations: 2091
         Gradient evaluations: 51
  message: Maximum number of iterations has been exceeded.
  success: False
   status: 1
      fun: -1.1058596669662146
        x: [ 3.123e+00  1.022e+00 ...  1.306e+00  2.499e+00]
      nit: 50
      jac: [-2.432e-04  7.428e-05 ... -2.050e-04 -1.992e-04]
 hess_inv: [[ 3.780e+00  5.350e-01 ...  5.605e-01  4.342e-01]
            [ 5.350e-01  1.987e+00 ... -7.798e-01 -2.818e-01]
            ...
            [ 5.605e-01 -7.798e-01 ...  3.530e+00  2.205e+00]
            [ 4.342e-01 -2.818e-01 ...  2.205e+00  3.405e+00]]
     nfev: 2091
     njev: 51
<Figure size 640x480 with 1 Axes>

原子同士の距離を変更する

distance:  0.2 energy:  0.15749274532446333 fci_energy:  0.15748213479836526
distance:  0.29285714285714287 energy:  -0.5679183288459648 fci_energy:  -0.5679447209710013
distance:  0.38571428571428573 energy:  -0.8833482168143287 fci_energy:  -0.8833596636183383
distance:  0.4785714285714286 energy:  -1.0335823410283806 fci_energy:  -1.0336011797110967
distance:  0.5714285714285714 energy:  -1.104177464301668 fci_energy:  -1.1042094222435166
distance:  0.6642857142857144 energy:  -1.1316543840491953 fci_energy:  -1.1323508827075506
distance:  0.7571428571428571 energy:  -1.1368969053665618 fci_energy:  -1.1369026717971333
distance:  0.8500000000000001 energy:  -1.128359326360385 fci_energy:  -1.128361878458112
distance:  0.9428571428571428 energy:  -1.1127239361512136 fci_energy:  -1.1127252078468768
distance:  1.0357142857142858 energy:  -1.0934760878958496 fci_energy:  -1.093476088229404
distance:  1.1285714285714286 energy:  -1.0727482370243173 fci_energy:  -1.0727578805453502
distance:  1.2214285714285713 energy:  -1.052007109639021 fci_energy:  -1.052008162170845
distance:  1.3142857142857143 energy:  -1.0322163819392465 fci_energy:  -1.0322400306247084
distance:  1.4071428571428573 energy:  -1.0141386084973292 fci_energy:  -1.0141470586695496
distance:  1.5 energy:  -0.9980888898562652 fci_energy:  -0.9981493534714101
<Figure size 640x480 with 1 Axes>