Print warning about unsorted custom dumps without atom IDs. Explain in manual.
This commit is contained in:
@ -242,6 +242,14 @@ all the processors or multiple smaller files.
|
|||||||
data for a single snapshot is collected from multiple processors,
|
data for a single snapshot is collected from multiple processors,
|
||||||
each of which owns a subset of the atoms.
|
each of which owns a subset of the atoms.
|
||||||
|
|
||||||
|
.. warning::
|
||||||
|
|
||||||
|
Without either including atom IDs or using the :doc:`dump_modify sort
|
||||||
|
<dump_modify>` option, it is impossible for visualization programs
|
||||||
|
(e.g. OVITO or VMD) or analysis tools to assign data in different
|
||||||
|
frames consistently to the same atom. This can lead to incorrect
|
||||||
|
visualizations or results. LAMMPS will print a warning in such cases.
|
||||||
|
|
||||||
For the *atom*, *custom*, *cfg*, *grid*, and *local* styles, sorting
|
For the *atom*, *custom*, *cfg*, *grid*, and *local* styles, sorting
|
||||||
is off by default. For the *dcd*, *grid/vtk*, *xtc*, *xyz*, and
|
is off by default. For the *dcd*, *grid/vtk*, *xtc*, *xyz*, and
|
||||||
*molfile* styles, sorting by atom ID or grid ID is on by default. See
|
*molfile* styles, sorting by atom ID or grid ID is on by default. See
|
||||||
|
|||||||
11
src/dump.cpp
11
src/dump.cpp
@ -89,6 +89,7 @@ Dump::Dump(LAMMPS *lmp, int /*narg*/, char **arg) : Pointers(lmp)
|
|||||||
unit_count = 0;
|
unit_count = 0;
|
||||||
delay_flag = 0;
|
delay_flag = 0;
|
||||||
write_header_flag = 1;
|
write_header_flag = 1;
|
||||||
|
has_id = 1;
|
||||||
|
|
||||||
skipflag = 0;
|
skipflag = 0;
|
||||||
skipvar = nullptr;
|
skipvar = nullptr;
|
||||||
@ -231,16 +232,22 @@ void Dump::init()
|
|||||||
ids = idsort = nullptr;
|
ids = idsort = nullptr;
|
||||||
index = proclist = nullptr;
|
index = proclist = nullptr;
|
||||||
irregular = nullptr;
|
irregular = nullptr;
|
||||||
|
if ((has_id == 0) && (me == 0))
|
||||||
|
error->warning(FLERR,"Dump {} is without Atom-IDs and not sorted by id. This may lead to data "
|
||||||
|
"changing order and prevent tracking individual atoms", id);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (sort_flag) {
|
if (sort_flag) {
|
||||||
if (multiproc > 1)
|
if (multiproc > 1)
|
||||||
error->all(FLERR,
|
error->all(FLERR,
|
||||||
"Cannot dump sort when 'nfile' or 'fileper' keywords are set to non-default values");
|
"Cannot sort dump when 'nfile' or 'fileper' keywords are set to non-default values");
|
||||||
if (sortcol == 0 && atom->tag_enable == 0)
|
if (sortcol == 0 && atom->tag_enable == 0)
|
||||||
error->all(FLERR,"Cannot dump sort on atom IDs with no atom IDs defined");
|
error->all(FLERR,"Cannot sort dump on atom IDs with no atom IDs defined");
|
||||||
if (sortcol && sortcol > size_one)
|
if (sortcol && sortcol > size_one)
|
||||||
error->all(FLERR,"Dump sort column is invalid");
|
error->all(FLERR,"Dump sort column is invalid");
|
||||||
|
if ((sortcol != 0) && (has_id == 0) && (me == 0))
|
||||||
|
error->warning(FLERR,"Dump {} is without Atom-IDs and not sorted by id. This may lead to data "
|
||||||
|
"changing order and prevent tracking individual atoms", id);
|
||||||
if (nprocs > 1 && irregular == nullptr)
|
if (nprocs > 1 && irregular == nullptr)
|
||||||
irregular = new Irregular(lmp);
|
irregular = new Irregular(lmp);
|
||||||
|
|
||||||
|
|||||||
@ -90,6 +90,7 @@ class Dump : protected Pointers {
|
|||||||
int unit_count; // # of times the unit information was written
|
int unit_count; // # of times the unit information was written
|
||||||
int delay_flag; // 1 if delay output until delaystep
|
int delay_flag; // 1 if delay output until delaystep
|
||||||
int write_header_flag; // 1 if write header, 0 if not
|
int write_header_flag; // 1 if write header, 0 if not
|
||||||
|
int has_id; // 1 if output contains Atom-IDs
|
||||||
|
|
||||||
bigint delaystep;
|
bigint delaystep;
|
||||||
|
|
||||||
|
|||||||
@ -1245,11 +1245,14 @@ int DumpCustom::parse_fields(int narg, char **arg)
|
|||||||
{
|
{
|
||||||
// customize by adding to if statement
|
// customize by adding to if statement
|
||||||
|
|
||||||
|
has_id = 0;
|
||||||
|
|
||||||
for (int iarg = 0; iarg < narg; iarg++) {
|
for (int iarg = 0; iarg < narg; iarg++) {
|
||||||
if (strcmp(arg[iarg],"id") == 0) {
|
if (strcmp(arg[iarg],"id") == 0) {
|
||||||
pack_choice[iarg] = &DumpCustom::pack_id;
|
pack_choice[iarg] = &DumpCustom::pack_id;
|
||||||
if (sizeof(tagint) == sizeof(smallint)) vtype[iarg] = Dump::INT;
|
if (sizeof(tagint) == sizeof(smallint)) vtype[iarg] = Dump::INT;
|
||||||
else vtype[iarg] = Dump::BIGINT;
|
else vtype[iarg] = Dump::BIGINT;
|
||||||
|
has_id = 1;
|
||||||
} else if (strcmp(arg[iarg],"mol") == 0) {
|
} else if (strcmp(arg[iarg],"mol") == 0) {
|
||||||
if (!atom->molecule_flag)
|
if (!atom->molecule_flag)
|
||||||
error->all(FLERR,"Dumping an atom property that isn't allocated");
|
error->all(FLERR,"Dumping an atom property that isn't allocated");
|
||||||
|
|||||||
Reference in New Issue
Block a user