revise logic and documentation of communication cutoff selection one more time
This commit is contained in:
@ -69,18 +69,15 @@ processors. By default the ghost cutoff = neighbor cutoff = pairwise
|
|||||||
force cutoff + neighbor skin. See the "neighbor"_neighbor.html command
|
force cutoff + neighbor skin. See the "neighbor"_neighbor.html command
|
||||||
for more information about the skin distance. If the specified Rcut is
|
for more information about the skin distance. If the specified Rcut is
|
||||||
greater than the neighbor cutoff, then extra ghost atoms will be acquired.
|
greater than the neighbor cutoff, then extra ghost atoms will be acquired.
|
||||||
If the provided cutoff is smaller, the provided value will be ignored
|
If the provided cutoff is smaller, the provided value will be ignored,
|
||||||
and the ghost cutoff is set to the neighbor cutoff. Specifying a
|
the ghost cutoff is set to the neighbor cutoff and a warning will be
|
||||||
cutoff value of 0.0 will reset any previous value to the default.
|
printed. Specifying a cutoff value of 0.0 will reset any previous value
|
||||||
If bonded interactions exist and equilibrium bond length information is
|
to the default. If bonded interactions exist and equilibrium bond length
|
||||||
available, then also a heuristic based on that bond length (2.0x {r_eq}
|
information is available, then also a heuristic based on that bond length
|
||||||
for systems with dihedrals or improper, 1.5x {r_eq} without) plus
|
is computed. It is used as communication cutoff, if there is no pair
|
||||||
neighbor skin is applied if the communication cutoff is set to its
|
style present and no {comm_modify cutoff} command used. Otherwise a
|
||||||
default value of 0.0. This avoids problems for systems without a pair
|
warning is printed, if this bond based estimate is larger than the
|
||||||
style or where the non-bonded cutoff is (much) shorter than the largest
|
communication cutoff used. A
|
||||||
bond lengths. A warning message is printed, if a specified
|
|
||||||
communication cutoff > 0.0 is overridden or the bond length heuristics
|
|
||||||
lead to a larger communication cutoff.
|
|
||||||
|
|
||||||
The {cutoff/multi} option is equivalent to {cutoff}, but applies to
|
The {cutoff/multi} option is equivalent to {cutoff}, but applies to
|
||||||
communication mode {multi} instead. Since in this case the communication
|
communication mode {multi} instead. Since in this case the communication
|
||||||
|
|||||||
55
src/comm.cpp
55
src/comm.cpp
@ -588,31 +588,43 @@ void Comm::set_proc_grid(int outflag)
|
|||||||
|
|
||||||
/* ----------------------------------------------------------------------
|
/* ----------------------------------------------------------------------
|
||||||
determine suitable communication cutoff.
|
determine suitable communication cutoff.
|
||||||
use the larger of the user specified value and the cutoff required
|
this uses three inputs: 1) maximum neighborlist cutoff, 2) an estimate
|
||||||
by the neighborlist build for pair styles.
|
based on bond lengths and bonded interaction styles present, and 3) a
|
||||||
if bonded interactions exist, apply a heuristic based on the equilibrium
|
user supplied communication cutoff.
|
||||||
bond length (use 1.5x r_bond if no dihedral or improper style exists
|
the neighbor list cutoff (1) is *always* used, since it is a requirement
|
||||||
otherwise 2x r_bond) plus neighbor list skin.
|
for neighborlists working correctly. the bond length based cutoff is
|
||||||
if no user specified communication cutoff is given include this
|
*only* used, if no pair style is defined and no user cutoff is provided.
|
||||||
heuristic, otherwise ignore it.
|
otherwise, a warning is printed. if the bond length based estimate is
|
||||||
|
larger than what is used.
|
||||||
print a warning, if a user specified communication cutoff is overridden.
|
print a warning, if a user specified communication cutoff is overridden.
|
||||||
------------------------------------------------------------------------- */
|
------------------------------------------------------------------------- */
|
||||||
|
|
||||||
double Comm::get_comm_cutoff()
|
double Comm::get_comm_cutoff()
|
||||||
{
|
{
|
||||||
double maxcommcutoff = 0.0;
|
double maxcommcutoff, maxbondcutoff = 0.0;
|
||||||
double maxbondcutoff = 0.0;
|
|
||||||
|
|
||||||
if (force->bond) {
|
if (force->bond) {
|
||||||
int n = atom->nbondtypes;
|
int n = atom->nbondtypes;
|
||||||
for (int i = 1; i <= n; ++i)
|
for (int i = 1; i <= n; ++i)
|
||||||
maxbondcutoff = MAX(maxbondcutoff,force->bond->equilibrium_distance(i));
|
maxbondcutoff = MAX(maxbondcutoff,force->bond->equilibrium_distance(i));
|
||||||
|
|
||||||
|
// apply bond length based heuristics.
|
||||||
|
|
||||||
|
if (force->newton_bond) {
|
||||||
if (force->dihedral || force->improper) {
|
if (force->dihedral || force->improper) {
|
||||||
maxbondcutoff *= 2.0;
|
maxbondcutoff *= 2.25;
|
||||||
} else {
|
} else {
|
||||||
maxbondcutoff *=1.5;
|
maxbondcutoff *=1.5;
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
if (force->dihedral || force->improper) {
|
||||||
|
maxbondcutoff *= 3.125;
|
||||||
|
} else if (force->angle) {
|
||||||
|
maxbondcutoff *= 2.25;
|
||||||
|
} else {
|
||||||
|
maxbondcutoff *=1.5;
|
||||||
|
}
|
||||||
|
}
|
||||||
maxbondcutoff += neighbor->skin;
|
maxbondcutoff += neighbor->skin;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -620,16 +632,27 @@ double Comm::get_comm_cutoff()
|
|||||||
|
|
||||||
maxcommcutoff = MAX(cutghostuser,neighbor->cutneighmax);
|
maxcommcutoff = MAX(cutghostuser,neighbor->cutneighmax);
|
||||||
|
|
||||||
// consider cutoff estimate from bond length only if no user specified cutoff
|
// use cutoff estimate from bond length only if no user specified
|
||||||
|
// cutoff was given and no pair style present. Otherwise print a
|
||||||
|
// warning, if the estimated bond based cutoff is larger than what
|
||||||
|
// is currently used.
|
||||||
|
|
||||||
if (cutghostuser == 0.0) maxcommcutoff = MAX(maxcommcutoff,maxbondcutoff);
|
if (!force->pair && (cutghostuser == 0.0)) {
|
||||||
|
maxcommcutoff = MAX(maxcommcutoff,maxbondcutoff);
|
||||||
|
} else {
|
||||||
|
if ((me == 0) && (maxbondcutoff > maxcommcutoff)) {
|
||||||
|
char mesg[256];
|
||||||
|
snprintf(mesg,256,"Communication cutoff %g is shorter than a bond "
|
||||||
|
"length based estimate of %g. This may lead to errors.",
|
||||||
|
maxcommcutoff,maxbondcutoff);
|
||||||
|
error->warning(FLERR,mesg);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// print warning if neighborlist cutoff overrides user cutoff or
|
// print warning if neighborlist cutoff overrides user cutoff
|
||||||
// applied bond based cutoff is larger than neighbor cutoff.
|
|
||||||
|
|
||||||
if (me == 0) {
|
if (me == 0) {
|
||||||
if ( ((cutghostuser > 0.0) && (maxcommcutoff > cutghostuser))
|
if ((cutghostuser > 0.0) && (maxcommcutoff > cutghostuser)) {
|
||||||
|| ((cutghostuser == 0.0) && (maxcommcutoff == maxbondcutoff)) ) {
|
|
||||||
char mesg[128];
|
char mesg[128];
|
||||||
snprintf(mesg,128,"Communication cutoff adjusted to %g",maxcommcutoff);
|
snprintf(mesg,128,"Communication cutoff adjusted to %g",maxcommcutoff);
|
||||||
error->warning(FLERR,mesg);
|
error->warning(FLERR,mesg);
|
||||||
|
|||||||
Reference in New Issue
Block a user