Skip to content

Commit

Permalink
fix ener seg fault
Browse files Browse the repository at this point in the history
  • Loading branch information
CaRoLZhangxy committed Mar 28, 2024
1 parent 68846bd commit 6ed68f0
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions source/api_cc/src/DeepPotPT.cc
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,7 @@ void DeepPotPT::compute(ENERGYVTYPE& ener,
int nframes = 1;
if (nloc == 0) {
// no backward map needed
ener.resize(nframes);
// dforce of size nall * 3
force.resize(static_cast<size_t>(nframes) * fwd_map.size() * 3);
fill(force.begin(), force.end(), (VALUETYPE)0.0);
Expand Down Expand Up @@ -270,6 +271,7 @@ void DeepPotPT::compute(ENERGYVTYPE& ener,
int nframes = 1;
if (natoms == 0) {
// no backward map needed
ener.resize(nframes);
// dforce of size nall * 3
force.resize(static_cast<size_t>(nframes) * natoms * 3);
fill(force.begin(), force.end(), (VALUETYPE)0.0);
Expand Down

0 comments on commit 6ed68f0

Please sign in to comment.