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

This commit is contained in:
sjplimp
2010-08-19 16:01:08 +00:00
parent ad1adc6474
commit 5ff00cfd0f
15 changed files with 118 additions and 8 deletions

View File

@ -912,6 +912,7 @@ void Domain::delete_region(int narg, char **arg)
int iregion = find_region(arg[0]); int iregion = find_region(arg[0]);
if (iregion == -1) error->all("Delete region ID does not exist"); if (iregion == -1) error->all("Delete region ID does not exist");
delete regions[iregion];
regions[iregion] = regions[nregion-1]; regions[iregion] = regions[nregion-1];
nregion--; nregion--;
} }

View File

@ -72,6 +72,7 @@ FixAddForce::FixAddForce(LAMMPS *lmp, int narg, char **arg) :
// optional args // optional args
iregion = -1; iregion = -1;
idregion = NULL;
estr = NULL; estr = NULL;
int iarg = 6; int iarg = 6;
@ -79,7 +80,11 @@ FixAddForce::FixAddForce(LAMMPS *lmp, int narg, char **arg) :
if (strcmp(arg[iarg],"region") == 0) { if (strcmp(arg[iarg],"region") == 0) {
if (iarg+2 > narg) error->all("Illegal fix addforce command"); if (iarg+2 > narg) error->all("Illegal fix addforce command");
iregion = domain->find_region(arg[iarg+1]); iregion = domain->find_region(arg[iarg+1]);
if (iregion == -1) error->all("Fix addforce region ID does not exist"); if (iregion == -1)
error->all("Region ID for fix addforce does not exist");
int n = strlen(arg[iarg+1]) + 1;
idregion = new char[n];
strcpy(idregion,arg[iarg+1]);
iarg += 2; iarg += 2;
} else if (strcmp(arg[iarg],"energy") == 0) { } else if (strcmp(arg[iarg],"energy") == 0) {
if (iarg+2 > narg) error->all("Illegal fix addforce command"); if (iarg+2 > narg) error->all("Illegal fix addforce command");
@ -107,6 +112,7 @@ FixAddForce::~FixAddForce()
delete [] ystr; delete [] ystr;
delete [] zstr; delete [] zstr;
delete [] estr; delete [] estr;
delete [] idregion;
memory->destroy_2d_double_array(sforce); memory->destroy_2d_double_array(sforce);
} }
@ -156,6 +162,13 @@ void FixAddForce::init()
else error->all("Variable for fix setforce is invalid style"); else error->all("Variable for fix setforce is invalid style");
} else estyle = NONE; } else estyle = NONE;
// set index and check validity of region
if (iregion >= 0) {
iregion = domain->find_region(idregion);
if (iregion == -1) error->all("Region ID for fix addforce does not exist");
}
if (xstyle == ATOM || ystyle == ATOM || zstyle == ATOM) if (xstyle == ATOM || ystyle == ATOM || zstyle == ATOM)
varflag = ATOM; varflag = ATOM;
else if (xstyle == EQUAL || ystyle == EQUAL || zstyle == EQUAL) else if (xstyle == EQUAL || ystyle == EQUAL || zstyle == EQUAL)

View File

