Finding the Ground State Energy of Lithium Hydride using a VQE

Variational Quantum Eigensolver — Quantum Chemistry

Aayush Grover
The Innostation Publication
7 min readApr 18, 2022


One of quantum computing’s BIGGEST applications is within the science of chemistry. Quantum chemistry is a subsection of physical chemistry that utilizes the rules and laws of quantum mechanics.

Chemical simulations through the use of quantum systems hold an immense amount of power and plausibility, largely due to the ability of quantum systems to surpass various classical computational challenges.

Quantum chemistry is used for various applications such as predicting the physical and chemical properties of molecules, discovering new drugs, and finding the ground state energy of an atom, molecule, or ion.

In this article, we’re focusing on that last one. If that’s gibberish to you, don’t worry about it, we’ll explain it soon. The end goal is to be able to find the ground state energy of LiH (lithium hydride) using a Variational Quantum Eigensolver (VQE).

Note that if you don’t know anything about Quantum Computing, or the Mathematics Behind Quantum Computing, check out my article on it here.

The Variational Quantum Eigensolver

Quantum computing currently isn’t at the place it needs to be for a lot of its chemistry-related applications. To counteract this, quantum computing engineers have developed various algorithms that incorporate both classical computing, and quantum computing.

One of the most famous examples of this within the field of Quantum Machine Learning (QML) is the Variational Quantum Eigensolver. This algorithm holds applications in vastly different fields like finance and chemistry.

The point of a variational quantum eigensolver is to find the lowest possible eigenvalue of a given hermitian matrix. If you haven’t learned linear algebra yet, that might be pretty difficult to understand.

For now, here’s all you need to know:

  • a matrix is almost like a multi-dimensional array of numbers with some cool mathematical properties.
  • a hermitian matrix is a matrix with a special kind of property that is equal to its conjugate transpose (don’t worry about what that means).
  • an eigenvalue is…. well… the scaling factor for an eigenvector after a linear transformation for that vector… but all you need to know is that its an important number that we need in different applications
  • a hamiltonian is a matrix that represents the energy of the electrons within a molecule

In its chemical applications, we’re taking a Hamiltonian matrix and finding its lowest eigenvalue. This results in the ground state energy of our molecule.

If you want to learn more about eigenvalues, check out the following video:

Why is this important?

The ground state energy of a molecule is the lowest possible energy state that a molecule can be in.

It’s one of the most important properties of a molecule and provides crucial information on the electron configuration of a molecule.

Once we can understand a molecule's electron configuration, we can actually simulate the molecule!

Backtracking — Why Quantum ML?

Before continuing into the theory behind the variational quantum eigensolver, let’s briefly discuss why we’re actually using quantum machine learning in the first place.

The problem of finding the ground state energy for a molecule has actually been solved through the use of Quantum Phase Estimation (QPE).

Circuit for Quantum Phase Estimation

Quantum phase estimation allows us to find the eigenstates (quantum states for eigenvalues and eigenvectors) of a simulated Hamiltonian, ultimately resulting in the ground state energy of a molecule for chemistry applications.

That being said, this algorithm requires a fully coherent quantum computer, something we simply don’t have right now. That’s the issue with a lot of quantum applications. Unfortunately, there’s just too much noise in current quantum computers for these applications to hold vast impacts.

Instead, we utilize quantum machine learning and hybrid algorithms to counteract the lack of a 100% coherent quantum computer. The QPE is 100% quantum, while the VQE has quantum and classical elements to it.

We incorporate quantum phases to utilize quantum properties within our algorithms. We then use classical gradient descent for the optimization of certain values, such as the eigenvalue of a Hamiltonian in this case.

Back on Track — The Theory Behind the VQE

Let’s split our theory into two different sections: quantum and classical. The nature of the variational quantum eigensolver is that it's a hybrid algorithm.

The word variational refers to its classical machine learning component while the word quantum refers to… well… its quantum component.

