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

replace hard crash with disabling atom sorting, when no suitable binsize is found

parent 09abc0c7
Loading
Loading
Loading
Loading
+10 −2
Original line number Diff line number Diff line
@@ -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;