improve warning and explanation about too short communication cutoff

This commit is contained in:
Axel Kohlmeyer
2025-04-30 16:46:22 -04:00
parent f9ba063c4a
commit 2ab7eda64a
3 changed files with 15 additions and 11 deletions

View File

@ -159,13 +159,17 @@ angle, dihedral, or improper with just one atom in the actual
sub-domain. Typically, this cutoff is set to the largest cutoff from sub-domain. Typically, this cutoff is set to the largest cutoff from
the :doc:`pair style(s) <pair_style>` plus the :doc:`neighbor list skin the :doc:`pair style(s) <pair_style>` plus the :doc:`neighbor list skin
distance <neighbor>` and will typically be sufficient for all bonded distance <neighbor>` and will typically be sufficient for all bonded
interactions. But if the pair style cutoff is small, this may not be interactions. But if the pair style cutoff is small (e.g. with a
enough. LAMMPS will print a warning in this case using some heuristic repulsive-only Lennard-Jones potential) this may not be enough. It is
based on the equilibrium bond length, but that still may not be even worse if there is no pair style defined (or the pair style is set
sufficient for cases where the force constants are small and thus bonds to "none"), since then there will be no ghost atoms created at all.
may be stretched very far. The communication cutoff can be adjusted
with :doc:`comm_modify cutoff \<value\> <comm_modify>`, but setting this The communication cutoff can be set or adjusted with :doc:`comm_modify
too large will waste CPU time and memory. cutoff \<value\> <comm_modify>`, but setting this too large will waste
CPU time and memory. LAMMPS will print warnings in these cases. For
bonds it uses some heuristic based on the equilibrium bond length, but
that still may not be sufficient for cases where the force constants are
small and thus bonds may be stretched very far.
.. _hint09: .. _hint09:

View File

@ -209,8 +209,8 @@ void CommBrick::setup()
double cut = get_comm_cutoff(); double cut = get_comm_cutoff();
if ((cut == 0.0) && (me == 0)) if ((cut == 0.0) && (me == 0))
error->warning(FLERR,"Communication cutoff is 0.0. No ghost atoms " error->warning(FLERR,"Communication cutoff is 0.0. No ghost atoms will be generated. "
"will be generated. Atoms may get lost."); "Energies and forces may be wrong and atoms may get lost.");
if (mode == Comm::MULTI) { if (mode == Comm::MULTI) {
double **cutcollectionsq = neighbor->cutcollectionsq; double **cutcollectionsq = neighbor->cutcollectionsq;

View File

@ -280,8 +280,8 @@ void CommTiled::setup()
double cut = get_comm_cutoff(); double cut = get_comm_cutoff();
if ((cut == 0.0) && (me == 0)) if ((cut == 0.0) && (me == 0))
error->warning(FLERR,"Communication cutoff is 0.0. No ghost atoms " error->warning(FLERR,"Communication cutoff is 0.0. No ghost atoms will be generated. "
"will be generated. Atoms may get lost."); "Energies and forces may be wrong and atoms may get lost.");
if (triclinic == 0) cutghost[0] = cutghost[1] = cutghost[2] = cut; if (triclinic == 0) cutghost[0] = cutghost[1] = cutghost[2] = cut;
else { else {