add support for checking consistency of atom bonus data
This commit is contained in:
40
src/atom.cpp
40
src/atom.cpp
@ -58,6 +58,7 @@ Atom::Atom(LAMMPS *lmp) : Pointers(lmp)
|
||||
natoms = 0;
|
||||
nlocal = nghost = nmax = 0;
|
||||
ntypes = 0;
|
||||
nellipsoids = nlines = ntris = nbodies = 0;
|
||||
nbondtypes = nangletypes = ndihedraltypes = nimpropertypes = 0;
|
||||
nbonds = nangles = ndihedrals = nimpropers = 0;
|
||||
|
||||
@ -738,6 +739,45 @@ int Atom::tag_consecutive()
|
||||
return 1;
|
||||
}
|
||||
|
||||
/* ----------------------------------------------------------------------
|
||||
check that bonus data settings are valid
|
||||
error if number of atoms with ellipsoid/line/tri/body flags
|
||||
are consistent with global setting.
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
void Atom::bonus_check()
|
||||
{
|
||||
bigint local_ellipsoids = 0, local_lines = 0, local_tris = 0;
|
||||
bigint local_bodies = 0, num_global;
|
||||
|
||||
for (int i = 0; i < nlocal; ++i) {
|
||||
if (ellipsoid && (ellipsoid[i] >=0)) ++local_ellipsoids;
|
||||
if (line && (line[i] >=0)) ++local_lines;
|
||||
if (tri && (tri[i] >=0)) ++local_tris;
|
||||
if (body && (body[i] >=0)) ++local_bodies;
|
||||
}
|
||||
|
||||
MPI_Allreduce(&local_ellipsoids,&num_global,1,MPI_LMP_BIGINT,MPI_MIN,world);
|
||||
if (nellipsoids != num_global)
|
||||
error->all(FLERR,"Inconsistent 'ellipsoids' header value and number of "
|
||||
"atoms with enabled ellipsoid flags");
|
||||
|
||||
MPI_Allreduce(&local_lines,&num_global,1,MPI_LMP_BIGINT,MPI_MIN,world);
|
||||
if (nlines != num_global)
|
||||
error->all(FLERR,"Inconsistent 'lines' header value and number of "
|
||||
"atoms with enabled line flags");
|
||||
|
||||
MPI_Allreduce(&local_tris,&num_global,1,MPI_LMP_BIGINT,MPI_MIN,world);
|
||||
if (ntris != num_global)
|
||||
error->all(FLERR,"Inconsistent 'tris' header value and number of "
|
||||
"atoms with enabled tri flags");
|
||||
|
||||
MPI_Allreduce(&local_bodies,&num_global,1,MPI_LMP_BIGINT,MPI_MIN,world);
|
||||
if (nbodies != num_global)
|
||||
error->all(FLERR,"Inconsistent 'bodies' header value and number of "
|
||||
"atoms with enabled body flags");
|
||||
}
|
||||
|
||||
/* ----------------------------------------------------------------------
|
||||
count and return words in a single line
|
||||
make copy of line before using strtok so as not to change line
|
||||
|
||||
Reference in New Issue
Block a user