From 284bd27f56f467a28fe555363c4cb2aad0cb04db Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=98yvind=20Sigmundson=20Sch=C3=B8yen?= Date: Mon, 15 Feb 2021 15:04:59 +0100 Subject: [PATCH 1/3] Test using Python 3.8 --- .travis.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index 0906f8d..1a54a7f 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,7 +1,6 @@ language: python python: -- '3.6' -- '3.7' +- '3.8' install: - pip install pipenv - pipenv install --skip-lock From 3db469efa78acf433d2e8ec5e6688a2759107d38 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=98yvind=20Sigmundson=20Sch=C3=B8yen?= Date: Mon, 15 Feb 2021 15:05:11 +0100 Subject: [PATCH 2/3] Remove TDHF dependency --- Pipfile | 1 - 1 file changed, 1 deletion(-) diff --git a/Pipfile b/Pipfile index 41dabda..ecfc9dc 100644 --- a/Pipfile +++ b/Pipfile @@ -7,7 +7,6 @@ verify_ssl = true [packages] pytest = "*" -tdhf = {editable = true,git = "ssh://git@github.com/haakoek/tdhf.git"} black = "*" matplotlib = "*" tqdm = "*" From 5e8f3327e06dceec8450f22df34cd99f84a400ae Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=98yvind=20Sigmundson=20Sch=C3=B8yen?= Date: Mon, 15 Feb 2021 15:05:26 +0100 Subject: [PATCH 3/3] Add kwarg to toggle prefactor in two-body exp val --- configuration_interaction/ci.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/configuration_interaction/ci.py b/configuration_interaction/ci.py index 4beb941..c3a507b 100644 --- a/configuration_interaction/ci.py +++ b/configuration_interaction/ci.py @@ -284,7 +284,7 @@ def compute_one_body_density_matrix(self, K=0): return rho_qp - def compute_two_body_expectation_value(self, op, K=0): + def compute_two_body_expectation_value(self, op, K=0, asym=True): r"""Function computing the expectation value of a two-body operator. For a given two-body operator :math:`\hat{A}`, we compute the expectation value by @@ -301,6 +301,10 @@ def compute_two_body_expectation_value(self, op, K=0): density matrix, i.e., the number of basis functions ``l``. K : int The eigenstate to use for the two-body density matrix. + asym: bool + Toggle whether or not ``op`` is anti-symmetrized or not. This + determines the prefactor when tracing the two-body density matrix + with the two-body operator. Default is ``True``. Returns ------- @@ -314,7 +318,7 @@ def compute_two_body_expectation_value(self, op, K=0): """ rho_rspq = self.compute_two_body_density_matrix(K=K) - return 0.25 * self.np.tensordot( + return (0.25 if asym else 0.5) * self.np.tensordot( op, rho_rspq, axes=((0, 1, 2, 3), (2, 3, 0, 1)) )