Process — Step by Step

  • Map a molecules Hamiltonian onto a qubit Hamiltonian — represent our molecule in mathematics
  • Create an ansatz — a mathematical guess for our ground state energy (our pre-optimization starting point)
  • Calculate the energy of our trial wavefunction from our ansatz
  • Optimize this through classical machine learning to find the ground state energy

This definitely might seem pretty overwhelming at first. Don’t worry about it too much, you’ll start to see the full picture soon enough.

1. Mapping our Hamiltonian of the molecule onto our qubit Hamiltonian

What we’re essentially doing here is taking the Hamiltonian of our molecule and mapping that onto our qubit. This allows us to perform calculations with the electron orbital interactions of a molecule through the use of our qubit.

It’s important to note that the number of qubits required is directly linked to the number of orbitals in our molecule.

If you go back to High School chemistry class, you’ll remember that orbitals or shells of a molecule store electrons. The more electrons you have, the more orbitals are required. The first orbital holds 2 electrons, the second 8 electrons, the third 8 electrons, etc.

The largest molecule that has been simulated using the variational quantum eigensolver is BeH2 (beryllium hydride).

2. Creating our Initial Guess — Ansatz

Our ansatz is essentially our starting point guess for our ground state energy. It's our trial wavefunction for which we will calculate the energy, and optimize to find the ground state energy.

The ansatz in this scenario is essentially a guess at the electron configuration for the specific molecule, depending on the interatomic distance between the individual atoms within the molecule.

Note that since our algorithm is a quantum machine learning algorithm, it won’t necessarily be able to find the exact ground state energy of our molecule. However, it’s going to be able to provide us with an incredibly accurate and optimized estimate.

3. Energy Calculations from Trial Wavefunction

From here, we take our trial wavefunction and calculate its energy. This way, we can work towards the optimization of the eigenvalue to find the ground state energy of our molecule.

Remember that the better our initial mathematical guess was, the easier it will be to find an accurate ground state energy, and the better our output will be.

4. Implementation of Classical Optimization

Lastly, we can implement classical optimization algorithms from the field of Machine Learning (ML).

In this situation, since we’re dealing with optimization, we actually use gradient descent.

Think of gradient descent as taking a ball anywhere on a hill and slowly rolling it down till it reaches a minimum within the hill. Eventually, we’re going to find a global minimum.

The goal of our variational quantum eigensolver is to eventually find the lowest eigenvalue of our Hamiltonian.

We can use gradient descent to create new parameters within our quantum loop to improve upon our ansatz (initial guess). We iterate upon this multiple times until we arrive at the ground state energy for our molecule.

Bond Lengths and Interatomic Distance for Molecule’s Ground State Energy

When two molecules are bonded, they have a certain bond length, referring to the distance between the centers of the two bonded atoms.

What we’re actually doing with the VQE is finding the ground state energy of our molecule with its associated bond length.

From Theory to Application

Now that we understand theoretically how to create a variational quantum eigensolver, it’s time to apply it… sort of…

Within this article, we’ve got a pretty good intuitive understanding of what the variational quantum eigensolver is, as well as how we can apply it to find the ground state energy and associated interatomic distance of a molecule.

That being said, coding it out requires a strong understanding of linear algebra, state vectors, quantum operations, and various other concepts within the field of quantum mechanics.

If you’d like to take a mathematical approach to understand quantum computing, check out this article.

If you want to check out the code for a variational quantum eigensolver to find the ground state energy of a LiH (lithium hydride) molecule, check out this project Github repository.

If you liked this article, please check out my other articles here, or check out my article on Quantum Teleportation here.

Feel free to check out my other socials: LinkedIn, Twitter

Consider subscribing to my newsletter here! I talk a lot about my progress, experiences, and my struggles. My March issue just came out where I talk about my difficulties regarding dealing with the loss of a loved one.



Aayush Grover
The Innostation Publication

Leveraging Artificial Intelligence and Blockchain technologies to propel societal transformation this decade.