remove multi/old from docs and print deprecation warning when used

also convert error messages to use new error location indicator API
This commit is contained in:
Axel Kohlmeyer
2025-02-01 15:29:27 -05:00
parent e9e4addacb
commit d17186a8fa
4 changed files with 108 additions and 93 deletions

View File

@ -15,15 +15,12 @@ Syntax
.. parsed-literal:: .. parsed-literal::
*mode* value = *single*, *multi*, or *multi/old* = communicate atoms within a single or multiple distances *mode* value = *single* or *multi* = communicate atoms within a single or multiple distances
*cutoff* value = Rcut (distance units) = communicate atoms from this far away *cutoff* value = Rcut (distance units) = communicate atoms from this far away
*cutoff/multi* collection value *cutoff/multi* collection value
collection = atom collection or collection range (supports asterisk notation) collection = atom collection or collection range (supports asterisk notation)
value = Rcut (distance units) = communicate atoms for selected types from this far away value = Rcut (distance units) = communicate atoms for selected types from this far away
*reduce/multi* arg = none = reduce number of communicated ghost atoms for multi style *reduce/multi* arg = none = reduce number of communicated ghost atoms for multi style
*cutoff/multi/old* type value
type = atom type or type range (supports asterisk notation)
value = Rcut (distance units) = communicate atoms for selected types from this far away
*group* value = group-ID = only communicate atoms in the group *group* value = group-ID = only communicate atoms in the group
*vel* value = *yes* or *no* = do or do not communicate velocity info with ghost atoms *vel* value = *yes* or *no* = do or do not communicate velocity info with ghost atoms
@ -66,19 +63,16 @@ subdomain. The distance is by default the maximum of the neighbor
cutoff across all atom type pairs. cutoff across all atom type pairs.
For many systems this is an efficient algorithm, but for systems with For many systems this is an efficient algorithm, but for systems with
widely varying cutoffs for different type pairs, the *multi* or *multi/old* mode can widely varying cutoffs for different type pairs, the *multi* mode can be
be faster. In *multi*, each atom is assigned to a collection which should faster. In *multi*, each atom is assigned to a collection which should
correspond to a set of atoms with similar interaction cutoffs. correspond to a set of atoms with similar interaction cutoffs. See the
See the :doc:`neighbor <neighbor>` command for a detailed description of collections. :doc:`neighbor <neighbor>` command for a detailed description of
In this case, each atom collection is assigned its own distance collections. In this case, each atom collection is assigned its own
cutoff for communication purposes, and fewer atoms will be distance cutoff for communication purposes, and fewer atoms will be
communicated. in *multi/old*, a similar technique is used but atoms communicated. See the :doc:`neighbor multi <neighbor>` command for
are grouped by atom type. See the :doc:`neighbor multi <neighbor>` and
:doc:`neighbor multi/old <neighbor>` commands for
neighbor list construction options that may also be beneficial for neighbor list construction options that may also be beneficial for
simulations of this kind. The *multi* communication mode is only compatible simulations of this kind. The *multi* communication mode is only
with the *multi* neighbor style. The *multi/old* communication mode is comparable compatible with the *multi* neighbor style.
with both the *multi* and *multi/old* neighbor styles.
The *cutoff* keyword allows you to extend the ghost cutoff distance The *cutoff* keyword allows you to extend the ghost cutoff distance
for communication mode *single*, which is the distance from the borders for communication mode *single*, which is the distance from the borders
@ -108,14 +102,12 @@ simulation to account for potential changes in the number of
collections. Custom cutoffs are preserved between runs but if collections. Custom cutoffs are preserved between runs but if
collections are redefined, one may want to re-specify the communication collections are redefined, one may want to re-specify the communication
cutoffs. For granular pair styles,the default cutoff is set to the sum cutoffs. For granular pair styles,the default cutoff is set to the sum
of the current maximum atomic radii for each collection. The of the current maximum atomic radii for each collection.
*cutoff/multi/old* option is similar to *cutoff/multi* except it
operates on atom types as opposed to collections.
The *reduce/multi* option applies to *multi* and sets the communication The *reduce/multi* option applies to *multi* and sets the communication
cutoff for a particle equal to the maximum interaction distance between particles cutoff for a particle equal to the maximum interaction distance between
in the same collection. This reduces the number of particles in the same collection. This reduces the number of ghost atoms
ghost atoms that need to be communicated. This method is only compatible with the that need to be communicated. This method is only compatible with the
*multi* neighbor style and requires a half neighbor list and Newton on. *multi* neighbor style and requires a half neighbor list and Newton on.
See the :doc:`neighbor multi <neighbor>` command for more information. See the :doc:`neighbor multi <neighbor>` command for more information.

View File

