git-svn-id: svn://svn.icms.temple.edu/lammps-ro/trunk@9795 f3b2605a-c512-4ea7-a41b-209d697bcdaa
This commit is contained in:
@ -55,6 +55,7 @@ FixDeposit::FixDeposit(LAMMPS *lmp, int narg, char **arg) :
|
||||
|
||||
iregion = -1;
|
||||
idregion = NULL;
|
||||
idnext = 0;
|
||||
globalflag = localflag = 0;
|
||||
lo = hi = deltasq = 0.0;
|
||||
nearsq = 0.0;
|
||||
@ -131,6 +132,17 @@ FixDeposit::FixDeposit(LAMMPS *lmp, int narg, char **arg) :
|
||||
ty *= yscale;
|
||||
tz *= zscale;
|
||||
|
||||
// maxtag_all = current max tag for all atoms
|
||||
|
||||
if (idnext) {
|
||||
int *tag = atom->tag;
|
||||
int nlocal = atom->nlocal;
|
||||
|
||||
int maxtag = 0;
|
||||
for (int i = 0; i < nlocal; i++) maxtag = MAX(maxtag,tag[i]);
|
||||
MPI_Allreduce(&maxtag,&maxtag_all,1,MPI_INT,MPI_MAX,world);
|
||||
}
|
||||
|
||||
// random number generator, same for all procs
|
||||
|
||||
random = new RanPark(lmp,seed);
|
||||
@ -347,14 +359,19 @@ void FixDeposit::pre_exchange()
|
||||
error->warning(FLERR,"Particle deposition was unsuccessful",0);
|
||||
|
||||
// reset global natoms
|
||||
// set tag # of new particle beyond all previous atoms
|
||||
// if idnext, set new atom ID to incremented maxtag_all
|
||||
// else set new atom ID to value beyond all current atoms
|
||||
// if global map exists, reset it now instead of waiting for comm
|
||||
// since deleting atoms messes up ghosts
|
||||
// since adding an atom messes up ghosts
|
||||
|
||||
if (success) {
|
||||
atom->natoms += 1;
|
||||
if (atom->tag_enable) {
|
||||
atom->tag_extend();
|
||||
if (idnext) {
|
||||
maxtag_all++;
|
||||
if (atom->nlocal && atom->tag[atom->nlocal-1] == 0)
|
||||
atom->tag[atom->nlocal-1] = maxtag_all;
|
||||
} else atom->tag_extend();
|
||||
if (atom->map_style) {
|
||||
atom->nghost = 0;
|
||||
atom->map_init();
|
||||
@ -390,6 +407,12 @@ void FixDeposit::options(int narg, char **arg)
|
||||
idregion = new char[n];
|
||||
strcpy(idregion,arg[iarg+1]);
|
||||
iarg += 2;
|
||||
} else if (strcmp(arg[iarg],"id") == 0) {
|
||||
if (iarg+2 > narg) error->all(FLERR,"Illegal fix deposit command");
|
||||
if (strcmp(arg[iarg+1],"max") == 0) idnext = 0;
|
||||
else if (strcmp(arg[iarg+1],"next") == 0) idnext = 1;
|
||||
else error->all(FLERR,"Illegal fix deposit command");
|
||||
iarg += 2;
|
||||
} else if (strcmp(arg[iarg],"global") == 0) {
|
||||
if (iarg+3 > narg) error->all(FLERR,"Illegal fix deposit command");
|
||||
globalflag = 1;
|
||||
|
||||
Reference in New Issue
Block a user