From 7179ab23fad8856e58e3b468ac127f0dbc7fdea3 Mon Sep 17 00:00:00 2001 From: Peter Reinholdt Date: Wed, 26 Nov 2025 12:03:23 +0100 Subject: [PATCH 1/2] Fix enpt2 --- pyci/src/enpt2.cpp | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/pyci/src/enpt2.cpp b/pyci/src/enpt2.cpp index c3751c97..e24514fd 100644 --- a/pyci/src/enpt2.cpp +++ b/pyci/src/enpt2.cpp @@ -104,6 +104,7 @@ void compute_enpt2_thread_terms(const SQuantOp &ham, const FullCIWfn &wfn, PairH jj = virs_up[j]; // 1-0 excitation elements excite_det(ii, jj, det_up); + fill_occs(wfn.nword, det_up, t_up); sign_up = phase_single_det(wfn.nword, ii, jj, rdet_up); val = ham.one_mo[n1 * ii + jj]; for (k = 0; k < wfn.nocc_up; ++k) { @@ -121,7 +122,6 @@ void compute_enpt2_thread_terms(const SQuantOp &ham, const FullCIWfn &wfn, PairH rank = wfn.rank_det(det_up); if (wfn.index_det_from_rank(rank) == -1) { val *= sign_up; - fill_occs(wfn.nword, det_up, t_up); compute_enpt2_thread_gather(wfn, ham.one_mo, ham.two_mo, terms[rank], val, n2, n3, t_up); } @@ -367,12 +367,8 @@ double compute_enpt2(const SQuantOp &ham, const WfnType &wfn, const double *coef v_threads.emplace_back(&compute_enpt2_thread, std::ref(ham), std::ref(wfn), std::ref(v_terms[i]), coeffs, eps, start, end); } - long n = 0; - for (auto &thread : v_threads) { - thread.join(); - compute_enpt2_thread_condense(terms, v_terms[n], n); - ++n; - } + for (auto &thread : v_threads) thread.join(); + for (long n=0; n Date: Wed, 26 Nov 2025 12:04:14 +0100 Subject: [PATCH 2/2] Update tests --- pyci/test/test_routines.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/pyci/test/test_routines.py b/pyci/test/test_routines.py index 585cecc7..9148280a 100644 --- a/pyci/test/test_routines.py +++ b/pyci/test/test_routines.py @@ -473,12 +473,12 @@ def test_run_hci(filename, wfn_type, occs, energy): @pytest.mark.parametrize( "filename, wfn_type, occs, energy", [ - ("he_ccpvqz", pyci.fullci_wfn, (1, 1), -2.964248588), - ("li2_ccpvdz", pyci.doci_wfn, (3, 3), -14.881173703), - ("be_ccpvdz", pyci.doci_wfn, (2, 2), -14.603138756), - ("he_ccpvqz", pyci.doci_wfn, (1, 1), -2.964248588), - ("be_ccpvdz", pyci.fullci_wfn, (2, 2), -14.617423859), - ("h2o_ccpvdz", pyci.doci_wfn, (5, 5), -75.784506748), + ("he_ccpvqz", pyci.fullci_wfn, (1, 1), -2.903862702173526), + ("li2_ccpvdz", pyci.doci_wfn, (3, 3), -14.90042952400693), + ("be_ccpvdz", pyci.doci_wfn, (2, 2), -14.61920612157886), + ("he_ccpvqz", pyci.doci_wfn, (1, 1), -2.903862702173526), + ("be_ccpvdz", pyci.fullci_wfn, (2, 2), -14.61740346031583), + ("h2o_ccpvdz", pyci.doci_wfn, (5, 5), -76.04227376501808), ], ) def test_enpt2(filename, wfn_type, occs, energy):