@ -11,7 +11,7 @@ Syntax
neighbor skin style neighbor skin style
* skin = extra distance beyond force cutoff (distance units) * skin = extra distance beyond force cutoff (distance units)
* style = *bin* or *nsq* or *multi* or *multi/old* * style = *bin* or *nsq* or *multi*
Examples Examples
"""""""" """"""""
@ -83,16 +83,6 @@ is customized or not, also see the :doc:`comm_modify mode multi
<comm_modify>` command for communication options that further improve <comm_modify>` command for communication options that further improve
performance in a manner consistent with neighbor style multi. performance in a manner consistent with neighbor style multi.
An alternate style, *multi/old*, sets the bin size to 1/2 of the shortest
cutoff distance and multiple sets of bins are defined to search over for
different atom types. This algorithm used to be the default *multi*
algorithm in LAMMPS but was found to be significantly slower than the new
approach. For the dense binary system, computational costs still grew as
:math:`\lambda^{2d}` at large enough :math:`\lambda`. This is equivalent
to the default style, albeit with a smaller prefactor. For now we are
keeping the old option in case there are use cases where multi/old
outperforms the new multi style.
.. note:: .. note::
If there are multiple sub-styles in a :doc:`hybrid/overlay pair style If there are multiple sub-styles in a :doc:`hybrid/overlay pair style

View File

@ -298,49 +298,55 @@ void Comm::modify_params(int narg, char **arg)
mode = Comm::SINGLE; mode = Comm::SINGLE;
} else if (strcmp(arg[iarg+1],"multi") == 0) { } else if (strcmp(arg[iarg+1],"multi") == 0) {
if (neighbor->style != Neighbor::MULTI) if (neighbor->style != Neighbor::MULTI)
error->all(FLERR,"Cannot use comm mode 'multi' without 'multi' style neighbor lists"); error->all(FLERR, iarg+1,
"Cannot use comm mode 'multi' without 'multi' style neighbor lists");
// need to reset cutghostuser when switching comm mode // need to reset cutghostuser when switching comm mode
if (mode == Comm::SINGLE) cutghostuser = 0.0; if (mode == Comm::SINGLE) cutghostuser = 0.0;
if (mode == Comm::MULTIOLD) cutghostuser = 0.0; if (mode == Comm::MULTIOLD) cutghostuser = 0.0;
memory->destroy(cutusermultiold); memory->destroy(cutusermultiold);
mode = Comm::MULTI; mode = Comm::MULTI;
} else if (strcmp(arg[iarg+1],"multi/old") == 0) { } else if (strcmp(arg[iarg+1],"multi/old") == 0) {
if (me == 0)
error->warning(FLERR, "Comm mode 'multi/old' is deprecated and will be removed soon");
if (neighbor->style == Neighbor::MULTI) if (neighbor->style == Neighbor::MULTI)
error->all(FLERR,"Cannot use comm mode 'multi/old' with 'multi' style neighbor lists"); error->all(FLERR, iarg+1,
"Cannot use comm mode 'multi/old' with 'multi' style neighbor lists");
// need to reset cutghostuser when switching comm mode // need to reset cutghostuser when switching comm mode
if (mode == Comm::SINGLE) cutghostuser = 0.0; if (mode == Comm::SINGLE) cutghostuser = 0.0;
if (mode == Comm::MULTI) cutghostuser = 0.0; if (mode == Comm::MULTI) cutghostuser = 0.0;
memory->destroy(cutusermulti); memory->destroy(cutusermulti);
mode = Comm::MULTIOLD; mode = Comm::MULTIOLD;
} else error->all(FLERR,"Unknown comm_modify mode argument: {}", arg[iarg+1]); } else error->all(FLERR, iarg+1, "Unknown comm_modify mode argument: {}", arg[iarg+1]);
iarg += 2; iarg += 2;
} else if (strcmp(arg[iarg],"group") == 0) { } else if (strcmp(arg[iarg],"group") == 0) {
if (iarg+2 > narg) utils::missing_cmd_args(FLERR, "comm_modify group", error); if (iarg+2 > narg) utils::missing_cmd_args(FLERR, "comm_modify group", error);
bordergroup = group->find(arg[iarg+1]); bordergroup = group->find(arg[iarg+1]);
if (bordergroup < 0) if (bordergroup < 0)
error->all(FLERR, "Invalid comm_modify keyword: group {} not found", arg[iarg+1]); error->all(FLERR, iarg+1, "Invalid comm_modify keyword: group {} not found", arg[iarg+1]);
if (bordergroup && ((atom->firstgroupname == nullptr) || strcmp(arg[iarg+1],atom->firstgroupname) != 0)) if (bordergroup && ((atom->firstgroupname == nullptr)
error->all(FLERR, "Comm_modify group != atom_modify first group: {}", atom->firstgroupname); || strcmp(arg[iarg+1],atom->firstgroupname) != 0))
error->all(FLERR, iarg+1,
"Comm_modify group != atom_modify first group: {}", atom->firstgroupname);
iarg += 2; iarg += 2;
} else if (strcmp(arg[iarg],"cutoff") == 0) { } else if (strcmp(arg[iarg],"cutoff") == 0) {
if (iarg+2 > narg) utils::missing_cmd_args(FLERR, "comm_modify cutoff", error); if (iarg+2 > narg) utils::missing_cmd_args(FLERR, "comm_modify cutoff", error);
if (mode == Comm::MULTI) if (mode == Comm::MULTI)
error->all(FLERR, "Use cutoff/multi keyword to set cutoff in multi mode"); error->all(FLERR, iarg, "Use cutoff/multi keyword to set cutoff in multi mode");
if (mode == Comm::MULTIOLD) if (mode == Comm::MULTIOLD)
error->all(FLERR, "Use cutoff/multi/old keyword to set cutoff in multi mode"); error->all(FLERR, iarg, "Use cutoff/multi/old keyword to set cutoff in multi/old mode");
cutghostuser = utils::numeric(FLERR,arg[iarg+1],false,lmp); cutghostuser = utils::numeric(FLERR,arg[iarg+1],false,lmp);
if (cutghostuser < 0.0) if (cutghostuser < 0.0)
error->all(FLERR,"Invalid cutoff {} in comm_modify command", arg[iarg+1]); error->all(FLERR, iarg+1, "Invalid cutoff {} in comm_modify command", arg[iarg+1]);
iarg += 2; iarg += 2;
} else if (strcmp(arg[iarg],"cutoff/multi") == 0) { } else if (strcmp(arg[iarg],"cutoff/multi") == 0) {
int i,nlo,nhi; int i,nlo,nhi;
double cut; double cut;
if (mode == Comm::SINGLE) if (mode == Comm::SINGLE)
error->all(FLERR,"Use cutoff keyword to set cutoff in single mode"); error->all(FLERR, iarg, "Use cutoff keyword to set cutoff in single mode");
if (mode == Comm::MULTIOLD) if (mode == Comm::MULTIOLD)
error->all(FLERR,"Use cutoff/multi/old keyword to set cutoff in multi/old mode"); error->all(FLERR, iarg, "Use cutoff/multi/old keyword to set cutoff in multi/old mode");
if (domain->box_exist == 0) if (domain->box_exist == 0)
error->all(FLERR, "Cannot set cutoff/multi before simulation box is defined"); error->all(FLERR, iarg, "Cannot set cutoff/multi before simulation box is defined");
// Check if # of collections has changed, if so erase any previously defined cutoffs // Check if # of collections has changed, if so erase any previously defined cutoffs
// Neighbor will reset ncollections if collections are redefined // Neighbor will reset ncollections if collections are redefined
@ -355,7 +361,7 @@ void Comm::modify_params(int narg, char **arg)
cut = utils::numeric(FLERR,arg[iarg+2],false,lmp); cut = utils::numeric(FLERR,arg[iarg+2],false,lmp);
cutghostuser = MAX(cutghostuser,cut); cutghostuser = MAX(cutghostuser,cut);
if (cut < 0.0) if (cut < 0.0)
error->all(FLERR,"Invalid cutoff {} in comm_modify command", arg[iarg+2]); error->all(FLERR, iarg+1, "Invalid cutoff {} in comm_modify command", arg[iarg+2]);
// collections use 1-based indexing externally and 0-based indexing internally // collections use 1-based indexing externally and 0-based indexing internally
for (i=nlo; i<=nhi; ++i) for (i=nlo; i<=nhi; ++i)
cutusermulti[i-1] = cut; cutusermulti[i-1] = cut;
@ -363,12 +369,15 @@ void Comm::modify_params(int narg, char **arg)
} else if (strcmp(arg[iarg],"cutoff/multi/old") == 0) { } else if (strcmp(arg[iarg],"cutoff/multi/old") == 0) {
int i,nlo,nhi; int i,nlo,nhi;
double cut; double cut;
if (me == 0)
error->warning(FLERR, "Comm mode 'multi/old' is deprecated and will be removed soon");
if (mode == Comm::SINGLE) if (mode == Comm::SINGLE)
error->all(FLERR,"Use cutoff keyword to set cutoff in single mode"); error->all(FLERR, iarg, "Use cutoff keyword to set cutoff in single mode");
if (mode == Comm::MULTI) if (mode == Comm::MULTI)
error->all(FLERR,"Use cutoff/multi keyword to set cutoff in multi mode"); error->all(FLERR, iarg, "Use cutoff/multi keyword to set cutoff in multi mode");
if (domain->box_exist == 0) if (domain->box_exist == 0)
error->all(FLERR, "Cannot set cutoff/multi before simulation box is defined"); error->all(FLERR, iarg, "Cannot set cutoff/multi/old before simulation box is defined");
const int ntypes = atom->ntypes; const int ntypes = atom->ntypes;
if (iarg+3 > narg) utils::missing_cmd_args(FLERR, "comm_modify cutoff/multi/old", error); if (iarg+3 > narg) utils::missing_cmd_args(FLERR, "comm_modify cutoff/multi/old", error);
if (cutusermultiold == nullptr) { if (cutusermultiold == nullptr) {
@ -380,20 +389,20 @@ void Comm::modify_params(int narg, char **arg)
cut = utils::numeric(FLERR,arg[iarg+2],false,lmp); cut = utils::numeric(FLERR,arg[iarg+2],false,lmp);
cutghostuser = MAX(cutghostuser,cut); cutghostuser = MAX(cutghostuser,cut);
if (cut < 0.0) if (cut < 0.0)
error->all(FLERR,"Invalid cutoff {} in comm_modify command", arg[iarg+2]); error->all(FLERR, iarg+1, "Invalid cutoff {} in comm_modify command", arg[iarg+2]);
for (i=nlo; i<=nhi; ++i) for (i=nlo; i<=nhi; ++i)
cutusermultiold[i] = cut; cutusermultiold[i] = cut;
iarg += 3; iarg += 3;
} else if (strcmp(arg[iarg],"reduce/multi") == 0) { } else if (strcmp(arg[iarg],"reduce/multi") == 0) {
if (mode == Comm::SINGLE) if (mode == Comm::SINGLE)
error->all(FLERR,"Use reduce/multi in mode multi only"); error->all(FLERR, iarg, "Use reduce/multi in mode multi only");
multi_reduce = 1; multi_reduce = 1;
iarg += 1; iarg += 1;
} else if (strcmp(arg[iarg],"vel") == 0) { } else if (strcmp(arg[iarg],"vel") == 0) {
if (iarg+2 > narg) utils::missing_cmd_args(FLERR, "comm_modify vel", error); if (iarg+2 > narg) utils::missing_cmd_args(FLERR, "comm_modify vel", error);
ghost_velocity = utils::logical(FLERR,arg[iarg+1],false,lmp); ghost_velocity = utils::logical(FLERR,arg[iarg+1],false,lmp);
iarg += 2; iarg += 2;
} else error->all(FLERR,"Unknown comm_modify keyword: {}", arg[iarg]); } else error->all(FLERR, iarg, "Unknown comm_modify keyword: {}", arg[iarg]);
} }
} }

View File

@ -319,13 +319,16 @@ void Neighbor::init()
// error checks // error checks
if (triclinic && atom->tag_enable == 0) if (triclinic && atom->tag_enable == 0)
error->all(FLERR, "Cannot build triclinic neighbor lists unless atoms have IDs"); error->all(FLERR, Error::NOLASTLINE,
"Cannot build triclinic neighbor lists unless atoms have IDs");
if (delay > 0 && (delay % every) != 0) if (delay > 0 && (delay % every) != 0)
error->all(FLERR,"Neighbor delay must be 0 or multiple of every setting"); error->all(FLERR, Error::NOLASTLINE,
"Neighbor delay must be 0 or multiple of every setting");
if (pgsize < 10*oneatom) if (pgsize < 10*oneatom)
error->all(FLERR,"Neighbor page size must be >= 10x the one atom setting"); error->all(FLERR, Error::NOLASTLINE,
"Neighbor page size must be >= 10x the one atom setting");
// ------------------------------------------------------------------ // ------------------------------------------------------------------
// settings // settings
@ -433,7 +436,8 @@ void Neighbor::init()
} }
} else { } else {
if (!force->pair) if (!force->pair)
error->all(FLERR, "Cannot use collection/interval command without defining a pairstyle"); error->all(FLERR, Error::NOLASTLINE,
"Cannot use collection/interval command without defining a pairstyle");
if (force->pair->finitecutflag) { if (force->pair->finitecutflag) {
finite_cut_flag = 1; finite_cut_flag = 1;
@ -469,7 +473,8 @@ void Neighbor::init()
} }
if (type2collection[i] == -1) if (type2collection[i] == -1)
error->all(FLERR, "Pair cutoff exceeds interval cutoffs for multi"); error->all(FLERR, Error::NOLASTLINE,
"Pair cutoff exceeds interval cutoffs for multi");
} }
// Define cutoffs // Define cutoffs
@ -621,7 +626,7 @@ void Neighbor::init()
for (i = 0; i < nex_type; i++) { for (i = 0; i < nex_type; i++) {
if (ex1_type[i] <= 0 || ex1_type[i] > n || if (ex1_type[i] <= 0 || ex1_type[i] > n ||
ex2_type[i] <= 0 || ex2_type[i] > n) ex2_type[i] <= 0 || ex2_type[i] > n)
error->all(FLERR,"Invalid atom type in neighbor exclusion list"); error->all(FLERR, Error::NOLASTLINE, "Invalid atom type in neighbor exclusion list");
ex_type[ex1_type[i]][ex2_type[i]] = 1; ex_type[ex1_type[i]][ex2_type[i]] = 1;
ex_type[ex2_type[i]][ex1_type[i]] = 1; ex_type[ex2_type[i]][ex1_type[i]] = 1;
} }
@ -844,7 +849,8 @@ int Neighbor::init_pair()
if (style == Neighbor::BIN) { if (style == Neighbor::BIN) {
for (i = 0; i < nrequest; ++i) for (i = 0; i < nrequest; ++i)
if (requests[i]->occasional && requests[i]->ghost) if (requests[i]->occasional && requests[i]->ghost)
error->all(FLERR, "Cannot request an occasional binned neighbor list with ghost info"); error->all(FLERR, Error::NOLASTLINE,
"Cannot request an occasional binned neighbor list with ghost info");
} }
// check requests with a custom neighbor list cutoff to make sure the cutoff is within // check requests with a custom neighbor list cutoff to make sure the cutoff is within
@ -854,7 +860,8 @@ int Neighbor::init_pair()
for (i = 0; i < nrequest; ++i) { for (i = 0; i < nrequest; ++i) {
if (requests[i]->cut) { if (requests[i]->cut) {
if (comm_cutoff < (requests[i]->cutoff + (requests[i]->occasional ? 0.0 : skin))) if (comm_cutoff < (requests[i]->cutoff + (requests[i]->occasional ? 0.0 : skin)))
error->all(FLERR, "Custom neighbor list cutoff too large for communication cutoff"); error->all(FLERR, Error::NOLASTLINE,
"Custom neighbor list cutoff too large for communication cutoff");
} }
} }
@ -938,17 +945,17 @@ int Neighbor::init_pair()
flag = choose_bin(requests[i]); flag = choose_bin(requests[i]);
lists[i]->bin_method = flag; lists[i]->bin_method = flag;
if (flag < 0) if (flag < 0)
error->all(FLERR,"Requested neighbor bin option does not exist"); error->all(FLERR, Error::NOLASTLINE, "Requested neighbor bin option does not exist");
flag = choose_stencil(requests[i]); flag = choose_stencil(requests[i]);
lists[i]->stencil_method = flag; lists[i]->stencil_method = flag;
if (flag < 0) if (flag < 0)
error->all(FLERR,"Requested neighbor stencil method does not exist"); error->all(FLERR, Error::NOLASTLINE, "Requested neighbor stencil method does not exist");
flag = choose_pair(requests[i]); flag = choose_pair(requests[i]);
lists[i]->pair_method = flag; lists[i]->pair_method = flag;
if (flag < 0) if (flag < 0)
error->all(FLERR,"Requested neighbor pair method does not exist"); error->all(FLERR, Error::NOLASTLINE, "Requested neighbor pair method does not exist");
} }
// instantiate unique Bin,Stencil classes in neigh_bin & neigh_stencil vecs // instantiate unique Bin,Stencil classes in neigh_bin & neigh_stencil vecs
@ -1001,7 +1008,7 @@ int Neighbor::init_pair()
if (lists[i]->bin_method > 0) { if (lists[i]->bin_method > 0) {
neigh_stencil[nstencil]->nb = neigh_bin[requests[i]->index_bin]; neigh_stencil[nstencil]->nb = neigh_bin[requests[i]->index_bin];
if (neigh_stencil[nstencil]->nb == nullptr) if (neigh_stencil[nstencil]->nb == nullptr)
error->all(FLERR,"Could not assign bin method to neighbor stencil"); error->all(FLERR, Error::NOLASTLINE, "Could not assign bin method to neighbor stencil");
} }
requests[i]->index_stencil = nstencil; requests[i]->index_stencil = nstencil;
@ -1029,12 +1036,12 @@ int Neighbor::init_pair()
if (lists[i]->bin_method > 0) { if (lists[i]->bin_method > 0) {
neigh_pair[i]->nb = neigh_bin[requests[i]->index_bin]; neigh_pair[i]->nb = neigh_bin[requests[i]->index_bin];
if (neigh_pair[i]->nb == nullptr) if (neigh_pair[i]->nb == nullptr)
error->all(FLERR,"Could not assign bin method to neighbor pair"); error->all(FLERR, Error::NOLASTLINE, "Could not assign bin method to neighbor pair");
} }
if (lists[i]->stencil_method > 0) { if (lists[i]->stencil_method > 0) {
neigh_pair[i]->ns = neigh_stencil[requests[i]->index_stencil]; neigh_pair[i]->ns = neigh_stencil[requests[i]->index_stencil];
if (neigh_pair[i]->ns == nullptr) if (neigh_pair[i]->ns == nullptr)
error->all(FLERR,"Could not assign stencil method to neighbor pair"); error->all(FLERR, Error::NOLASTLINE, "Could not assign stencil method to neighbor pair");
} }
requests[i]->index_pair = i; requests[i]->index_pair = i;
@ -1129,8 +1136,8 @@ int Neighbor::init_pair()
++count; ++count;
} }
if (count == 100) if (count == 100)
error->all(FLERR, "Failed to reorder neighbor lists to satisfy constraints - " error->all(FLERR, Error::NOLASTLINE, "Failed to reorder neighbor lists to satisfy "
"Contact the LAMMPS developers for assistance"); "constraints - Contact the LAMMPS developers for assistance");
// debug output // debug output
@ -2103,7 +2110,8 @@ int Neighbor::choose_pair(NeighRequest *rq)
// error check for includegroup with ghost neighbor request // error check for includegroup with ghost neighbor request
if (includegroup && rq->ghost) if (includegroup && rq->ghost)
error->all(FLERR,"Neighbor include group not allowed with ghost neighbors"); error->all(FLERR, Error::NOLASTLINE,
"Neighbor include group not allowed with ghost neighbors");
// convert newton request to newtflag = on or off // convert newton request to newtflag = on or off
@ -2112,7 +2120,7 @@ int Neighbor::choose_pair(NeighRequest *rq)
else if (rq->newton == 0 && !newton_pair) newtflag = false; else if (rq->newton == 0 && !newton_pair) newtflag = false;
else if (rq->newton == 1) newtflag = true; else if (rq->newton == 1) newtflag = true;
else if (rq->newton == 2) newtflag = false; else if (rq->newton == 2) newtflag = false;
else error->all(FLERR,"Illegal 'newton' flag in neighbor list request"); else error->all(FLERR, Error::NOLASTLINE, "Illegal 'newton' flag in neighbor list request");
int molecular = atom->molecular; int molecular = atom->molecular;
@ -2449,7 +2457,7 @@ void Neighbor::build(int topoflag)
// check that using special bond flags will not overflow neigh lists // check that using special bond flags will not overflow neigh lists
if (nall > NEIGHMASK) if (nall > NEIGHMASK)
error->one(FLERR,"Too many local+ghost atoms for neighbor list"); error->one(FLERR, Error::NOLASTLINE, "Too many local+ghost atoms for neighbor list");
// store current atom positions and box size if needed // store current atom positions and box size if needed
@ -2566,11 +2574,13 @@ void Neighbor::build_one(class NeighList *mylist)
// check if list structure is initialized // check if list structure is initialized
if (mylist == nullptr) if (mylist == nullptr)
error->all(FLERR,"Trying to build an occasional neighbor list before initialization complete"); error->all(FLERR, Error::NOLASTLINE,
"Trying to build an occasional neighbor list before initialization is complete");
// build_one() should never be invoked on a perpetual list // build_one() should never be invoked on a perpetual list
if (!mylist->occasional) error->all(FLERR,"Neighbor::build_one() invoked on perpetual list"); if (!mylist->occasional)
error->all(FLERR, Error::NOLASTLINE, "Neighbor::build_one() invoked on a perpetual list");
// no need to build this occasional list if already built // no need to build this occasional list if already built
// since last comm->exchange() and re-neighbor which invoked build() // since last comm->exchange() and re-neighbor which invoked build()
@ -2613,18 +2623,24 @@ void Neighbor::build_one(class NeighList *mylist)
void Neighbor::set(int narg, char **arg) void Neighbor::set(int narg, char **arg)
{ {
if (narg != 2) error->all(FLERR,"Illegal neighbor command: expected 2 arguments but found {}", narg); if (narg != 2)
error->all(FLERR, Error::ARGZERO,
"Illegal neighbor command: expected 2 arguments but found {}", narg);
skin = utils::numeric(FLERR,arg[0],false,lmp); skin = utils::numeric(FLERR,arg[0],false,lmp);
if (skin < 0.0) error->all(FLERR, "Invalid neighbor argument: {}", arg[0]); if (skin < 0.0) error->all(FLERR, Error::ARGZERO, "Invalid neighbor argument: {}", arg[0]);
if (strcmp(arg[1],"nsq") == 0) style = Neighbor::NSQ; if (strcmp(arg[1],"nsq") == 0) style = Neighbor::NSQ;
else if (strcmp(arg[1],"bin") == 0) style = Neighbor::BIN; else if (strcmp(arg[1],"bin") == 0) style = Neighbor::BIN;
else if (strcmp(arg[1],"multi") == 0) { else if (strcmp(arg[1],"multi") == 0) {
style = Neighbor::MULTI; style = Neighbor::MULTI;
ncollections = atom->ntypes; ncollections = atom->ntypes;
} else if (strcmp(arg[1],"multi/old") == 0) style = Neighbor::MULTI_OLD; } else if (strcmp(arg[1],"multi/old") == 0) {
else error->all(FLERR,"Unknown neighbor {} argument: {}", arg[0], arg[1]); style = Neighbor::MULTI_OLD;
if (me == 0)
error->warning(FLERR, "Neighbor list style 'multi/old' is deprecated "
"and will be removed soon");
} else error->all(FLERR, 1, "Unknown neighbor {} argument: {}", arg[0], arg[1]);
if (style == Neighbor::MULTI_OLD && lmp->citeme) lmp->citeme->add(cite_neigh_multi_old); if (style == Neighbor::MULTI_OLD && lmp->citeme) lmp->citeme->add(cite_neigh_multi_old);
if (style == Neighbor::MULTI && lmp->citeme) lmp->citeme->add(cite_neigh_multi); if (style == Neighbor::MULTI && lmp->citeme) lmp->citeme->add(cite_neigh_multi);
@ -2662,12 +2678,14 @@ void Neighbor::modify_params(int narg, char **arg)
if (strcmp(arg[iarg],"every") == 0) { if (strcmp(arg[iarg],"every") == 0) {
if (iarg+2 > narg) utils::missing_cmd_args(FLERR, "neigh_modify every", error); if (iarg+2 > narg) utils::missing_cmd_args(FLERR, "neigh_modify every", error);
every = utils::inumeric(FLERR,arg[iarg+1],false,lmp); every = utils::inumeric(FLERR,arg[iarg+1],false,lmp);
if (every <= 0) error->all(FLERR, "Invalid neigh_modify every argument: {}", every); if (every <= 0)
error->all(FLERR, iarg+1, "Invalid neigh_modify every argument: {}", every);
iarg += 2; iarg += 2;
} else if (strcmp(arg[iarg],"delay") == 0) { } else if (strcmp(arg[iarg],"delay") == 0) {
if (iarg+2 > narg) utils::missing_cmd_args(FLERR, "neigh_modify delay", error); if (iarg+2 > narg) utils::missing_cmd_args(FLERR, "neigh_modify delay", error);
delay = utils::inumeric(FLERR,arg[iarg+1],false,lmp); delay = utils::inumeric(FLERR,arg[iarg+1],false,lmp);
if (delay < 0) error->all(FLERR, "Invalid neigh_modify delay argument: {}", delay); if (delay < 0)
error->all(FLERR, iarg+1, "Invalid neigh_modify delay argument: {}", delay);
iarg += 2; iarg += 2;
} else if (strcmp(arg[iarg],"check") == 0) { } else if (strcmp(arg[iarg],"check") == 0) {
if (iarg+2 > narg) utils::missing_cmd_args(FLERR, "neigh_modify check", error); if (iarg+2 > narg) utils::missing_cmd_args(FLERR, "neigh_modify check", error);
@ -2701,11 +2719,13 @@ void Neighbor::modify_params(int narg, char **arg)
if (iarg+2 > narg) utils::missing_cmd_args(FLERR, "neigh_modify include", error); if (iarg+2 > narg) utils::missing_cmd_args(FLERR, "neigh_modify include", error);
includegroup = group->find(arg[iarg+1]); includegroup = group->find(arg[iarg+1]);
if (includegroup < 0) if (includegroup < 0)
error->all(FLERR, "Invalid include keyword: group {} not found", arg[iarg+1]); error->all(FLERR, iarg+1, "Invalid include keyword: group {} not found", arg[iarg+1]);
if (atom->firstgroupname == nullptr) if (atom->firstgroupname == nullptr)
error->all(FLERR, "Invalid include keyword: atom_modify first command must be used"); error->all(FLERR, iarg+1,
"Invalid include keyword: atom_modify first command must be used");
if (strcmp(arg[iarg+1],atom->firstgroupname) != 0) if (strcmp(arg[iarg+1],atom->firstgroupname) != 0)
error->all(FLERR, "Neigh_modify include group != atom_modify first group: {}", atom->firstgroupname); error->all(FLERR, iarg+1,
"Neigh_modify include group != atom_modify first group: {}", atom->firstgroupname);
iarg += 2; iarg += 2;
} else if (strcmp(arg[iarg],"exclude") == 0) { } else if (strcmp(arg[iarg],"exclude") == 0) {
if (iarg+2 > narg) utils::missing_cmd_args(FLERR, "neigh_modify exclude", error); if (iarg+2 > narg) utils::missing_cmd_args(FLERR, "neigh_modify exclude", error);
@ -2731,9 +2751,11 @@ void Neighbor::modify_params(int narg, char **arg)
ex1_group[nex_group] = group->find(arg[iarg+2]); ex1_group[nex_group] = group->find(arg[iarg+2]);
ex2_group[nex_group] = group->find(arg[iarg+3]); ex2_group[nex_group] = group->find(arg[iarg+3]);
if (ex1_group[nex_group] == -1) if (ex1_group[nex_group] == -1)
error->all(FLERR, "Invalid exclude group keyword: group {} not found", arg[iarg+2]); error->all(FLERR, iarg+2,
"Invalid exclude group keyword: group {} not found", arg[iarg+2]);
if (ex2_group[nex_group] == -1) if (ex2_group[nex_group] == -1)
error->all(FLERR, "Invalid exclude group keyword: group {} not found", arg[iarg+3]); error->all(FLERR, iarg+3,
"Invalid exclude group keyword: group {} not found", arg[iarg+3]);
if (group->dynamic[ex1_group[nex_group]] || group->dynamic[ex2_group[nex_group]]) if (group->dynamic[ex1_group[nex_group]] || group->dynamic[ex2_group[nex_group]])
error->all(FLERR, "Neigh_modify exclude group is not compatible with dynamic groups"); error->all(FLERR, "Neigh_modify exclude group is not compatible with dynamic groups");
nex_group++; nex_group++;
@ -2742,7 +2764,8 @@ void Neighbor::modify_params(int narg, char **arg)
strcmp(arg[iarg+1],"molecule/intra") == 0) { strcmp(arg[iarg+1],"molecule/intra") == 0) {
if (iarg+3 > narg) utils::missing_cmd_args(FLERR, "neigh_modify exclude molecule", error); if (iarg+3 > narg) utils::missing_cmd_args(FLERR, "neigh_modify exclude molecule", error);
if (atom->molecule_flag == 0) if (atom->molecule_flag == 0)
error->all(FLERR,"Neigh_modify exclude molecule requires atom attribute molecule"); error->all(FLERR, iarg+1,
"Neigh_modify exclude molecule requires atom attribute molecule");
if (nex_mol == maxex_mol) { if (nex_mol == maxex_mol) {
maxex_mol += EXDELTA; maxex_mol += EXDELTA;
memory->grow(ex_mol_group,maxex_mol,"neigh:ex_mol_group"); memory->grow(ex_mol_group,maxex_mol,"neigh:ex_mol_group");
@ -2753,7 +2776,7 @@ void Neighbor::modify_params(int narg, char **arg)
} }
ex_mol_group[nex_mol] = group->find(arg[iarg+2]); ex_mol_group[nex_mol] = group->find(arg[iarg+2]);
if (ex_mol_group[nex_mol] == -1) if (ex_mol_group[nex_mol] == -1)
error->all(FLERR, "Invalid exclude keyword:group {} not found", arg[iarg+2]); error->all(FLERR, iarg+1, "Invalid exclude keyword:group {} not found", arg[iarg+2]);
if (strcmp(arg[iarg+1],"molecule/intra") == 0) if (strcmp(arg[iarg+1],"molecule/intra") == 0)
ex_mol_intra[nex_mol] = 1; ex_mol_intra[nex_mol] = 1;
else else
@ -2763,7 +2786,7 @@ void Neighbor::modify_params(int narg, char **arg)
} else if (strcmp(arg[iarg+1],"none") == 0) { } else if (strcmp(arg[iarg+1],"none") == 0) {
nex_type = nex_group = nex_mol = 0; nex_type = nex_group = nex_mol = 0;
iarg += 2; iarg += 2;
} else error->all(FLERR,"Unknown neigh_modify exclude keyword: {}", arg[iarg+1]); } else error->all(FLERR, iarg+1, "Unknown neigh_modify exclude keyword: {}", arg[iarg+1]);
} else if (strcmp(arg[iarg],"collection/interval") == 0) { } else if (strcmp(arg[iarg],"collection/interval") == 0) {
if (style != Neighbor::MULTI) if (style != Neighbor::MULTI)
error->all(FLERR,"Cannot use collection/interval command without multi setting"); error->all(FLERR,"Cannot use collection/interval command without multi setting");
@ -2772,7 +2795,8 @@ void Neighbor::modify_params(int narg, char **arg)
utils::missing_cmd_args(FLERR, "neigh_modify collection/interval", error); utils::missing_cmd_args(FLERR, "neigh_modify collection/interval", error);
ncollections = utils::inumeric(FLERR,arg[iarg+1],false,lmp); ncollections = utils::inumeric(FLERR,arg[iarg+1],false,lmp);
if (ncollections < 1) if (ncollections < 1)
error->all(FLERR, "Invalid collection/interval keyword: illegal number of custom collections: {}", ncollections); error->all(FLERR, iarg+1, "Invalid collection/interval keyword: illegal number of "
"custom collections: {}", ncollections);
if (iarg+2+ncollections > narg) if (iarg+2+ncollections > narg)
error->all(FLERR, "Invalid collection/interval keyword: expected {} separate lists of types", ncollections); error->all(FLERR, "Invalid collection/interval keyword: expected {} separate lists of types", ncollections);
@ -2800,13 +2824,14 @@ void Neighbor::modify_params(int narg, char **arg)
iarg += 2 + ncollections; iarg += 2 + ncollections;
} else if (strcmp(arg[iarg],"collection/type") == 0) { } else if (strcmp(arg[iarg],"collection/type") == 0) {
if (style != Neighbor::MULTI) if (style != Neighbor::MULTI)
error->all(FLERR,"Cannot use collection/type command without multi setting"); error->all(FLERR, iarg, "Cannot use collection/type command without multi setting");
if (iarg+2 > narg) if (iarg+2 > narg)
utils::missing_cmd_args(FLERR, "neigh_modify collection/type", error); utils::missing_cmd_args(FLERR, "neigh_modify collection/type", error);
ncollections = utils::inumeric(FLERR,arg[iarg+1],false,lmp); ncollections = utils::inumeric(FLERR,arg[iarg+1],false,lmp);
if (ncollections < 1) if (ncollections < 1)
error->all(FLERR, "Invalid collection/type keyword: illegal number of custom collections: {}", ncollections); error->all(FLERR, iarg+1, "Invalid collection/type keyword: illegal number of "
"custom collections: {}", ncollections);
if (iarg+2+ncollections > narg) if (iarg+2+ncollections > narg)
error->all(FLERR, "Invalid collection/type keyword: expected {} separate lists of types", ncollections); error->all(FLERR, "Invalid collection/type keyword: expected {} separate lists of types", ncollections);
@ -2823,8 +2848,7 @@ void Neighbor::modify_params(int narg, char **arg)
// Erase previous mapping // Erase previous mapping
for (i = 1; i <= ntypes; i++) for (i = 1; i <= ntypes; i++) type2collection[i] = -1;
type2collection[i] = -1;
// For each custom range, define mapping for types in interval // For each custom range, define mapping for types in interval
@ -2849,7 +2873,7 @@ void Neighbor::modify_params(int narg, char **arg)
} }
iarg += 2 + ncollections; iarg += 2 + ncollections;
} else error->all(FLERR,"Unknown neigh_modify keyword: {}", arg[iarg]); } else error->all(FLERR, iarg, "Unknown neigh_modify keyword: {}", arg[iarg]);
} }
} }