we need to use Error::one() since not all MPI ranks might trigger

This commit is contained in:
Axel Kohlmeyer
2022-10-26 16:14:48 -04:00
parent e4ca652648
commit a714a60ed3

View File

@ -240,16 +240,19 @@ void FixPair::post_force(int /*vflag*/)
// extract pair style fields one by one // extract pair style fields one by one
// store their values in this fix // store their values in this fix
int nlocal = atom->nlocal; const int nlocal = atom->nlocal;
int icol = 0; int icol = 0;
int columns; int columns;
for (int ifield = 0; ifield < nfield; ifield++) { for (int ifield = 0; ifield < nfield; ifield++) {
void *pvoid = pstyle->extract_peratom(fieldname[ifield],columns); void *pvoid = pstyle->extract_peratom(fieldname[ifield],columns);
//pvoid could return nullptr if no atoms in current spatial domain
if (pvoid == nullptr && nlocal>0) // Pair::extract_peratom() may return a null pointer if there are no atoms the sub-domain
error->all(FLERR,"Fix pair pair style cannot extract {}",fieldname[ifield]); // so returning null is only an error if there are local atoms.
if ((pvoid == nullptr) && (nlocal > 0))
error->one(FLERR, "Fix pair cannot extract property {} from pair style", fieldname[ifield]);
if (columns == 0) { if (columns == 0) {
double *pvector = (double *) pvoid; double *pvector = (double *) pvoid;