forked from lijiext/lammps
make old_velocities allocation safer while retaining the test for nlocal
This commit is contained in:
parent
09ad293425
commit
4de9cec1b6
|
@ -250,7 +250,7 @@ FixMSST::FixMSST(LAMMPS *lmp, int narg, char **arg) :
|
||||||
nrigid = 0;
|
nrigid = 0;
|
||||||
rfix = NULL;
|
rfix = NULL;
|
||||||
|
|
||||||
maxold = 0;
|
maxold = -1;
|
||||||
old_velocity = NULL;
|
old_velocity = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -458,7 +458,7 @@ void FixMSST::initial_integrate(int vflag)
|
||||||
|
|
||||||
// realloc old_velocity if necessary
|
// realloc old_velocity if necessary
|
||||||
|
|
||||||
if (atom->nmax > maxold) {
|
if (nlocal > maxold) {
|
||||||
memory->destroy(old_velocity);
|
memory->destroy(old_velocity);
|
||||||
maxold = atom->nmax;
|
maxold = atom->nmax;
|
||||||
memory->create(old_velocity,maxold,3,"msst:old_velocity");
|
memory->create(old_velocity,maxold,3,"msst:old_velocity");
|
||||||
|
|
Loading…
Reference in New Issue