diff --git a/src/reset_atoms_id.cpp b/src/reset_atoms_id.cpp index 26685f1972..c0fce95326 100644 --- a/src/reset_atoms_id.cpp +++ b/src/reset_atoms_id.cpp @@ -43,7 +43,9 @@ static int compare_coords(const int, const int, void *); /* ---------------------------------------------------------------------- */ -ResetAtomsID::ResetAtomsID(LAMMPS *lmp) : Command(lmp) {} +ResetAtomsID::ResetAtomsID(LAMMPS *lmp) : Command(lmp) { + binlo = binhi = -1; +} /* ---------------------------------------------------------------------- */ @@ -480,6 +482,9 @@ int ResetAtomsID::sort_bins(int n, char *inbuf, int &flag, int *&proclist, char bigint binlo = rptr->binlo; bigint binhi = rptr->binhi; + if ((binlo < 0) || (binhi < 0)) + error->one(FLERR, "Called sort_bins without previous setup of bins"); + // nbins = my subset of bins from binlo to binhi-1 // initialize linked lists of my Rvous atoms in each bin