@ -43,6 +43,7 @@ class FixAddForce : public Fix {
double xvalue,yvalue,zvalue; double xvalue,yvalue,zvalue;
int varflag,iregion; int varflag,iregion;
char *xstr,*ystr,*zstr,*estr; char *xstr,*ystr,*zstr,*estr;
char *idregion;
int xvar,yvar,zvar,evar,xstyle,ystyle,zstyle,estyle; int xvar,yvar,zvar,evar,xstyle,ystyle,zstyle,estyle;
double foriginal[4],foriginal_all[4]; double foriginal[4],foriginal_all[4];
int force_flag; int force_flag;

View File

@ -76,13 +76,18 @@ FixAveForce::FixAveForce(LAMMPS *lmp, int narg, char **arg) :
// optional args // optional args
iregion = -1; iregion = -1;
idregion = NULL;
int iarg = 6; int iarg = 6;
while (iarg < narg) { while (iarg < narg) {
if (strcmp(arg[iarg],"region") == 0) { if (strcmp(arg[iarg],"region") == 0) {
if (iarg+2 > narg) error->all("Illegal fix aveforce command"); if (iarg+2 > narg) error->all("Illegal fix aveforce command");
iregion = domain->find_region(arg[iarg+1]); iregion = domain->find_region(arg[iarg+1]);
if (iregion == -1) error->all("Fix aveforce region ID does not exist"); if (iregion == -1)
error->all("Region ID for fix aveforce does not exist");
int n = strlen(arg[iarg+1]) + 1;
idregion = new char[n];
strcpy(idregion,arg[iarg+1]);
iarg += 2; iarg += 2;
} else error->all("Illegal fix aveforce command"); } else error->all("Illegal fix aveforce command");
@ -99,6 +104,7 @@ FixAveForce::~FixAveForce()
delete [] xstr; delete [] xstr;
delete [] ystr; delete [] ystr;
delete [] zstr; delete [] zstr;
delete [] idregion;
} }
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */
@ -137,6 +143,13 @@ void FixAveForce::init()
else error->all("Variable for fix aveforce is invalid style"); else error->all("Variable for fix aveforce is invalid style");
} }
// set index and check validity of region
if (iregion >= 0) {
iregion = domain->find_region(idregion);
if (iregion == -1) error->all("Region ID for fix aveforce does not exist");
}
if (xstyle == EQUAL || ystyle == EQUAL || zstyle == EQUAL) varflag = EQUAL; if (xstyle == EQUAL || ystyle == EQUAL || zstyle == EQUAL) varflag = EQUAL;
else varflag = CONSTANT; else varflag = CONSTANT;

View File

