Skip to content

Commit

Permalink
Now?
Browse files Browse the repository at this point in the history
  • Loading branch information
obackhouse committed Oct 20, 2024
1 parent 3571a35 commit 7f5cfc5
Showing 1 changed file with 134 additions and 88 deletions.
222 changes: 134 additions & 88 deletions ebcc/codegen/bootstrap_QCISD.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,21 +63,26 @@
# Get the T1 contractions in pdaggerq format
pq.clear()
pq.set_left_operators([["e1(i,a)"]])
for ham in ("f", "v"):
pq.add_commutator(1.0, [ham], ["t1"])
pq.add_commutator(1.0, [ham], ["t2"])
pq.add_double_commutator(1.0, [ham], ["t1"], ["t2"])
pq.add_commutator(1.0, ["f"], ["t1"])
pq.add_commutator(1.0, ["v"], ["t1"])
pq.add_commutator(1.0, ["f"], ["t2"])
pq.add_commutator(1.0, ["v"], ["t2"])
pq.add_double_commutator(1.0, ["f"], ["t1"], ["t2"])
pq.add_double_commutator(1.0, ["v"], ["t1"], ["t2"])
pq.simplify()
terms_t1 = pq.fully_contracted_strings()

# Get the T2 contractions in pdaggerq format
pq.clear()
pq.set_left_operators([["e2(i,j,b,a)"]])
for ham in ("f", "v"):
pq.add_operator_product(1.0, [ham])
pq.add_commutator(1.0, [ham], ["t1"])
pq.add_commutator(1.0, [ham], ["t2"])
pq.add_double_commutator(1.0, [ham], ["t1"], ["t2"])
pq.add_operator_product(1.0, ["f"])
pq.add_operator_product(1.0, ["v"])
pq.add_commutator(1.0, ["f"], ["t1"])
pq.add_commutator(1.0, ["v"], ["t1"])
pq.add_commutator(1.0, ["f"], ["t2"])
pq.add_commutator(1.0, ["v"], ["t2"])
pq.add_double_commutator(0.5, ["f"], ["t2"], ["t2"])
pq.add_double_commutator(0.5, ["v"], ["t2"], ["t2"])
pq.simplify()
terms_t2 = pq.fully_contracted_strings()

Expand Down Expand Up @@ -121,40 +126,51 @@
pq.clear()
pq.set_left_operators([["1"]])
pq.set_right_operators([["1"]])
for ham in ("f", "v"):
pq.add_commutator(1.0, [ham, "e1(a,i)"], ["t1"])
pq.add_commutator(1.0, [ham, "e1(a,i)"], ["t2"])
pq.add_double_commutator(1.0, [ham, "e1(a,i)"], ["t1"], ["t2"])
pq.add_commutator(1.0, ["f", "e1(a,i)"], ["t1"])
pq.add_commutator(1.0, ["v", "e1(a,i)"], ["t1"])
pq.add_commutator(1.0, ["f", "e1(a,i)"], ["t2"])
pq.add_commutator(1.0, ["v", "e1(a,i)"], ["t2"])
pq.add_double_commutator(1.0, ["f", "e1(a,i)"], ["t1"], ["t2"])
pq.add_double_commutator(1.0, ["v", "e1(a,i)"], ["t1"], ["t2"])
pq.set_left_operators([["l1"], ["l2"]])
for ham in ("f", "v"):
pq.add_commutator(1.0, [ham, "e1(a,i)"], ["t1"])
pq.add_commutator(1.0, [ham, "e1(a,i)"], ["t2"])
pq.add_double_commutator(1.0, [ham, "e1(a,i)"], ["t1"], ["t2"])
pq.add_commutator(-1.0, ["e1(a,i)", ham], ["t1"])
pq.add_commutator(-1.0, ["e1(a,i)", ham], ["t2"])
pq.add_double_commutator(-1.0, ["e1(a,i)", ham], ["t1"], ["t2"])
pq.add_commutator(1.0, ["f", "e1(a,i)"], ["t1"])
pq.add_commutator(1.0, ["v", "e1(a,i)"], ["t1"])
pq.add_commutator(1.0, ["f", "e1(a,i)"], ["t2"])
pq.add_commutator(1.0, ["v", "e1(a,i)"], ["t2"])
pq.add_double_commutator(1.0, ["f", "e1(a,i)"], ["t1"], ["t2"])
pq.add_double_commutator(1.0, ["v", "e1(a,i)"], ["t1"], ["t2"])
pq.add_commutator(1.0, ["e1(a,i)", "f"], ["t1"])
pq.add_commutator(1.0, ["e1(a,i)", "v"], ["t1"])
pq.add_commutator(1.0, ["e1(a,i)", "f"], ["t2"])
pq.add_commutator(1.0, ["e1(a,i)", "v"], ["t2"])
pq.add_double_commutator(1.0, ["e1(a,i)", "f"], ["t1"], ["t2"])
pq.add_double_commutator(1.0, ["e1(a,i)", "v"], ["t1"], ["t2"])
pq.simplify()
terms_l1 = pq.fully_contracted_strings()

