Skip to content

Commit

Permalink
a trick but greatly accelerate h_qc construction.
Browse files Browse the repository at this point in the history
  • Loading branch information
jiangtong1000 authored and liwt31 committed Aug 11, 2023
1 parent 9583324 commit 1576c3c
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions renormalizer/model/h_qc.py
Original file line number Diff line number Diff line change
Expand Up @@ -143,15 +143,16 @@ def process_op(old_op: Op):
return Op.product(new_ops)

# 1-e terms
for p, q in itertools.product(range(norbs), repeat=2):
pairs = np.argwhere(h1e!=0)
for p, q in pairs:
op = process_op(a_dag_ops[p] * a_ops[q])
ham_terms.append(op * h1e[p, q])

# 2-e terms.
for q,s in itertools.product(range(norbs),repeat = 2):
for p,r in itertools.product(range(q),range(s)):
op = process_op(Op.product([a_dag_ops[p], a_dag_ops[q], a_ops[r], a_ops[s]]))
ham_terms.append(op * h2e[p, q, r, s])
pairs = np.argwhere(h2e!=0)
for p, q, r, s in pairs:
op = process_op(Op.product([a_dag_ops[p], a_dag_ops[q], a_ops[r], a_ops[s]]))
ham_terms.append(op * h2e[p, q, r, s])


basis = []
Expand Down

0 comments on commit 1576c3c

Please sign in to comment.