Skip to content
This repository has been archived by the owner on Nov 15, 2023. It is now read-only.

qiskit-application-modules-demo-sessions/qiskit-nature/Qiskit_Nature_YouTube_Tutorial.ipynb is broken #9

Open
jwoehr opened this issue Dec 26, 2021 · 1 comment

Comments

@jwoehr
Copy link

jwoehr commented Dec 26, 2021

In [27] the code:

runtime_result = runtime_vqe_solver.solve(problem_reduced)

returns consistently:

---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
<ipython-input-27-fb20d8ad77c2> in <module>
----> 1 runtime_result = runtime_vqe_solver.solve(problem_reduced)

~/work/Qiskit/qrel_env/lib/python3.8/site-packages/qiskit_nature/algorithms/ground_state_solvers/ground_state_eigensolver.py in solve(self, problem, aux_operators)
    144         raw_mes_result = self._solver.compute_minimum_eigenvalue(main_operator, aux_ops)
    145 
--> 146         result = problem.interpret(raw_mes_result)
    147         return result
    148 

~/work/Qiskit/qrel_env/lib/python3.8/site-packages/qiskit_nature/problems/second_quantization/electronic/electronic_structure_problem.py in interpret(self, raw_result)
    174         result = ElectronicStructureResult()
    175         result.combine(eigenstate_result)
--> 176         self._grouped_property_transformed.interpret(result)
    177         result.computed_energies = np.asarray([e.real for e in eigenstate_result.eigenenergies])
    178         return result

~/work/Qiskit/qrel_env/lib/python3.8/site-packages/qiskit_nature/properties/grouped_property.py in interpret(self, result)
    104         """
    105         for prop in self._properties.values():
--> 106             prop.interpret(result)

~/work/Qiskit/qrel_env/lib/python3.8/site-packages/qiskit_nature/properties/second_quantization/electronic/particle_number.py in interpret(self, result)
    199 
    200             if aux_op_eigenvalues[_key] is not None:
--> 201                 n_particles = aux_op_eigenvalues[_key][0].real  # type: ignore
    202                 result.num_particles.append(n_particles)
    203 

TypeError: 'float' object is not subscriptable
@HuangJunye
Copy link
Collaborator

@jwoehr Sorry for the slow response. I can't reproduce this issue. Can you try updating your qiskit and qiskit-nature to the latest version and try again?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants