address segfault issue with fix nve/gpu when group is not "all"

This commit is contained in:
Axel Kohlmeyer
2021-12-29 14:06:22 -05:00
parent 5d8b83a251
commit d130aa4289

View File

@ -37,7 +37,7 @@ using namespace FixConst;
FixNVEGPU::FixNVEGPU(LAMMPS *lmp, int narg, char **arg) :
FixNVE(lmp, narg, arg)
{
_dtfm = 0;
_dtfm = nullptr;
_nlocal_max = 0;
}
@ -57,7 +57,11 @@ void FixNVEGPU::setup(int vflag)
_respa_on = 1;
else
_respa_on = 0;
if (atom->ntypes > 1) reset_dt();
// ensure that _dtfm array is initialized if the group is not "all"
// or there is more than one atom type as that re-ordeted array is used for
// per-type/per-atom masses and group membership detection.
if ((igroup != 0) || (atom->ntypes > 1)) reset_dt();
}
/* ----------------------------------------------------------------------