diff --git a/src/atom.cpp b/src/atom.cpp index 95f5406d95..72bdc8a0e7 100644 --- a/src/atom.cpp +++ b/src/atom.cpp @@ -1884,11 +1884,19 @@ void Atom::setup_sort_bins() // user setting if explicitly set // default = 1/2 of neighbor cutoff // check if neighbor cutoff = 0.0 + // and in that case, disable sorting double binsize; if (userbinsize > 0.0) binsize = userbinsize; - else binsize = 0.5 * neighbor->cutneighmax; - if (binsize == 0.0) error->all(FLERR,"Atom sorting has bin size = 0.0"); + else if (neighbor->cutneighmax > 0.0) binsize = 0.5 * neighbor->cutneighmax; + + if ((binsize == 0.0) && (sortfreq > 0)) { + sortfreq = 0; + if (comm->me == 0) + error->warning(FLERR,"No pairwise cutoff or binsize set. " + "Atom sorting therefore disabled."); + return; + } double bininv = 1.0/binsize;