You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: documentation/source/general/tutorial/H2.rst
+15-12Lines changed: 15 additions & 12 deletions
Original file line number
Diff line number
Diff line change
@@ -1,10 +1,10 @@
1
1
.. _H2:
2
2
3
3
Simulating the dynamics of the $H_2$ molecule
4
-
===========================================
4
+
=============================================
5
5
6
6
Quantum computing offers a promising avenue for simulating complex molecular systems, potentially revolutionizing fields like drug discovery, materials science, and chemical engineering. At the heart of this capability lies Hamiltonian simulation, a powerful technique that allows us to model the quantum behavior of molecules with exponentially less resources compared to classical computers.
7
-
In this tutorial, we'll explore how to simulate molecules using Hamiltonian simulation techniques implemented in Qrisp. Since version 0.5 Qrisp provides a user-friendly interface for simulating quantum many body systems, making it a suitable tool for tackling complex quantum chemistry problems.
7
+
In this tutorial, we'll explore how to simulate molecules using Hamiltonian simulation techniques implemented in Qrisp. Since version 0.5, Qrisp provides a user-friendly interface for simulating quantum many body systems, making it a suitable tool for tackling complex quantum chemistry problems.
8
8
We'll cover the following key aspects:
9
9
10
10
* :ref:`The fundamentals of Hamiltonian simulation and the second quantization <ham_sim_fundamentals>`
@@ -15,36 +15,37 @@ By the end of this tutorial, you'll have a solid understanding of how to leverag
15
15
Let's dive in and discover how Qrisp can help us unlock the quantum secrets of molecules!
16
16
17
17
.. _ham_sim_fundamentals:
18
+
18
19
The fundamentals of Hamiltonian simulation and the second quantization
To understand what "second quantization" means it might be helpful to start with the **first quantization**. The idea behind this is that physical systems containing only a single particale are described by a Hilbert space $\mathcal{H}$, which consits of a set of basis-vectors:
23
+
To understand what "second quantization" means it might be helpful to start with the **first quantization**. The idea behind this is that physical systems containing only a single particale are described by a Hilbert space $\mathcal{H}$, which consits of a set of basisvectors:
23
24
24
25
.. math::
25
-
\mathcal{H} = \text{span}(\ket{\psi_i} | i \in\mathcal{N})
26
+
\mathcal{H} = \text{span}(\ket{\psi_i} \mid i \in\mathcal{N})
26
27
27
28
An arbitrary state $\ket{\phi}$ can therefore be represented by a linear combination of these basis vectors:
What these particular $\ket{\psi_i}$ represent depends on the system. For instance for the hydrogen atom these basis vectors represent the `atomic orbitals <https://en.wikipedia.org/wiki/Atomic_orbital>`_. If you participated in a course for atomic physics before, you might have seen pictures like this:
35
+
What these particular $\ket{\psi_i}$ represent depends on the system. For instance for the Hydrogen atom these basis vectors represent the `atomic orbitals <https://en.wikipedia.org/wiki/Atomic_orbital>`_. If you participated in a course for atomic physics before, you might have seen pictures like this:
35
36
36
37
.. image:: ./hydrogen_with_axes.png
37
38
:width:400px
38
39
:align:center
39
40
40
41
This plot represents the real part of the amplitude of one of the basis vectors (the one with $n = 4, k = 3, l = 1$ to be precise).
41
42
42
-
The **second quantization** now describes how systems including *multiple particles* are treated. For this the so called ladder-operators are introduced, that is for each basis state $\ket{\psi_i}$ there is an operator $a_i^\dagger$, which creates a particle in state $\ket{\psi_i}$. A creative notation for this might be:
43
+
The **second quantization** now describes how systems including *multiple particles* are treated. For this the so called ladderoperators are introduced, that is, for each basis state $\ket{\psi_i}$ there is an operator $a_i^\dagger$, which creates a particle in state $\ket{\psi_i}$. A creative notation for this might be:
43
44
44
45
.. math::
45
46
a_i^\dagger\ket{\phi} = \ket{\phi\text{ + a particle in state i}}
46
47
47
-
For this reason this operator is called "creator". Similarly there is also the "annihilator" $a_i$, which destroys the particle.
48
+
For this reason, this operator is called the "creator". Similarly there is also the "annihilator" $a_i$, which destroys the particle.
48
49
49
50
The ladder operators therefore determine the intrinsic interaction behavior of the particles. Observations from experiments show that there are two types of particles whose ladder operators follow different sets of laws.
50
51
@@ -89,7 +90,7 @@ To apply the Pauli exclusion principle but also other anti-commutation laws for
89
90
The Jordan-Wigner embedding
90
91
^^^^^^^^^^^^^^^^^^^^^^^^^^^
91
92
92
-
A natural question that comes up is how to represent the ladder operators and the corresponding states on the quantum computer. The most established way to do this is to use the `Jordan-Wigner embedding <https://en.wikipedia.org/wiki/Jordan%E2%80%93Wigner_transformation>`_ (even though there are several `interesting alternatives <https://arxiv.org/abs/2212.09731>`_). The Jordan-Wigner embedding identifies each ladder term with an operator that acts on a qubit space:
93
+
A natural question that comes up is how to represent the ladder operators and the corresponding states on a quantum computer. The most established way to do this is to use the `Jordan-Wigner embedding <https://en.wikipedia.org/wiki/Jordan%E2%80%93Wigner_transformation>`_ (even though there are several `interesting alternatives <https://arxiv.org/abs/2212.09731>`_). The Jordan-Wigner embedding identifies each ladder term with an operator that acts on a qubit space:
93
94
94
95
.. math::
95
96
a_k = A_k \prod_{i = 0}^{k-1} Z_i
@@ -103,7 +104,7 @@ Where $A_k = \ket{0}\bra{1}$ and $Z_i$ are the Pauli-Z Operators. Feel free to v
103
104
print(O_qubit)
104
105
# Yields: Z_0*Z_1*Z_2*Z_3*A_4
105
106
106
-
This gives us an instance of the :ref:`QubitOperator` class. What is the difference to a :ref:`FermionicOperator`? While FermionicOperators model the more abstract fermion space, qubit operators represent operators on the qubit space $(\mathbb{C}^2)^{\otimes n}$ and can be simulated and evaluated efficiently using a quantum computer. In particular, QubitOperators can represent tensor products of the following operators $X,Y,Z,A,C,P^0,P^1,I$. Make sure to read the :ref:`docstring<QubitOperator>` to learn about their definition!
107
+
This gives us an instance of the :ref:`QubitOperator` class. What is the difference to a :ref:`FermionicOperator`? While FermionicOperators model the more abstract fermion space, qubit operators represent operators on the qubit space $(\mathbb{C}^2)^{\otimes n}$ and can be simulated and evaluated efficiently using a quantum computer. In particular, QubitOperators can represent tensor products of the following operators $X,Y,Z,A,C,P^0,P^1,I$. Make sure to read the :ref:`documentation<QubitOperator>` to learn about their definition!
107
108
108
109
Dynamics
109
110
^^^^^^^^
@@ -129,6 +130,7 @@ The particular values of the coefficients (like $h_{01}$ and $h_{00}$) are deter
129
130
130
131
131
132
.. _molecular_data_tut:
133
+
132
134
Loading molecular data into Qrisp
133
135
=================================
134
136
@@ -171,6 +173,7 @@ Or if preferred, the Jordan-Wigner embedding:
This concludes our little tutorial on Hamiltonian simulation. We hope you could learn something and possibly feel motivated to explore more systems and techniques! Make sure to also check out the :ref:`MolecularPotentialEnergyCurve` example to learn how to compute the ground state for both types of operators!
232
+
This concludes our little tutorial on Hamiltonian simulation. We hope you could learn something and feel motivated to explore more systems and techniques! Make sure to also check out the :ref:`MolecularPotentialEnergyCurve` example to learn how to compute the ground state for both types of operators!
where $E_{\text{elec}}(\{R_A\})$ is the electronic energy and $E_{\text{nuc}}(\{R_A\})$ is the nuclear repulsion energy depending on the coordinates of the atoms $\{R_A\}$.
13
+
where $E_{\text{elec}}(\{R_A\})$ is the electronic energy and $E_{\text{nuc}}(\{R_A\})$ is the nuclear repulsion energy depending on the coordinates of the nuclei $\{R_A\}$.
14
14
15
15
16
16
Example Hydrogen
17
17
================
18
18
19
-
We caluclate the potential energy curve for the Hydrogen molecule for varying interatomic distance of the atoms.
20
-
19
+
We caluclate the potential energy curve for the Hydrogen molecule for varying interatomic distance.
21
20
22
21
We implement a function ``problem_data`` that sets up a molecule and
23
22
utilizes the `PySCF <https://pyscf.org>`_ quantum chemistry library to compute the :meth:`electronic data <qrisp.vqe.problems.electronic_structure.electronic_structure_problem>` (one- and two-electron integrals, number of orbitals, number of electrons, nuclear repulsion energy, Hartree-Fock energy)
24
-
for a given molecular geometry. In this example, we vary the **atomic distance**between the two Hydrogen atoms.
23
+
for a given molecular geometry. In this example, we vary the **interatomic distance**, i.e., the distance between the two Hydrogen nuclei.
25
24
26
25
::
27
26
@@ -35,7 +34,7 @@ for a given molecular geometry. In this example, we vary the **atomic distance**
35
34
basis = 'sto-3g')
36
35
return electronic_data(mol)
37
36
38
-
Next, we define an array of atomic ``distances``. For each distance ``r`` we compute the electronic ``data`` including the Hartree-Fock energy.
37
+
Next, we define an array of interatomic ``distances``. For each distance ``r`` we compute the electronic ``data`` including the Hartree-Fock energy.
39
38
Then we utilize the :meth:`electronic_structure_problem <qrisp.vqe.problems.electronic_structure.electronic_structure_problem>` method to create a :ref:`VQEProblem` for the given electronic ``data``. By default, the ``QCCSD`` ansatz is utilized.
40
39
41
40
VQE is a probabilistic algorithm and may not yield the optimal solution every time.
@@ -66,8 +65,8 @@ Finally, we visualize the results.
@@ -82,10 +81,10 @@ Finally, we visualize the results.
82
81
Example Beryllium hydride
83
82
=========================
84
83
85
-
We caluclate the potential energy curve for the Beryllium hydride molecule for varying interatomic distance of the atoms.
84
+
We caluclate the potential energy curve for the Beryllium hydride molecule for varying interatomic distance.
86
85
87
86
As in the previous example, we set up a function that computes the :meth:`electronic data <qrisp.vqe.problems.electronic_structure.electronic_structure_problem>` for
88
-
the Beryllium hydride molecule for varying **atomic distance**between the Beryllium and Hydrogen atoms.
87
+
the Beryllium hydride molecule for varying **interatomic distance**, i.e., the distance between the Beryllium and Hydrogen nuclei.
89
88
90
89
::
91
90
@@ -148,8 +147,8 @@ Finally, we visualize the results.
0 commit comments