diff --git a/src/compute_property_atom.cpp b/src/compute_property_atom.cpp index 0c20744a5c..56282052c4 100644 --- a/src/compute_property_atom.cpp +++ b/src/compute_property_atom.cpp @@ -23,6 +23,7 @@ #include "atom_vec_body.h" #include "update.h" #include "domain.h" +#include "comm.h" #include "memory.h" #include "error.h" @@ -57,6 +58,8 @@ ComputePropertyAtom::ComputePropertyAtom(LAMMPS *lmp, int narg, char **arg) : error->all(FLERR,"Compute property/atom for " "atom property that isn't allocated"); pack_choice[i] = &ComputePropertyAtom::pack_molecule; + } else if (strcmp(arg[iarg],"proc") == 0) { + pack_choice[i] = &ComputePropertyAtom::pack_proc; } else if (strcmp(arg[iarg],"type") == 0) { pack_choice[i] = &ComputePropertyAtom::pack_type; } else if (strcmp(arg[iarg],"mass") == 0) { @@ -455,6 +458,21 @@ void ComputePropertyAtom::pack_molecule(int n) /* ---------------------------------------------------------------------- */ +void ComputePropertyAtom::pack_proc(int n) +{ + int *mask = atom->mask; + int nlocal = atom->nlocal; + int me = comm->me; + + for (int i = 0; i < nlocal; i++) { + if (mask[i] & groupbit) buf[n] = me; + else buf[n] = 0.0; + n += nvalues; + } +} + +/* ---------------------------------------------------------------------- */ + void ComputePropertyAtom::pack_type(int n) { int *type = atom->type; diff --git a/src/compute_property_atom.h b/src/compute_property_atom.h index 8b4e958573..9315813f8e 100644 --- a/src/compute_property_atom.h +++ b/src/compute_property_atom.h @@ -49,6 +49,7 @@ class ComputePropertyAtom : public Compute { void pack_id(int); void pack_molecule(int); + void pack_proc(int); void pack_type(int); void pack_mass(int);