make warnings in scatter/gather into errors
This commit is contained in:
430
src/library.cpp
430
src/library.cpp
@ -527,7 +527,7 @@ void lammps_file(void *handle, const char *filename)
|
||||
BEGIN_CAPTURE
|
||||
{
|
||||
if (lmp->update->whichflag != 0)
|
||||
lmp->error->all(FLERR, "Library error: issuing LAMMPS commands during a run is not allowed");
|
||||
lmp->error->all(FLERR, "Issuing LAMMPS commands during a run is not allowed");
|
||||
else
|
||||
lmp->input->file(filename);
|
||||
}
|
||||
@ -564,8 +564,7 @@ char *lammps_command(void *handle, const char *cmd)
|
||||
BEGIN_CAPTURE
|
||||
{
|
||||
if (lmp->update->whichflag != 0)
|
||||
lmp->error->all(FLERR,"Library error: issuing LAMMPS commands "
|
||||
"during a run is not allowed.");
|
||||
lmp->error->all(FLERR, "Issuing LAMMPS command during a run is not allowed.");
|
||||
else
|
||||
result = lmp->input->one(cmd);
|
||||
}
|
||||
@ -641,7 +640,7 @@ void lammps_commands_string(void *handle, const char *str)
|
||||
BEGIN_CAPTURE
|
||||
{
|
||||
if (lmp->update->whichflag != 0) {
|
||||
lmp->error->all(FLERR,"Library error: issuing LAMMPS command during run");
|
||||
lmp->error->all(FLERR, "Issuing LAMMPS commands during a run is not allowed");
|
||||
}
|
||||
|
||||
std::size_t cursor = 0;
|
||||
@ -949,9 +948,9 @@ void lammps_extract_box(void *handle, double *boxlo, double *boxhi,
|
||||
BEGIN_CAPTURE
|
||||
{
|
||||
// do nothing if box does not yet exist
|
||||
if ((lmp->domain->box_exist == 0)
|
||||
&& (lmp->comm->me == 0)) {
|
||||
lmp->error->warning(FLERR,"Calling lammps_extract_box without a box");
|
||||
if (lmp->domain->box_exist == 0) {
|
||||
if (lmp->comm->me == 0)
|
||||
lmp->error->warning(FLERR, "Call to lammps_extract_box() without a box ignored");
|
||||
return;
|
||||
}
|
||||
|
||||
@ -1011,12 +1010,12 @@ void lammps_reset_box(void *handle, double *boxlo, double *boxhi,
|
||||
BEGIN_CAPTURE
|
||||
{
|
||||
if (lmp->atom->natoms > 0)
|
||||
lmp->error->all(FLERR,"Calling lammps_reset_box not supported when atoms exist");
|
||||
lmp->error->all(FLERR, "Calling lammps_reset_box() not supported when atoms exist");
|
||||
|
||||
// warn and do nothing if no box exists
|
||||
if (lmp->domain->box_exist == 0) {
|
||||
if (lmp->comm->me == 0)
|
||||
lmp->error->warning(FLERR,"Ignoring call to lammps_reset_box without a box");
|
||||
lmp->error->warning(FLERR,"Call to lammps_reset_box() without a box ignored");
|
||||
return;
|
||||
}
|
||||
|
||||
@ -2629,7 +2628,14 @@ x[0][2], x[1][0], x[1][1], x[1][2], x[2][0], :math:`\dots`);
|
||||
*natoms*), as queried by :cpp:func:`lammps_get_natoms`,
|
||||
:cpp:func:`lammps_extract_global`, or :cpp:func:`lammps_extract_setting`.
|
||||
|
||||
This function is not compatible with ``-DLAMMPS_BIGBIG``.
|
||||
.. admonition:: Restrictions
|
||||
:class: warning
|
||||
|
||||
This function is not compatible with ``-DLAMMPS_BIGBIG``.
|
||||
|
||||
Atom IDs must be defined and consecutive.
|
||||
|
||||
The total number of atoms must not be more than 2147483647 (max 32-bit signed int).
|
||||
|
||||
\endverbatim
|
||||
*
|
||||
@ -2650,8 +2656,7 @@ This function is not compatible with ``-DLAMMPS_BIGBIG``.
|
||||
Allreduce to sum vector into data across all procs
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
void lammps_gather_atoms(void *handle, const char *name, int type, int count,
|
||||
void *data)
|
||||
void lammps_gather_atoms(void *handle, const char *name, int type, int count, void *data)
|
||||
{
|
||||
auto lmp = (LAMMPS *) handle;
|
||||
|
||||
@ -2671,8 +2676,7 @@ void lammps_gather_atoms(void *handle, const char *name, int type, int count,
|
||||
flag = 1;
|
||||
if (lmp->atom->natoms > MAXSMALLINT) flag = 1;
|
||||
if (flag) {
|
||||
if (lmp->comm->me == 0)
|
||||
lmp->error->warning(FLERR,"Library error in lammps_gather_atoms");
|
||||
lmp->error->all(FLERR,"lammps_gather_atoms(): Atom-IDs must exist and be consecutive");
|
||||
return;
|
||||
}
|
||||
|
||||
@ -2680,8 +2684,7 @@ void lammps_gather_atoms(void *handle, const char *name, int type, int count,
|
||||
|
||||
void *vptr = lmp->atom->extract(name);
|
||||
if (vptr == nullptr) {
|
||||
if (lmp->comm->me == 0)
|
||||
lmp->error->warning(FLERR,"lammps_gather_atoms: unknown property name");
|
||||
lmp->error->all(FLERR, "lammps_gather_atoms(): unknown property {}", name);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -2756,8 +2759,7 @@ void lammps_gather_atoms(void *handle, const char *name, int type, int count,
|
||||
MPI_Allreduce(copy,data,count*natoms,MPI_DOUBLE,MPI_SUM,lmp->world);
|
||||
lmp->memory->destroy(copy);
|
||||
} else {
|
||||
if (lmp->comm->me == 0)
|
||||
lmp->error->warning(FLERR,"lammps_gather_atoms: unsupported data type");
|
||||
lmp->error->all(FLERR,"lammps_gather_atoms(): unsupported data type");
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
@ -2785,10 +2787,17 @@ groups total, but not in order by atom ID (e.g., if *name* is *x* and *count*
|
||||
is 3, then *data* might be something like x[10][0], x[10][1], x[10][2],
|
||||
x[2][0], x[2][1], x[2][2], x[4][0], :math:`\dots`); *data* must be
|
||||
pre-allocated by the caller to length (*count* :math:`\times` *natoms*), as
|
||||
queried by :cpp:func:`lammps_get_natoms`,
|
||||
:cpp:func:`lammps_extract_global`, or :cpp:func:`lammps_extract_setting`.
|
||||
queried by :cpp:func:`lammps_get_natoms`, :cpp:func:`lammps_extract_global`,
|
||||
or :cpp:func:`lammps_extract_setting`.
|
||||
|
||||
This function is not compatible with ``-DLAMMPS_BIGBIG``.
|
||||
.. admonition:: Restrictions
|
||||
:class: warning
|
||||
|
||||
This function is not compatible with ``-DLAMMPS_BIGBIG``.
|
||||
|
||||
Atom IDs must be defined.
|
||||
|
||||
The total number of atoms must not be more than 2147483647 (max 32-bit signed int).
|
||||
|
||||
\endverbatim
|
||||
*
|
||||
@ -2828,8 +2837,7 @@ void lammps_gather_atoms_concat(void *handle, const char *name, int type,
|
||||
if (lmp->atom->tag_enable == 0) flag = 1;
|
||||
if (lmp->atom->natoms > MAXSMALLINT) flag = 1;
|
||||
if (flag) {
|
||||
if (lmp->comm->me == 0)
|
||||
lmp->error->warning(FLERR,"Library error in lammps_gather_atoms");
|
||||
lmp->error->all(FLERR,"lammps_gather_atoms_concat(): Atom-IDs must exist");
|
||||
return;
|
||||
}
|
||||
|
||||
@ -2837,8 +2845,7 @@ void lammps_gather_atoms_concat(void *handle, const char *name, int type,
|
||||
|
||||
void *vptr = lmp->atom->extract(name);
|
||||
if (vptr == nullptr) {
|
||||
if (lmp->comm->me == 0)
|
||||
lmp->error->warning(FLERR,"lammps_gather_atoms: unknown property name");
|
||||
lmp->error->all(FLERR,"lammps_gather_atoms_concat(): unknown property {}", name);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -2947,7 +2954,14 @@ x[100][2], x[57][0], x[57][1], x[57][2], x[210][0], :math:`\dots`);
|
||||
*data* must be pre-allocated by the caller to length
|
||||
(*count* :math:`\times` *ndata*).
|
||||
|
||||
This function is not compatible with ``-DLAMMPS_BIGBIG``.
|
||||
.. admonition:: Restrictions
|
||||
:class: warning
|
||||
|
||||
This function is not compatible with ``-DLAMMPS_BIGBIG``.
|
||||
|
||||
Atom IDs must be defined and an :doc:`atom map must be enabled <atom_modify>`
|
||||
|
||||
The total number of atoms must not be more than 2147483647 (max 32-bit signed int).
|
||||
|
||||
\endverbatim
|
||||
*
|
||||
@ -2993,16 +3007,13 @@ void lammps_gather_atoms_subset(void *handle, const char *name, int type,
|
||||
if (lmp->atom->natoms > MAXSMALLINT) flag = 1;
|
||||
if (lmp->atom->map_style == Atom::MAP_NONE) flag = 1;
|
||||
if (flag) {
|
||||
if (lmp->comm->me == 0)
|
||||
lmp->error->warning(FLERR,"Library error in lammps_gather_atoms_subset: atoms must have mappable ids");
|
||||
lmp->error->all(FLERR,"lammps_gather_atoms_subset(): Atom-IDs must exist and be mapped");
|
||||
return;
|
||||
}
|
||||
|
||||
void *vptr = lmp->atom->extract(name);
|
||||
if (vptr == nullptr) {
|
||||
if (lmp->comm->me == 0)
|
||||
lmp->error->warning(FLERR,"lammps_gather_atoms_subset: "
|
||||
"unknown property name");
|
||||
lmp->error->all(FLERR,"lammps_gather_atoms_subset(): unknown property {}", name);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -3110,7 +3121,15 @@ atom ID (e.g., if *name* is *x* and *count* = 3, then
|
||||
*data* = {x[0][0], x[0][1], x[0][2], x[1][0], x[1][1], x[1][2], x[2][0],
|
||||
:math:`\dots`}); *data* must be of length (*count* :math:`\times` *natoms*).
|
||||
|
||||
This function is not compatible with ``-DLAMMPS_BIGBIG``.
|
||||
.. admonition:: Restrictions
|
||||
:class: warning
|
||||
|
||||
This function is not compatible with ``-DLAMMPS_BIGBIG``.
|
||||
|
||||
Atom IDs must be defined, must be consecutive, and an
|
||||
:doc:`atom map must be enabled <atom_modify>`
|
||||
|
||||
The total number of atoms must not be more than 2147483647 (max 32-bit signed int).
|
||||
|
||||
\endverbatim
|
||||
*
|
||||
@ -3152,8 +3171,8 @@ void lammps_scatter_atoms(void *handle, const char *name, int type, int count,
|
||||
if (lmp->atom->natoms > MAXSMALLINT) flag = 1;
|
||||
if (lmp->atom->map_style == Atom::MAP_NONE) flag = 1;
|
||||
if (flag) {
|
||||
if (lmp->comm->me == 0)
|
||||
lmp->error->warning(FLERR,"Library error in lammps_scatter_atoms: ids must exist, be consecutive, and be mapped");
|
||||
lmp->error->all(FLERR,"lammps_scatter_atoms(): "
|
||||
"Atom-IDs must exist, be consecutive, and be mapped");
|
||||
return;
|
||||
}
|
||||
|
||||
@ -3161,9 +3180,7 @@ void lammps_scatter_atoms(void *handle, const char *name, int type, int count,
|
||||
|
||||
void *vptr = lmp->atom->extract(name);
|
||||
if (vptr == nullptr) {
|
||||
if (lmp->comm->me == 0)
|
||||
lmp->error->warning(FLERR,
|
||||
"lammps_scatter_atoms: unknown property name");
|
||||
lmp->error->all(FLERR, "lammps_scatter_atoms(): unknown property {}", name);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -3244,7 +3261,14 @@ to be the array {x[1][0], x[1][1], x[1][2], x[100][0], x[100][1], x[100][2],
|
||||
x[57][0], x[57][1], x[57][2]}, then *count* = 3, *ndata* = 3, and *ids* would
|
||||
be {1, 100, 57}.
|
||||
|
||||
This function is not compatible with ``-DLAMMPS_BIGBIG``.
|
||||
.. admonition:: Restrictions
|
||||
:class: warning
|
||||
|
||||
This function is not compatible with ``-DLAMMPS_BIGBIG``.
|
||||
|
||||
Atom IDs must be defined and an :doc:`atom map must be enabled <atom_modify>`
|
||||
|
||||
The total number of atoms must not be more than 2147483647 (max 32-bit signed int).
|
||||
|
||||
\endverbatim
|
||||
*
|
||||
@ -3301,16 +3325,13 @@ void lammps_scatter_atoms_subset(void *handle, const char *name, int type,
|
||||
if (lmp->atom->natoms > MAXSMALLINT) flag = 1;
|
||||
if (lmp->atom->map_style == Atom::MAP_NONE) flag = 1;
|
||||
if (flag) {
|
||||
if (lmp->comm->me == 0)
|
||||
lmp->error->warning(FLERR,"Library error in lammps_scatter_atoms_subset: atoms must have mapped ids");
|
||||
lmp->error->all(FLERR,"lammps_scatter_atoms_subset(): Atom-IDs must exist and be mapped");
|
||||
return;
|
||||
}
|
||||
|
||||
void *vptr = lmp->atom->extract(name);
|
||||
if (vptr == nullptr) {
|
||||
if (lmp->comm->me == 0)
|
||||
lmp->error->warning(FLERR,
|
||||
"lammps_scatter_atoms_subset: unknown property name");
|
||||
lmp->error->all(FLERR, "lammps_scatter_atoms_subset(): unknown property {}", name);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -3849,7 +3870,14 @@ The *data* array will be ordered in groups of *count* values, sorted by atom ID
|
||||
This function will return an error if fix or compute data are requested and the fix or compute ID
|
||||
given does not have per-atom data.
|
||||
|
||||
This function is not compatible with ``-DLAMMPS_BIGBIG``.
|
||||
.. admonition:: Restrictions
|
||||
:class: warning
|
||||
|
||||
This function is not compatible with ``-DLAMMPS_BIGBIG``.
|
||||
|
||||
Atom IDs must be defined and must be consecutive.
|
||||
|
||||
The total number of atoms must not be more than 2147483647 (max 32-bit signed int).
|
||||
|
||||
\endverbatim
|
||||
*
|
||||
@ -3899,7 +3927,7 @@ void lammps_gather(void *handle, const char *name, int type, int count, void *da
|
||||
BEGIN_CAPTURE
|
||||
{
|
||||
#if defined(LAMMPS_BIGBIG)
|
||||
lmp->error->all(FLERR,"Library function lammps_gather not compatible with -DLAMMPS_BIGBIG");
|
||||
lmp->error->all(FLERR, "Library function lammps_gather() is not compatible with -DLAMMPS_BIGBIG");
|
||||
#else
|
||||
int i,j,offset,ltype;
|
||||
|
||||
@ -3910,8 +3938,7 @@ void lammps_gather(void *handle, const char *name, int type, int count, void *da
|
||||
flag = 1;
|
||||
if (lmp->atom->natoms > MAXSMALLINT) flag = 1;
|
||||
if (flag) {
|
||||
if (lmp->comm->me == 0)
|
||||
lmp->error->warning(FLERR,"Library error in lammps_gather");
|
||||
lmp->error->all(FLERR,"lammps_gather(): Atom-IDs must exist, and be consecutive");
|
||||
return;
|
||||
}
|
||||
|
||||
@ -3921,28 +3948,25 @@ void lammps_gather(void *handle, const char *name, int type, int count, void *da
|
||||
// fix
|
||||
|
||||
if (vptr==nullptr && utils::strmatch(name,"^f_")) {
|
||||
const char *fixid = name+2;
|
||||
|
||||
auto fix = lmp->modify->get_fix_by_id(&name[2]);
|
||||
auto fix = lmp->modify->get_fix_by_id(fixid);
|
||||
if (!fix) {
|
||||
if (lmp->comm->me == 0)
|
||||
lmp->error->warning(FLERR,"lammps_gather: unknown fix id");
|
||||
lmp->error->all(FLERR,"lammps_gather(): unknown fix id {}", fixid);
|
||||
return;
|
||||
}
|
||||
|
||||
if (fix->peratom_flag == 0) {
|
||||
if (lmp->comm->me == 0)
|
||||
lmp->error->warning(FLERR,"lammps_gather: fix does not return peratom data");
|
||||
lmp->error->all(FLERR,"lammps_gather(): fix {} does not return peratom data", fixid);
|
||||
return;
|
||||
}
|
||||
if ((count > 1) && (fix->size_peratom_cols != count)) {
|
||||
if (lmp->comm->me == 0)
|
||||
lmp->error->warning(FLERR,"lammps_gather: count != values peratom for fix");
|
||||
lmp->error->all(FLERR,"lammps_gather: count != values peratom for fix {}", fixid);
|
||||
return;
|
||||
}
|
||||
|
||||
if (lmp->update->ntimestep % fix->peratom_freq) {
|
||||
if (lmp->comm->me == 0)
|
||||
lmp->error->all(FLERR,"lammps_gather: fix not computed at compatible time");
|
||||
lmp->error->all(FLERR,"lammps_gather: fix {} not computed at compatible time", fixid);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -3953,22 +3977,19 @@ void lammps_gather(void *handle, const char *name, int type, int count, void *da
|
||||
// compute
|
||||
|
||||
if (vptr==nullptr && utils::strmatch(name,"^c_")) {
|
||||
|
||||
auto compute = lmp->modify->get_compute_by_id(&name[2]);
|
||||
const char *compid = name+2;
|
||||
auto compute = lmp->modify->get_compute_by_id(compid);
|
||||
if (!compute) {
|
||||
if (lmp->comm->me == 0)
|
||||
lmp->error->warning(FLERR,"lammps_gather: unknown compute id");
|
||||
lmp->error->all(FLERR,"lammps_gather(): unknown compute id {}", compid);
|
||||
return;
|
||||
}
|
||||
|
||||
if (compute->peratom_flag == 0) {
|
||||
if (lmp->comm->me == 0)
|
||||
lmp->error->warning(FLERR,"lammps_gather: compute does not return peratom data");
|
||||
lmp->error->all(FLERR,"lammps_gather(): compute {} does not return peratom data", compid);
|
||||
return;
|
||||
}
|
||||
if ((count > 1) && (compute->size_peratom_cols != count)) {
|
||||
if (lmp->comm->me == 0)
|
||||
lmp->error->warning(FLERR,"lammps_gather: count != values peratom for compute");
|
||||
lmp->error->all(FLERR,"lammps_gather(): count != values peratom for compute {}", compid);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -3984,28 +4005,26 @@ void lammps_gather(void *handle, const char *name, int type, int count, void *da
|
||||
if ((vptr == nullptr) && utils::strmatch(name,"^[id]2?_")) {
|
||||
|
||||
int idx,icol;
|
||||
if (utils::strmatch(name,"^[id]_")) idx = lmp->atom->find_custom(&name[2],ltype,icol);
|
||||
else idx = lmp->atom->find_custom(&name[3],ltype,icol);
|
||||
const char *propid;
|
||||
if (utils::strmatch(name,"^[id]_")) propid = name+2;
|
||||
else propid = name+3;
|
||||
idx = lmp->atom->find_custom(propid,ltype,icol);
|
||||
|
||||
if (idx < 0) {
|
||||
if (lmp->comm->me == 0)
|
||||
lmp->error->warning(FLERR,"lammps_gather: unknown property/atom id");
|
||||
lmp->error->all(FLERR,"lammps_gather(): unknown property/atom id {}", propid);
|
||||
return;
|
||||
}
|
||||
|
||||
if (ltype != type) {
|
||||
if (lmp->comm->me == 0)
|
||||
lmp->error->warning(FLERR,"lammps_gather: mismatch property/atom type");
|
||||
lmp->error->all(FLERR,"lammps_gather(): mismatch property/atom type for {}", propid);
|
||||
return;
|
||||
}
|
||||
if ((count == 1) && (icol != 0)) {
|
||||
if (lmp->comm->me == 0)
|
||||
lmp->error->warning(FLERR,"lammps_gather: mismatch property/atom count");
|
||||
lmp->error->all(FLERR,"lammps_gather(): mismatch property/atom count for {}", propid);
|
||||
return;
|
||||
}
|
||||
if ((count > 1) && (icol != count)) {
|
||||
if (lmp->comm->me == 0)
|
||||
lmp->error->warning(FLERR,"lammps_gather: mismatch property/atom count");
|
||||
lmp->error->all(FLERR,"lammps_gather(): mismatch property/atom count for {}", propid);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -4021,8 +4040,7 @@ void lammps_gather(void *handle, const char *name, int type, int count, void *da
|
||||
// no match
|
||||
|
||||
if (vptr == nullptr) {
|
||||
if (lmp->comm->me == 0)
|
||||
lmp->error->warning(FLERR,"lammps_gather: undefined property name");
|
||||
lmp->error->all(FLERR,"lammps_gather(): undefined property {}", name);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -4122,7 +4140,14 @@ pre-allocated by the caller to length (*count* :math:`\times` *natoms*), as quer
|
||||
:cpp:func:`lammps_get_natoms`, :cpp:func:`lammps_extract_global`, or
|
||||
:cpp:func:`lammps_extract_setting`.
|
||||
|
||||
This function is not compatible with ``-DLAMMPS_BIGBIG``.
|
||||
.. admonition:: Restrictions
|
||||
:class: warning
|
||||
|
||||
This function is not compatible with ``-DLAMMPS_BIGBIG``.
|
||||
|
||||
Atom IDs must be defined.
|
||||
|
||||
The total number of atoms must be less than 2147483647 (max 32-bit signed int).
|
||||
|
||||
\endverbatim
|
||||
*
|
||||
@ -4173,8 +4198,8 @@ void lammps_gather_concat(void *handle, const char *name, int type, int count,
|
||||
BEGIN_CAPTURE
|
||||
{
|
||||
#if defined(LAMMPS_BIGBIG)
|
||||
lmp->error->all(FLERR,"Library function lammps_gather_concat"
|
||||
" not compatible with -DLAMMPS_BIGBIG");
|
||||
lmp->error->all(FLERR,"Library function lammps_gather_concat()"
|
||||
" is not compatible with -DLAMMPS_BIGBIG");
|
||||
#else
|
||||
int i,offset,ltype;
|
||||
|
||||
@ -4184,8 +4209,7 @@ void lammps_gather_concat(void *handle, const char *name, int type, int count,
|
||||
if (lmp->atom->tag_enable == 0) flag = 1;
|
||||
if (lmp->atom->natoms > MAXSMALLINT) flag = 1;
|
||||
if (flag) {
|
||||
if (lmp->comm->me == 0)
|
||||
lmp->error->warning(FLERR,"Library error in lammps_gather_concat");
|
||||
lmp->error->all(FLERR,"lammps_gather_concat(): atom-IDs must exist");
|
||||
return;
|
||||
}
|
||||
|
||||
@ -4195,27 +4219,24 @@ void lammps_gather_concat(void *handle, const char *name, int type, int count,
|
||||
// fix
|
||||
|
||||
if (vptr==nullptr && utils::strmatch(name,"^f_")) {
|
||||
|
||||
auto fix = lmp->modify->get_fix_by_id(&name[2]);
|
||||
const char *fixid = name+2;
|
||||
auto fix = lmp->modify->get_fix_by_id(fixid);
|
||||
if (!fix) {
|
||||
if (lmp->comm->me == 0)
|
||||
lmp->error->warning(FLERR,"lammps_gather_concat: unknown fix id");
|
||||
lmp->error->all(FLERR,"lammps_gather_concat(): unknown fix id {}", fixid);
|
||||
return;
|
||||
}
|
||||
|
||||
if (fix->peratom_flag == 0) {
|
||||
if (lmp->comm->me == 0)
|
||||
lmp->error->warning(FLERR,"lammps_gather_concat: fix does not return peratom data");
|
||||
lmp->error->all(FLERR,"lammps_gather_concat(): fix {} does not return peratom data", fixid);
|
||||
return;
|
||||
}
|
||||
if ((count > 1) && (fix->size_peratom_cols != count)) {
|
||||
if (lmp->comm->me == 0)
|
||||
lmp->error->warning(FLERR,"lammps_gather_concat: count != values peratom for fix");
|
||||
lmp->error->all(FLERR,"lammps_gather_concat(): count != values peratom for fix {}", fixid);
|
||||
return;
|
||||
}
|
||||
if (lmp->update->ntimestep % fix->peratom_freq) {
|
||||
if (lmp->comm->me == 0)
|
||||
lmp->error->all(FLERR,"lammps_gather_concat: fix not computed at compatible time");
|
||||
lmp->error->all(FLERR,"lammps_gather_concat(): fix {} not computed at compatible time",
|
||||
fixid);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -4227,21 +4248,21 @@ void lammps_gather_concat(void *handle, const char *name, int type, int count,
|
||||
|
||||
if (vptr==nullptr && utils::strmatch(name,"^c_")) {
|
||||
|
||||
auto compute = lmp->modify->get_compute_by_id(&name[2]);
|
||||
const char *compid = name + 2;
|
||||
auto compute = lmp->modify->get_compute_by_id(compid);
|
||||
if (!compute) {
|
||||
if (lmp->comm->me == 0)
|
||||
lmp->error->warning(FLERR,"lammps_gather_concat: unknown compute id");
|
||||
lmp->error->all(FLERR,"lammps_gather_concat(): unknown compute id {}", compid);
|
||||
return;
|
||||
}
|
||||
|
||||
if (compute->peratom_flag == 0) {
|
||||
if (lmp->comm->me == 0)
|
||||
lmp->error->warning(FLERR,"lammps_gather_concat: compute does not return peratom data");
|
||||
lmp->error->all(FLERR,"lammps_gather_concat(): compute {} does not return peratom data",
|
||||
compid);
|
||||
return;
|
||||
}
|
||||
if ((count > 1) && (compute->size_peratom_cols != count)) {
|
||||
if (lmp->comm->me == 0)
|
||||
lmp->error->warning(FLERR,"lammps_gather_concat: count != values peratom for compute");
|
||||
lmp->error->all(FLERR,"lammps_gather_concat(): count != values peratom for compute {}",
|
||||
compid);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -4257,28 +4278,26 @@ void lammps_gather_concat(void *handle, const char *name, int type, int count,
|
||||
if ((vptr==nullptr) && utils::strmatch(name,"^[id]2?_")) {
|
||||
|
||||
int idx,icol;
|
||||
if (utils::strmatch(name,"^[id]_")) idx = lmp->atom->find_custom(&name[2],ltype,icol);
|
||||
else idx = lmp->atom->find_custom(&name[3],ltype,icol);
|
||||
const char *propid;
|
||||
if (utils::strmatch(name,"^[id]_")) propid = name + 2;
|
||||
else propid = name + 3;
|
||||
idx = lmp->atom->find_custom(propid,ltype,icol);
|
||||
|
||||
if (idx < 0) {
|
||||
if (lmp->comm->me == 0)
|
||||
lmp->error->warning(FLERR,"lammps_gather_concat: unknown property/atom id");
|
||||
lmp->error->all(FLERR,"lammps_gather_concat(): unknown property/atom id {}", propid);
|
||||
return;
|
||||
}
|
||||
|
||||
if (ltype != type) {
|
||||
if (lmp->comm->me == 0)
|
||||
lmp->error->warning(FLERR,"lammps_gather_concat: mismatch property/atom type");
|
||||
lmp->error->all(FLERR,"lammps_gather_concat(): mismatch property/atom {} type", propid);
|
||||
return;
|
||||
}
|
||||
if ((count == 1) && (icol != 0)) {
|
||||
if (lmp->comm->me == 0)
|
||||
lmp->error->warning(FLERR,"lammps_gather_concat: mismatch property/atom count");
|
||||
lmp->error->all(FLERR,"lammps_gather_concat(): mismatch property/atom {} count", propid);
|
||||
return;
|
||||
}
|
||||
if ((count > 1) && (icol != count)) {
|
||||
if (lmp->comm->me == 0)
|
||||
lmp->error->warning(FLERR,"lammps_gather_concat: mismatch property/atom count");
|
||||
lmp->error->all(FLERR,"lammps_gather_concat(): mismatch property/atom {} count", propid);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -4294,8 +4313,7 @@ void lammps_gather_concat(void *handle, const char *name, int type, int count,
|
||||
// no match
|
||||
|
||||
if (vptr == nullptr) {
|
||||
if (lmp->comm->me == 0)
|
||||
lmp->error->warning(FLERR,"lammps_gather_concat: undefined property name");
|
||||
lmp->error->all(FLERR,"lammps_gather_concat(): undefined property {}", name);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -4405,7 +4423,14 @@ look like {x[100][0], x[100][1], x[100][2], x[57][0], x[57][1], x[57][2], x[210]
|
||||
:math:`\dots`}); *ids* must be provided by the user with length *ndata*, and *data* must be
|
||||
pre-allocated by the caller to length (*count*\ :math:`{}\times{}`\ *ndata*).
|
||||
|
||||
This function is not compatible with ``-DLAMMPS_BIGBIG``.
|
||||
.. admonition:: Restrictions
|
||||
:class: warning
|
||||
|
||||
This function is not compatible with ``-DLAMMPS_BIGBIG``.
|
||||
|
||||
Atom IDs must be defined and an :doc:`atom map must be enabled <atom_modify>`
|
||||
|
||||
The total number of atoms must not be more than 2147483647 (max 32-bit signed int).
|
||||
|
||||
\endverbatim
|
||||
*
|
||||
@ -4471,8 +4496,7 @@ void lammps_gather_subset(void *handle, const char *name, int type, int count,
|
||||
if (lmp->atom->natoms > MAXSMALLINT) flag = 1;
|
||||
if (lmp->atom->map_style == Atom::MAP_NONE) flag = 1;
|
||||
if (flag) {
|
||||
if (lmp->comm->me == 0)
|
||||
lmp->error->warning(FLERR,"Library error in lammps_gather_subset");
|
||||
lmp->error->all (FLERR,"lammps_gather_subset(): atom IDs must be enabled and mapped");
|
||||
return;
|
||||
}
|
||||
|
||||
@ -4481,26 +4505,24 @@ void lammps_gather_subset(void *handle, const char *name, int type, int count,
|
||||
// fix
|
||||
|
||||
if (vptr==nullptr && utils::strmatch(name,"^f_")) {
|
||||
const char *fixid = name + 2;
|
||||
|
||||
auto fix = lmp->modify->get_fix_by_id(&name[2]);
|
||||
auto fix = lmp->modify->get_fix_by_id(fixid);
|
||||
if (!fix) {
|
||||
if (lmp->comm->me == 0)
|
||||
lmp->error->warning(FLERR,"lammps_gather_subset: unknown fix id");
|
||||
lmp->error->all(FLERR,"lammps_gather_subset(): unknown fix id {}", fixid);
|
||||
return;
|
||||
}
|
||||
|
||||
if (fix->peratom_flag == 0) {
|
||||
if (lmp->comm->me == 0)
|
||||
lmp->error->warning(FLERR,"lammps_gather_subset: fix does not return peratom data");
|
||||
lmp->error->all(FLERR,"lammps_gather_subset(): fix {} does not return peratom data", fixid);
|
||||
return;
|
||||
}
|
||||
if ((count > 1) && (fix->size_peratom_cols != count)) {
|
||||
lmp->error->warning(FLERR,"lammps_gather_subset: count != values peratom for fix");
|
||||
lmp->error->all(FLERR,"lammps_gather_subset(): count != values peratom for fix {}", fixid);
|
||||
return;
|
||||
}
|
||||
if (lmp->update->ntimestep % fix->peratom_freq) {
|
||||
if (lmp->comm->me == 0)
|
||||
lmp->error->all(FLERR,"lammps_gather_subset: fix not computed at compatible time");
|
||||
lmp->error->all(FLERR,"lammps_gather_subset(): fix {} not computed at compatible time", fixid);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -4511,22 +4533,21 @@ void lammps_gather_subset(void *handle, const char *name, int type, int count,
|
||||
// compute
|
||||
|
||||
if (vptr==nullptr && utils::strmatch(name,"^c_")) {
|
||||
|
||||
auto compute = lmp->modify->get_compute_by_id(&name[2]);
|
||||
const char *compid = name + 2;
|
||||
auto compute = lmp->modify->get_compute_by_id(compid);
|
||||
if (!compute) {
|
||||
if (lmp->comm->me == 0)
|
||||
lmp->error->warning(FLERR,"lammps_gather_subset: unknown compute id");
|
||||
lmp->error->all(FLERR,"lammps_gather_subset(): unknown compute id {}", compid);
|
||||
return;
|
||||
}
|
||||
|
||||
if (compute->peratom_flag == 0) {
|
||||
if (lmp->comm->me == 0)
|
||||
lmp->error->warning(FLERR,"lammps_gather_subset: compute does not return peratom data");
|
||||
lmp->error->all(FLERR,"lammps_gather_subset(): compute {} does not return peratom data",
|
||||
compid);
|
||||
return;
|
||||
}
|
||||
if ((count > 1) && (compute->size_peratom_cols != count)) {
|
||||
if (lmp->comm->me == 0)
|
||||
lmp->error->warning(FLERR,"lammps_gather_subset: count != values peratom for compute");
|
||||
lmp->error->all(FLERR,"lammps_gather_subset(): count != values peratom for compute {}",
|
||||
compid);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -4542,28 +4563,26 @@ void lammps_gather_subset(void *handle, const char *name, int type, int count,
|
||||
if ((vptr == nullptr) && utils::strmatch(name,"^[id]2?_")) {
|
||||
|
||||
int idx,icol;
|
||||
if (utils::strmatch(name,"^[id]_")) idx = lmp->atom->find_custom(&name[2],ltype,icol);
|
||||
else idx = lmp->atom->find_custom(&name[3],ltype,icol);
|
||||
const char *propid;
|
||||
if (utils::strmatch(name,"^[id]_")) propid = name + 2;
|
||||
else propid = name + 3;
|
||||
idx = lmp->atom->find_custom(propid,ltype,icol);
|
||||
|
||||
if (idx < 0) {
|
||||
if (lmp->comm->me == 0)
|
||||
lmp->error->warning(FLERR,"lammps_gather_subset: unknown property/atom id");
|
||||
lmp->error->all(FLERR,"lammps_gather_subset(): unknown property/atom id {}", propid);
|
||||
return;
|
||||
}
|
||||
|
||||
if (ltype != type) {
|
||||
if (lmp->comm->me == 0)
|
||||
lmp->error->warning(FLERR,"lammps_gather_subset: mismatch property/atom type");
|
||||
lmp->error->all(FLERR,"lammps_gather_subset(): mismatch property/atom {} type", propid);
|
||||
return;
|
||||
}
|
||||
if (count == 1 && icol != 0) {
|
||||
if (lmp->comm->me == 0)
|
||||
lmp->error->warning(FLERR,"lammps_gather_subset: mismatch property/atom count");
|
||||
lmp->error->all(FLERR,"lammps_gather_subset(): mismatch property/atom {} count", propid);
|
||||
return;
|
||||
}
|
||||
if (count > 1 && icol != count) {
|
||||
if (lmp->comm->me == 0)
|
||||
lmp->error->warning(FLERR,"lammps_gather_subset: mismatch property/atom count");
|
||||
lmp->error->all(FLERR,"lammps_gather_subset(): mismatch property/atom {} count", propid);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -4579,8 +4598,7 @@ void lammps_gather_subset(void *handle, const char *name, int type, int count,
|
||||
// no match
|
||||
|
||||
if (vptr == nullptr) {
|
||||
if (lmp->comm->me == 0)
|
||||
lmp->error->warning(FLERR,"lammps_gather_subset: undefined property name");
|
||||
lmp->error->all(FLERR,"lammps_gather_subset(): undefined property {}", name);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -4688,7 +4706,15 @@ The *data* array needs to be ordered in groups of *count* values, sorted by atom
|
||||
*name* is *x* and *count* = 3, then *data* = {x[0][0], x[0][1], x[0][2], x[1][0], x[1][1],
|
||||
x[1][2], x[2][0], :math:`\dots`}); *data* must be of length (*count* :math:`\times` *natoms*).
|
||||
|
||||
This function is not compatible with ``-DLAMMPS_BIGBIG``.
|
||||
.. admonition:: Restrictions
|
||||
:class: warning
|
||||
|
||||
This function is not compatible with ``-DLAMMPS_BIGBIG``.
|
||||
|
||||
Atom IDs must be defined, must be consecutive, and an
|
||||
:doc:`atom map must be enabled <atom_modify>`
|
||||
|
||||
The total number of atoms must not be more than 2147483647 (max 32-bit signed int).
|
||||
|
||||
\endverbatim
|
||||
*
|
||||
@ -4751,8 +4777,7 @@ void lammps_scatter(void *handle, const char *name, int type, int count,
|
||||
if (lmp->atom->natoms > MAXSMALLINT) flag = 1;
|
||||
if (lmp->atom->map_style == Atom::MAP_NONE) flag = 1;
|
||||
if (flag) {
|
||||
if (lmp->comm->me == 0)
|
||||
lmp->error->warning(FLERR,"Library error in lammps_scatter");
|
||||
lmp->error->all(FLERR,"lammps_scatter(): atom IDs must be defined, consecutive, and mapped");
|
||||
return;
|
||||
}
|
||||
|
||||
@ -4762,22 +4787,19 @@ void lammps_scatter(void *handle, const char *name, int type, int count,
|
||||
// fix
|
||||
|
||||
if (vptr==nullptr && utils::strmatch(name,"^f_")) {
|
||||
|
||||
auto fix = lmp->modify->get_fix_by_id(&name[2]);
|
||||
const char *fixid = name + 2;
|
||||
auto fix = lmp->modify->get_fix_by_id(fixid);
|
||||
if (!fix) {
|
||||
if (lmp->comm->me == 0)
|
||||
lmp->error->warning(FLERR,"lammps_scatter: unknown fix id");
|
||||
lmp->error->all(FLERR,"lammps_scatter(): unknown fix id {}", fixid);
|
||||
return;
|
||||
}
|
||||
|
||||
if (fix->peratom_flag == 0) {
|
||||
if (lmp->comm->me == 0)
|
||||
lmp->error->warning(FLERR,"lammps_scatter: fix does not return peratom data");
|
||||
lmp->error->all(FLERR,"lammps_scatter(): fix {} does not return peratom data", fixid);
|
||||
return;
|
||||
}
|
||||
if ((count > 1) && (fix->size_peratom_cols != count)) {
|
||||
if (lmp->comm->me == 0)
|
||||
lmp->error->warning(FLERR,"lammps_scatter: count != values peratom for fix");
|
||||
lmp->error->all(FLERR,"lammps_scatter(): count != values peratom for fix {}", fixid);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -4788,22 +4810,19 @@ void lammps_scatter(void *handle, const char *name, int type, int count,
|
||||
// compute
|
||||
|
||||
if (vptr==nullptr && utils::strmatch(name,"^c_")) {
|
||||
|
||||
auto compute = lmp->modify->get_compute_by_id(&name[2]);
|
||||
const char *compid = name + 2;
|
||||
auto compute = lmp->modify->get_compute_by_id(compid);
|
||||
if (!compute) {
|
||||
if (lmp->comm->me == 0)
|
||||
lmp->error->warning(FLERR,"lammps_scatter: unknown compute id");
|
||||
lmp->error->all(FLERR,"lammps_scatter(): unknown compute id {}",compid);
|
||||
return;
|
||||
}
|
||||
|
||||
if (compute->peratom_flag == 0) {
|
||||
if (lmp->comm->me == 0)
|
||||
lmp->error->warning(FLERR,"lammps_scatter: compute does not return peratom data");
|
||||
lmp->error->all(FLERR,"lammps_scatter(): compute {} does not return peratom data", compid);
|
||||
return;
|
||||
}
|
||||
if ((count > 1) && (compute->size_peratom_cols != count)) {
|
||||
if (lmp->comm->me == 0)
|
||||
lmp->error->warning(FLERR,"lammps_scatter: count != values peratom for compute");
|
||||
lmp->error->all(FLERR,"lammps_scatter(): count != values peratom for compute {}", compid);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -4819,28 +4838,26 @@ void lammps_scatter(void *handle, const char *name, int type, int count,
|
||||
if ((vptr == nullptr) && utils::strmatch(name,"^[id]2?_")) {
|
||||
|
||||
int idx,icol;
|
||||
if (utils::strmatch(name,"^[id]_")) idx = lmp->atom->find_custom(&name[2],ltype,icol);
|
||||
else idx = lmp->atom->find_custom(&name[3],ltype,icol);
|
||||
const char *propid;
|
||||
if (utils::strmatch(name,"^[id]_")) propid = name + 2;
|
||||
else propid = name + 3;
|
||||
idx = lmp->atom->find_custom(propid,ltype,icol);
|
||||
|
||||
if (idx < 0) {
|
||||
if (lmp->comm->me == 0)
|
||||
lmp->error->warning(FLERR,"lammps_scatter: unknown property/atom id");
|
||||
lmp->error->all(FLERR,"lammps_scatter(): unknown property/atom id {}", propid);
|
||||
return;
|
||||
}
|
||||
|
||||
if (ltype != type) {
|
||||
if (lmp->comm->me == 0)
|
||||
lmp->error->warning(FLERR,"lammps_scatter: mismatch property/atom type");
|
||||
lmp->error->all(FLERR,"lammps_scatter(): mismatch property/atom {} type", propid);
|
||||
return;
|
||||
}
|
||||
if (count == 1 && icol != 0) {
|
||||
if (lmp->comm->me == 0)
|
||||
lmp->error->warning(FLERR,"lammps_scatter: mismatch property/atom count");
|
||||
lmp->error->all(FLERR,"lammps_scatter(): mismatch property/atom {} count", propid);
|
||||
return;
|
||||
}
|
||||
if (count > 1 && icol != count) {
|
||||
if (lmp->comm->me == 0)
|
||||
lmp->error->warning(FLERR,"lammps_scatter: mismatch property/atom count");
|
||||
lmp->error->all(FLERR,"lammps_scatter(): mismatch property/atom {} count", propid);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -4856,8 +4873,7 @@ void lammps_scatter(void *handle, const char *name, int type, int count,
|
||||
// no match
|
||||
|
||||
if (vptr == nullptr) {
|
||||
if (lmp->comm->me == 0)
|
||||
lmp->error->warning(FLERR,"lammps_scatter: unknown property name");
|
||||
lmp->error->all(FLERR,"lammps_scatter(): unknown property {}", name);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -4938,7 +4954,14 @@ to be the array {x[1][0], x[1][1], x[1][2], x[100][0], x[100][1], x[100][2],
|
||||
x[57][0], x[57][1], x[57][2]}, then *count* = 3, *ndata* = 3, and *ids* would
|
||||
be {1, 100, 57}.
|
||||
|
||||
This function is not compatible with ``-DLAMMPS_BIGBIG``.
|
||||
.. admonition:: Restrictions
|
||||
:class: warning
|
||||
|
||||
This function is not compatible with ``-DLAMMPS_BIGBIG``.
|
||||
|
||||
Atom IDs must be defined and an :doc:`atom map must be enabled <atom_modify>`
|
||||
|
||||
The total number of atoms must not be more than 2147483647 (max 32-bit signed int).
|
||||
|
||||
\endverbatim
|
||||
*
|
||||
@ -4979,8 +5002,8 @@ This function is not compatible with ``-DLAMMPS_BIGBIG``.
|
||||
loop over Ndata, if I own atom ID, set its values from data
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
void lammps_scatter_subset(void *handle, const char *name,int type, int count,
|
||||
int ndata, int *ids, void *data)
|
||||
void lammps_scatter_subset(void *handle, const char *name,int type, int count, int ndata,
|
||||
int *ids, void *data)
|
||||
{
|
||||
auto lmp = (LAMMPS *) handle;
|
||||
|
||||
@ -5001,8 +5024,7 @@ void lammps_scatter_subset(void *handle, const char *name,int type, int count,
|
||||
if (lmp->atom->natoms > MAXSMALLINT) flag = 1;
|
||||
if (lmp->atom->map_style == Atom::MAP_NONE) flag = 1;
|
||||
if (flag) {
|
||||
if (lmp->comm->me == 0)
|
||||
lmp->error->warning(FLERR,"Library error in lammps_scatter_atoms_subset");
|
||||
lmp->error->all(FLERR,"lammps_scatter_subset(): atom-IDs must be defined and mapped");
|
||||
return;
|
||||
}
|
||||
|
||||
@ -5011,22 +5033,19 @@ void lammps_scatter_subset(void *handle, const char *name,int type, int count,
|
||||
// fix
|
||||
|
||||
if (vptr==nullptr && utils::strmatch(name,"^f_")) {
|
||||
|
||||
auto fix = lmp->modify->get_fix_by_id(&name[2]);
|
||||
const char *fixid = name + 2;
|
||||
auto fix = lmp->modify->get_fix_by_id(fixid);
|
||||
if (!fix) {
|
||||
if (lmp->comm->me == 0)
|
||||
lmp->error->warning(FLERR,"lammps_scatter_subset: unknown fix id");
|
||||
lmp->error->all(FLERR,"lammps_scatter_subset(): unknown fix id {}", fixid);
|
||||
return;
|
||||
}
|
||||
|
||||
if (fix->peratom_flag == 0) {
|
||||
if (lmp->comm->me == 0)
|
||||
lmp->error->warning(FLERR,"lammps_scatter_subset: fix does not return peratom data");
|
||||
lmp->error->all(FLERR,"lammps_scatter_subset(): fix {} does not return peratom data", fixid);
|
||||
return;
|
||||
}
|
||||
if ((count > 1) && (fix->size_peratom_cols != count)) {
|
||||
if (lmp->comm->me == 0)
|
||||
lmp->error->warning(FLERR,"lammps_scatter_subset: count != values peratom for fix");
|
||||
lmp->error->all(FLERR,"lammps_scatter_subset(): count != values peratom for fix {}", fixid);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -5037,22 +5056,21 @@ void lammps_scatter_subset(void *handle, const char *name,int type, int count,
|
||||
// compute
|
||||
|
||||
if (vptr==nullptr && utils::strmatch(name,"^c_")) {
|
||||
|
||||
auto compute = lmp->modify->get_compute_by_id(&name[2]);
|
||||
const char *compid = name + 2;
|
||||
auto compute = lmp->modify->get_compute_by_id(compid);
|
||||
if (!compute) {
|
||||
if (lmp->comm->me == 0)
|
||||
lmp->error->warning(FLERR,"lammps_scatter_subset: unknown compute id");
|
||||
lmp->error->all(FLERR,"lammps_scatter_subset(): unknown compute id {}", compid);
|
||||
return;
|
||||
}
|
||||
|
||||
if (compute->peratom_flag == 0) {
|
||||
if (lmp->comm->me == 0)
|
||||
lmp->error->warning(FLERR,"lammps_scatter_subset: compute does not return peratom data");
|
||||
lmp->error->all(FLERR,"lammps_scatter_subset(): compute {} does not return peratom data",
|
||||
compid);
|
||||
return;
|
||||
}
|
||||
if ((count > 1) && (compute->size_peratom_cols != count)) {
|
||||
if (lmp->comm->me == 0)
|
||||
lmp->error->warning(FLERR,"lammps_scatter_subset: count != values peratom for compute");
|
||||
lmp->error->all(FLERR,"lammps_scatter_subset(): count != values peratom for compute {}",
|
||||
compid);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -5068,28 +5086,26 @@ void lammps_scatter_subset(void *handle, const char *name,int type, int count,
|
||||
if ((vptr == nullptr) && utils::strmatch(name,"^[id]2?_")) {
|
||||
|
||||
int idx,icol;
|
||||
if (utils::strmatch(name,"^[id]_")) idx = lmp->atom->find_custom(&name[2],ltype,icol);
|
||||
else idx = lmp->atom->find_custom(&name[3],ltype,icol);
|
||||
const char *propid;
|
||||
if (utils::strmatch(name,"^[id]_")) propid = name + 2;
|
||||
else propid = name + 3;
|
||||
idx = lmp->atom->find_custom(propid,ltype,icol);
|
||||
|
||||
if (idx < 0) {
|
||||
if (lmp->comm->me == 0)
|
||||
lmp->error->warning(FLERR,"lammps_scatter_subset: unknown property/atom id");
|
||||
lmp->error->all(FLERR,"lammps_scatter_subset(): unknown property/atom id {}", propid);
|
||||
return;
|
||||
}
|
||||
|
||||
if (ltype != type) {
|
||||
if (lmp->comm->me == 0)
|
||||
lmp->error->warning(FLERR,"lammps_scatter_subset: mismatch property/atom type");
|
||||
lmp->error->all(FLERR,"lammps_scatter_subset(): mismatch property/atom {} type", propid);
|
||||
return;
|
||||
}
|
||||
if (count == 1 && icol != 0) {
|
||||
if (lmp->comm->me == 0)
|
||||
lmp->error->warning(FLERR,"lammps_gather: mismatch property/atom count");
|
||||
lmp->error->all(FLERR,"lammps_scatter_subset(): mismatch property/atom {} count", propid);
|
||||
return;
|
||||
}
|
||||
if (count > 1 && icol != count) {
|
||||
if (lmp->comm->me == 0)
|
||||
lmp->error->warning(FLERR,"lammps_gather: mismatch property/atom count");
|
||||
lmp->error->all(FLERR,"lammps_scatter_subset(): mismatch property/atom {} count", propid);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -5105,9 +5121,7 @@ void lammps_scatter_subset(void *handle, const char *name,int type, int count,
|
||||
// no match
|
||||
|
||||
if (vptr == nullptr) {
|
||||
if (lmp->comm->me == 0)
|
||||
lmp->error->warning(FLERR,"lammps_scatter_atoms_subset: "
|
||||
"unknown property name");
|
||||
lmp->error->all(FLERR,"lammps_scatter_subset(): unknown property {}", name);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -5246,7 +5260,7 @@ int lammps_create_atoms(void *handle, int n, const tagint *id, const int *type,
|
||||
// error if box does not exist or tags not defined
|
||||
|
||||
int flag = 0;
|
||||
std::string msg("Failure in lammps_create_atoms: ");
|
||||
std::string msg("Failure in lammps_create_atoms(): ");
|
||||
if (lmp->domain->box_exist == 0) {
|
||||
flag = 1;
|
||||
msg += "trying to create atoms before before simulation box is defined";
|
||||
@ -5257,7 +5271,7 @@ int lammps_create_atoms(void *handle, int n, const tagint *id, const int *type,
|
||||
}
|
||||
|
||||
if (flag) {
|
||||
if (lmp->comm->me == 0) lmp->error->warning(FLERR,msg);
|
||||
lmp->error->all(FLERR, msg);
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user