From 6e24dc5229cae8c1a1e7081e270661024478fa24 Mon Sep 17 00:00:00 2001 From: Oliver Backhouse Date: Sat, 23 Nov 2024 11:37:17 +0000 Subject: [PATCH] Missed statements --- ebcc/codegen/bootstrap_DFDCD.py | 4 ++-- ebcc/codegen/bootstrap_DFDCSD.py | 2 +- ebcc/codegen/bootstrap_MPn.py | 4 ++-- ebcc/codegen/bootstrap_common.py | 2 ++ 4 files changed, 7 insertions(+), 5 deletions(-) diff --git a/ebcc/codegen/bootstrap_DFDCD.py b/ebcc/codegen/bootstrap_DFDCD.py index 4e49f1cd..5e5b2520 100644 --- a/ebcc/codegen/bootstrap_DFDCD.py +++ b/ebcc/codegen/bootstrap_DFDCD.py @@ -38,8 +38,8 @@ # Get the energy contractions in pdaggerq format pq.clear() pq.set_left_operators([["1"]]) - pq.add_st_operator(1.0, ["f"], ["t1", "t2"]) - pq.add_st_operator(1.0, ["v"], ["t1", "t2"]) + pq.add_st_operator(1.0, ["f"], ["t2"]) + pq.add_st_operator(1.0, ["v"], ["t2"]) pq.simplify() terms = pq.fully_contracted_strings() terms = remove_reference_energy(terms) diff --git a/ebcc/codegen/bootstrap_DFDCSD.py b/ebcc/codegen/bootstrap_DFDCSD.py index 7cca030a..19dd9d21 100644 --- a/ebcc/codegen/bootstrap_DFDCSD.py +++ b/ebcc/codegen/bootstrap_DFDCSD.py @@ -81,7 +81,7 @@ ] # Get the T amplitudes in albert format - output_expr, returns = get_amplitudes([terms], spin, orders=[2], density_fit=True) + output_expr, returns = get_amplitudes([terms_t1, terms_t2], spin, density_fit=True) # Generate the T amplitude code for name, codegen in code_generators.items(): diff --git a/ebcc/codegen/bootstrap_MPn.py b/ebcc/codegen/bootstrap_MPn.py index 96a5d131..3b737095 100644 --- a/ebcc/codegen/bootstrap_MPn.py +++ b/ebcc/codegen/bootstrap_MPn.py @@ -140,7 +140,7 @@ def postamble(): if tuple(key) in {("o", "o", "v", "v") , ("v", "v", "o", "o")}: continue i, j, k, l = ["ov".index(k) for k in key] - codegen.write(f"rdm2.{key} = np.zeros((t1.shape[{i}], t1.shape[{j}], t1.shape[{k}], t1.shape[{l}]))") + codegen.write(f"rdm2.{''.join(key)} = np.zeros((t1.shape[{i}], t1.shape[{j}], t1.shape[{k}], t1.shape[{l}]))") codegen.write("rdm2 = pack_2e(rdm2.oooo, rdm2.ooov, rdm2.oovo, rdm2.ovoo, rdm2.vooo, rdm2.oovv, rdm2.ovov, rdm2.ovvo, rdm2.voov, rdm2.vovo, rdm2.vvoo, rdm2.ovvv, rdm2.vovv, rdm2.vvov, rdm2.vvvo, rdm2.vvvv).transpose((0, 2, 1, 3))") else: for s in ("aaaa", "aabb", "bbbb"): @@ -149,7 +149,7 @@ def postamble(): continue i, j, k, l = ["ov".index(k) for k in key] si, sj, sk, sl = s - codegen.write(f"rdm2.{si+sj+sk+sl}.{key} = np.zeros((t1.{si}.shape[{i}], t1.{sj}.shape[{j}], t1.{sk}.shape[{k}], t1.{sl}.shape[{l}]))") + codegen.write(f"rdm2.{si+sj+sk+sl}.{''.join(key)} = np.zeros((t1.{si}.shape[{i}], t1.{sj}.shape[{j}], t1.{sk}.shape[{k}], t1.{sl}.shape[{l}]))") codegen.write("rdm2.aaaa = pack_2e(rdm2.aaaa.oooo, rdm2.aaaa.ooov, rdm2.aaaa.oovo, rdm2.aaaa.ovoo, rdm2.aaaa.vooo, rdm2.aaaa.oovv, rdm2.aaaa.ovov, rdm2.aaaa.ovvo, rdm2.aaaa.voov, rdm2.aaaa.vovo, rdm2.aaaa.vvoo, rdm2.aaaa.ovvv, rdm2.aaaa.vovv, rdm2.aaaa.vvov, rdm2.aaaa.vvvo, rdm2.aaaa.vvvv).transpose((0, 2, 1, 3))") codegen.write("rdm2.aabb = pack_2e(rdm2.abab.oooo, rdm2.abab.ooov, rdm2.abab.oovo, rdm2.abab.ovoo, rdm2.abab.vooo, rdm2.abab.oovv, rdm2.abab.ovov, rdm2.abab.ovvo, rdm2.abab.voov, rdm2.abab.vovo, rdm2.abab.vvoo, rdm2.abab.ovvv, rdm2.abab.vovv, rdm2.abab.vvov, rdm2.abab.vvvo, rdm2.abab.vvvv).transpose((0, 2, 1, 3))") codegen.write("rdm2.bbbb = pack_2e(rdm2.bbbb.oooo, rdm2.bbbb.ooov, rdm2.bbbb.oovo, rdm2.bbbb.ovoo, rdm2.bbbb.vooo, rdm2.bbbb.oovv, rdm2.bbbb.ovov, rdm2.bbbb.ovvo, rdm2.bbbb.voov, rdm2.bbbb.vovo, rdm2.bbbb.vvoo, rdm2.bbbb.ovvv, rdm2.bbbb.vovv, rdm2.bbbb.vvov, rdm2.bbbb.vvvo, rdm2.bbbb.vvvv).transpose((0, 2, 1, 3))") diff --git a/ebcc/codegen/bootstrap_common.py b/ebcc/codegen/bootstrap_common.py index 9322e777..1fbbcbf3 100644 --- a/ebcc/codegen/bootstrap_common.py +++ b/ebcc/codegen/bootstrap_common.py @@ -47,6 +47,8 @@ def get_amplitudes(terms_grouped, spin, strategy="exhaust", which="t", orders=No for index_spins in get_amplitude_spins(indices[: n + 1], indices[n + 1 :], spin): expr_n = import_from_pdaggerq(terms, index_spins=index_spins) expr_n = spin_integrate(expr_n, spin) + if density_fit: + expr_n = tuple(_density_fit(e) for e in expr_n) output_n = [Tensor(*tuple(sorted(e.external_indices, key=lambda i: indices.index(i.name))), name=f"{which}{order}new") for e in expr_n] returns_n = (output_n[0],) expr.extend(expr_n)