VQE for more complex molecules or systems

Hello everyone. So I just tried the Pennylane’s demo on the introduction of VQE (A brief overview of VQE | PennyLane Demos). I was wondering, how do I do this for more complex molecules, especially when defining the trial functions. Like, how to know about how many qubits do I need and what operations do I need to make a trial function for a certain molecule?

Thank you for your attention.

Hi @verstrikt,
The number of qubits is given by the molecular Hamiltonian. The following line shows you how you can get them.

H, qubits = qml.qchem.molecular_hamiltonian(symbols, coordinates)

In that demo take a look at the green note at the end of the Building the electronic Hamiltonian section. There you can learn how to use PennyLane Datasets to obtain various attributes for different molecules. Learn more about using Datasets on this blog post.

I hope this helps!

1 Like

Think @verstrikt’s question relates to my question here too https://discuss.pennylane.ai/t/setting-the-active-orbitals-or-electrons-in-a-reaction

1 Like

Hi @mchau,

I think the questions are different.

@verstrikt actually our demo on resource estimation might be exactly what you were looking for. Here we show how many qubits would be needed for simulating certain materials, including very complicated ones such as dilithium iron silicate Li_2FeSiO_4.

@mchau check out the demo in case it helps you too!

1 Like

Thank you for the answers. i apologize for my late response.