Skip to content

Chemistry notebook failing after OpenFermion release #3625

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
balopat opened this issue Dec 22, 2020 · 0 comments · Fixed by #3626
Closed

Chemistry notebook failing after OpenFermion release #3625

balopat opened this issue Dec 22, 2020 · 0 comments · Fixed by #3626
Labels
area/docs priority/p1 Fix is needed as soon as possible. Should be staffed. It is blocking some major flows for users

Comments

@balopat
Copy link
Contributor

balopat commented Dec 22, 2020

We should fix this ASAP as it blocks PR checks through the notebook tests.

This cell in docs/tutorials/educators/chemisrty.ipynb is failing:

import cirq
import openfermioncirq as ofc
import numpy as np

# Initialize qubits
qubits = cirq.LineQubit.range(n_qubits)

# Create circuit
circuit = cirq.Circuit(
    ofc.simulate_trotter(
        qubits, hamiltonian, time,
        n_steps=10,
        order=0,
        algorithm=ofc.trotter.LOW_RANK)
)

# Apply the circuit to the initial state
result = circuit.final_state_vector(initial_state)

# Compute the fidelity with the final state from exact evolution
fidelity = abs(np.dot(exact_state, result.conj()))**2

print(fidelity)

With this error

---------------------------------------------------------------------------
ModuleNotFoundError                       Traceback (most recent call last)
<ipython-input-16-0304f2d19241> in <module>
      1 import cirq
----> 2 import openfermioncirq as ofc
      3 import numpy as np
      4 
      5 # Initialize qubits

~/.virtualenvs/cirq38/lib/python3.7/site-packages/openfermioncirq/__init__.py in <module>
     32 )
     33 
---> 34 from openfermioncirq.primitives import (
     35     ffft,
     36     prepare_gaussian_state,

~/.virtualenvs/cirq38/lib/python3.7/site-packages/openfermioncirq/primitives/__init__.py in <module>
     13 """Building blocks of algorithms for quantum simulation."""
     14 
---> 15 from openfermioncirq.primitives.bogoliubov_transform import bogoliubov_transform
     16 
     17 from openfermioncirq.primitives.ffft import ffft

~/.virtualenvs/cirq38/lib/python3.7/site-packages/openfermioncirq/primitives/bogoliubov_transform.py in <module>
     20 import cirq
     21 from openfermion import slater_determinant_preparation_circuit
---> 22 from openfermion.ops._givens_rotations import (
     23         fermionic_gaussian_decomposition,
     24         givens_decomposition_square)

ModuleNotFoundError: No module named 'openfermion.ops._givens_rotations'

@balopat balopat added kind/docs priority/p1 Fix is needed as soon as possible. Should be staffed. It is blocking some major flows for users labels Dec 22, 2020
CirqBot pushed a commit that referenced this issue Dec 23, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/docs priority/p1 Fix is needed as soon as possible. Should be staffed. It is blocking some major flows for users
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants