I am using the Qiskit Aer estimator in order to evaluate the ground state of molecules via qiskit nature on local simulators using vqe, with and without noise model. My results are completely off. To illustrate the problem, let me add here the corresponding code snippet
from qiskit_nature.units import DistanceUnit
from qiskit_nature.second_q.drivers import PySCFDriver
driver = PySCFDriver(atom="H 0 0 0; H 0 0 0.735", basis="sto-3g")
es_problem = driver.run()
from qiskit_nature.second_q.mappers import JordanWignerMapper, QubitConverter
converter = QubitConverter(JordanWignerMapper())
from qiskit.algorithms.optimizers import SLSQP
from qiskit_nature.second_q.algorithms import VQEUCCFactory
from qiskit_nature.second_q.circuit.library import UCCSD
from qiskit_nature.second_q.algorithms import GroundStateEigensolver
If I take the standard Estimator from qiskit everything goes as expected
from qiskit.primitives import Estimator
vqe_solver = VQEUCCFactory(Estimator(), UCCSD(), SLSQP())
calc = GroundStateEigensolver(converter, vqe_solver)
res = calc.solve(es_problem)
print(res)
And here is the result I get
=== GROUND STATE ENERGY ===
* Electronic ground state energy (Hartree): -1.857275030145
- computed part: -1.857275030145
~ Nuclear repulsion energy (Hartree): 0.719968994449
> Total ground state energy (Hartree): -1.137306035696
=== MEASURED OBSERVABLES ===
0: # Particles: 2.000 S: 0.000 S^2: 0.000 M: 0.000
=== DIPOLE MOMENTS ===
~ Nuclear dipole moment (a.u.): [0.0 0.0 1.3889487]
0:
* Electronic dipole moment (a.u.): [0.0 0.0 1.38894893]
- computed part: [0.0 0.0 1.38894893]
> Dipole moment (a.u.): [0.0 0.0 -0.00000023] Total: 0.00000023
(debye): [0.0 0.0 -0.00000058] Total: 0.00000058
If I use the Aer estimator for a noiseless simulation
from qiskit_aer.primitives import Estimator as AerEstimator
seed=170
noiseless_estimator = AerEstimator(
run_options={"seed": seed, "shots": 1024},
transpile_options={"seed_transpiler": seed},
)
vqe_solver2=VQEUCCFactory(noiseless_estimator, UCCSD(), SLSQP())
calc2 = GroundStateEigensolver(converter, vqe_solver2)
res2 =calc2.solve(es_problem)
print(res2)
These are the output numbers I get. They are really different.
=== GROUND STATE ENERGY ===
* Electronic ground state energy (Hartree): -0.761369413072
- computed part: -0.761369413072
~ Nuclear repulsion energy (Hartree): 0.719968994449
> Total ground state energy (Hartree): -0.041400418623
=== MEASURED OBSERVABLES ===
0: # Particles: 2.006 S: 0.446 S^2: 0.645 M: 0.009
=== DIPOLE MOMENTS ===
~ Nuclear dipole moment (a.u.): [0.0 0.0 1.3889487]
0:
* Electronic dipole moment (a.u.): [0.0 0.0 1.38395701]
- computed part: [0.0 0.0 1.38395701]
> Dipole moment (a.u.): [0.0 0.0 0.00499169] Total: 0.00499169
(debye): [0.0 0.0 0.0126876] Total: 0.0126876
I tried to use qiskit aer Estimator primitives in different environments and setups and on the IBM Quantum Lab as well to be reasonably sure that the problem does not depend from the installation. The output I get is the same.
I expect that without noise qiskit aer Estimator provides the same results as the default Estimator, and if there are differences in the Total ground state energy value, they are below 0.01 Hartree.
How can I fix this? Am I doing anything wrong in Aer Estimator usage? Thank you in advance.