diff --git a/pyci/src/common.cpp b/pyci/src/common.cpp index b6657be..675b58a 100644 --- a/pyci/src/common.cpp +++ b/pyci/src/common.cpp @@ -30,7 +30,7 @@ long get_num_threads(void) { } long end_chunk_idx(const long thread_idx, const long num_threads, const long sideLength) { - return ceil(sqrt(thread_idx / num_threads) * sideLength); + return ceil(static_cast(thread_idx) / static_cast(num_threads) * sideLength); } void set_num_threads(const long n) { diff --git a/pyci/src/hci.cpp b/pyci/src/hci.cpp index e934c84..10ff9d7 100644 --- a/pyci/src/hci.cpp +++ b/pyci/src/hci.cpp @@ -267,11 +267,9 @@ long add_hci(const SQuantOp &ham, WfnType &wfn, const double *coeffs, const doub v_threads.emplace_back(&hci_thread, std::ref(ham), std::ref(wfn), std::ref(v_wfns.back()), coeffs, eps, start, end); } - long n = 0; - for (auto &thread : v_threads) { - thread.join(); - wfn.add_dets_from_wfn(v_wfns[n++]); - } + for (auto &thread : v_threads) thread.join(); + for (auto &wf : v_wfns) wfn.add_dets_from_wfn(wf); + return wfn.ndet - ndet_old; }