revert workarounds in compute rdf and adf now that the issue is fixed at the root

This commit is contained in:
Axel Kohlmeyer
2025-01-16 00:38:31 -05:00
parent 36dcb294b3
commit 00f23d4829
2 changed files with 3 additions and 70 deletions

View File

@ -331,32 +331,6 @@ void ComputeADF::init()
if ((neighbor->style == Neighbor::MULTI) || (neighbor->style == Neighbor::MULTI_OLD))
error->all(FLERR, "Compute adf with custom cutoffs requires neighbor style 'bin' or 'nsq'");
// check if the pair style cutoff varies
double pairmaxcut, pairmincut;
double skin = neighbor->skin;
double cutoff_user = mycutneigh - skin;
if (force->pair) {
pairmaxcut = 0.0;
pairmincut = BIG;
for (int i = 1; i <= atom->ntypes; i++)
for (int j = i; j <= atom->ntypes; j++) {
const double cut = sqrt(force->pair->cutsq[i][j]);
pairmaxcut = MAX(pairmaxcut, cut);
pairmincut = MIN(pairmincut, cut);
}
} else {
pairmaxcut = pairmincut = cutoff_user;
}
// if the pair-wise cutoff varies for different pairs of types, the neighbor list code
// will still re-use the pairwise neighbor list if the *largest* cutoff is sufficient.
// this will lead to incorrect results and a larger user cutoff is required.
if ((cutoff_user > pairmincut) && (cutoff_user <= pairmaxcut))
error->all(FLERR,"Compute adf max cutoff {} must be larger than the maximum pair-wise "
"cutoff {} when the pair-wise cutoff varies", cutoff_user, pairmaxcut);
req->set_cutoff(mycutneigh);
}
}

View File

@ -38,8 +38,6 @@
using namespace LAMMPS_NS;
using namespace MathConst;
static constexpr double BIG = 1.0e20;
/* ---------------------------------------------------------------------- */
ComputeRDF::ComputeRDF(LAMMPS *lmp, int narg, char **arg) :
@ -175,58 +173,19 @@ void ComputeRDF::init()
if (!force->pair && !cutflag)
error->all(FLERR,"Compute rdf requires a pair style or an explicit cutoff");
// check if the pair style cutoff varies
double pairmaxcut, pairmincut;
if (force->pair) {
pairmaxcut = 0.0;
pairmincut = BIG;
for (int i = 1; i <= atom->ntypes; i++)
for (int j = i; j <= atom->ntypes; j++) {
const double cut = sqrt(force->pair->cutsq[i][j]);
pairmaxcut = MAX(pairmaxcut, cut);
pairmincut = MIN(pairmincut, cut);
}
} else {
pairmaxcut = pairmincut = cutoff_user;
}
if (cutflag) {
mycutneigh = cutoff_user + skin;
double cutghost; // as computed by Neighbor and Comm
double cutforce = 0.0; // largest pairwise cutoff plus skin
if (force->pair) cutforce = force->pair->cutforce + skin;
if (force->pair)
cutghost = MAX(force->pair->cutforce+skin,comm->cutghostuser);
else
cutghost = comm->cutghostuser;
if (force->pair) cutghost = MAX(force->pair->cutforce+skin,comm->cutghostuser);
else cutghost = comm->cutghostuser;
if (mycutneigh > cutghost)
error->all(FLERR,"Compute rdf cutoff plus skin {} exceeds ghost atom range {} - "
"use comm_modify cutoff command to increase it", mycutneigh, cutghost);
// if the pair-wise cutoff varies for different pairs of types, the neighbor list code
// will still re-use the pairwise neighbor list if the *largest* cutoff is sufficient.
// this will lead to incorrect results and a larger user cutoff is required.
if ((cutoff_user > pairmincut) && (cutoff_user <= pairmaxcut))
error->all(FLERR,"Compute rdf cutoff {} must be larger than the maximum pair-wise cutoff {} "
"when the pair-wise cutoff varies", cutoff_user, pairmaxcut);
if (force->pair && (cutoff_user < pairmaxcut)) {
if (comm->me == 0)
error->warning(FLERR,"Compute rdf cutoff {} is less than the pair-wise cutoff {} - "
"forcing a needless neighbor list build", cutoff_user, pairmaxcut);
}
delr = cutoff_user / nbin;
} else {
if ((pairmincut != pairmaxcut) && (comm->me == 0))
error->warning(FLERR,"Pair-wise cutoff varies between {} and {}. Individual rdf functions "
"are only correct up to that cutoff - Use cutoff keyword to force a common "
"cutoff", pairmincut, pairmaxcut);
delr = force->pair->cutforce / nbin;
}
} delr = force->pair->cutforce / nbin;
delrinv = 1.0/delr;