When running the VQE simulation for $H_2$ over a range of distances as detailed in the Simulating Molecules using VQE section of the Qiskit Textbook, the VQE energy deviation from the exact energy increases with distance as shown in the figure below:
How is this relation($Error \propto distance$) explained and how can it's effects be minimized?
My VQE code is as follows:
distances = np.arange(0.2, 5, 0.5) # for a finer exact_energies plot run with step of 0.1
exact_energies = []
vqe_energies = []
optimizer = SPSA(maxiter=1000)
for dist in distances:
molecule = "H .0 .0 -" + str(dist) + "; H .0 .0 " + str(dist)
driver = PySCFDriver(atom = molecule, unit=UnitsType.ANGSTROM, charge=0, spin=0, basis='sto3g')
qmolecule = driver.run()
num_particles = qmolecule.num_alpha + qmolecule.num_beta
qubitOp = FermionicOperator(h1=qmolecule.one_body_integrals, h2=qmolecule.two_body_integrals).mapping(map_type='parity')
qubitOp = Z2Symmetries.two_qubit_reduction(qubitOp, num_particles)
result = NumPyEigensolver(qubitOp).run()
exact_energies.append(np.real(result.eigenvalues))
var_form = EfficientSU2(qubitOp.num_qubits, entanglement="linear")
vqe = VQE(qubitOp, var_form, optimizer)
vqe_result = np.real(vqe.run(backend)['eigenvalue'])
vqe_energies.append(vqe_result)
I expected the error to be very low as maxiter = 1000
. Also note the backend
is a statevector_simulator
.