VQE_EN.ipynb 43.8 KB
Notebook
Newer Older
Q
Quleaf 已提交
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# Variational Quantum Eigensolver\n",
    "\n",
    "<em> Copyright (c) 2021 Institute for Quantum Computing, Baidu Inc. All Rights Reserved. </em>"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Overview\n",
    "\n",
Q
Quleaf 已提交
18
    "It is widely believed that one of the most promising applications of quantum computing in the near future is solving quantum chemistry problems [1-2]. **Variational Quantum Eigensolver** (VQE) is a strong proof to this possibility of studying quantum chemistry with **Noisy Intermediate-Scale Quantum** (NISQ) devices [1-4]. The core task is to solve the ground state of any molecular Hamiltonian $\\hat{H}$ by preparing a parametrized wave function ansatz $|\\Psi(\\boldsymbol\\theta)\\rangle$ on a quantum computer and adopt classical optimization methods (e.g. gradient descent) to adjust the parameters $\\boldsymbol\\theta$ to minimize the expectation value $\\langle \\Psi(\\boldsymbol\\theta)|\\hat{H}|\\Psi(\\boldsymbol\\theta)\\rangle$. This approach is based on the **Rayleigh-Ritz variational principle**. \n",
Q
Quleaf 已提交
19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38
    "\n",
    "$$\n",
    "E_0 = \\min_{\\boldsymbol\\theta} \\langle \\Psi(\\boldsymbol\\theta)|\\hat{H}|\\Psi(\\boldsymbol\\theta)\\rangle.\n",
    "\\tag{1}\n",
    "$$\n",
    "\n",
    "where $E_0$ denotes the ground state energy. Numerically, it can be understood as finding the smallest eigenvalue $\\lambda_{\\min}$ of a **discretized** Hamiltonian $H$ (hermitian matrix) and its corresponding eigenvector $|\\Psi_0\\rangle$. How such a discretization can be done on a classical computer belongs to the art of quantum chemistry and is far beyond the scope of this tutorial. We will discuss this part with a few words in the background section. In general, such a Hamiltonian $H$ is expressed as a weighted sum of Pauli spin operators $\\{X,Y,Z\\}$ (native to quantum devices) such that this information can be processed on a quantum computer.\n",
    "\n",
    "$$\n",
    "H = \\sum_k c_k ~ \\bigg( \\bigotimes_{j=0}^{M-1} \\sigma_j^{(k)} \\bigg),\n",
    "\\tag{2}\n",
    "$$\n",
    "\n",
    "where $\\sigma_j^{(k)} \\in \\{I,X,Y,Z\\}$ and $M$ stands for qubit number. We refer this form of Hamiltonian as **Pauli strings**. For example, \n",
    "\n",
    "$$\n",
    "H= 0.12~Y_0 \\otimes I_1-0.04~X_0\\otimes Z_1.\n",
    "\\tag{3}\n",
    "$$\n",
    "\n",
Q
Quleaf 已提交
39
    "In the next section, we will provide a brief review on the electronic structure problem which essentially tells us how to calculate the Hamiltonian $H$. For those who are already familiar with this topic or only interested in how to implement VQE on Paddle Quantum, please skip this part and jump into the illustrative example of hydrogen molecule $H_2$.\n",
Q
Quleaf 已提交
40 41 42 43 44 45 46 47 48 49 50 51
    "\n",
    "## Background: the electronic structure problem\n",
    "\n",
    "In this section, we focus on one of the fundamental problems in quantum chemistry --  **the electronic structure problem**. To be more specific, we are interested in the low lying energy eigenstates of any given molecule. These knowledge could help predict reaction rates and location of stable structures [5]. Suppose a molecule consists of $N_n$ nuclei and $N_e$ electrons, the first quantized (canonical quantization) Hamiltonian operator $\\hat{H}_{mol}$ describing the total energy of this molecular system can be written as\n",
    "\n",
    "$$\n",
    "\\begin{align}\n",
    "\\hat{H}_{\\text{mol}} & = -\\sum_{i}\\frac{\\nabla_{R_i}^2}{2M_i} - \\sum_{i} \\frac{\\nabla_{r_i}^2}{2} -\\sum_{i,j}\\frac{Z_i}{\\lvert R_i - r_j\\lvert} + \\sum_{i,j>i}\\frac{Z_iZ_j}{\\lvert R_i - R_j\\lvert} + \\sum_{i, j>i}\\frac{1}{\\lvert r_i - r_j\\lvert}, \n",
    "\\tag{4}\n",
    "\\end{align}\n",
    "$$\n",
    "\n",
