Skip to content

Commit

Permalink
Assert the output from pyscf is formatted like we expect
Browse files Browse the repository at this point in the history
  • Loading branch information
caleb-johnson committed Oct 29, 2024
1 parent 8c730af commit 4129bca
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion qiskit_addon_sqd/fermion.py
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,11 @@ def solve_fermion(
# Compute total spin
spin_squared = myci.spin_square(sci_vec, norb, (num_up, num_dn))[0]

# Convert the PySCF SCIVector to internal format
# Convert the PySCF SCIVector to internal format. We access a private field here,
# so we assert that we expect the SCIVector output from kernel_fixed_space to
# have its _strs field populated with alpha and beta strings.
assert isinstance(sci_vec._strs[0], np.ndarray) and isinstance(sci_vec._strs[1], np.ndarray)
assert sci_vec.shape == (len(sci_vec._strs[0]), len(sci_vec._strs[1]))
sci_state = SCIState(
amplitudes=np.array(sci_vec), ci_strs_a=sci_vec._strs[0], ci_strs_b=sci_vec._strs[1]
)
Expand Down

0 comments on commit 4129bca

Please sign in to comment.