refactor: switch to using primitives in qiskit_nature/second_q stack#856
Conversation
|
Note: Neko is expected to fail here, since I bumped the required Terra version to |
a4f50ae to
74c0a4d
Compare
|
@ElePT @manoelmarques could either of you please take a look at updating the 12th tutorial: https://github.com/Qiskit/qiskit-nature/blob/main/docs/tutorials/12_deuteron_binding_energy.ipynb ? |
|
I am also noticing some flaky tests which use the @ElePT do you have any ideas what could be causing those failures? |
74c0a4d to
72ab0c6
Compare
0c5652b to
3fe8008
Compare
|
I realized just now that this was not a draft PR until now, so I cannot mark it as "ready for review"... So instead I'm leaving this comment to do just that 😄 There are two aspects to make note of:
|
Pull Request Test Coverage Report for Build 3196983293
💛 - Coveralls |
| if hasattr(raw_result, "eigenstates"): | ||
| result.eigenstates = [ | ||
| (_statevector_to_circuit(Statevector(state)), None) | ||
| for state in raw_result.eigenstates | ||
| ] |
There was a problem hiding this comment.
As things stands eigenstates comes from the classical Numpy solver so I am wondering why the conversion to a circuit here rather than perhaps giving back a Statevector. Someone wanting a circuit from it can always convert it themselves - is this something we use/want as a circuit?
There was a problem hiding this comment.
The idea was to have a simple and consistent type for EigenstateResult.eigenstates. Namely list[tuple[QuantumCircuit, Sequence[float] | None]] meaning that it is a list of circuits + their optimal parameters (or None if non-parameterized circuit).
If a user needs the eigenstate, they can still obtain it from the EigenstateResult.raw_result object. Handling this consistently here, avoids another isinstance check when using the .eigenstates in other locations 👍
…iskit-community#856) * refactor: switch to using primitives in qiskit_nature/second_q stack * refactor: split excited energy tests into subtests * refactor: align VQE*Factory interface with new VQE * fix: do not rely on optimal_parameters.values() order * fix: update tutorials * Apply changes based on code review
Summary
This refactors the entire
qiskit_nature/second_qstack to use the new Qiskit primitives.Some further changes are required:
VQE(positional estimator, ansatz and optimizer)EigenstateResult.eigenstatesonce Fix VQE result, add ansatz Qiskit/qiskit#8816 is mergedDetails and comments
Closes #849