Skip to content
Draft
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
21 changes: 21 additions & 0 deletions source/api_cc/src/DeepPotPT.cc
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,27 @@ void DeepPotPT::compute(ENERGYVTYPE& ener,
nlist_data.padding();
if (do_message_passing) {
int nswap = lmp_list.nswap;
std::vector<std::vector<int>> sendlist_new;
sendlist_new.resize(nswap);
// select real atoms in sendlist
for (int s = 0; s < nswap; ++s) {
int cnt = 0;
sendlist_new[s].reserve(lmp_list.sendnum[s]);
for (int k = 0; k < lmp_list.sendnum[s]; ++k) {
const int old_idx = lmp_list.sendlist[s][k];
int mapped = (old_idx >= 0 && old_idx < (int)fwd_map.size())
? fwd_map[old_idx]
: -1;
if (mapped >= 0) {
sendlist_new[s].push_back(mapped);
++cnt;
}
}
std::memcpy(lmp_list.sendlist[s], sendlist_new[s].data(),
cnt * sizeof(int));
lmp_list.sendnum[s] = cnt;
lmp_list.recvnum[s] = cnt;
}
torch::Tensor sendproc_tensor =
torch::from_blob(lmp_list.sendproc, {nswap}, int32_option);
torch::Tensor recvproc_tensor =
Expand Down
Loading