enable more correct natoms computation when atoms are lost

This commit is contained in:
Steven J. Plimpton
2018-08-07 15:05:07 -06:00
parent e88311235f
commit d27215b7e1
4 changed files with 15 additions and 2 deletions

View File

@ -84,7 +84,7 @@ idregion(NULL), idvar(NULL), idprop(NULL)
idprop = new char[n];
strcpy(idprop,arg[iarg+1]);
iarg += 2;
} else if (strcmp(arg[iarg],"every") == 0) {
} else if (strcmp(arg[iarg],"every") == 0) {
if (iarg+2 > narg) error->all(FLERR,"Illegal group command");
nevery = force->inumeric(FLERR,arg[iarg+1]);
if (nevery <= 0) error->all(FLERR,"Illegal group command");

View File

@ -754,6 +754,18 @@ void Group::read_restart(FILE *fp)
// computations on a group of atoms
// ----------------------------------------------------------------------
/* ----------------------------------------------------------------------
count atoms in group all
------------------------------------------------------------------------- */
bigint Group::count_all()
{
bigint nme = atom->nlocal;
bigint nall;
MPI_Allreduce(&nme,&nall,1,MPI_LMP_BIGINT,MPI_SUM,world);
return nall;
}
/* ----------------------------------------------------------------------
count atoms in group
------------------------------------------------------------------------- */

View File

@ -37,6 +37,7 @@ class Group : protected Pointers {
void write_restart(FILE *);
void read_restart(FILE *);
bigint count_all(); // count atoms in group all
bigint count(int); // count atoms in group
bigint count(int,int); // count atoms in group & region
double mass(int); // total mass of atoms in group

View File

@ -1698,7 +1698,7 @@ void Thermo::compute_timeremain()
void Thermo::compute_atoms()
{
bivalue = atom->natoms;
bivalue = group->count_all();
}
/* ---------------------------------------------------------------------- */