abort with an error if Pair::single() cannot work for granular pair style

This commit is contained in:
Axel Kohlmeyer
2020-11-01 16:10:16 -05:00
parent 0b51bba75c
commit b1de97a3cd

View File

@ -1398,6 +1398,10 @@ double PairGranular::single(int i, int j, int itype, int jtype,
int *jlist;
double *history,*allhistory;
int nall = atom->nlocal + atom->nghost;
if ((i >= nall) || (j >= nall))
error->all(FLERR,"Not enough atoms for pair granular single function");
double *radius = atom->radius;
radi = radius[i];
radj = radius[j];
@ -1529,8 +1533,8 @@ double PairGranular::single(int i, int j, int itype, int jtype,
jlist = list->firstneigh[i];
if (use_history) {
if (fix_history == nullptr)
error->one(FLERR,"Pair::single() computation needs history");
if ((fix_history == nullptr) || (fix_history->firstvalue == nullptr))
error->one(FLERR,"Pair granular single computation needs history");
allhistory = fix_history->firstvalue[i];
for (int jj = 0; jj < jnum; jj++) {
neighprev++;