# Get the L2 contractions in pdaggerq format
pq.clear()
pq.set_left_operators([["1"]])
pq.set_right_operators([["1"]])
for ham in ("f", "v"):
pq.add_operator_product(1.0, [ham, "e2(a,b,j,i)"])
pq.add_commutator(1.0, [ham, "e2(a,b,j,i)"], ["t1"])
pq.add_commutator(1.0, [ham, "e2(a,b,j,i)"], ["t2"])
pq.add_double_commutator(1.0, [ham, "e2(a,b,j,i)"], ["t1"], ["t2"])
pq.add_commutator(1.0, ["f", "e2(a,b,j,i)"], ["t1"])
pq.add_commutator(1.0, ["v", "e2(a,b,j,i)"], ["t1"])
pq.add_commutator(1.0, ["f", "e2(a,b,j,i)"], ["t2"])
pq.add_commutator(1.0, ["v", "e2(a,b,j,i)"], ["t2"])
pq.add_double_commutator(1.0, ["f", "e2(a,b,j,i)"], ["t1"], ["t2"])
pq.add_double_commutator(1.0, ["v", "e2(a,b,j,i)"], ["t1"], ["t2"])
pq.set_left_operators([["l1"], ["l2"]])
for ham in ("f", "v"):
pq.add_operator_product(1.0, [ham, "e2(a,b,j,i)"])
pq.add_commutator(1.0, [ham, "e2(a,b,j,i)"], ["t1"])
pq.add_commutator(1.0, [ham, "e2(a,b,j,i)"], ["t2"])
pq.add_double_commutator(1.0, [ham, "e2(a,b,j,i)"], ["t1"], ["t2"])
pq.add_operator_product(-1.0, ["e2(a,b,j,i)", ham])
pq.add_commutator(-1.0, ["e2(a,b,j,i)", ham], ["t1"])
pq.add_commutator(-1.0, ["e2(a,b,j,i)", ham], ["t2"])
pq.add_double_commutator(-1.0, ["e2(a,b,j,i)", ham], ["t1"], ["t2"])
pq.add_commutator(1.0, ["f", "e2(a,b,j,i)"], ["t1"])
pq.add_commutator(1.0, ["v", "e2(a,b,j,i)"], ["t1"])
pq.add_commutator(1.0, ["f", "e2(a,b,j,i)"], ["t2"])
pq.add_commutator(1.0, ["v", "e2(a,b,j,i)"], ["t2"])
pq.add_double_commutator(1.0, ["f", "e2(a,b,j,i)"], ["t1"], ["t2"])
pq.add_double_commutator(1.0, ["v", "e2(a,b,j,i)"], ["t1"], ["t2"])
pq.add_commutator(1.0, ["e2(a,b,j,i)", "f"], ["t1"])
pq.add_commutator(1.0, ["e2(a,b,j,i)", "v"], ["t1"])
pq.add_commutator(1.0, ["e2(a,b,j,i)", "f"], ["t2"])
pq.add_commutator(1.0, ["e2(a,b,j,i)", "v"], ["t2"])
pq.add_double_commutator(1.0, ["e2(a,b,j,i)", "f"], ["t1"], ["t2"])
pq.add_double_commutator(1.0, ["e2(a,b,j,i)", "v"], ["t1"], ["t2"])
pq.simplify()
terms_l2 = pq.fully_contracted_strings()

