Commit 62601678 authored by Axel Kohlmeyer's avatar Axel Kohlmeyer
Browse files

when growing arrays with reallocate, always check against atom->nmax and not...

when growing arrays with reallocate, always check against atom->nmax and not atom->nlocal or else these arrays may be of inconsistent size and communication can lead to data corruption
parent 081910ad
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -220,7 +220,7 @@ void FixNEB::init()
  if (atom->natoms > MAXSMALLINT) error->all(FLERR,"Too many atoms for NEB");
  ntotal = atom->natoms;

  if (atom->nlocal > maxlocal) reallocate();
  if (atom->nmax > maxlocal) reallocate();

  if (MULTI_PROC && counts == NULL) {
    memory->create(xsendall,ntotal,3,"neb:xsendall");
@@ -624,7 +624,7 @@ void FixNEB::inter_replica_comm()

  // reallocate memory if necessary

  if (atom->nlocal > maxlocal) reallocate();
  if (atom->nmax > maxlocal) reallocate();

  double **x = atom->x;
  double **f = atom->f;