BKSF mapper fails to map H2 operator from driver
See original GitHub issueEnvironment
- Qiskit Nature version:
main
branch (did not try release) - Python version: 3.6
- Operating system: Linux
What is happening?
In #432 I was asked had I tried with BKSF as I had added Parity and BK mappers into the test_excited_states_solvers.py test case when fixing the referenced issue and observing issues around two qubit reduction and symmetries. I did not try BKSF, you can see my comment in the referenced PR, but in trying it fails in the ground state computation. Now the bksf test file includes an pre-defined operator that is commented as H2 - in this case its built from the driver and here it fails with the following exception.
<snip>
line 480, in _add_edges_for_term
_type = _interaction_type(n_number, n_raise, n_lower)
File "...qiskit_nature/mappers/second_quantization/bksf.py", line 421, in _interaction_type
raise ValueError("unexpected number of number operators: ", n_number)
ValueError: ('unexpected number of number operators: ', 0)
How can we reproduce the issue?
Based on the
from qiskit import BasicAer
from qiskit.utils import algorithm_globals, QuantumInstance
from qiskit_nature.drivers import UnitsType
from qiskit_nature.drivers.second_quantization import PySCFDriver
from qiskit_nature.mappers.second_quantization import BravyiKitaevSuperFastMapper, BravyiKitaevMapper
from qiskit_nature.converters.second_quantization import QubitConverter
from qiskit_nature.problems.second_quantization import ElectronicStructureProblem
from qiskit_nature.algorithms import GroundStateEigensolver, VQEUCCFactory
algorithm_globals.random_seed = 8
driver = PySCFDriver(
atom="H .0 .0 .0; H .0 .0 0.75",
unit=UnitsType.ANGSTROM,
charge=0,
spin=0,
basis="sto3g",
)
es_problem = ElectronicStructureProblem(driver)
quantum_instance = QuantumInstance(
BasicAer.get_backend("statevector_simulator"),
seed_transpiler=90,
seed_simulator=12,
)
#converter = QubitConverter(BravyiKitaevMapper())
converter = QubitConverter(BravyiKitaevSuperFastMapper())
solver = VQEUCCFactory(quantum_instance)
gsc = GroundStateEigensolver(converter, solver)
result = gsc.solve(es_problem)
print(result)
What should happen?
If the code above is switched to say the BravyiKitaevMapper (not the super fast one) then it works and prints the result as below. I would expect the same with BKSF
=== GROUND STATE ENERGY ===
* Electronic ground state energy (Hartree): -1.842686681847
- computed part: -1.842686681847
~ Nuclear repulsion energy (Hartree): 0.70556961456
> Total ground state energy (Hartree): -1.137117067287
=== 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.41729459]
0:
* Electronic dipole moment (a.u.): [0.0 0.0 1.41729468]
- computed part: [0.0 0.0 1.41729468]
> Dipole moment (a.u.): [0.0 0.0 -0.00000009] Total: 0.00000009
(debye): [0.0 0.0 -0.00000024] Total: 0.00000024
Any suggestions?
No response
Issue Analytics
- State:
- Created 2 years ago
- Comments:10 (10 by maintainers)
Top Results From Across the Web
How to map a JSON column with H2, JPA, and Hibernate
I just came across this problem working with the JSONB column type - the binary version of the JSON type, which doesn't map...
Read more >Spatial Mapping of VOC and NOx Limitation of Ozone ...
To summarize the results, maps of the results were prepared using the five highest ozone days at each site during each year. In...
Read more >nIU - River Thames Conditions - Environment Agency - GOV.UK
Lusotopie 2001, Liverpool on the map of england, Folgejahr, ... Katolsk messe drammen, Durandus of st pourcain, Carbonite mobile sign in error, Ahorramas?...
Read more >Vesting Tentative Tract Map No. 6195 - Fresno.GOV
Vesting Tentative Tract Map No. 6195. Draft Environmental Impact Report. State Clearinghouse No. 2021060089. City of Fresno, California.
Read more >Draft Initial Study and Mitigated Negative Declaration - Lodi.gov
driving range and agricultural land. The entire 30-acre Project site is designated as. “Prime Farmland” by the Farmland Mapping and Monitoring Program ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
This appears to boil down to the fact that the
BKSFMapper
is unable to handle all-identity operators likeIIII
. @jlapeyre could you take a look at this one?Yes, I pushed a commit to #451 doing this.