Closed cpossel closed 3 years ago
I moved it to Nature - you may be right that the fix may come down to logic that is in Terra, but I think Nature is the 'right' place to have this for now as things are investigated
Okay. Then the whole version info might be useful instead of only the Terra version:
Qiskit Software | Version -- | -- Qiskit | 0.27.0 Terra | 0.17.4 Aer | 0.8.2 Ignis | 0.6.0 Aqua | 0.9.2 IBM Q Provider | 0.14.0 Python | 3.8.10 \| packaged by conda-forge \| (default, May 11 2021, 06:25:23) [MSC v.1916 64 bit (AMD64)] OS | Windows Qiskit Nature | 0.1.3The fact that this is an IndexError
when accessing label[0]
seems to suggest that the length of label
is 0 which would mean that the number of qubits is 0. This sounds correct when simulating a single He
atom in combination with two_qubit_reduction=True
. We can add a check to the QubitConverter
to skip this reduction when there are 2 or fewer qubits to begin with.
However, I don't think simulating e.g. Ne
should cause this. Could you double check that please?
I rechecked it and you're completely right. Ne
works fine.
In the other cases (H
, H-
, He
) the error still persists.
I tested to switch to two_qubit_reduction=False
and then also H
, H-
, and He
worked fine in agreement with your explanation.
I think the check you proposed (or even only a warning message) would be helpful for all those who start with such small examples and try out the possible options without (yet) understanding all of them in detail.
Information
What is the current behavior?
Script terminates with
IndexError
when converting aElectronicStructureProblem
to a qubit operator usingconvert
method from aQubitConverter
object. Here is the whole traceback:Steps to reproduce the problem
Run the example file in the README.md from https://github.com/Qiskit/qiskit-nature, but use a single helium atom (He) instead of H2.
In my case I slightly adjusted the example (switch to PSI4), so here's the script I used:
The commented molecule H2 works perfectly fine, but some other molecules (He, H, H-, Ne) throw the mentioned error.
What is the expected behavior?
Convert the
ElectronicStructureProblem
to a qubit operator without error. In case of the example script, finally print the ground state energy.Suggested solutions
Actually I have no idea, where exactly the problem comes from. It might even be a bug in earlier parts that propagate till
pauli_table.py
, and thus might belong to the qiskit-nature package. Though I don't have enough insight to figure that out. Any help and suggestions would be appreciated!