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

This commit is contained in:
Axel Kohlmeyer 2018-11-29 01:38:04 -05:00
parent 09abc0c75a
commit ea6d8a5dca
1 changed files with 10 additions and 2 deletions

View File

@ -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;