Q
Quleaf 已提交
52
    "where $R_i, M_i,$ and $Z_i$ denote the position, mass and atomic number (the number of protons) of the $i^{th}$ nucleus, and the positions of electrons are $r_i$. The first two sums describe the kinetic energy of nuclei and electrons, respectively. The third sum describes the attractive Coulomb interaction between the positively charged nuclei and the negatively charged electrons. The last two terms represent the repulsive nuclei-nuclei and electron-electron interactions.  Here, the molecular Hamiltonian $\\hat{H}_\\text{mol}$ is already in atomic units of energy, **Hartree**. $1$ Hartree is $[\\hbar^2/(m_ee^2a_0^2)] = 27.2$ eV or $630$ kcal/mol, where $m_e, e,$ and $a_0$ stand for the mass of electron, charge of electron, and Bohr radius. \n",
Q
Quleaf 已提交
53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68
    "\n",
    "\n",
    "**Note:** The spin-orbit interaction and hyperfine interaction are not considered in this picture. They can be treated as perturbations if necessary. \n",
    "\n",
    "### Born-Oppenheimer approximation\n",
    "\n",
    "Since the nuclei are much heavier than electrons, the electrons will move much faster than the nuclei. It is reasonable to treat the positions of nuclei as fixed, $R_i =$ constants. This is known as the Born-Oppenheimer approximation by decoupling the behavior of nuclei and electrons in time scale. Consequently, the kinetic energy term of nuclei will disappear and the nuclei-nuclei repulsive interaction term can be viewed as an energy shift (independent of electron positions $r_i$). We could derive the electronic Hamiltonian $\\hat{H}_{\\text{electron}}$ as\n",
    "\n",
    "$$\n",
    "\\begin{align}\n",
    "\\hat{H}_{\\text{electron}} & =  - \\sum_{i} \\frac{\\nabla_{r_i}^2}{2} -\\sum_{i,j}\\frac{Z_i}{\\lvert R_i - r_j\\lvert} + \\sum_{i, j>i}\\frac{1}{\\lvert r_i - r_j\\lvert} \n",
    "\\tag{5},\n",
    "\\end{align}\n",
    "$$\n",
    "\n",
    "The energy levels of the electrons in the molecule can be found by solving the time independent Schrödinger equation\n",
Q
Quleaf 已提交
69
    "\n",
Q
Quleaf 已提交
70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91
    "$$\n",
    "\\hat{H}_{\\text{electron}} |\\Psi_n \\rangle = E_n |\\Psi_n \\rangle,\n",
    "\\tag{6}\n",
    "$$\n",
    "\n",
    "where $n$ stands for the energy level. Notice the electron repulsion terms scale as $N_e(N_e-1)/2$ which means for the Oxygen molecule $O_2$ carrying 16 electrons there will be 120 electron repulsion terms in total! In general, this problem cannot be solved analytically. As Dirac concluded in [Quantum mechanics of many-electron systems](https://royalsocietypublishing.org/doi/10.1098/rspa.1929.0094) [6],\n",
    "\n",
    "> *The underlying physical laws necessary for the mathematical theory of a large part of physics and the whole of chemistry are thus completely known, and the difficulty is only that the exact application of these laws leads to equations much too complicated to be soluble.*                                                                                                                                                                  \n",
    ">\n",
    "> ​\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t-- Paul Dirac (1929)\n",
    "\n",
    "A straightforward numerical approach is discretizing the infinite-dimensional Hilbert space into equidistant grid points where linear algebra guides the whole calculation. Suppose each axis of space is discretized into $k$ points, the $N$-electron (drop the subscript e for simplicity) wave function can be written as [2]\n",
    "\n",
    "$$\n",
    "|\\Psi \\rangle = \\sum_{\\mathbf{x_1}, \\ldots, \\mathbf{x_N}} \\psi(\\mathbf{x_1}, \\ldots, \\mathbf{x_N}) \\mathcal{A}(|\\mathbf{x_1}, \\ldots, \\mathbf{x_N}\\rangle).\n",
    "\\tag{7}\n",
    "$$\n",
    "\n",
    "where coordinate $|\\mathbf{x_j}\\rangle = |r_j\\rangle |\\sigma_j\\rangle$ records the spatial location and spin of the $j^{th}$ electron, $|r_j\\rangle  = |x_j,y_j,z_j\\rangle$ for $j\\in \\{1,2,\\cdots,N\\}$, $x_j,y_j,z_j \\in \\{0,1,\\cdots,k-1\\}$ and  $\\sigma_j \\in \\{\\downarrow,\\uparrow\\}$ for spin down or up.  There will be $k^{3N}\\times 2^{N}$ complex amplitudes in total. Here, $\\mathcal{A}$ denotes anti-symmetrization and a consequence of the Pauli exclusion principle (electrons are fermion), and $\\psi(\\mathbf{x_1}, \\mathbf{x_2}, \\ldots, \\mathbf{x_N})=\\langle\\mathbf{x_1}, \\mathbf{x_2}, \\ldots, \\mathbf{x_N}|\\Psi\\rangle$. One can see that storing such a wave function already requires **exponentially growing memory** with respect to the number of electrons $N$. This would make classical simulation methods based on this naive numerical approach intractable for systems size larger than few tens of electrons. Now, the question becomes can we prepare such a wave function $|\\Psi\\rangle$ directly on a quantum computer and measure the expectation value $E_0$? In the next section, let's take the simplest molecular system -- hydrogen molecule $H_2$ as a concrete example.\n",
    "\n",
    "\n",
    "\n",
