qiskit-nature
qiskit-nature copied to clipboard
QEOM energies differ for Statevector and Qasm simulator
Information
- Qiskit Aqua version: 0.8.1
- Python version: 3.6.8
- Operating system: Ubuntu
What is the current behavior?
For H2 molecule QEOM excited state energies differ running with Statevector and Qasm simulators.
Steps to reproduce the problem
Please, run the gist
What is the expected behavior?
Close excited state energies
Suggested solutions
Seems like the problem is somewhere in eval() method, but I'm not sure about that.
How about using Aer for statevector simulator instead of BasicAer?
@ikkoham Hello! Aer for statevector simulator provides the same results as BasicAer and they are equal to exact diagonalization results. But still there is some problem with qasm.
Qasm by default performs measurements, so you obtain statistical errors. This is its default behavior, because users often use it to mimic a real device. If you want exact diagonalization, try setting the parameter initial_custom
to True
.
Hello @yaelbh!
I use include_custom = True
with qasm simulator.
Still excited state energies deviate greatly.
And also there is some obvious error in matrix element calculations.
Hello @paulineollitrault ! Could you please provide any insights on how to deal with this inconsistence in qasm results?
Hi @MariaSapova! A fix is pending (see above), waiting to be merged
@paulineollitrault as far as I can see this commit fixes the normalization of the matrix elements, but what about differences in q_0_0, q_1_1, q_2_2 values? I guess the energies differ because of these matrix elements.
@paulineollitrault Do you have any response to the last comment above that despite the normalization fix being merged there are still differences? If this is still an issue I will transfer this to the new repo to be fixed there/
@woodsp-ibm @paulineollitrault Hello! I actually already opened another issue which is more general Qiskit/qiskit-aqua#1510. I found out that evaluate_operators() in GroundStateEigensolvers produces incorrect expectation values when using qasm. With rewriting expectation value evaluation I could overcome this issue and got correct matricees in QEOM.
I investigated this bug together with @Cryoris again today but we have not been able to track down the exact cause of it yet.. We opened a PR to fix a sub-issue of this but I am afraid a fix for this issue will not make it into the upcoming release. I will revisit this again in more detail later.
This issue seems to have been solved as a side effect of the new Qiskit release.
The problematic methods for this issue (eval_op()
and evaluate_operators()
) have been deprecated and replaced.
The new behaviour of the QEOM calculation does not show this difference between the noisy and state vector "backend" (this has also been replaced): see this gist
Thank you, Anthony! :+1: