Este vídeo pertenece al curso Quantum Computing for Natural Sciences (with IBM Quantum) de openHPI. ¿Quiere ver más?
An error occurred while loading the video player, or it takes a long time to initialize. You can try clearing your browser cache. Please try again later and contact the helpdesk if the problem persists.
Scroll to current position
- 00:00Hello and welcome back to the course on quantum computing for Natural Sciences.
- 00:05In the last lecture, you have seen two quantum algorithms, the quantum phase estimation and the variational quantum Eigen
- 00:11solver to solve for the ground state of the time independent Schrödinger equation.
- 00:16In the context of quantum chemistry.
- 00:19Today, you are going to see how we implement the version of quantum Eigensolver with the software package Qiskit developed
- 00:27by I B M.
- 00:30In the following, you are going to see how to how to code to implement each part of the VQE algorithm, which means how
- 00:39to map the molecule to the qubit Hamiltonian, how to define the Ansatz and how to define the optimization routine.
- 00:47And finally how to set and run the VQE algorithm.
- 00:52As the first step we collect information about our molecule of interest.
- 00:57In our case, it's the lithium hydride molecule the lithium and the hydrogen atom set 1.3 angstrom apart in the Qiskit code
- 01:07we can use the PySCFDriver giving it the information about the molecule and the basis within which we want to work
- 01:15In our case, it is this sto3g basis.
- 01:20In the next step, we then define the Hamiltonian in its second quantized formulation.
- 01:27For this, we run the driver to get the electronic structure problem from the electronic structure problem
- 01:34We can then extract this Hamiltonian in its second quantization formulation.
- 01:40In the next step, we then map to Hamiltonian to the corresponding qubit Hamiltonian.
- 01:47For this, we are using the parity mapper, it uses the number of particles which means the number of electrons as an argument
- 01:55Then we can apply the parity mapper to the Hamiltonian extracted in the previous step.
- 02:04Having the qubit Hamiltonian ready.
- 02:06We can now go to the next step and define the parameterized Ansatz.
- 02:11The parameterized Ansatz consists of two parts first, the fixed initial state, for which we use the Hartree-Fock state.
- 02:19And the second part, the parameterized circuit for which we use the unitary couple cluster with single and double excitations
- 02:28That was introduced in the previous lecture.
- 02:31Both of them need the number of spatial orbitals, which is the number of orbitals on which the problem is defined.
- 02:38And the number of particles as an input argument.
- 02:41Additionally, they also need to know about the mapper in order to correctly map the initial state and the excitations in the
- 02:49UCCSD Ansatz to the corresponding circuits.
- 02:55The last part is to initialize the optimization routine.
- 02:59In our case, we are using the COBYLA optimizer with a maximum number of iterations set to 2500.
- 03:07This is ensures that after 2500 iterations and the optimizer still has not converged, it still stops.
- 03:18Then we can finally set up the VQE algorithm.
- 03:22First, we set up the environment in which the VQE is executed.
- 03:27Since we are executing the VQE locally, we can straightforwardly do this by calling the Qiskit run time primitive estimator
- 03:36If you would like to execute the VQE algorithm on real hardware, we would have to specify this at this point, then we can
- 03:44set up the VQE solver by passing the estimator the parameterized Ansatz and the optimizer to the VQE class,
- 03:53then we can call the function compute minimum eigenvalue giving us argument to qubit Hamiltonian which starts the VQE
- 04:02optimization.
- 04:04After the optimization has converged or reached a number of maximal iterations, it returns a minimum a minimum eigensolver
- 04:15result.
- 04:17This result can then be transformed into an electronic structure result by passing the result to the interpret function of
- 04:26the problem.
- 04:28The final VQE energy can then be extracted from the results by calling the total energies variable
- 04:37on the left
- 04:38You can see the results that were obtained by the presented code.
- 04:43The VQE energe is -7.7 Ha which is very close to the exact energy which for such a small problem
- 04:54can be obtained by exactly diagnosing the Hamiltonian
- 04:59below
- 04:59You can also see a prototypical energy evolution.
- 05:03During the VQE optimization, we start at a higher energy.
- 05:08And after initial exploration phase in the parameter space, we converge to the exact ground state energy.
- 05:18The only difference between the code that is used to create these results
- 05:24And the present code is that we used, we mapped the problem to a smaller problem size using active space transformation.
- 05:35This is something you are going to learn about in the next lecture to present the code and the steps necessary to reproduce
- 05:42the results are going to be available in the additional resources of the course.
- 05:50This code and additional code examples can also be found in the tutorials of Qiskit.
To enable the transcript, please select a language in the video player settings menu.