print incompatible pair style warnings in USER-TALLY only on MPI rank 0

This commit is contained in:
Axel Kohlmeyer
2017-06-12 20:05:15 -04:00
parent 286d4f2743
commit 420db44596
6 changed files with 60 additions and 31 deletions

View File

@ -69,18 +69,42 @@ void ComputeForceTally::init()
else
force->pair->add_tally_callback(this);
if (force->pair->single_enable == 0 || force->pair->manybody_flag)
error->warning(FLERR,"Compute force/tally used with incompatible pair style");
if ((comm->me == 0) && (force->bond || force->angle || force->dihedral
|| force->improper || force->kspace))
error->warning(FLERR,"Compute force/tally only called from pair style");
if (comm->me == 0) {
if (force->pair->single_enable == 0 || force->pair->manybody_flag)
error->warning(FLERR,"Compute force/tally used with incompatible pair style");
if (force->bond || force->angle || force->dihedral
|| force->improper || force->kspace)
error->warning(FLERR,"Compute force/tally only called from pair style");
}
did_compute = -1;
}
/* ---------------------------------------------------------------------- */
void ComputeForceTally::setup()
{
const int ntotal = atom->nlocal + atom->nghost;
if (atom->nmax > nmax) {
memory->destroy(fatom);
nmax = atom->nmax;
memory->create(fatom,nmax,size_peratom_cols,"force/tally:fatom");
array_atom = fatom;
}
// clear storage as needed
for (int i=0; i < ntotal; ++i)
for (int j=0; j < size_peratom_cols; ++j)
fatom[i][j] = 0.0;
for (int i=0; i < size_peratom_cols; ++i)
vector[i] = ftotal[i] = 0.0;
}
/* ---------------------------------------------------------------------- */
void ComputeForceTally::pair_tally_callback(int i, int j, int nlocal, int newton,
double, double, double fpair,
double dx, double dy, double dz)
@ -197,7 +221,7 @@ double ComputeForceTally::compute_scalar()
void ComputeForceTally::compute_peratom()
{
invoked_peratom = update->ntimestep;
if ((did_compute != invoked_peratom) || (update->eflag_global != invoked_peratom))
if (((atom->nlocal > 0) && (did_compute != invoked_peratom)) || (update->eflag_global != invoked_peratom))
error->all(FLERR,"Energy was not tallied on needed timestep");
// collect contributions from ghost atoms

View File

@ -31,6 +31,7 @@ class ComputeForceTally : public Compute {
virtual ~ComputeForceTally();
void init();
void setup();
double compute_scalar();
void compute_peratom();

View File

@ -68,13 +68,14 @@ void ComputeHeatFluxTally::init()
else
force->pair->add_tally_callback(this);
if (force->pair->single_enable == 0 || force->pair->manybody_flag)
error->warning(FLERR,"Compute heat/flux/tally used with incompatible pair style");
if ((comm->me == 0) && (force->bond || force->angle || force->dihedral
|| force->improper || force->kspace))
error->warning(FLERR,"Compute heat/flux/tally only called from pair style");
if (comm->me == 0) {
if (force->pair->single_enable == 0 || force->pair->manybody_flag)
error->warning(FLERR,"Compute heat/flux/tally used with incompatible pair style");
if (force->bond || force->angle || force->dihedral
|| force->improper || force->kspace)
error->warning(FLERR,"Compute heat/flux/tally only called from pair style");
}
did_compute = -1;
}

View File

@ -66,13 +66,14 @@ void ComputePEMolTally::init()
if (atom->molecule_flag == 0)
error->all(FLERR,"Compute pe/mol/tally requires molecule IDs");
if (force->pair->single_enable == 0 || force->pair->manybody_flag)
error->warning(FLERR,"Compute pe/mol/tally used with incompatible pair style");
if ((comm->me == 0) && (force->bond || force->angle || force->dihedral
|| force->improper || force->kspace))
error->warning(FLERR,"Compute pe/mol/tally only called from pair style");
if (comm->me == 0) {
if (force->pair->single_enable == 0 || force->pair->manybody_flag)
error->warning(FLERR,"Compute pe/mol/tally used with incompatible pair style");
if (force->bond || force->angle || force->dihedral
|| force->improper || force->kspace)
error->warning(FLERR,"Compute pe/mol/tally only called from pair style");
}
did_compute = -1;
}

View File

@ -68,13 +68,14 @@ void ComputePETally::init()
else
force->pair->add_tally_callback(this);
if (force->pair->single_enable == 0 || force->pair->manybody_flag)
error->warning(FLERR,"Compute pe/tally used with incompatible pair style");
if ((comm->me == 0) && (force->bond || force->angle || force->dihedral
|| force->improper || force->kspace))
error->warning(FLERR,"Compute pe/tally only called from pair style");
if (comm->me == 0) {
if (force->pair->single_enable == 0 || force->pair->manybody_flag)
error->warning(FLERR,"Compute pe/tally used with incompatible pair style");
if (force->bond || force->angle || force->dihedral
|| force->improper || force->kspace)
error->warning(FLERR,"Compute pe/tally only called from pair style");
}
did_compute = -1;
}

View File

@ -69,13 +69,14 @@ void ComputeStressTally::init()
else
force->pair->add_tally_callback(this);
if (force->pair->single_enable == 0 || force->pair->manybody_flag)
error->warning(FLERR,"Compute stress/tally used with incompatible pair style");
if ((comm->me == 0) && (force->bond || force->angle || force->dihedral
|| force->improper || force->kspace))
error->warning(FLERR,"Compute stress/tally only called from pair style");
if (comm->me == 0) {
if (force->pair->single_enable == 0 || force->pair->manybody_flag)
error->warning(FLERR,"Compute stress/tally used with incompatible pair style");
if (force->bond || force->angle || force->dihedral
|| force->improper || force->kspace)
error->warning(FLERR,"Compute stress/tally only called from pair style");
}
did_compute = -1;
}