we need to use Error::one() since not all MPI ranks might trigger
This commit is contained in:
@ -240,16 +240,19 @@ void FixPair::post_force(int /*vflag*/)
|
||||
// extract pair style fields one by one
|
||||
// store their values in this fix
|
||||
|
||||
int nlocal = atom->nlocal;
|
||||
const int nlocal = atom->nlocal;
|
||||
|
||||
int icol = 0;
|
||||
int columns;
|
||||
|
||||
for (int ifield = 0; ifield < nfield; ifield++) {
|
||||
void *pvoid = pstyle->extract_peratom(fieldname[ifield],columns);
|
||||
//pvoid could return nullptr if no atoms in current spatial domain
|
||||
if (pvoid == nullptr && nlocal>0)
|
||||
error->all(FLERR,"Fix pair pair style cannot extract {}",fieldname[ifield]);
|
||||
|
||||
// Pair::extract_peratom() may return a null pointer if there are no atoms the sub-domain
|
||||
// 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) {
|
||||
double *pvector = (double *) pvoid;
|
||||
|
||||
Reference in New Issue
Block a user