What kind of molecule can be simulated?

Hello to you all!

I am a physics student and I’m currently working on a Quantum Chemistry with PennyLane and Quantum Machine Learning project.
The idea would be to study the key concepts and try simulating a physical system (i.e a molecule) with PennyLane (which I learned the basics of).
I’ve been working with PennyLane online pages and demos. So far I’ve been dealing with quite simple molecules (H2, H3, H20, etc…) and I would like to simulate a molecule of my own and so I wanted to know what could I aim for ? For instance is CH4 too easy or a benzene molecule too complicated ?

Thank you for your response!

Hi @Mohamed_SO,

Thank you for your question and welcome to the Forum!

I would say a Benzene molecule would be too complicated. Even CH4 may take a very long time. You could try some of the molecules that we have in our new quantum datasets. Here you can see how many qubits you would need so it gives you an idea of the magnitude of the problem.

Please let me know if this helps!

1 Like

Hi @CatalinaAlbornoz!

I actually tried with CH4 and using some tricks I managed to do some simulations (I’ll be asking other questions on the forume soon!).

To see whether or not they’re yielding the good result (namely the ground state energy), would you have a quantum chemistry/theoretical chemistry dataset to recommand?

Thank you!

Hi @Mohamed_SO, You can create a sparse matrix representation of the Hamiltonian and compute the eigenvalues with qml.eigvals(). Here is a code example for the hydrogen molecule:

import pennylane as qml
from pennylane import numpy as np

symbols = ["H", "H"]
geometry = np.array([[0.0, 0.0,  0.69440367], [0.0, 0.0, -0.69440367]]) 

H, qubits = qml.qchem.molecular_hamiltonian(symbols, geometry)
Hs = qml.SparseHamiltonian(qml.utils.sparse_hamiltonian(H), wires=range(qubits))

qml.eigvals(Hs, k=5) # k (int): The number of eigenvalues to be returned for a SparseHamiltonian.
1 Like

Thank you for your response!

Although, if qml.eigvals() were to directly give the eigenvalues - meaning including the ground state energy - how would VQE still be relevant for finding the ground state of a molecule ?

Hi @Mohamed_SO. For a SparseHamiltonian object, the eigvals function computes the eigenvalues by diagonalizing the sparse matrix representation of the Hamiltonian with scipy.sparse.linalg.eigsh which returns k eigenvalues. The diagonalization is expensive and becomes intractable for larger molecules and basis sets, for which running VQE on a quantum hardware device can provide the ground state energy. Please see the documentation of SparseHamiltonian and eigvals for more details and let us know if you have further questions.

OK I understand.
But in this case, where can I find some ground state energy reference given with classical simulation in order to see whether or not my simulation is working ?

You can use the results you get with qml.eigvals as a reference to verify your VQE ground state energy. You can also find molecular ground state energies for a wide range of molecules and basis sets here.

2 Likes

Great! Thank very much!