Skip to content

Commit

Permalink
Change if condition to assertion in basis_rotation
Browse files Browse the repository at this point in the history
  • Loading branch information
chmwzc committed Dec 19, 2023
1 parent eadbcb4 commit b344e33
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
3 changes: 1 addition & 2 deletions src/qibochem/ansatz/basis_rotation.py
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,6 @@ def br_circuit(n_qubits, parameters, n_occ):
# Add the Givens rotation circuits
for g_rot_parameter in g_rotation_parameters:
for orb1, orb2, theta, _phi in g_rot_parameter:
if not np.allclose(_phi, 0.0):
raise ValueError("Unitary rotation is not real")
assert np.allclose(_phi, 0.0), "Unitary rotation is not real!"
circuit += givens_rotation_gate(n_qubits, orb1, orb2, theta)
return circuit
4 changes: 2 additions & 2 deletions tests/test_molecule.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ def test_run_pyscf():

def test_run_pyscf_molecule_xyz():
"""Pyscf driver with xyz file"""
file_path = Path("data/lih.xyz")
file_path = Path("tests", "data", "lih.xyz")
if not file_path.is_file():
with open(file_path, "w") as file_handler:
file_handler.write("2\n0 1\nLi 0.0 0.0 0.0\nH 0.0 0.0 1.2\n")
Expand All @@ -42,7 +42,7 @@ def test_run_pyscf_molecule_xyz():


def test_run_pyscf_molecule_xyz_charged():
file_path = Path("data/h2.xyz")
file_path = Path("tests", "data", "h2.xyz")
if not file_path.is_file():
with open(file_path, "w") as file_handler:
file_handler.write("2\n \nH 0.0 0.0 0.0\nH 0.0 0.0 0.7\n")
Expand Down

0 comments on commit b344e33

Please sign in to comment.