Q
Quleaf 已提交
92
    "**Note:** A detailed review on quantum chemistry and existing classical computational methods are far beyond the scope of this tutorial, we refer the enthusiastic readers to the standard textbooks *'Molecular Electronic-Structure Theory'* [5] by Helgaker and *'Modern Quantum Chemistry: Introduction to Advanced Electronic Structure Theory'* [7] by Szabo & Ostlund. To bridge to knowledge gap between quantum chemistry and quantum computing, please check the following review papers [Quantum computational chemistry](https://journals.aps.org/rmp/abstract/10.1103/RevModPhys.92.015003) [2] and [Quantum Chemistry in the Age of Quantum Computing](https://pubs.acs.org/doi/10.1021/acs.chemrev.8b00803) [1].\n",
Q
Quleaf 已提交
93 94 95 96 97 98 99 100
    "\n",
    "**Note:** For energy calculation, it is desired to reach the **chemical accuracy** of $1.6\\times10^{-3}$ Hartree or 1 kcal/mol . "
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
Q
Quleaf 已提交
101
    "## Ground state of the hydrogen molecule $H_2$\n",
Q
Quleaf 已提交
102 103 104
    "\n",
    "### Building electronic Hamiltonian\n",
    "\n",
Q
Quleaf 已提交
105 106 107
    "First of all, let us import the necessary libraries and packages.`qchem` module in Paddle Quantum is developed basing on `psi4` and `openfermion`, so you need to install these two packages before executing the following codes. We strongly encourage you to read the tutorial [Building molecular Hamiltonian](./BuildingMolecule_EN.ipynb) first, which introduces how to utilize our quantum chemistry toolkit `qchem`.\n",
    "\n",
    "**Note: As to the environment setting, please refer to [README.md](https://github.com/PaddlePaddle/Quantum/blob/master/README.md).**"
Q
Quleaf 已提交
108 109 110 111 112 113 114
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {
    "ExecuteTime": {
Q
Quleaf 已提交
115 116
     "end_time": "2021-04-30T09:14:44.970178Z",
     "start_time": "2021-04-30T09:14:40.895128Z"
Q
Quleaf 已提交
117 118 119 120
    }
   },
   "outputs": [],
   "source": [
Q
Quleaf 已提交
121 122 123 124 125
    "import paddle\n",
    "import paddle_quantum.qchem as qchem\n",
    "from paddle_quantum.utils import Hamiltonian\n",
    "from paddle_quantum.circuit import UAnsatz\n",
    "\n",
Q
Quleaf 已提交
126 127 128 129 130 131 132
    "import os\n",
    "import matplotlib.pyplot as plt\n",
    "\n",
    "import numpy\n",
    "from numpy import pi as PI\n",
    "from numpy import savez, zeros\n",
    "\n",
Q
Quleaf 已提交
133 134 135
    "# Eliminate noisy python warnings\n",
    "import warnings\n",
    "warnings.filterwarnings(\"ignore\")"
Q
Quleaf 已提交
136 137 138 139 140 141
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
Q
Quleaf 已提交
142
    "To analyze specific molecules, we need several key information such as **geometry**, **basis set** (such as STO-3G), **multiplicity**, and **charge** to model the molecule and achieve more information about the molecule, such as one-body integrations, two-body integrations, and others. Next, through our built-in quantum chemistry toolkit, we could set a `Hamiltonian` class to carry molecule Hamiltonian information, which may simplify the following calculations."
Q
Quleaf 已提交
143 144 145 146 147 148 149
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {
    "ExecuteTime": {
Q
Quleaf 已提交
150 151
     "end_time": "2021-04-30T09:14:44.982005Z",
     "start_time": "2021-04-30T09:14:44.975892Z"
Q
Quleaf 已提交
152 153 154 155 156 157 158
    }
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
Q
Quleaf 已提交
159 160
      "FCI energy for H2_sto-3g_singlet (2 electrons) is -1.137283834485513.\n",
      "\n",
Q
Quleaf 已提交
161
      "The generated h2 Hamiltonian is \n",
Q
Quleaf 已提交
162 163 164 165 166 167 168 169 170 171 172 173 174 175 176
      " -0.09706626861762556 I\n",
      "-0.04530261550868938 X0, X1, Y2, Y3\n",
      "0.04530261550868938 X0, Y1, Y2, X3\n",
      "0.04530261550868938 Y0, X1, X2, Y3\n",
      "-0.04530261550868938 Y0, Y1, X2, X3\n",
      "0.1714128263940239 Z0\n",
      "0.16868898168693286 Z0, Z1\n",
      "0.12062523481381837 Z0, Z2\n",
      "0.16592785032250773 Z0, Z3\n",
      "0.17141282639402394 Z1\n",
      "0.16592785032250773 Z1, Z2\n",
      "0.12062523481381837 Z1, Z3\n",
      "-0.2234315367466399 Z2\n",
      "0.17441287610651626 Z2, Z3\n",
      "-0.2234315367466399 Z3\n"
Q
Quleaf 已提交
177 178 179 180
     ]
    }
   ],
   "source": [
Q
Quleaf 已提交
181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200
    "geo = qchem.geometry(structure=[['H', [-0., 0., 0.0]], ['H', [-0., 0., 0.74]]])\n",
    "# geo = qchem.geometry(file='h2.xyz')\n",
    "\n",
    "# Save molecule information in to variable molecule, including one-body integrations, one-body integrations, molecular and Hamiltonian\n",
    "molecule = qchem.get_molecular_data(\n",
    "    geometry=geo,\n",
    "    basis='sto-3g',\n",
    "    charge=0,\n",
    "    multiplicity=1,\n",
    "    method=\"fci\",\n",
    "    if_save=True,\n",
    "    if_print=True\n",
    ")\n",
    "# Recall Hamiltonian\n",
    "molecular_hamiltonian = qchem.spin_hamiltonian(molecule=molecule,\n",
    "                                               filename=None, \n",
    "                                               multiplicity=1, \n",
    "                                               mapping_method = 'jordan_wigner',)\n",
    "# Print results\n",
    "print(\"\\nThe generated h2 Hamiltonian is \\n\", molecular_hamiltonian)"
Q
Quleaf 已提交
201 202 203 204 205 206 207 208
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "**Note:** This Hamiltonian is generated with an interatomic distance of $d = 74$ pm. \n",
    "\n",
Q
Quleaf 已提交
209
    "In addition to inputting molecular geometry directly, inputting molecular geometry file (.xyz file) is also allowed. For more information about quantum chemistry toolkit, please refer to the tutorial [Building molecular Hamiltonian](./BuildingMolecule_EN.ipynb). If you need to test the geometric configuration of more molecules, please check out this [database](http://smart.sns.it/molecules/index.html)."
Q
Quleaf 已提交
210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### Building QNN and trial wave function\n",
    "\n",
    "To implement VQE, we firstly need to design a quantum neural network QNN to prepare the wave function ansatz $|\\Psi(\\boldsymbol\\theta)\\rangle$. Here, we provide a 4-qubit quantum circuit template with a depth of $D$ blocks. The dotted frame in the figure below denotes a single block:\n",
    "\n",
    "\n",
    "![Utheta.jpg](https://release-data.cdn.bcebos.com/PIC%2FUtheta.jpg)\n",
    "\n",
    "Next, we use the `UAnsatz` class and the built-in `real_entangled_layer(theta, D)` circuit template in Paddle Quantum to realize this QNN.\n",
    "\n"
   ]
  },
  {
   "cell_type": "code",
Q
Quleaf 已提交
229
   "execution_count": 11,
Q
Quleaf 已提交
230 231
   "metadata": {
    "ExecuteTime": {
Q
Quleaf 已提交
232 233
     "end_time": "2021-04-30T09:14:50.083041Z",
     "start_time": "2021-04-30T09:14:50.062255Z"
Q
Quleaf 已提交
234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253
    }
   },
   "outputs": [],
   "source": [
    "def U_theta(theta, Hamiltonian, N, D):\n",
    "    \"\"\"\n",
    "    Quantum Neural Network\n",
    "    \"\"\"\n",
    "    \n",
    "    # Initialize the quantum neural network according to the number of qubits N\n",
    "    cir = UAnsatz(N)\n",
    "    \n",
    "    # Built-in {R_y + CNOT} circuit template\n",
    "    cir.real_entangled_layer(theta[:D], D)\n",
    "    \n",
    "    # Lay R_y gates in the last row\n",
    "    for i in range(N):\n",
    "        cir.ry(theta=theta[D][i][0], which_qubit=i)\n",
    "        \n",
    "    # The quantum neural network acts on the default initial state |0000>\n",
Q
Quleaf 已提交
254
    "    fin_state = cir.run_state_vector()\n",
Q
Quleaf 已提交
255
    "    \n",
Q
Quleaf 已提交
256
    "    # Calculate the expectated value of the given Hamiltonian\n",
Q
Quleaf 已提交
257 258
    "    expectation_val = cir.expecval(Hamiltonian)\n",
    "\n",
Q
Quleaf 已提交
259
    "    return expectation_val, cir, fin_state"
Q
Quleaf 已提交
260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### Setting up the loss function and model\n",
    "\n",
    "Now that we have the target Hamiltonian and QNN, we will further define the training model and loss function. By applying the QNN $U(\\theta)$ on the initial state $|0..0\\rangle$, we get the output state $|\\psi(\\boldsymbol\\theta)\\rangle $. Then, the loss function to be minimized is the expectation value, \n",
    "\n",
    "\n",
    "$$\n",
    "\\min_{\\boldsymbol\\theta}  \\mathcal{L}(\\boldsymbol \\theta) = \\min_{\\boldsymbol\\theta} \\langle \\Psi(\\boldsymbol\\theta)|H |\\Psi(\\boldsymbol\\theta)\\rangle\n",
    "= \\min_{\\boldsymbol\\theta} \\sum_k c_k~\\langle \\Psi(\\boldsymbol\\theta)| \\bigotimes_j \\sigma_j^{(k)}|\\Psi(\\boldsymbol\\theta)\\rangle.\n",
    "\\tag{8}\n",
    "$$"
   ]
  },
  {
   "cell_type": "code",
Q
Quleaf 已提交
280
   "execution_count": 12,
Q
Quleaf 已提交
281 282
   "metadata": {
    "ExecuteTime": {
Q
Quleaf 已提交
283 284
     "end_time": "2021-04-30T09:14:50.183996Z",
     "start_time": "2021-04-30T09:14:50.167892Z"
Q
Quleaf 已提交
285 286 287 288
    }
   },
   "outputs": [],
   "source": [
Q
Quleaf 已提交
289
    "class StateNet(paddle.nn.Layer):\n",
Q
Quleaf 已提交
290 291 292
    "    \"\"\"\n",
    "    Construct the model net\n",
    "    \"\"\"\n",
Q
Quleaf 已提交
293
    "\n",
Q
Quleaf 已提交
294
    "    def __init__(self, shape, dtype=\"float64\"):\n",
Q
Quleaf 已提交
295 296
    "        super(StateNet, self).__init__()\n",
    "        \n",
Q
Quleaf 已提交
297
    "        # Initialize the list of theta parameters, filling the initial values with a uniform distribution of [0, 2* PI]  \n",
Q
Quleaf 已提交
298 299 300
    "        self.theta = self.create_parameter(shape=shape, \n",
    "                                           default_initializer=paddle.nn.initializer.Uniform(low=0.0, high=2*PI),\n",
    "                                           dtype=dtype, is_bias=False)\n",
Q
Quleaf 已提交
301 302 303 304
    "        \n",
    "    # Define loss function and forward propagation mechanism\n",
    "    def forward(self, N, D):\n",
    "        \n",
Q
Quleaf 已提交
305 306
    "        # Calculate loss function/expected value\n",
    "        loss, cir, fin_state = U_theta(self.theta, molecular_hamiltonian.pauli_str, N, D)\n",
Q
Quleaf 已提交
307
    "\n",
Q
Quleaf 已提交
308
    "        return loss, cir, fin_state"
Q
Quleaf 已提交
309 310 311 312 313 314 315 316 317 318 319 320 321
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### Hyper-parameters\n",
    "\n",
    "Before training the QNN, we also need to set some training hyper-parameters, mainly the learning rate (LR), the number of iterations (ITR), and the depth (D) of repeated blocks. "
   ]
  },
  {
   "cell_type": "code",
Q
Quleaf 已提交
322
   "execution_count": 13,
Q
Quleaf 已提交
323 324
   "metadata": {
    "ExecuteTime": {
Q
Quleaf 已提交
325 326
     "end_time": "2021-04-30T09:14:50.222465Z",
     "start_time": "2021-04-30T09:14:50.187093Z"
Q
Quleaf 已提交
327 328 329 330
    }
   },
   "outputs": [],
   "source": [
Q
Quleaf 已提交
331 332
    "ITR = 80  # Set the number of optimization iterations\n",
    "LR = 0.4   # Set the learning rate\n",
Q
Quleaf 已提交
333 334
    "D = 2      # Set the depth of the repetitive calculation module in QNN\n",
    "N = molecular_hamiltonian.n_qubits # Set number of qubits"
Q
Quleaf 已提交
335 336 337 338 339 340 341 342
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### Training\n",
    "\n",
Q
Quleaf 已提交
343
    "After all the training model parameters are set, we convert the data into Tensor in the Paddle, and then train the quantum neural network. The results of the training process is stored in the summary_data file.\n"
Q
Quleaf 已提交
344 345 346 347
   ]
  },
  {
   "cell_type": "code",
Q
Quleaf 已提交
348
   "execution_count": 14,
Q
Quleaf 已提交
349 350
   "metadata": {
    "ExecuteTime": {
Q
Quleaf 已提交
351 352
     "end_time": "2021-04-30T09:15:52.165788Z",
     "start_time": "2021-04-30T09:15:29.625076Z"
Q
Quleaf 已提交
353 354 355 356 357 358 359
    }
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
Q
Quleaf 已提交
360 361 362 363 364 365 366 367
      "iter: 20 loss: -1.0510\n",
      "iter: 20 Ground state energy: -1.0510 Ha\n",
      "iter: 40 loss: -1.1298\n",
      "iter: 40 Ground state energy: -1.1298 Ha\n",
      "iter: 60 loss: -1.1361\n",
      "iter: 60 Ground state energy: -1.1361 Ha\n",
      "iter: 80 loss: -1.1371\n",
      "iter: 80 Ground state energy: -1.1371 Ha\n",
Q
Quleaf 已提交
368
      "\n",
Q
Quleaf 已提交
369
      "Circuit after training:\n",
Q
Quleaf 已提交
370
      "--Ry(4.710)----*--------------x----Ry(1.569)----*--------------x----Ry(-0.01)--\n",
Q
Quleaf 已提交
371
      "               |              |                 |              |               \n",
Q
Quleaf 已提交
372
      "--Ry(1.507)----x----*---------|----Ry(1.566)----x----*---------|----Ry(4.392)--\n",
Q
Quleaf 已提交
373
      "                    |         |                      |         |               \n",
Q
Quleaf 已提交
374
      "--Ry(5.984)---------x----*----|----Ry(4.476)---------x----*----|----Ry(1.692)--\n",
Q
Quleaf 已提交
375
      "                         |    |                           |    |               \n",
Q
Quleaf 已提交
376
      "--Ry(0.132)--------------x----*----Ry(7.773)--------------x----*----Ry(3.194)--\n",
Q
Quleaf 已提交
377
      "                                                                               \n"
Q
Quleaf 已提交
378 379 380 381
     ]
    }
   ],
   "source": [
Q
Quleaf 已提交
382
    "# Determine the parameter dimensions of the network \n",
Q
Quleaf 已提交
383
    "net = StateNet(shape=[D + 1, N, 1])\n",
Q
Quleaf 已提交
384
    "\n",
Q
Quleaf 已提交
385 386
    "# In general, we use the Adam optimizer to obtain relatively good convergence,\n",
    "# Of course you can change it to SGD or RMS prop.\n",
Q
Quleaf 已提交
387
    "opt = paddle.optimizer.Adam(learning_rate=LR, parameters=net.parameters())\n",
Q
Quleaf 已提交
388
    "\n",
Q
Quleaf 已提交
389 390 391
    "# Record optimization results\n",
    "summary_iter, summary_loss = [], []\n",
    "\n",
Q
Quleaf 已提交
392
    "# Optimize iterations\n",
Q
Quleaf 已提交
393 394
    "for itr in range(1, ITR + 1):\n",
    "\n",
Q
Quleaf 已提交
395 396
    "    # Forward propagation calculates the loss function\n",
    "    loss, cir, fin_state = net(N, D)\n",
Q
Quleaf 已提交
397
    "\n",
Q
Quleaf 已提交
398
    "    # Back propagation minimizes the loss function\n",
Q
Quleaf 已提交
399 400 401
    "    loss.backward()\n",
    "    opt.minimize(loss)\n",
    "    opt.clear_grad()\n",
Q
Quleaf 已提交
402
    "\n",
Q
Quleaf 已提交
403
    "    # Update optimization results\n",
Q
Quleaf 已提交
404 405
    "    summary_loss.append(loss.numpy())\n",
    "    summary_iter.append(itr)\n",
Q
Quleaf 已提交
406
    "\n",
Q
Quleaf 已提交
407
    "    # Print results\n",
Q
Quleaf 已提交
408 409 410 411
    "    if itr % 20 == 0:\n",
    "        print(\"iter:\", itr, \"loss:\", \"%.4f\" % loss.numpy())\n",
    "        print(\"iter:\", itr, \"Ground state energy:\", \"%.4f Ha\" \n",
    "                                            % loss.numpy())\n",
Q
Quleaf 已提交
412
    "    if itr == ITR:\n",
Q
Quleaf 已提交
413
    "        print(\"\\nCircuit after training:\") \n",
Q
Quleaf 已提交
414
    "        print(cir)\n",
Q
Quleaf 已提交
415
    "\n",
Q
Quleaf 已提交
416
    "# Save the training results in the Output folder\n",
Q
Quleaf 已提交
417 418 419
    "os.makedirs(\"output\", exist_ok=True)\n",
    "savez(\"./output/summary_data\", iter = summary_iter, \n",
    "                               energy=summary_loss)"
Q
Quleaf 已提交
420 421 422 423 424 425 426
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### Benchmarking\n",
Q
Quleaf 已提交
427
    "We have now completed the training of the quantum neural network, and the estimated value of the ground state energy obtained is $E_0 \\approx -1.137 $ Hartree, we compare it with the theoretical value $E_0 = -1.1371$ to benchmark our model. The estimation obtained with VQE agree with a full configuration-interaction (FCI) calculation within chemical accuracy $\\varepsilon = 1.6 \\times 10^{-3}$ Hartree.\n",
Q
Quleaf 已提交
428 429 430 431 432
    "\n"
   ]
  },
  {
   "cell_type": "code",
Q
Quleaf 已提交
433
   "execution_count": 15,
Q
Quleaf 已提交
434 435
   "metadata": {
    "ExecuteTime": {
Q
Quleaf 已提交
436 437
     "end_time": "2021-04-30T09:15:18.096944Z",
     "start_time": "2021-04-30T09:15:17.481250Z"
Q
Quleaf 已提交
438 439 440 441 442
    }
   },
   "outputs": [
    {
     "data": {
Q
Quleaf 已提交
443
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAYoAAAEGCAYAAAB7DNKzAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjQuMiwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8rg+JYAAAACXBIWXMAAAsTAAALEwEAmpwYAAAyKUlEQVR4nO3deXxU1fn48c9DQgKEhF1AEBIURAJJIGETQdkUV1ChaLHiglYrKrVa8av9ldbWtda61X2tWLQoAoqCgCiuGJB9VQgSZQ87hkB4fn+cmziEySSQ5c4kz/v1mtfce+fMvU9mJvPMPeeec0RVMcYYY4pTw+8AjDHGhDdLFMYYY0KyRGGMMSYkSxTGGGNCskRhjDEmpGi/AyhvjRs31sTERL/DMMaYiDJ//vxtqtok2GNVLlEkJiaSmZnpdxjGGBNRRGR9cY9Z1ZMxxpiQLFEYY4wJyRKFMcaYkKpcG4Ux1dXBgwfJzs4mNzfX71BMGKtVqxYtW7akZs2apX6OJQpjqojs7Gzi4+NJTExERPwOx4QhVWX79u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d8+HAAdu7cyZ49e+jZsycAv/71r3nvvfcAGDZsGPfeey8PP/wwL730Urn0TrdEUZSN92SqiPvv/2U5OvrI9djYI9fj4o5cT0g4cr1Bg5KPl5ycXPjFD/DUU0+xbds2MjIyAo4TV+J+oqOjOXz4cOF64KRCsbGxhctRUVGFVU/Fufrqq/n222858cQTmTZtGu+//z6ffvopU6dO5e9//ztLliw56jk333wzt912GxdddBFz5sxh3LhxQfd9+PBhvvrqq6MmVAqkqjzxxBOcc845R2yfM2fOUX/LoUOHUFWSk5P58ssvg+6vNK9fnTp1GDhwIJMnT+att94KOb5VaVWJy2PLlY0ga8xx6devH7m5uTz99NOF2/bv319s+d69ezN+/HjAfXE2btyYhIQEEhMTWbBgAQALFixg3bp1IY9bv3596tevXzifRME+AV5++WUWLlzItGnTOHz4MBs2bKBv3748+OCD7Nq1i7179xIfH8+egP/3Xbt20aKF69L16quvFm4vWu7ss8/miSeeKFwPbBcocM455/D0009z8OBBAFavXs2+ffuK/VtOPfVUtm7dWpgoDh48yLJly4L+zfHx8Xz99dcATJgw4YjHR40axS233ELXrl1pUJosXwJLFEXZeE/GHBcR4d133+WTTz4hKSmJbt26MXLkSB58MPjIO+PGjWP+/PmkpKQwduzYwi/lSy+9lJycHJKTk3nyySdLNcT4yy+/zE033URaWlpho3BR+fn5XHHFFXTq1InOnTtzyy23UL9+fS688EImTZpU2Eg9btw4hg0bRnp6Oo0bNy58ftFyjz/+OJmZmaSkpNChQweeeeaZo445atQoOnToQJcuXejYsSO//e1vQ16xFBMTw8SJE7nzzjtJTU0lLS2t2CutXnzxRa677jrS0tLYt28f9erVK3wsPT2dhIQErr766hJfu9KQ4l7USJWRkaGZmZnHv4PcXBg2DEaOhKFDyy8wYyrYihUrOO200/wOw1SSwPaQBx54gI0bN/LYY48B8NNPP3HWWWexcuVKatQ4+nwg2GdFROarasZRhbEziqPFxkLNmlb1ZIwJa++//z5paWl07NiRuXPncs899wDw2muv0b17d/7+978HTRLHwxqzixKx3tnGmL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3IdEWnnjb4ayjzgTBFpLG7q3cuBT44hjj1AfMD6dOBmb6RQRKRzMc+rh5sP46DX1lBwBlB0f4Hm4hIMXpVTK9zfbQxgicJEtkeAwKufnsd9OS/CzU1xPL/2f8B9yX8A3OBVubyAq3ZZ4DUAP0sJv6zVzX42Fjfs8yJgvqoey5DPHwMdChqzgXtxiW+xiCzz1oMZD2SIyBJc28pKL57tuLaVpUUb0YF/AzW857wJXOVV0RkDYKPHGmOMCc3OKIwxxoRkicIYY0xIliiMMcaEZInCGGNMSJYojDHGhGSJwhhjTEiWKIwxxoT0/wFZaZQgViVXjwAAAABJRU5ErkJggg==\n",
Q
Quleaf 已提交
444 445 446 447 448 449 450 451 452 453 454 455 456 457
      "text/plain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "result = numpy.load('./output/summary_data.npz')\n",
    "\n",
    "eig_val, eig_state = numpy.linalg.eig(\n",
Q
Quleaf 已提交
458
    "                     molecular_hamiltonian.construct_h_matrix())\n",
Q
Quleaf 已提交
459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491
    "min_eig_H = numpy.min(eig_val.real)\n",
    "min_loss = numpy.ones([len(result['iter'])]) * min_eig_H\n",
    "\n",
    "plt.figure(1)\n",
    "func1, = plt.plot(result['iter'], result['energy'], \n",
    "                  alpha=0.7, marker='', linestyle=\"-\", color='r')\n",
    "func_min, = plt.plot(result['iter'], min_loss, \n",
    "                  alpha=0.7, marker='', linestyle=\":\", color='b')\n",
    "plt.xlabel('Number of iteration')\n",
    "plt.ylabel('Energy (Ha)')\n",
    "\n",
    "plt.legend(handles=[\n",
    "    func1,\n",
    "    func_min\n",
    "],\n",
    "    labels=[\n",
    "        r'$\\left\\langle {\\psi \\left( {\\theta } \\right)} '\n",
    "        r'\\right|H\\left| {\\psi \\left( {\\theta } \\right)} \\right\\rangle $',\n",
    "        'Ground-state energy',\n",
    "    ], loc='best')\n",
    "\n",
    "#plt.savefig(\"vqe.png\", bbox_inches='tight', dpi=300)\n",
    "plt.show()"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Determining the interatomic distance\n",
    "\n",
    "Recall the above calculation is done with an interatomic distance $d = 74$ pm between two hydrogen atoms. Another interesting aspect we can try with VQE is determining the true interatomic distance by modifying the `h2.xyz` file. The results are summarize in figure below,\n",
    "\n",
Q
Quleaf 已提交
492
    "![vqe-fig-dist](figures/vqe-fig-distance.png)\n",
Q
Quleaf 已提交
493
    "\n",
Q
Quleaf 已提交
494
    "The lowest value is found around $d = 74$ pm (1 pm = $1\\times 10^{-12}$m), which is consistent with the [experimental data](https://cccbdb.nist.gov/exp2x.asp?casno=1333740&charge=0) $d_{exp} (H_2) = 74.14$ pm."
Q
Quleaf 已提交
495 496 497 498 499 500 501 502 503 504
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "_______\n",
    "\n",
    "## References\n",
    "\n",
Q
Quleaf 已提交
505
    "[1] Cao, Yudong, et al. Quantum Chemistry in the Age of Quantum Computing. [Chemical reviews 119.19 (2019): 10856-10915.](https://pubs.acs.org/doi/10.1021/acs.chemrev.8b00803)\n",
Q
Quleaf 已提交
506
    "\n",
Q
Quleaf 已提交
507
    "[2] McArdle, Sam, et al. Quantum computational chemistry. [Reviews of Modern Physics 92.1 (2020): 015003.](https://journals.aps.org/rmp/abstract/10.1103/RevModPhys.92.015003)\n",
Q
Quleaf 已提交
508 509
    "\n",
    "\n",
Q
Quleaf 已提交
510 511 512 513
    "[3] Peruzzo, A. et al. A variational eigenvalue solver on a photonic quantum processor. [Nat. Commun. 5, 4213 (2014).](https://www.nature.com/articles/ncomms5213)\n",
    "\n",
    "[4] Moll, Nikolaj, et al. Quantum optimization using variational algorithms on near-term quantum devices. [Quantum Science and Technology 3.3 (2018): 030503.](https://iopscience.iop.org/article/10.1088/2058-9565/aab822)\n",
    "\n",
Q
Quleaf 已提交
514 515
    "[5] Helgaker, Trygve, Poul Jorgensen, and Jeppe Olsen. Molecular electronic-structure theory. John Wiley & Sons, 2014.\n",
    "\n",
Q
Quleaf 已提交
516
    "[6] Dirac, Paul Adrien Maurice. Quantum mechanics of many-electron systems. [Proceedings of the Royal Society of London. Series A, Containing Papers of a Mathematical and Physical Character 123.792 (1929): 714-733.](https://royalsocietypublishing.org/doi/10.1098/rspa.1929.0094)\n",
Q
Quleaf 已提交
517
    "\n",
Q
Quleaf 已提交
518
    "[7] Szabo, Attila, and Neil S. Ostlund. Modern quantum chemistry: introduction to advanced electronic structure theory. Courier Corporation, 2012."
Q
Quleaf 已提交
519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
Q
Quleaf 已提交
538
   "version": "3.8.10"
Q
Quleaf 已提交
539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555
  },
  "toc": {
   "base_numbering": 1,
   "nav_menu": {},
   "number_sections": true,
   "sideBar": true,
   "skip_h1_title": false,
   "title_cell": "Table of Contents",
   "title_sidebar": "Contents",
   "toc_cell": false,
   "toc_position": {
    "height": "calc(100% - 180px)",
    "left": "10px",
    "top": "150px",
    "width": "426.667px"
   },
   "toc_section_display": true,
Q
Quleaf 已提交
556
   "toc_window_display": false
Q
Quleaf 已提交
557 558 559 560 561
  }
 },
 "nbformat": 4,
 "nbformat_minor": 4
}