git-svn-id: svn://svn.icms.temple.edu/lammps-ro/trunk@9795 f3b2605a-c512-4ea7-a41b-209d697bcdaa

This commit is contained in:
sjplimp
2013-04-23 22:53:30 +00:00
parent d8011903ba
commit 1eb48e25a6
3 changed files with 42 additions and 4 deletions

View File

@ -55,6 +55,7 @@ FixDeposit::FixDeposit(LAMMPS *lmp, int narg, char **arg) :
iregion = -1; iregion = -1;
idregion = NULL; idregion = NULL;
idnext = 0;
globalflag = localflag = 0; globalflag = localflag = 0;
lo = hi = deltasq = 0.0; lo = hi = deltasq = 0.0;
nearsq = 0.0; nearsq = 0.0;
@ -131,6 +132,17 @@ FixDeposit::FixDeposit(LAMMPS *lmp, int narg, char **arg) :
ty *= yscale; ty *= yscale;
tz *= zscale; 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 number generator, same for all procs
random = new RanPark(lmp,seed); random = new RanPark(lmp,seed);
@ -347,14 +359,19 @@ void FixDeposit::pre_exchange()
error->warning(FLERR,"Particle deposition was unsuccessful",0); error->warning(FLERR,"Particle deposition was unsuccessful",0);
// reset global natoms // 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 // 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) { if (success) {
atom->natoms += 1; atom->natoms += 1;
if (atom->tag_enable) { 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) { if (atom->map_style) {
atom->nghost = 0; atom->nghost = 0;
atom->map_init(); atom->map_init();
@ -390,6 +407,12 @@ void FixDeposit::options(int narg, char **arg)
idregion = new char[n]; idregion = new char[n];
strcpy(idregion,arg[iarg+1]); strcpy(idregion,arg[iarg+1]);
iarg += 2; 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) { } else if (strcmp(arg[iarg],"global") == 0) {
if (iarg+3 > narg) error->all(FLERR,"Illegal fix deposit command"); if (iarg+3 > narg) error->all(FLERR,"Illegal fix deposit command");
globalflag = 1; globalflag = 1;

View File

@ -44,6 +44,7 @@ class FixDeposit : public Fix {
double xlo,xhi,ylo,yhi,zlo,zhi; double xlo,xhi,ylo,yhi,zlo,zhi;
double tx,ty,tz; double tx,ty,tz;
int nfirst,ninserted; int nfirst,ninserted;
int idnext,maxtag_all;
class RanPark *random; class RanPark *random;
void options(int, char **); void options(int, char **);

View File

@ -196,7 +196,7 @@ void PairTable::allocate()
void PairTable::settings(int narg, char **arg) 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 // new settings
@ -209,6 +209,20 @@ void PairTable::settings(int narg, char **arg)
tablength = force->inumeric(arg[1]); tablength = force->inumeric(arg[1]);
if (tablength < 2) error->all(FLERR,"Illegal number of pair table entries"); 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 // delete old tables, since cannot just change settings
for (int m = 0; m < ntables; m++) free_table(&tables[m]); for (int m = 0; m < ntables; m++) free_table(&tables[m]);