From 7f5cfc5a461052fcf0d6b17c6d35cbf197dd1a20 Mon Sep 17 00:00:00 2001 From: Oliver Backhouse Date: Sun, 20 Oct 2024 10:33:18 +0100 Subject: [PATCH] Now? --- ebcc/codegen/bootstrap_QCISD.py | 222 +++++++++++++++++++------------- 1 file changed, 134 insertions(+), 88 deletions(-) diff --git a/ebcc/codegen/bootstrap_QCISD.py b/ebcc/codegen/bootstrap_QCISD.py index aeb98783..1565854d 100644 --- a/ebcc/codegen/bootstrap_QCISD.py +++ b/ebcc/codegen/bootstrap_QCISD.py @@ -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() @@ -121,18 +126,25 @@ 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() @@ -140,21 +152,25 @@ 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() @@ -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) @@ -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) @@ -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) @@ -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) @@ -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) @@ -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) @@ -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) @@ -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) @@ -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) @@ -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) @@ -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) @@ -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)