@ -41,6 +41,7 @@ class FixAveForce : public Fix {
double xvalue,yvalue,zvalue; double xvalue,yvalue,zvalue;
int varflag; int varflag;
char *xstr,*ystr,*zstr; char *xstr,*ystr,*zstr;
char *idregion;
int xvar,yvar,zvar,xstyle,ystyle,zstyle; int xvar,yvar,zvar,xstyle,ystyle,zstyle;
int iregion; int iregion;
double foriginal_all[4]; double foriginal_all[4];

View File

@ -53,6 +53,7 @@ FixDeposit::FixDeposit(LAMMPS *lmp, int narg, char **arg) :
// set defaults // set defaults
iregion = -1; iregion = -1;
idregion = NULL;
globalflag = localflag = 0; globalflag = localflag = 0;
lo = hi = deltasq = 0.0; lo = hi = deltasq = 0.0;
nearsq = 0.0; nearsq = 0.0;
@ -142,6 +143,7 @@ FixDeposit::FixDeposit(LAMMPS *lmp, int narg, char **arg) :
FixDeposit::~FixDeposit() FixDeposit::~FixDeposit()
{ {
delete random; delete random;
delete [] idregion;
} }
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */
@ -153,6 +155,16 @@ int FixDeposit::setmask()
return mask; return mask;
} }
/* ---------------------------------------------------------------------- */
void FixDeposit::init()
{
// set index and check validity of region
iregion = domain->find_region(idregion);
if (iregion == -1) error->all("Region ID for fix deposit does not exist");
}
/* ---------------------------------------------------------------------- /* ----------------------------------------------------------------------
perform particle insertion perform particle insertion
------------------------------------------------------------------------- */ ------------------------------------------------------------------------- */
@ -350,7 +362,11 @@ void FixDeposit::options(int narg, char **arg)
if (strcmp(arg[iarg],"region") == 0) { if (strcmp(arg[iarg],"region") == 0) {
if (iarg+2 > narg) error->all("Illegal fix deposit command"); if (iarg+2 > narg) error->all("Illegal fix deposit command");
iregion = domain->find_region(arg[iarg+1]); iregion = domain->find_region(arg[iarg+1]);
if (iregion == -1) error->all("Fix deposit region ID does not exist"); if (iregion == -1)
error->all("Region ID for fix deposit does not exist");
int n = strlen(arg[iarg+1]) + 1;
idregion = new char[n];
strcpy(idregion,arg[iarg+1]);
iarg += 2; iarg += 2;
} else if (strcmp(arg[iarg],"global") == 0) { } else if (strcmp(arg[iarg],"global") == 0) {
if (iarg+3 > narg) error->all("Illegal fix deposit command"); if (iarg+3 > narg) error->all("Illegal fix deposit command");

View File

@ -30,6 +30,7 @@ class FixDeposit : public Fix {
FixDeposit(class LAMMPS *, int, char **); FixDeposit(class LAMMPS *, int, char **);
~FixDeposit(); ~FixDeposit();
int setmask(); int setmask();
void init();
void pre_exchange(); void pre_exchange();
void write_restart(FILE *); void write_restart(FILE *);
void restart(char *); void restart(char *);
@ -37,6 +38,7 @@ class FixDeposit : public Fix {
private: private:
int ninsert,ntype,nfreq,seed; int ninsert,ntype,nfreq,seed;
int iregion,globalflag,localflag,maxattempt,rateflag,scaleflag; int iregion,globalflag,localflag,maxattempt,rateflag,scaleflag;
char *idregion;
double lo,hi,deltasq,nearsq,rate; double lo,hi,deltasq,nearsq,rate;
double vxlo,vxhi,vylo,vyhi,vzlo,vzhi; double vxlo,vxhi,vylo,vyhi,vzlo,vzhi;
double xlo,xhi,ylo,yhi,zlo,zhi; double xlo,xhi,ylo,yhi,zlo,zhi;

View File

@ -46,10 +46,13 @@ FixEvaporate::FixEvaporate(LAMMPS *lmp, int narg, char **arg) :
nevery = atoi(arg[3]); nevery = atoi(arg[3]);
nflux = atoi(arg[4]); nflux = atoi(arg[4]);
iregion = domain->find_region(arg[5]); iregion = domain->find_region(arg[5]);
int n = strlen(arg[5]) + 1;
idregion = new char[n];
strcpy(idregion,arg[5]);
int seed = atoi(arg[6]); int seed = atoi(arg[6]);
if (nevery <= 0 || nflux <= 0) error->all("Illegal fix evaporate command"); if (nevery <= 0 || nflux <= 0) error->all("Illegal fix evaporate command");
if (iregion == -1) error->all("Fix evaporate region ID does not exist"); if (iregion == -1) error->all("Region ID for fix evaporate does not exist");
if (seed <= 0) error->all("Illegal fix evaporate command"); if (seed <= 0) error->all("Illegal fix evaporate command");
// random number generator, same for all procs // random number generator, same for all procs
@ -86,6 +89,7 @@ FixEvaporate::FixEvaporate(LAMMPS *lmp, int narg, char **arg) :
FixEvaporate::~FixEvaporate() FixEvaporate::~FixEvaporate()
{ {
delete [] idregion;
delete random; delete random;
memory->sfree(list); memory->sfree(list);
memory->sfree(mark); memory->sfree(mark);
@ -104,6 +108,12 @@ int FixEvaporate::setmask()
void FixEvaporate::init() void FixEvaporate::init()
{ {
// set index and check validity of region
iregion = domain->find_region(idregion);
if (iregion == -1)
error->all("Region ID for fix evaporate does not exist");
// check that no deletable atoms are in atom->firstgroup // check that no deletable atoms are in atom->firstgroup
// deleting such an atom would not leave firstgroup atoms first // deleting such an atom would not leave firstgroup atoms first

View File

@ -38,6 +38,7 @@ class FixEvaporate : public Fix {
int nevery,nflux,iregion; int nevery,nflux,iregion;
int molflag; int molflag;
int ndeleted; int ndeleted;
char *idregion;
int nmax; int nmax;
int *list,*mark; int *list,*mark;

View File

@ -47,13 +47,17 @@ FixHeat::FixHeat(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, narg, arg)
// optional args // optional args
iregion = -1; iregion = -1;
idregion = NULL;
int iarg = 5; int iarg = 5;
while (iarg < narg) { while (iarg < narg) {
if (strcmp(arg[iarg],"region") == 0) { if (strcmp(arg[iarg],"region") == 0) {
if (iarg+2 > narg) error->all("Illegal fix heat command"); if (iarg+2 > narg) error->all("Illegal fix heat command");
iregion = domain->find_region(arg[iarg+1]); iregion = domain->find_region(arg[iarg+1]);
if (iregion == -1) error->all("Fix heat region ID does not exist"); if (iregion == -1) error->all("Region ID for fix heat does not exist");
int n = strlen(arg[iarg+1]) + 1;
idregion = new char[n];
strcpy(idregion,arg[iarg+1]);
iarg += 2; iarg += 2;
} else error->all("Illegal fix heat command"); } else error->all("Illegal fix heat command");
} }
@ -63,6 +67,13 @@ FixHeat::FixHeat(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, narg, arg)
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */
FixHeat::~FixHeat()
{
delete [] idregion;
}
/* ---------------------------------------------------------------------- */
int FixHeat::setmask() int FixHeat::setmask()
{ {
int mask = 0; int mask = 0;
@ -74,6 +85,13 @@ int FixHeat::setmask()
void FixHeat::init() void FixHeat::init()
{ {
// set index and check validity of region
if (iregion >= 0) {
iregion = domain->find_region(idregion);
if (iregion == -1) error->all("Region ID for fix heat does not exist");
}
// cannot have 0 atoms in group // cannot have 0 atoms in group
if (group->count(igroup) == 0.0) error->all("Fix heat group has no atoms"); if (group->count(igroup) == 0.0) error->all("Fix heat group has no atoms");

View File

@ -27,6 +27,7 @@ namespace LAMMPS_NS {
class FixHeat : public Fix { class FixHeat : public Fix {
public: public:
FixHeat(class LAMMPS *, int, char **); FixHeat(class LAMMPS *, int, char **);
~FixHeat();
int setmask(); int setmask();
void init(); void init();
void end_of_step(); void end_of_step();
@ -37,6 +38,7 @@ class FixHeat : public Fix {
double heat_input; double heat_input;
double masstotal; double masstotal;
double scale; double scale;
char *idregion;
}; };
} }

View File

@ -76,13 +76,18 @@ FixSetForce::FixSetForce(LAMMPS *lmp, int narg, char **arg) :
// optional args // optional args
iregion = -1; iregion = -1;
idregion = NULL;
int iarg = 6; int iarg = 6;
while (iarg < narg) { while (iarg < narg) {
if (strcmp(arg[iarg],"region") == 0) { if (strcmp(arg[iarg],"region") == 0) {
if (iarg+2 > narg) error->all("Illegal fix setforce command"); if (iarg+2 > narg) error->all("Illegal fix setforce command");
iregion = domain->find_region(arg[iarg+1]); iregion = domain->find_region(arg[iarg+1]);
if (iregion == -1) error->all("Fix setforce region ID does not exist"); if (iregion == -1)
error->all("Region ID for fix setforce does not exist");
int n = strlen(arg[iarg+1]) + 1;
idregion = new char[n];
strcpy(idregion,arg[iarg+1]);
iarg += 2; iarg += 2;
} else error->all("Illegal fix setforce command"); } else error->all("Illegal fix setforce command");
} }
@ -101,6 +106,7 @@ FixSetForce::~FixSetForce()
delete [] xstr; delete [] xstr;
delete [] ystr; delete [] ystr;
delete [] zstr; delete [] zstr;
delete [] idregion;
memory->destroy_2d_double_array(sforce); memory->destroy_2d_double_array(sforce);
} }
@ -143,6 +149,13 @@ void FixSetForce::init()
else error->all("Variable for fix setforce is invalid style"); else error->all("Variable for fix setforce is invalid style");
} }
// set index and check validity of region
if (iregion >= 0) {
iregion = domain->find_region(idregion);
if (iregion == -1) error->all("Region ID for fix setforce does not exist");
}
if (xstyle == ATOM || ystyle == ATOM || zstyle == ATOM) if (xstyle == ATOM || ystyle == ATOM || zstyle == ATOM)
varflag = ATOM; varflag = ATOM;
else if (xstyle == EQUAL || ystyle == EQUAL || zstyle == EQUAL) else if (xstyle == EQUAL || ystyle == EQUAL || zstyle == EQUAL)

View File

@ -42,6 +42,7 @@ class FixSetForce : public Fix {
double xvalue,yvalue,zvalue; double xvalue,yvalue,zvalue;
int varflag,iregion; int varflag,iregion;
char *xstr,*ystr,*zstr; char *xstr,*ystr,*zstr;
char *idregion;
int xvar,yvar,zvar,xstyle,ystyle,zstyle; int xvar,yvar,zvar,xstyle,ystyle,zstyle;
double foriginal[3],foriginal_all[3]; double foriginal[3],foriginal_all[3];
int force_flag; int force_flag;

View File

@ -46,7 +46,11 @@ FixWallRegion::FixWallRegion(LAMMPS *lmp, int narg, char **arg) :
// parse args // parse args
iregion = domain->find_region(arg[3]); iregion = domain->find_region(arg[3]);
if (iregion == -1) error->all("Fix wall/region region ID does not exist"); if (iregion == -1)
error->all("Region ID for fix wall/region does not exist");
int n = strlen(arg[3]) + 1;
idregion = new char[n];
strcpy(idregion,arg[3]);
if (strcmp(arg[4],"lj93") == 0) style = LJ93; if (strcmp(arg[4],"lj93") == 0) style = LJ93;
else if (strcmp(arg[4],"lj126") == 0) style = LJ126; else if (strcmp(arg[4],"lj126") == 0) style = LJ126;
@ -66,6 +70,13 @@ FixWallRegion::FixWallRegion(LAMMPS *lmp, int narg, char **arg) :
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */
FixWallRegion::~FixWallRegion()
{
delete [] idregion;
}
/* ---------------------------------------------------------------------- */
int FixWallRegion::setmask() int FixWallRegion::setmask()
{ {
int mask = 0; int mask = 0;
@ -80,6 +91,12 @@ int FixWallRegion::setmask()
void FixWallRegion::init() void FixWallRegion::init()
{ {
// set index and check validity of region
iregion = domain->find_region(idregion);
if (iregion == -1)
error->all("Region ID for fix wall/region does not exist");
// error checks for style COLLOID // error checks for style COLLOID
// insure all particle shapes are spherical // insure all particle shapes are spherical
// can be polydisperse // can be polydisperse

View File

@ -27,7 +27,7 @@ namespace LAMMPS_NS {
class FixWallRegion : public Fix { class FixWallRegion : public Fix {
public: public:
FixWallRegion(class LAMMPS *, int, char **); FixWallRegion(class LAMMPS *, int, char **);
~FixWallRegion() {} ~FixWallRegion();
int setmask(); int setmask();
void init(); void init();
void setup(int); void setup(int);
@ -45,6 +45,7 @@ class FixWallRegion : public Fix {
double ewall[4],ewall_all[4]; double ewall[4],ewall_all[4];
int nlevels_respa; int nlevels_respa;
double dt; double dt;
char *idregion;
double coeff1,coeff2,coeff3,coeff4,offset; double coeff1,coeff2,coeff3,coeff4,offset;
double eng,fwall; double eng,fwall;