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
|
// 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;
|
||||||
|
|||||||
Reference in New Issue
Block a user