I am running a VQE over the H2 molecule on ibmq_quito and I set a callback function to save all jobs id's of all iterations. When I check the penultimate job (and the previous ones), I have 2 circuits or experiments (one for Z basis and one for X basis). But when I check the last job, I just obtain one circuit. Does anyone know why on the last job of the VQE I have one circuit while I still have to measure in different basis to get the expectation value of the energy? Thank you very much in advance!
1 Answer
$\begingroup$
$\endgroup$
2
This is because the last job is to extract the eigenstate. If you check the circuit, then you should see that it is just being measure in the Z basis. This circuit will give back the user the counts of the states that the Ansatz generated.
-
$\begingroup$ First, thank you very much for your reply. But I still don't understand how does it measure then the expectation value with just one circuit in the Z basis if I have terms of my Hamiltonian expressed in the X basis? Does it use the counts of the penultimate job? $\endgroup$– bjail66Commented Jul 13, 2021 at 12:14
-
$\begingroup$ @SilviaRiera The last circuit does not measure the expectation. Its job is to determine the eigenstate correspond to the eigenvalue that you found through optimization. So it execute the circuit with the found optimal parameters, then measure in the Z basis, then just count the states. If you check your vqe result, you see there are many different return values, one of them is the eigenstate. This circuit is design to extract that returned value. $\endgroup$– KAJ226Commented Jul 13, 2021 at 14:42