update global bonus data counters after deleting atoms

This commit is contained in:
Axel Kohlmeyer
2019-02-17 17:14:45 -05:00
parent 7d0c0bc984
commit 07c1942b13

View File

@ -16,6 +16,10 @@
#include "delete_atoms.h"
#include "atom.h"
#include "atom_vec.h"
#include "atom_vec_ellipsoid.h"
#include "atom_vec_line.h"
#include "atom_vec_tri.h"
#include "atom_vec_body.h"
#include "molecule.h"
#include "comm.h"
#include "domain.h"
@ -121,11 +125,39 @@ void DeleteAtoms::command(int narg, char **arg)
}
// reset atom->natoms and also topology counts
// reset atom->map if it exists
// set nghost to 0 so old ghosts of deleted atoms won't be mapped
bigint nblocal = atom->nlocal;
MPI_Allreduce(&nblocal,&atom->natoms,1,MPI_LMP_BIGINT,MPI_SUM,world);
// reset bonus data counts
AtomVecEllipsoid *avec_ellipsoid =
(AtomVecEllipsoid *) atom->style_match("ellipsoid");
AtomVecLine *avec_line = (AtomVecLine *) atom->style_match("line");
AtomVecTri *avec_tri = (AtomVecTri *) atom->style_match("tri");
AtomVecBody *avec_body = (AtomVecBody *) atom->style_match("body");
bigint nlocal_bonus;
if (atom->nellipsoids > 0) {
nlocal_bonus = avec_ellipsoid->nlocal_bonus;
MPI_Allreduce(&nlocal_bonus,&atom->nellipsoids,1,MPI_LMP_BIGINT,MPI_MIN,world);
}
if (atom->nlines > 0) {
nlocal_bonus = avec_line->nlocal_bonus;
MPI_Allreduce(&nlocal_bonus,&atom->nlines,1,MPI_LMP_BIGINT,MPI_MIN,world);
}
if (atom->ntris > 0) {
nlocal_bonus = avec_tri->nlocal_bonus;
MPI_Allreduce(&nlocal_bonus,&atom->ntris,1,MPI_LMP_BIGINT,MPI_MIN,world);
}
if (atom->nbodies > 0) {
nlocal_bonus = avec_body->nlocal_bonus;
MPI_Allreduce(&nlocal_bonus,&atom->nbodies,1,MPI_LMP_BIGINT,MPI_MIN,world);
}
// reset atom->map if it exists
// set nghost to 0 so old ghosts of deleted atoms won't be mapped
if (atom->map_style) {
atom->nghost = 0;
atom->map_init();