Added vel keyword to fix_styles wall_lj93 and wall_lj126

git-svn-id: svn://svn.icms.temple.edu/lammps-ro/trunk@2151 f3b2605a-c512-4ea7-a41b-209d697bcdaa
This commit is contained in:
athomps
2008-10-04 02:38:52 +00:00
parent cb99406738
commit 8e995f29bd
6 changed files with 81 additions and 10 deletions

View File

@ -33,7 +33,7 @@ using namespace LAMMPS_NS;
FixWallLJ126::FixWallLJ126(LAMMPS *lmp, int narg, char **arg) :
Fix(lmp, narg, arg)
{
if (narg != 8) error->all("Illegal fix wall/lj126 command");
if (narg < 8) error->all("Illegal fix wall/lj126 command");
scalar_flag = 1;
vector_flag = 1;
@ -42,7 +42,11 @@ FixWallLJ126::FixWallLJ126(LAMMPS *lmp, int narg, char **arg) :
extscalar = 1;
extvector = 1;
if (strcmp(arg[3],"xlo") == 0) {
// set defaults
vel = 0.0;
if (strcmp(arg[3],"xlo") == 0) {
dim = 0;
side = -1;
} else if (strcmp(arg[3],"xhi") == 0) {
@ -62,11 +66,20 @@ FixWallLJ126::FixWallLJ126(LAMMPS *lmp, int narg, char **arg) :
side = 1;
} else error->all("Illegal fix wall/lj126 command");
coord = atof(arg[4]);
coord0 = atof(arg[4]);
epsilon = atof(arg[5]);
sigma = atof(arg[6]);
cutoff = atof(arg[7]);
int iarg = 8;
while (iarg < narg) {
if (strcmp(arg[iarg],"vel") == 0) {
if (iarg+2 > narg) error->all("Illegal fix wall/lj126 command");
vel = atof(arg[iarg+1]);
iarg += 2;
} else error->all("Illegal fix wall/lj126 command");
}
coeff1 = 48.0 * epsilon * pow(sigma,12.0);
coeff2 = 24.0 * epsilon * pow(sigma,6.0);
coeff3 = 4.0 * epsilon * pow(sigma,12.0);
@ -140,6 +153,13 @@ void FixWallLJ126::post_force(int vflag)
wall[0] = wall[1] = wall[2] = wall[3] = 0.0;
wall_flag = 0;
// coord = current position of wall
// coord0 = initial position of wall
double delt = (update->ntimestep - update->beginstep) * update->dt;
double coord = coord0 + delt*vel;
for (int i = 0; i < nlocal; i++)
if (mask[i] & groupbit) {
if (side == -1) delta = x[i][dim] - coord;

View File

@ -36,6 +36,7 @@ class FixWallLJ126 : public Fix {
double coord,epsilon,sigma,cutoff;
double coeff1,coeff2,coeff3,coeff4,offset;
double wall[4],wall_all[4];
double vel,coord0;
int wall_flag;
int nlevels_respa;
};

View File

@ -29,7 +29,7 @@ using namespace LAMMPS_NS;
FixWallLJ93::FixWallLJ93(LAMMPS *lmp, int narg, char **arg) :
Fix(lmp, narg, arg)
{
if (narg != 8) error->all("Illegal fix wall/lj93 command");
if (narg < 8) error->all("Illegal fix wall/lj93 command");
scalar_flag = 1;
vector_flag = 1;
@ -38,6 +38,10 @@ FixWallLJ93::FixWallLJ93(LAMMPS *lmp, int narg, char **arg) :
extscalar = 1;
extvector = 1;
// set defaults
vel = 0.0;
if (strcmp(arg[3],"xlo") == 0) {
dim = 0;
side = -1;
@ -58,11 +62,20 @@ FixWallLJ93::FixWallLJ93(LAMMPS *lmp, int narg, char **arg) :
side = 1;
} else error->all("Illegal fix wall/lj93 command");
coord = atof(arg[4]);
coord0 = atof(arg[4]);
epsilon = atof(arg[5]);
sigma = atof(arg[6]);
cutoff = atof(arg[7]);
int iarg = 8;
while (iarg < narg) {
if (strcmp(arg[iarg],"vel") == 0) {
if (iarg+2 > narg) error->all("Illegal fix wall/lj93 command");
vel = atof(arg[iarg+1]);
iarg += 2;
} else error->all("Illegal fix wall/lj93 command");
}
coeff1 = 6.0/5.0 * epsilon * pow(sigma,9.0);
coeff2 = 3.0 * epsilon * pow(sigma,3.0);
coeff3 = 2.0/15.0 * epsilon * pow(sigma,9.0);
@ -137,6 +150,12 @@ void FixWallLJ93::post_force(int vflag)
wall[0] = wall[1] = wall[2] = wall[3] = 0.0;
wall_flag = 0;
// coord = current position of wall
// coord0 = initial position of wall
double delt = (update->ntimestep - update->beginstep) * update->dt;
double coord = coord0 + delt*vel;
for (int i = 0; i < nlocal; i++)
if (mask[i] & groupbit) {
if (side == -1) delta = x[i][dim] - coord;

View File

@ -37,6 +37,7 @@ class FixWallLJ93 : public Fix {
double coord,epsilon,sigma,cutoff;
double coeff1,coeff2,coeff3,coeff4,offset;
double wall[4],wall_all[4];
double vel,coord0;
int wall_flag;
int nlevels_respa;
};