Skip to content

Commit

Permalink
fix whitetrainling
Browse files Browse the repository at this point in the history
  • Loading branch information
RichRick1 committed Feb 21, 2025
1 parent 44a8672 commit b13e286
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion moha/hamiltonians.py
Original file line number Diff line number Diff line change
Expand Up @@ -521,8 +521,14 @@ def generate_one_body_integral(self,
else:
raise TypeError("mu array has wrong basis")

# sum of J_ax_ij for j>i
sum_Jij = (np.sum(J_ax, axis=1) - np.diag(J_ax)) / 2
# if only two sites are present, then no need to devide by 2 two avoid double counting
if sum_Jij.shape[0] == 2:
sum_Jij *= 2

one_body_term = 0.5 * diags(mu - np.diag(J_eq) -
(np.sum(J_ax, axis=1) - np.diag(J_ax)) / 2,
sum_Jij,
format="csr")

self.one_body = one_body_term
Expand Down

0 comments on commit b13e286

Please sign in to comment.