diff --git a/src/AMOEBA/pair_amoeba.cpp b/src/AMOEBA/pair_amoeba.cpp index 8229684d29..1ea4450432 100644 --- a/src/AMOEBA/pair_amoeba.cpp +++ b/src/AMOEBA/pair_amoeba.cpp @@ -2077,16 +2077,25 @@ void *PairAmoeba::extract(const char *str, int &dim) if (strcmp(str,"opbend_pentic") == 0) return (void *) &opbend_pentic; if (strcmp(str,"opbend_sextic") == 0) return (void *) &opbend_sextic; - // peratom requests from FixPair - // return dim = # of quantites per atom - // 0 = per-atom vector - // 1 or more = # of columns in per-atom array + return nullptr; +} +/* ---------------------------------------------------------------------- + peratom requests from FixPair + return ptr to requested data + also return ncol = # of quantites per atom + 0 = per-atom vector + 1 or more = # of columns in per-atom array + return NULL if str is not recognized +---------------------------------------------------------------------- */ + +void *PairAmoeba::extract_peratom(const char *str, int &ncol) +{ if (strcmp(str,"uind") == 0) { - dim = 3; + ncol = 3; return (void *) uind; } else if (strcmp(str,"uinp") == 0) { - dim = 3; + ncol = 3; return (void *) uinp; } diff --git a/src/AMOEBA/pair_amoeba.h b/src/AMOEBA/pair_amoeba.h index 7b0719bca0..869a5aff4f 100644 --- a/src/AMOEBA/pair_amoeba.h +++ b/src/AMOEBA/pair_amoeba.h @@ -50,6 +50,7 @@ class PairAmoeba : public Pair { void unpack_reverse_grid(int, void *, int, int *) override; void *extract(const char *, int &) override; + void *extract_peratom(const char *, int &) override; double memory_usage() override; protected: diff --git a/src/MANYBODY/pair_eam.cpp b/src/MANYBODY/pair_eam.cpp index 2534386225..b14d47f7f0 100644 --- a/src/MANYBODY/pair_eam.cpp +++ b/src/MANYBODY/pair_eam.cpp @@ -934,16 +934,25 @@ void *PairEAM::extract(const char *str, int &dim) dim = 2; if (strcmp(str,"scale") == 0) return (void *) scale; - // peratom requests from FixPair - // return dim = # of quantites per atom - // 0 = per-atom vector - // 1 or more = # of columns in per-atom array + return nullptr; +} +/* ---------------------------------------------------------------------- + peratom requests from FixPair + return ptr to requested data + also return ncol = # of quantites per atom + 0 = per-atom vector + 1 or more = # of columns in per-atom array + return NULL if str is not recognized +---------------------------------------------------------------------- */ + +void *PairEAM::extract_peratom(const char *str, int &ncol) +{ if (strcmp(str,"rho") == 0) { - dim = 0; + ncol = 0; return (void *) rho; } else if (strcmp(str,"fp") == 0) { - dim = 0; + ncol = 0; return (void *) fp; } diff --git a/src/MANYBODY/pair_eam.h b/src/MANYBODY/pair_eam.h index 3589ab4ab0..11ab969d18 100644 --- a/src/MANYBODY/pair_eam.h +++ b/src/MANYBODY/pair_eam.h @@ -53,6 +53,7 @@ class PairEAM : public Pair { double init_one(int, int) override; double single(int, int, int, int, double, double, double, double &) override; void *extract(const char *, int &) override; + void *extract_peratom(const char *, int &) override; int pack_forward_comm(int, int *, double *, int, int *) override; void unpack_forward_comm(int, int, double *) override; diff --git a/src/fix_pair.cpp b/src/fix_pair.cpp index fafc86d903..bc918c468c 100644 --- a/src/fix_pair.cpp +++ b/src/fix_pair.cpp @@ -83,15 +83,15 @@ FixPair::FixPair(LAMMPS *lmp, int narg, char **arg) : triggerptr = new int*[nfield]; - int dim; ncols = 0; for (int ifield = 0; ifield < nfield; ifield++) { int columns = 0; // set in case fieldname not recognized by pstyle - void *pvoid = pstyle->extract(fieldname[ifield],columns); + void *pvoid = pstyle->extract_peratom(fieldname[ifield],columns); if (columns) ncols += columns; else ncols++; if (trigger[ifield]) { + int dim; triggerptr[ifield] = (int *) pstyle->extract(triggername[ifield],dim); if (!triggerptr[ifield]) error->all(FLERR,"Fix pair pair style cannot extract {}", @@ -222,7 +222,7 @@ void FixPair::post_force(int /*vflag*/) int columns; for (int ifield = 0; ifield < nfield; ifield++) { - void *pvoid = pstyle->extract(fieldname[ifield],columns); + void *pvoid = pstyle->extract_peratom(fieldname[ifield],columns); if (pvoid == nullptr) error->all(FLERR,"Fix pair pair style cannot extract {}",fieldname[ifield]); diff --git a/src/pair.h b/src/pair.h index 048abb6bb9..8cda065e19 100644 --- a/src/pair.h +++ b/src/pair.h @@ -215,6 +215,7 @@ class Pair : protected Pointers { // specific child-class methods for certain Pair styles virtual void *extract(const char *, int &) { return nullptr; } + virtual void *extract_peratom(const char *, int &) { return nullptr; } virtual void swap_eam(double *, double **) {} virtual void reset_dt() {} virtual void min_xf_pointers(int, double **, double **) {}