Skip to content

Commit bb546bf

Browse files
peter-reinholdtmsricher
authored andcommitted
Fix data race
1 parent 7c9ebf2 commit bb546bf

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

pyci/src/hci.cpp

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -267,11 +267,9 @@ long add_hci(const SQuantOp &ham, WfnType &wfn, const double *coeffs, const doub
267267
v_threads.emplace_back(&hci_thread<WfnType>, std::ref(ham), std::ref(wfn),
268268
std::ref(v_wfns.back()), coeffs, eps, start, end);
269269
}
270-
long n = 0;
271-
for (auto &thread : v_threads) {
272-
thread.join();
273-
wfn.add_dets_from_wfn(v_wfns[n++]);
274-
}
270+
for (auto &thread : v_threads) thread.join();
271+
for (auto &wf : v_wfns) wfn.add_dets_from_wfn(wf);
272+
275273
return wfn.ndet - ndet_old;
276274
}
277275

0 commit comments

Comments
 (0)