Skip to content

Commit

Permalink
fix mod
Browse files Browse the repository at this point in the history
Signed-off-by: Jinzhe Zeng <[email protected]>
  • Loading branch information
njzjz authored Nov 2, 2023
1 parent 9331ce4 commit d60fc2a
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions source/lmp/pair_deepmd.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -336,9 +336,13 @@ void PairDeepMD::make_ttm_aparam(vector<double> &daparam) {
double xscale = (x[ii][0] - domain->boxlo[0]) / domain->xprd;
double yscale = (x[ii][1] - domain->boxlo[1]) / domain->yprd;
double zscale = (x[ii][2] - domain->boxlo[2]) / domain->zprd;
int ixnode = static_cast<int>(xscale * nxnodes) % nxnodes;
int iynode = static_cast<int>(yscale * nynodes) % nynodes;
int iznode = static_cast<int>(zscale * nznodes) % nznodes;
int ixnode = static_cast<int>(xscale * nxnodes);
int iynode = static_cast<int>(yscale * nynodes);
int iznode = static_cast<int>(zscale * nznodes);
// https://stackoverflow.com/a/1907585/9567349
ixnode = ((ixnode % nxnodes) + nxnodes) % nxnodes;
iynode = ((iynode % nynodes) + nynodes) % nynodes;
iznode = ((iznode % nznodes) + nznodes) % nznodes;

Check warning on line 345 in source/lmp/pair_deepmd.cpp

View check run for this annotation

Codecov / codecov/patch

source/lmp/pair_deepmd.cpp#L343-L345

Added lines #L343 - L345 were not covered by tests
daparam[ii] = T_electron[ixnode][iynode][iznode];
}
}
Expand Down

0 comments on commit d60fc2a

Please sign in to comment.