adjust error messaging for rho[i] > rhomax in EAM

This commit is contained in:
Steve Plimpton
2024-04-15 17:24:47 -06:00
parent 1924a06466
commit 16e5fce31e
2 changed files with 11 additions and 9 deletions

View File

@ -43,7 +43,6 @@ PairEAM::PairEAM(LAMMPS *lmp) : Pair(lmp)
unit_convert_flag = utils::get_supported_conversions(utils::ENERGY);
nmax = 0;
exceeded_rhomax = 0;
rho = nullptr;
fp = nullptr;
numforce = nullptr;
@ -146,10 +145,11 @@ void PairEAM::compute(int eflag, int vflag)
double *coeff;
int *ilist,*jlist,*numneigh,**firstneigh;
int beyond_rhomax = 0;
evdwl = 0.0;
ev_init(eflag,vflag);
int beyond_rhomax = 0;
// grow energy and fp arrays if necessary
// need to be atom->nmax in length
@ -327,13 +327,13 @@ void PairEAM::compute(int eflag, int vflag)
}
}
if (eflag && (exceeded_rhomax >= 0)) {
if (eflag && (!exceeded_rhomax)) {
MPI_Allreduce(&beyond_rhomax, &exceeded_rhomax, 1, MPI_INT, MPI_MAX, world);
if (exceeded_rhomax > 0) {
if (exceeded_rhomax) {
if (comm->me == 0)
error->warning(FLERR, "Local rho[i] exceeded rhomax of EAM potential table. "
"Computed embedding term is unreliable.");
exceeded_rhomax = -1;
error->warning(FLERR,
"A per-atom density exceeded rhomax of EAM potential table - "
"a linear extrapolation to the energy was made");
}
}

View File

@ -64,10 +64,12 @@ class PairEAM : public Pair {
protected:
int nmax; // allocated size of per-atom arrays
int exceeded_rhomax; // 0 or 1 when rho[i] exceeded rhomax, -1 when not to check
double cutforcesq;
double **scale;
bigint embedstep; // timestep, the embedding term was computed
bigint embedstep; // timestep, the embedding term was computed
int exceeded_rhomax; // global flag for whether rho[i] has exceeded rhomax
// on a step energy is computed - 0 = no, 1 = yes
// per-atom arrays