Unverified Commit a3fad229 authored by Steve Plimpton's avatar Steve Plimpton Committed by GitHub
Browse files

Merge pull request #1040 from lammps/natom

enable more correct natoms computation when atoms are lost
parents fac5e29f d27215b7
Loading
Loading
Loading
Loading
+12 −0
Original line number Diff line number Diff line
@@ -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
------------------------------------------------------------------------- */
+1 −0
Original line number Diff line number Diff line
@@ -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
+1 −1
Original line number Diff line number Diff line
@@ -1698,7 +1698,7 @@ void Thermo::compute_timeremain()

void Thermo::compute_atoms()
{
  bivalue = atom->natoms;
  bivalue = group->count_all();
}

/* ---------------------------------------------------------------------- */
+1 −1

File changed.

Contains only whitespace changes.