Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 3 additions & 7 deletions pyci/src/enpt2.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand All @@ -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);
}
Expand Down Expand Up @@ -367,12 +367,8 @@ double compute_enpt2(const SQuantOp &ham, const WfnType &wfn, const double *coef
v_threads.emplace_back(&compute_enpt2_thread<WfnType>, 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<nthread; n++) compute_enpt2_thread_condense(terms, v_terms[n], n);
// compute enpt2 correction
double e = energy - ham.ecore, correction = 0.0;
for (const auto &keyval : terms)
Expand Down
12 changes: 6 additions & 6 deletions pyci/test/test_routines.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down