Commit 420db445 authored by Axel Kohlmeyer's avatar Axel Kohlmeyer
Browse files

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

parent 286d4f27
Loading
Loading
Loading
Loading
+31 −7
Original line number Diff line number Diff line
@@ -69,18 +69,42 @@ void ComputeForceTally::init()
  else
    force->pair->add_tally_callback(this);

  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 ((comm->me == 0) && (force->bond || force->angle || force->dihedral
                          || force->improper || force->kspace))
    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
+1 −0
Original line number Diff line number Diff line
@@ -31,6 +31,7 @@ class ComputeForceTally : public Compute {
  virtual ~ComputeForceTally();

  void init();
  void setup();

  double compute_scalar();
  void compute_peratom();
+7 −6
Original line number Diff line number Diff line
@@ -68,13 +68,14 @@ void ComputeHeatFluxTally::init()
  else
    force->pair->add_tally_callback(this);

  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 ((comm->me == 0) && (force->bond || force->angle || force->dihedral
                          || force->improper || force->kspace))
    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;
}

+7 −6
Original line number Diff line number Diff line
@@ -66,13 +66,14 @@ void ComputePEMolTally::init()
  if (atom->molecule_flag == 0)
    error->all(FLERR,"Compute pe/mol/tally requires molecule IDs");

  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 ((comm->me == 0) && (force->bond || force->angle || force->dihedral
                          || force->improper || force->kspace))
    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;
}

+7 −6
Original line number Diff line number Diff line
@@ -68,13 +68,14 @@ void ComputePETally::init()
  else
    force->pair->add_tally_callback(this);

  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 ((comm->me == 0) && (force->bond || force->angle || force->dihedral
                          || force->improper || force->kspace))
    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;
}

Loading