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
2 changes: 1 addition & 1 deletion pyci/src/common.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<double>(thread_idx) / static_cast<double>(num_threads) * sideLength);
}

void set_num_threads(const long n) {
Expand Down
8 changes: 3 additions & 5 deletions pyci/src/hci.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -267,11 +267,9 @@ long add_hci(const SQuantOp &ham, WfnType &wfn, const double *coeffs, const doub
v_threads.emplace_back(&hci_thread<WfnType>, 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;
}

Expand Down