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

@ -10,7 +10,7 @@ fix wall/lj126 command :h3
[Syntax:]
fix ID group-ID wall/lj126 style coord epsilon sigma cutoff :pre
fix ID group-ID wall/lj126 style coord epsilon sigma cutoff keyword values ... :pre
ID, group-ID are documented in "fix"_fix.html command
wall/lj126 = style name of this fix command
@ -19,10 +19,16 @@ coord = position of wall
epsilon = Lennard-Jones epsilon for wall-particle interaction
sigma = Lennard-Jones sigma for wall-particle interaction
cutoff = distance from wall at which wall-particle interaction is cut off :ul
one or more keyword/value pairs may be appended :l
keyword = {vel} :l
{vel} args = v
v = velocity of wall (velocity units)
:ule
[Examples:]
fix wallhi all wall/lj126 xhi 10.0 1.0 1.0 1.12 :pre
fix leftwall all wall/lj126 zlo 0.0 1.0 1.0 0.858 vel 1.0
[Description:]
@ -41,6 +47,12 @@ provided by the "fix wall/lj93"_fix_wall_lj93.html command.
The wall potential is shifted so that the energy of a wall-particle
interaction is 0.0 at the cutoff distance.
If the {vel} keyword is specified, the position of wall will move during the
simulation, based on its initial position (coord) and the specified
velocity (vel). Note that if you do multiple runs, the initial position
of the indenter (x,y,z) does not change, so it will continue to move
at the specified velocity.
[Restart, fix_modify, output, run start/stop, minimize info:]
No information about this fix is written to "binary restart
@ -77,4 +89,7 @@ Any dimension (xyz) that has a LJ 12/6 wall must be non-periodic.
"fix wall/reflect"_fix_wall_reflect.html, "fix
wall/lj93"_fix_wall_lj93.html
[Default:] none
[Default:]
The option defaults are vel = 0.

View File

@ -10,7 +10,7 @@ fix wall/lj93 command :h3
[Syntax:]
fix ID group-ID wall/lj93 style coord epsilon sigma cutoff :pre
fix ID group-ID wall/lj93 style coord epsilon sigma cutoff keyword values ... :pre
ID, group-ID are documented in "fix"_fix.html command
wall/lj93 = style name of this fix command
@ -18,11 +18,17 @@ style = {xlo} or {xhi} or {ylo} or {yhi} or {zlo} or {zhi}
coord = position of wall
epsilon = Lennard-Jones epsilon for wall-particle interaction
sigma = Lennard-Jones sigma for wall-particle interaction
cutoff = distance from wall at which wall-particle interaction is cut off :ul
cutoff = distance from wall at which wall-particle interaction is cut off :l
one or more keyword/value pairs may be appended :l
keyword = {vel} :l
{vel} args = v
v = velocity of wall (velocity units)
:ule
[Examples:]
fix wallhi all wall/lj93 xhi 10.0 1.0 1.0 2.5 :pre
fix leftwall all wall/lj93 zlo 0.0 1.0 1.0 0.858 vel 1.0
[Description:]
@ -42,6 +48,12 @@ wall/lj126"_fix_wall_lj126.html command.
The wall potential is shifted so that the energy of a wall-particle
interaction is 0.0 at the cutoff distance.
If the {vel} keyword is specified, the position of wall will move during the
simulation, based on its initial position (coord) and the specified
velocity (vel). Note that if you do multiple runs, the initial position
of the indenter (x,y,z) does not change, so it will continue to move
at the specified velocity.
[Restart, fix_modify, output, run start/stop, minimize info:]
No information about this fix is written to "binary restart
@ -78,4 +90,7 @@ Any dimension (xyz) that has a LJ 9/3 wall must be non-periodic.
"fix wall/reflect"_fix_wall_reflect.html, "fix
wall/lj126"_fix_wall_lj126.html
[Default:] none
[Default:]
The option defaults are vel = 0.

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;
};