Unverified Commit 48cae270 authored by Axel Kohlmeyer's avatar Axel Kohlmeyer
Browse files

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
parent cc81dc20
Loading
Loading
Loading
Loading
+4 −6
Original line number Diff line number Diff line
@@ -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)