Skip to content

Commit

Permalink
rearrange
Browse files Browse the repository at this point in the history
  • Loading branch information
caleb-johnson committed Oct 28, 2024
1 parent 6b7c5f3 commit bcd1dd0
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions qiskit_addon_sqd/fermion.py
Original file line number Diff line number Diff line change
Expand Up @@ -127,17 +127,18 @@ def solve_fermion(
verbose=verbose,
max_cycle=max_davidson,
)
# Convert the PySCF SCIVector to internal format
sci_state = SCIState(
amplitudes=np.array(sci_vec), ci_strs_a=sci_vec._strs[0], ci_strs_b=sci_vec._strs[1]
)

# Calculate the avg occupancy of each orbital
dm1 = myci.make_rdm1s(sci_state, norb, (num_up, num_dn))
dm1 = myci.make_rdm1s(sci_vec, norb, (num_up, num_dn))
avg_occupancy = [np.diagonal(dm1[0]), np.diagonal(dm1[1])]

# Compute total spin
spin_squared = myci.spin_square(sci_state, norb, (num_up, num_dn))[0]
spin_squared = myci.spin_square(sci_vec, norb, (num_up, num_dn))[0]

# Convert the PySCF SCIVector to internal format
sci_state = SCIState(
amplitudes=np.array(sci_vec), ci_strs_a=sci_vec._strs[0], ci_strs_b=sci_vec._strs[1]
)

return e_sci, sci_state, avg_occupancy, spin_squared

Expand Down

0 comments on commit bcd1dd0

Please sign in to comment.