do not allow pairwise cutoffs <= 0.0. avoids undefined behavior and division by zero errors

This commit is contained in:
Axel Kohlmeyer
2017-07-14 13:49:28 -04:00
parent e084d4dad6
commit a04711b21f

View File

@ -242,6 +242,7 @@ void Pair::init()
for (i = 1; i <= atom->ntypes; i++)
for (j = i; j <= atom->ntypes; j++) {
cut = init_one(i,j);
if (cut <= 0.0) error->all(FLERR,"Illegal pair style cutoff <= 0.0");
cutsq[i][j] = cutsq[j][i] = cut*cut;
cutforce = MAX(cutforce,cut);
if (tail_flag) {