Expand Down Expand Up @@ -318,10 +334,12 @@
pq.set_right_operators_type("IP")
pq.set_left_operators([["a*(i)"]])
pq.set_right_operators([["r1"], ["r2"]])
for ham in ("f", "v"):
pq.add_commutator(1.0, [ham], ["t1"])
pq.add_commutator(1.0, [ham], ["t2"])
pq.add_double_commutator(1.0, [ham], ["t1"], ["t2"])
pq.add_commutator(1.0, ["f"], ["t1"])
pq.add_commutator(1.0, ["v"], ["t1"])
pq.add_commutator(1.0, ["f"], ["t2"])
pq.add_commutator(1.0, ["v"], ["t2"])
pq.add_double_commutator(1.0, ["f"], ["t1"], ["t2"])
pq.add_double_commutator(1.0, ["v"], ["t1"], ["t2"])
pq.simplify()
terms_r1 = pq.fully_contracted_strings()
terms_r1 = remove_e0_eom(terms_r1)
Expand All @@ -331,11 +349,14 @@
pq.set_right_operators_type("IP")
pq.set_left_operators([["a*(i)", "a*(j)", "a(a)"]])
pq.set_right_operators([["r1"], ["r2"]])
for ham in ("f", "v"):
pq.add_operator_product(1.0, [ham])
pq.add_commutator(1.0, [ham], ["t1"])
pq.add_commutator(1.0, [ham], ["t2"])
pq.add_double_commutator(1.0, [ham], ["t1"], ["t2"])
pq.add_operator_product(1.0, ["f"])
pq.add_operator_product(1.0, ["v"])
pq.add_commutator(1.0, ["f"], ["t1"])
pq.add_commutator(1.0, ["v"], ["t1"])
pq.add_commutator(1.0, ["f"], ["t2"])
pq.add_commutator(1.0, ["v"], ["t2"])
pq.add_double_commutator(0.5, ["f"], ["t2"], ["t2"])
pq.add_double_commutator(0.5, ["v"], ["t2"], ["t2"])
pq.simplify()
terms_r2 = pq.fully_contracted_strings()
terms_r2 = remove_e0_eom(terms_r2)
Expand Down Expand Up @@ -400,10 +421,12 @@
pq.set_right_operators_type("EA")
pq.set_left_operators([["a(a)"]])
pq.set_right_operators([["r1"], ["r2"]])
for ham in ("f", "v"):
pq.add_commutator(1.0, [ham], ["t1"])
pq.add_commutator(1.0, [ham], ["t2"])
pq.add_double_commutator(1.0, [ham], ["t1"], ["t2"])
pq.add_commutator(1.0, ["f"], ["t1"])
pq.add_commutator(1.0, ["v"], ["t1"])
pq.add_commutator(1.0, ["f"], ["t2"])
pq.add_commutator(1.0, ["v"], ["t2"])
pq.add_double_commutator(1.0, ["f"], ["t1"], ["t2"])
pq.add_double_commutator(1.0, ["v"], ["t1"], ["t2"])
pq.simplify()
terms_r1 = pq.fully_contracted_strings()
terms_r1 = remove_e0_eom(terms_r1)
Expand All @@ -413,11 +436,14 @@
pq.set_right_operators_type("EA")
pq.set_left_operators([["a*(i)", "a(b)", "a(a)"]])
pq.set_right_operators([["r1"], ["r2"]])
for ham in ("f", "v"):
pq.add_operator_product(1.0, [ham])
pq.add_commutator(1.0, [ham], ["t1"])
pq.add_commutator(1.0, [ham], ["t2"])
pq.add_double_commutator(1.0, [ham], ["t1"], ["t2"])
pq.add_operator_product(1.0, ["f"])
pq.add_operator_product(1.0, ["v"])
pq.add_commutator(1.0, ["f"], ["t1"])
pq.add_commutator(1.0, ["v"], ["t1"])
pq.add_commutator(1.0, ["f"], ["t2"])
pq.add_commutator(1.0, ["v"], ["t2"])
pq.add_double_commutator(0.5, ["f"], ["t2"], ["t2"])
pq.add_double_commutator(0.5, ["v"], ["t2"], ["t2"])
pq.simplify()
terms_r2 = pq.fully_contracted_strings()
terms_r2 = remove_e0_eom(terms_r2)
Expand Down Expand Up @@ -483,10 +509,12 @@
pq.set_right_operators_type("EE")
pq.set_left_operators([["e1(i,a)"]])
pq.set_right_operators([["r1"], ["r2"]])
for ham in ("f", "v"):
pq.add_commutator(1.0, [ham], ["t1"])
pq.add_commutator(1.0, [ham], ["t2"])
pq.add_double_commutator(1.0, [ham], ["t1"], ["t2"])
pq.add_commutator(1.0, ["f"], ["t1"])
pq.add_commutator(1.0, ["v"], ["t1"])
pq.add_commutator(1.0, ["f"], ["t2"])
pq.add_commutator(1.0, ["v"], ["t2"])
pq.add_double_commutator(1.0, ["f"], ["t1"], ["t2"])
pq.add_double_commutator(1.0, ["v"], ["t1"], ["t2"])
pq.simplify()
terms_r1 = pq.fully_contracted_strings()
terms_r1 = remove_e0_eom(terms_r1)
Expand All @@ -496,11 +524,14 @@
pq.set_right_operators_type("EE")
pq.set_left_operators([["e2(i,j,b,a)"]])
pq.set_right_operators([["r1"], ["r2"]])
for ham in ("f", "v"):
pq.add_operator_product(1.0, [ham])
pq.add_commutator(1.0, [ham], ["t1"])
pq.add_commutator(1.0, [ham], ["t2"])
pq.add_double_commutator(1.0, [ham], ["t1"], ["t2"])
pq.add_operator_product(1.0, ["f"])
pq.add_operator_product(1.0, ["v"])
pq.add_commutator(1.0, ["f"], ["t1"])
pq.add_commutator(1.0, ["v"], ["t1"])
pq.add_commutator(1.0, ["f"], ["t2"])
pq.add_commutator(1.0, ["v"], ["t2"])
pq.add_double_commutator(0.5, ["f"], ["t2"], ["t2"])
pq.add_double_commutator(0.5, ["v"], ["t2"], ["t2"])
pq.simplify()
terms_r2 = pq.fully_contracted_strings()
terms_r2 = remove_e0_eom(terms_r2)
Expand Down Expand Up @@ -566,10 +597,12 @@
pq.set_left_operators_type("IP")
pq.set_left_operators([["l1"], ["l2"]])
pq.set_right_operators([["a(i)"]])
for ham in ("f", "v"):
pq.add_commutator(1.0, [ham], ["t1"])
pq.add_commutator(1.0, [ham], ["t2"])
pq.add_double_commutator(1.0, [ham], ["t1"], ["t2"])
pq.add_commutator(1.0, ["f"], ["t1"])
pq.add_commutator(1.0, ["v"], ["t1"])
pq.add_commutator(1.0, ["f"], ["t2"])
pq.add_commutator(1.0, ["v"], ["t2"])
pq.add_double_commutator(1.0, ["f"], ["t1"], ["t2"])
pq.add_double_commutator(1.0, ["v"], ["t1"], ["t2"])
pq.simplify()
terms_r1 = pq.fully_contracted_strings()
terms_r1 = remove_e0_eom(terms_r1)
Expand All @@ -579,11 +612,14 @@
pq.set_left_operators_type("IP")
pq.set_right_operators([["a*(a)", "a(j)", "a(i)"]])
pq.set_left_operators([["l1"], ["l2"]])
for ham in ("f", "v"):
pq.add_operator_product(1.0, [ham])
pq.add_commutator(1.0, [ham], ["t1"])
pq.add_commutator(1.0, [ham], ["t2"])
pq.add_double_commutator(1.0, [ham], ["t1"], ["t2"])
pq.add_operator_product(1.0, ["f"])
pq.add_operator_product(1.0, ["v"])
pq.add_commutator(1.0, ["f"], ["t1"])
pq.add_commutator(1.0, ["v"], ["t1"])
pq.add_commutator(1.0, ["f"], ["t2"])
pq.add_commutator(1.0, ["v"], ["t2"])
pq.add_double_commutator(0.5, ["f"], ["t2"], ["t2"])
pq.add_double_commutator(0.5, ["v"], ["t2"], ["t2"])
pq.simplify()
terms_r2 = pq.fully_contracted_strings()
terms_r2 = remove_e0_eom(terms_r2)
Expand Down Expand Up @@ -648,10 +684,12 @@
pq.set_left_operators_type("EA")
pq.set_left_operators([["l1"], ["l2"]])
pq.set_right_operators([["a*(a)"]])
for ham in ("f", "v"):
pq.add_commutator(1.0, [ham], ["t1"])
pq.add_commutator(1.0, [ham], ["t2"])
pq.add_double_commutator(1.0, [ham], ["t1"], ["t2"])
pq.add_commutator(1.0, ["f"], ["t1"])
pq.add_commutator(1.0, ["v"], ["t1"])
pq.add_commutator(1.0, ["f"], ["t2"])
pq.add_commutator(1.0, ["v"], ["t2"])
pq.add_double_commutator(1.0, ["f"], ["t1"], ["t2"])
pq.add_double_commutator(1.0, ["v"], ["t1"], ["t2"])
pq.simplify()
terms_r1 = pq.fully_contracted_strings()
terms_r1 = remove_e0_eom(terms_r1)
Expand All @@ -661,11 +699,14 @@
pq.set_left_operators_type("EA")
pq.set_right_operators([["a*(a)", "a*(b)", "a(i)"]])
pq.set_left_operators([["l1"], ["l2"]])
for ham in ("f", "v"):
pq.add_operator_product(1.0, [ham])
pq.add_commutator(1.0, [ham], ["t1"])
pq.add_commutator(1.0, [ham], ["t2"])
pq.add_double_commutator(1.0, [ham], ["t1"], ["t2"])
pq.add_operator_product(1.0, ["f"])
pq.add_operator_product(1.0, ["v"])
pq.add_commutator(1.0, ["f"], ["t1"])
pq.add_commutator(1.0, ["v"], ["t1"])
pq.add_commutator(1.0, ["f"], ["t2"])
pq.add_commutator(1.0, ["v"], ["t2"])
pq.add_double_commutator(0.5, ["f"], ["t2"], ["t2"])
pq.add_double_commutator(0.5, ["v"], ["t2"], ["t2"])
pq.simplify()
terms_r2 = pq.fully_contracted_strings()
terms_r2 = remove_e0_eom(terms_r2)
Expand Down Expand Up @@ -731,10 +772,12 @@
pq.set_left_operators_type("EE")
pq.set_left_operators([["l1"], ["l2"]])
pq.set_right_operators([["e1(a,i)"]])
for ham in ("f", "v"):
pq.add_commutator(1.0, [ham], ["t1"])
pq.add_commutator(1.0, [ham], ["t2"])
pq.add_double_commutator(1.0, [ham], ["t1"], ["t2"])
pq.add_commutator(1.0, ["f"], ["t1"])
pq.add_commutator(1.0, ["v"], ["t1"])
pq.add_commutator(1.0, ["f"], ["t2"])
pq.add_commutator(1.0, ["v"], ["t2"])
pq.add_double_commutator(1.0, ["f"], ["t1"], ["t2"])
pq.add_double_commutator(1.0, ["v"], ["t1"], ["t2"])
pq.simplify()
terms_r1 = pq.fully_contracted_strings()
terms_r1 = remove_e0_eom(terms_r1)
Expand All @@ -744,11 +787,14 @@
pq.set_left_operators_type("EE")
pq.set_left_operators([["l1"], ["l2"]])
pq.set_right_operators([["e2(a,b,j,i)"]])
for ham in ("f", "v"):
pq.add_operator_product(1.0, [ham])
pq.add_commutator(1.0, [ham], ["t1"])
pq.add_commutator(1.0, [ham], ["t2"])
pq.add_double_commutator(1.0, [ham], ["t1"], ["t2"])
pq.add_operator_product(1.0, ["f"])
pq.add_operator_product(1.0, ["v"])
pq.add_commutator(1.0, ["f"], ["t1"])
pq.add_commutator(1.0, ["v"], ["t1"])
pq.add_commutator(1.0, ["f"], ["t2"])
pq.add_commutator(1.0, ["v"], ["t2"])
pq.add_double_commutator(0.5, ["f"], ["t2"], ["t2"])
pq.add_double_commutator(0.5, ["v"], ["t2"], ["t2"])
pq.simplify()
terms_r2 = pq.fully_contracted_strings()
terms_r2 = remove_e0_eom(terms_r2)
Expand Down

0 comments on commit 7f5cfc5

Please sign in to comment.