move memory allocation for atom style variable data where it belongs and cannot be skipped

this fixes the bug reported on lammps-users on 2020-01-22 by Olivier Politano
This commit is contained in:
Axel Kohlmeyer 2020-01-22 14:34:12 -05:00
parent cc81dc2046
commit 48cae2703b
No known key found for this signature in database
GPG Key ID: D9B44E93BF0C375A
1 changed files with 4 additions and 6 deletions

View File

@ -316,6 +316,10 @@ void ComputeGlobalAtom::compute_peratom()
nmax = atom->nmax;
memory->destroy(indices);
memory->create(indices,nmax,"global/atom:indices");
if (whichref == VARIABLE) {
memory->destroy(varatom);
memory->create(varatom,nmax,"global/atom:varatom");
}
if (nvalues == 1) {
memory->destroy(vector_atom);
memory->create(vector_atom,nmax,"global/atom:vector_atom");
@ -373,12 +377,6 @@ void ComputeGlobalAtom::compute_peratom()
}
} else if (whichref == VARIABLE) {
if (atom->nmax > nmax) {
nmax = atom->nmax;
memory->destroy(varatom);
memory->create(varatom,nmax,"global/atom:varatom");
}
input->variable->compute_atom(ref2index,igroup,varatom,1,0);
for (i = 0; i < nlocal; i++)
if (mask[i] & groupbit)