From 1eb48e25a6cdcf2cd4b319840d109ce61a2ac8c6 Mon Sep 17 00:00:00 2001 From: sjplimp Date: Tue, 23 Apr 2013 22:53:30 +0000 Subject: [PATCH] git-svn-id: svn://svn.icms.temple.edu/lammps-ro/trunk@9795 f3b2605a-c512-4ea7-a41b-209d697bcdaa --- src/fix_deposit.cpp | 29 ++++++++++++++++++++++++++--- src/fix_deposit.h | 1 + src/pair_table.cpp | 16 +++++++++++++++- 3 files changed, 42 insertions(+), 4 deletions(-) diff --git a/src/fix_deposit.cpp b/src/fix_deposit.cpp index 106b293d42..1bc91e13ae 100644 --- a/src/fix_deposit.cpp +++ b/src/fix_deposit.cpp @@ -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; diff --git a/src/fix_deposit.h b/src/fix_deposit.h index b379d4db49..5625dc1976 100644 --- a/src/fix_deposit.h +++ b/src/fix_deposit.h @@ -44,6 +44,7 @@ class FixDeposit : public Fix { double xlo,xhi,ylo,yhi,zlo,zhi; double tx,ty,tz; int nfirst,ninserted; + int idnext,maxtag_all; class RanPark *random; void options(int, char **); diff --git a/src/pair_table.cpp b/src/pair_table.cpp index bb86d1f725..9d7d806028 100644 --- a/src/pair_table.cpp +++ b/src/pair_table.cpp @@ -196,7 +196,7 @@ void PairTable::allocate() void PairTable::settings(int narg, char **arg) { - if (narg != 2) error->all(FLERR,"Illegal pair_style command"); + if (narg < 2) error->all(FLERR,"Illegal pair_style command"); // new settings @@ -209,6 +209,20 @@ void PairTable::settings(int narg, char **arg) tablength = force->inumeric(arg[1]); if (tablength < 2) error->all(FLERR,"Illegal number of pair table entries"); + // optional keywords + // assert the tabulation is compatible with a specific long-range solver + + int iarg = 2; + while (iarg < narg) { + if (strcmp(arg[iarg],"ewald") == 0) ewaldflag = 1; + else if (strcmp(arg[iarg],"pppm") == 0) pppmflag = 1; + else if (strcmp(arg[iarg],"msm") == 0) msmflag = 1; + else if (strcmp(arg[iarg],"dispersion") == 0) dispersionflag = 1; + else if (strcmp(arg[iarg],"tip4p") == 0) tip4pflag = 1; + else error->all(FLERR,"Illegal pair_style command"); + iarg++; + } + // delete old tables, since cannot just change settings for (int m = 0; m < ntables; m++) free_table(&tables[m]);