Skip to content
Merged
Show file tree
Hide file tree
Changes from 15 commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
f99ad4d
debug 4749
iProzd Aug 14, 2025
ba8f52e
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Aug 14, 2025
aa8b3a8
fix cmake
iProzd Aug 14, 2025
4dab5d8
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Aug 14, 2025
4a2027e
fix bugs
iProzd Aug 26, 2025
a4f565f
Update DeepPotPT.cc
iProzd Aug 27, 2025
58e340c
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Aug 27, 2025
e0626dd
Update DeepPotPT.cc
iProzd Aug 27, 2025
73ad268
wrapped a func
iProzd Aug 27, 2025
7167591
fix const
iProzd Aug 27, 2025
619b158
Merge branch 'devel' into D0814_debug_c_nlist
iProzd Aug 27, 2025
e8b889e
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Aug 27, 2025
2114514
Update test_lammps_dpa_pt.py
iProzd Aug 27, 2025
af2411d
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Aug 27, 2025
69a9086
Merge branch 'master' into D0814_debug_c_nlist
wanghan-iapcm Feb 20, 2026
bb13cdf
revert old fix
iProzd Feb 25, 2026
0411338
use own comm data for remapped sendlist
iProzd Feb 25, 2026
b415c67
Update common.cc
iProzd Feb 25, 2026
3068a24
Revert commit
iProzd Mar 3, 2026
c8e4be1
Merge branch 'master' into D0814_debug_c_nlist
iProzd Mar 3, 2026
5875158
update fix, ref to #5268
iProzd Mar 3, 2026
78fdc64
Delete test_select_real_atoms_sendlist.cc
iProzd Mar 3, 2026
773c4e6
Create test_select_real_atoms_sendlist.cc
iProzd Mar 3, 2026
b061270
Update DeepSpinPT.cc
iProzd Mar 3, 2026
9afc5c0
fix PD
iProzd Mar 3, 2026
280729f
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Mar 3, 2026
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
3 changes: 3 additions & 0 deletions source/api_cc/include/common.h
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,9 @@ void select_real_atoms_coord(std::vector<VALUETYPE>& dcoord,
const int& nall,
const bool aparam_nall = false);

void select_real_atoms_sendlist(const deepmd::InputNlist& inlist,
const std::vector<int>& fwd_map);

/**
* @brief Apply the given map to a vector.
* @param[out] out The output vector.
Expand Down
1 change: 1 addition & 0 deletions source/api_cc/src/DeepPotPD.cc
Original file line number Diff line number Diff line change
Expand Up @@ -399,6 +399,7 @@ void DeepPotPD::compute(ENERGYVTYPE& ener,
auto sendlist_tensor = predictor_fl->GetInputHandle("send_list");

int nswap = lmp_list.nswap;
select_real_atoms_sendlist(lmp_list, fwd_map);
sendproc_tensor->Reshape({nswap});
Comment thread
iProzd marked this conversation as resolved.
sendproc_tensor->CopyFromCpu(lmp_list.sendproc);

Expand Down
1 change: 1 addition & 0 deletions source/api_cc/src/DeepPotPT.cc
Original file line number Diff line number Diff line change
Expand Up @@ -212,6 +212,7 @@ void DeepPotPT::compute(ENERGYVTYPE& ener,
nlist_data.padding();
if (do_message_passing) {
int nswap = lmp_list.nswap;
select_real_atoms_sendlist(lmp_list, fwd_map);
torch::Tensor sendproc_tensor =
torch::from_blob(lmp_list.sendproc, {nswap}, int32_option);
torch::Tensor recvproc_tensor =
Expand Down
1 change: 1 addition & 0 deletions source/api_cc/src/DeepSpinPT.cc
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,7 @@ void DeepSpinPT::compute(ENERGYVTYPE& ener,
nlist_data.padding();
if (do_message_passing) {
int nswap = lmp_list.nswap;
select_real_atoms_sendlist(lmp_list, fwd_map);
torch::Tensor sendproc_tensor =
Comment thread
iProzd marked this conversation as resolved.
Outdated
torch::from_blob(lmp_list.sendproc, {nswap}, int32_option);
torch::Tensor recvproc_tensor =
Expand Down
25 changes: 25 additions & 0 deletions source/api_cc/src/common.cc
Original file line number Diff line number Diff line change
Expand Up @@ -232,6 +232,31 @@ template void deepmd::select_real_atoms_coord<float>(
const int& nall,
const bool aparam_nall);

void deepmd::select_real_atoms_sendlist(const deepmd::InputNlist& inlist,
const std::vector<int>& fwd_map) {
int nswap = inlist.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(inlist.sendnum[s]);
for (int k = 0; k < inlist.sendnum[s]; ++k) {
const int old_idx = inlist.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(inlist.sendlist[s], sendlist_new[s].data(), cnt * sizeof(int));
Comment thread
iProzd marked this conversation as resolved.
Outdated
inlist.sendnum[s] = cnt;
inlist.recvnum[s] = cnt;
Comment thread
iProzd marked this conversation as resolved.
Outdated
}
}

void deepmd::NeighborListData::copy_from_nlist(const InputNlist& inlist,
const int natoms) {
int inum = natoms >= 0 ? natoms : inlist.inum;
Expand Down
6 changes: 6 additions & 0 deletions source/lmp/tests/test_lammps_dpa_pt.py
Original file line number Diff line number Diff line change
Expand Up @@ -495,6 +495,12 @@ def test_pair_deepmd_type_map(lammps_type_map) -> None:
lammps_type_map.run(1)


def test_pair_deepmd_type_map_with_null(lammps_type_map) -> None:
lammps_type_map.pair_style(f"deepmd {pb_file.resolve()}")
lammps_type_map.pair_coeff("* * H NULL")
lammps_type_map.run(0)

Comment thread
iProzd marked this conversation as resolved.

def test_pair_deepmd_real(lammps_real) -> None:
lammps_real.pair_style(f"deepmd {pb_file.resolve()}")
lammps_real.pair_coeff("* *")
Expand Down
Loading