From bbb9f5d88e2c26bf9801b514c305f66e1bf9b718 Mon Sep 17 00:00:00 2001
From: sjplimp
The file in the tools/kate directory is an add-on to the Kate editor +in the KDE suite that allow syntax highlighting of LAMMPS input +scripts. See the README.txt file for details. +
+The file was provided by Alessandro Luigi Sellerio +(alessandro.sellerio at ieni.cnr.it). +
+The lmp2arc sub-directory contains a tool for converting LAMMPS output
diff --git a/doc/Section_tools.txt b/doc/Section_tools.txt
index 2d1a1d3fd5..ff9e807613 100644
--- a/doc/Section_tools.txt
+++ b/doc/Section_tools.txt
@@ -50,6 +50,7 @@ own sub-directories with their own Makefiles.
"eff"_#eff
"emacs"_#emacs
"ipp"_#ipp
+"kate"_#kate
"lmp2arc"_#arc
"lmp2cfg"_#cfg
"lmp2vmd"_#vmd
@@ -220,6 +221,17 @@ tools/createatoms tool's input file.
:line
+kate tool :h4,link(kate)
+
+The file in the tools/kate directory is an add-on to the Kate editor
+in the KDE suite that allow syntax highlighting of LAMMPS input
+scripts. See the README.txt file for details.
+
+The file was provided by Alessandro Luigi Sellerio
+(alessandro.sellerio at ieni.cnr.it).
+
+:line
+
lmp2arc tool :h4,link(arc)
The lmp2arc sub-directory contains a tool for converting LAMMPS output
From 43e422a6833f1214136258719951f30ff3b6d67b Mon Sep 17 00:00:00 2001
From: sjplimp
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ scale value = no or yes
no = the variable value is the new setting
- yes = the variable value multiplies the original setting
-
- reset value = no or yes
+ yes = the variable value multiplies the original setting
+ reset value = no or yes
no = values will remain altered at the end of a run
yes = reset altered values to their original values at the end of a run
@@ -65,7 +64,11 @@ attributes which can be varied by this fix are discussed below. Many
other fixes can also be used to time-vary simulation parameters,
e.g. the "fix deform" command will change the simulation box
size/shape and the "fix move" command will change atom positions and
-velocities in a prescribed manner.
+velocities in a prescribed manner. Also note that many commands allow
+variables as arguments for specific parameters, if described in that
+manner on their doc pages. An equal-style variable can calculate a
+time-dependent quantity, so this is another way to vary a simulation
+parameter over time.
If N is specified as 0, the specified attributes are only changed once, before the simulation begins. This is all that is needed if the diff --git a/doc/fix_adapt.txt b/doc/fix_adapt.txt index 6c7b6ef356..bd9bc5a9a7 100644 --- a/doc/fix_adapt.txt +++ b/doc/fix_adapt.txt @@ -31,7 +31,7 @@ zero or more keyword/value pairs may be appended :l keyword = {scale} or {reset} :l {scale} value = {no} or {yes} {no} = the variable value is the new setting - {yes} = the variable value multiplies the original setting :pre + {yes} = the variable value multiplies the original setting {reset} value = {no} or {yes} {no} = values will remain altered at the end of a run {yes} = reset altered values to their original values at the end of a run :pre @@ -52,7 +52,11 @@ attributes which can be varied by this fix are discussed below. Many other fixes can also be used to time-vary simulation parameters, e.g. the "fix deform" command will change the simulation box size/shape and the "fix move" command will change atom positions and -velocities in a prescribed manner. +velocities in a prescribed manner. Also note that many commands allow +variables as arguments for specific parameters, if described in that +manner on their doc pages. An equal-style variable can calculate a +time-dependent quantity, so this is another way to vary a simulation +parameter over time. If {N} is specified as 0, the specified attributes are only changed once, before the simulation begins. This is all that is needed if the diff --git a/doc/fix_wall.html b/doc/fix_wall.html index 5e8f1546d9..281d36a005 100644 --- a/doc/fix_wall.html +++ b/doc/fix_wall.html @@ -29,14 +29,18 @@
args = coord epsilon sigma cutoff +
cutoff = distance from wall at which wall-particle interaction is cut off (distance units)
pbc value = yes or no
+ no = invoke the wall constraint in the normal way
+ pbc value = yes or no
yes = allow periodic boundary in a wall dimension
no = require non-perioidic boundaries in any wall dimension
@@ -144,6 +147,16 @@ constant K, and has units (energy/distance^2). The input parameter
spring is at the cutoff. This is a repulsive-only spring since the
interaction is truncated at the cutoff
+For any wall, the epsilon and/or sigma parameter can be specified +as an equal-style variable, in which case it should be +specified as v_name, where name is the variable name. As with a +variable wall position, the variable is evaluated each timestep and +the result becomes the current epsilon or sigma of the wall. +Equal-style variables can specify formulas with various mathematical +functions, and include thermo_style command +keywords for the simulation box parameters and timestep and elapsed +time. Thus it is easy to specify a time-dependent wall interaction. +
IMPORTANT NOTE: For all of the styles, you must insure that r is always > 0 for all particles in the group, or LAMMPS will generate an error. This means you cannot start your simulation with particles at @@ -194,7 +207,8 @@ want.
Here are examples of variable definitions that move the wall position in a time-dependent fashion using equal-style -variables. +variables. The wall interaction parameters (epsilon, +sigma) could be varied with additional variable definitions.
variable ramp equal ramp(0,10)
fix 1 all wall xlo v_ramp 1.0 1.0 2.5
diff --git a/doc/fix_wall.txt b/doc/fix_wall.txt
index 3874587bd0..803aff618e 100644
--- a/doc/fix_wall.txt
+++ b/doc/fix_wall.txt
@@ -25,7 +25,9 @@ face = {xlo} or {xhi} or {ylo} or {yhi} or {zlo} or {zhi} :l
constant = number like 0.0 or -30.0 (distance units)
variable = "equal-style variable"_variable.html like v_x or v_wiggle
epsilon = strength factor for wall-particle interaction (energy or energy/distance^2 units)
+ epsilon can be a variable (see below) :l
sigma = size factor for wall-particle interaction (distance units)
+ sigma can be a variable (see below) :l
cutoff = distance from wall at which wall-particle interaction is cut off (distance units) :pre
zero or more keyword/value pairs may be appended :l
keyword = {units} or {fld} :l
@@ -34,7 +36,7 @@ keyword = {units} or {fld} :l
{box} = the wall position is defined in simulation box units
{fld} value = {yes} or {no}
{yes} = invoke the wall constraint to be compatible with implicit FLD
- {no} = invoke the wall constraint in the normal way :pre
+ {no} = invoke the wall constraint in the normal way
{pbc} value = {yes} or {no}
{yes} = allow periodic boundary in a wall dimension
{no} = require non-perioidic boundaries in any wall dimension :pre
@@ -129,6 +131,16 @@ constant K, and has units (energy/distance^2). The input parameter
spring is at the {cutoff}. This is a repulsive-only spring since the
interaction is truncated at the {cutoff}
+For any wall, the {epsilon} and/or {sigma} parameter can be specified
+as an "equal-style variable"_variable.html, in which case it should be
+specified as v_name, where name is the variable name. As with a
+variable wall position, the variable is evaluated each timestep and
+the result becomes the current epsilon or sigma of the wall.
+Equal-style variables can specify formulas with various mathematical
+functions, and include "thermo_style"_thermo_style.html command
+keywords for the simulation box parameters and timestep and elapsed
+time. Thus it is easy to specify a time-dependent wall interaction.
+
IMPORTANT NOTE: For all of the styles, you must insure that r is
always > 0 for all particles in the group, or LAMMPS will generate an
error. This means you cannot start your simulation with particles at
@@ -179,7 +191,8 @@ want.
Here are examples of variable definitions that move the wall position
in a time-dependent fashion using equal-style
-"variables"_variable.html.
+"variables"_variable.html. The wall interaction parameters (epsilon,
+sigma) could be varied with additional variable definitions.
variable ramp equal ramp(0,10)
fix 1 all wall xlo v_ramp 1.0 1.0 2.5 :pre
From aa62e9b389830676c409d376848dec6a59d58f9f Mon Sep 17 00:00:00 2001
From: sjplimp
Date: Fri, 18 Jan 2013 16:59:43 +0000
Subject: [PATCH 05/12] git-svn-id:
svn://svn.icms.temple.edu/lammps-ro/trunk@9297
f3b2605a-c512-4ea7-a41b-209d697bcdaa
---
src/version.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/version.h b/src/version.h
index 840d95c190..06f5372acb 100644
--- a/src/version.h
+++ b/src/version.h
@@ -1 +1 @@
-#define LAMMPS_VERSION "19 Jan 2013"
+#define LAMMPS_VERSION "20 Jan 2013"
From 2d6d2de507ff921827d4a23f168a819f0abe2a60 Mon Sep 17 00:00:00 2001
From: sjplimp
Date: Fri, 18 Jan 2013 20:39:12 +0000
Subject: [PATCH 06/12] git-svn-id:
svn://svn.icms.temple.edu/lammps-ro/trunk@9299
f3b2605a-c512-4ea7-a41b-209d697bcdaa
---
src/fix_wall.cpp | 10 ++++++--
src/region.cpp | 34 ++++++++++++++++++++-------
src/region.h | 17 ++++++++++----
src/region_intersect.cpp | 3 ++-
src/region_sphere.cpp | 50 +++++++++++++++++++++++++++++++++++++---
src/region_sphere.h | 6 +++++
src/variable.cpp | 12 +++++-----
7 files changed, 108 insertions(+), 24 deletions(-)
diff --git a/src/fix_wall.cpp b/src/fix_wall.cpp
index 70fcbbea2c..297f22741c 100644
--- a/src/fix_wall.cpp
+++ b/src/fix_wall.cpp
@@ -314,10 +314,16 @@ void FixWall::post_force(int vflag)
else coord *= zscale;
} else coord = coord0[m];
if (wstyle[m] == VARIABLE) {
- if (estyle[m] == VARIABLE)
+ if (estyle[m] == VARIABLE) {
epsilon[m] = input->variable->compute_equal(eindex[m]);
- if (sstyle[m] == VARIABLE)
+ if (epsilon[m] < 0.0)
+ error->all(FLERR,"Variable evaluation in fix wall gave bad value");
+ }
+ if (sstyle[m] == VARIABLE) {
sigma[m] = input->variable->compute_equal(sindex[m]);
+ if (sigma[m] < 0.0)
+ error->all(FLERR,"Variable evaluation in fix wall gave bad value");
+ }
precompute(m);
}
diff --git a/src/region.cpp b/src/region.cpp
index a9d27e1a38..14f7155e4a 100644
--- a/src/region.cpp
+++ b/src/region.cpp
@@ -36,9 +36,10 @@ Region::Region(LAMMPS *lmp, int narg, char **arg) : Pointers(lmp)
style = new char[n];
strcpy(style,arg[1]);
+ varshape = 0;
xstr = ystr = zstr = tstr = NULL;
dx = dy = dz = 0.0;
- laststep = -1;
+ lastshape = lastdynamic = -1;
}
/* ---------------------------------------------------------------------- */
@@ -100,23 +101,35 @@ int Region::dynamic_check()
XOR computes 0 if 2 args are the same, 1 if different
note that inside() returns 1 for points on surface of region
thus point on surface of exterior region will not match
+ if region has variable shape, invoke shape_update() once per timestep
if region is dynamic, apply inverse transform to x,y,z
unmove first, then unrotate, so don't have to change rotation point
+ caller is responsible for wrapping this call with
+ modify->clearstep_compute() and modify->addstep_compute() if needed
------------------------------------------------------------------------- */
int Region::match(double x, double y, double z)
{
- if (dynamic) inverse_transform(x,y,z);
+ if (varshape && update->ntimestep != lastshape) {
+ shape_update();
+ lastshape = update->ntimestep;
+ }
+
+ if (dynamic && update->ntimestep) inverse_transform(x,y,z);
+
return !(inside(x,y,z) ^ interior);
}
/* ----------------------------------------------------------------------
generate list of contact points for interior or exterior regions
+ if region has variable shape, invoke shape_update() once per timestep
if region is dynamic:
before: inverse transform x,y,z (unmove, then unrotate)
after: forward transform contact point xs,yx,zs (rotate, then move),
then reset contact delx,dely,delz based on new contact point
no need to do this if no rotation since delxyz doesn't change
+ caller is responsible for wrapping this call with
+ modify->clearstep_compute() and modify->addstep_compute() if needed
------------------------------------------------------------------------- */
int Region::surface(double x, double y, double z, double cutoff)
@@ -125,6 +138,11 @@ int Region::surface(double x, double y, double z, double cutoff)
double xs,ys,zs;
double xnear[3],xorig[3];
+ if (varshape && update->ntimestep != lastshape) {
+ shape_update();
+ lastshape = update->ntimestep;
+ }
+
if (dynamic) {
xorig[0] = x;
xorig[1] = y;
@@ -179,13 +197,13 @@ void Region::add_contact(int n, double *x, double xp, double yp, double zp)
void Region::forward_transform(double &x, double &y, double &z)
{
if (rotateflag) {
- if (update->ntimestep != laststep)
+ if (update->ntimestep != lastdynamic)
theta = input->variable->compute_equal(tvar);
rotate(x,y,z,theta);
}
if (moveflag) {
- if (update->ntimestep != laststep) {
+ if (update->ntimestep != lastdynamic) {
if (xstr) dx = input->variable->compute_equal(xvar);
if (ystr) dy = input->variable->compute_equal(yvar);
if (zstr) dz = input->variable->compute_equal(zvar);
@@ -195,7 +213,7 @@ void Region::forward_transform(double &x, double &y, double &z)
z += dz;
}
- laststep = update->ntimestep;
+ lastdynamic = update->ntimestep;
}
/* ----------------------------------------------------------------------
@@ -206,7 +224,7 @@ void Region::forward_transform(double &x, double &y, double &z)
void Region::inverse_transform(double &x, double &y, double &z)
{
if (moveflag) {
- if (update->ntimestep != laststep) {
+ if (update->ntimestep != lastdynamic) {
if (xstr) dx = input->variable->compute_equal(xvar);
if (ystr) dy = input->variable->compute_equal(yvar);
if (zstr) dz = input->variable->compute_equal(zvar);
@@ -217,12 +235,12 @@ void Region::inverse_transform(double &x, double &y, double &z)
}
if (rotateflag) {
- if (update->ntimestep != laststep)
+ if (update->ntimestep != lastdynamic)
theta = input->variable->compute_equal(tvar);
rotate(x,y,z,-theta);
}
- laststep = update->ntimestep;
+ lastdynamic = update->ntimestep;
}
/* ----------------------------------------------------------------------
diff --git a/src/region.h b/src/region.h
index 2406dc186f..8f79590258 100644
--- a/src/region.h
+++ b/src/region.h
@@ -40,27 +40,36 @@ class Region : protected Pointers {
Region(class LAMMPS *, int, char **);
virtual ~Region();
- void init();
+ virtual void init();
virtual int dynamic_check();
+
+ // called by other classes to check point versus region
+
int match(double, double, double);
int surface(double, double, double, double);
+ // implemented by each region, not called by other classes
+
virtual int inside(double, double, double) = 0;
virtual int surface_interior(double *, double) = 0;
virtual int surface_exterior(double *, double) = 0;
+ virtual void shape_update() {}
protected:
+ int varshape; // 1 if region shape changes over time
+
void add_contact(int, double *, double, double, double);
void options(int, char **);
private:
- int dynamic; // 1 if region changes over time
- int moveflag,rotateflag;
+ int dynamic; // 1 if region position/orientation changes over time
+ int moveflag,rotateflag; // 1 if position/orientation changes
+
double point[3],axis[3],runit[3];
char *xstr,*ystr,*zstr,*tstr;
int xvar,yvar,zvar,tvar;
double dx,dy,dz,theta;
- bigint laststep;
+ bigint lastshape,lastdynamic;
void forward_transform(double &, double &, double &);
void inverse_transform(double &, double &, double &);
diff --git a/src/region_intersect.cpp b/src/region_intersect.cpp
index 1d3d78d186..736ec3c6e1 100644
--- a/src/region_intersect.cpp
+++ b/src/region_intersect.cpp
@@ -37,7 +37,8 @@ RegIntersect::RegIntersect(LAMMPS *lmp, int narg, char **arg) :
int iregion;
for (int iarg = 0; iarg < n; iarg++) {
iregion = domain->find_region(arg[iarg+3]);
- if (iregion == -1) error->all(FLERR,"Region intersect region ID does not exist");
+ if (iregion == -1)
+ error->all(FLERR,"Region intersect region ID does not exist");
list[nregion++] = iregion;
}
diff --git a/src/region_sphere.cpp b/src/region_sphere.cpp
index e90704dd74..773fc4cb16 100644
--- a/src/region_sphere.cpp
+++ b/src/region_sphere.cpp
@@ -15,10 +15,15 @@
#include "stdlib.h"
#include "string.h"
#include "region_sphere.h"
+#include "input.h"
+#include "variable.h"
+#include "update.h"
#include "error.h"
using namespace LAMMPS_NS;
+enum{CONSTANT,VARIABLE};
+
/* ---------------------------------------------------------------------- */
RegSphere::RegSphere(LAMMPS *lmp, int narg, char **arg) :
@@ -29,13 +34,23 @@ RegSphere::RegSphere(LAMMPS *lmp, int narg, char **arg) :
xc = xscale*atof(arg[2]);
yc = yscale*atof(arg[3]);
zc = zscale*atof(arg[4]);
- radius = xscale*atof(arg[5]);
- // error check
+ rstr = NULL;
+ if (strstr(arg[5],"v_") == arg[5]) {
+ int n = strlen(&arg[5][2]) + 1;
+ rstr = new char[n];
+ strcpy(rstr,&arg[5][2]);
+ radius = 0.0;
+ rstyle = VARIABLE;
+ varshape = 1;
+ } else {
+ radius = xscale*atof(arg[5]);
+ rstyle = CONSTANT;
+ }
if (radius < 0.0) error->all(FLERR,"Illegal region sphere command");
- // extent of sphere
+ // extent of sphere, will be 0.0 for variable radius
if (interior) {
bboxflag = 1;
@@ -55,9 +70,27 @@ RegSphere::RegSphere(LAMMPS *lmp, int narg, char **arg) :
RegSphere::~RegSphere()
{
+ delete [] rstr;
delete [] contact;
}
+/* ---------------------------------------------------------------------- */
+
+void RegSphere::init()
+{
+ Region::init();
+
+ // check variable
+
+ if (rstr) {
+ rvar = input->variable->find(rstr);
+ if (rvar < 0)
+ error->all(FLERR,"Variable name for region sphere does not exist");
+ if (!input->variable->equalstyle(rvar))
+ error->all(FLERR,"Variable for region sphere is invalid style");
+ }
+}
+
/* ----------------------------------------------------------------------
inside = 1 if x,y,z is inside or on surface
inside = 0 if x,y,z is outside and not on surface
@@ -124,3 +157,14 @@ int RegSphere::surface_exterior(double *x, double cutoff)
}
return 0;
}
+
+/* ----------------------------------------------------------------------
+ change region shape via variable evaluation
+------------------------------------------------------------------------- */
+
+void RegSphere::shape_update()
+{
+ radius = xscale * input->variable->compute_equal(rvar);
+ if (radius < 0.0)
+ error->one(FLERR,"Variable evaluation in region gave bad value");
+}
diff --git a/src/region_sphere.h b/src/region_sphere.h
index 73556d07c3..ed34369221 100644
--- a/src/region_sphere.h
+++ b/src/region_sphere.h
@@ -28,13 +28,19 @@ class RegSphere : public Region {
public:
RegSphere(class LAMMPS *, int, char **);
~RegSphere();
+ void init();
int inside(double, double, double);
int surface_interior(double *, double);
int surface_exterior(double *, double);
+ void shape_update();
private:
double xc,yc,zc;
double radius;
+ int rstyle,rvar;
+ char *rstr;
+
+ void variable_check();
};
}
diff --git a/src/variable.cpp b/src/variable.cpp
index 5b9402a731..d60acccc58 100644
--- a/src/variable.cpp
+++ b/src/variable.cpp
@@ -2159,17 +2159,17 @@ double Variable::eval_tree(Tree *tree, int i)
}
if (tree->type == RMASK) {
- if (domain->regions[tree->ivalue1]->inside(atom->x[i][0],
- atom->x[i][1],
- atom->x[i][2])) return 1.0;
+ if (domain->regions[tree->ivalue1]->match(atom->x[i][0],
+ atom->x[i][1],
+ atom->x[i][2])) return 1.0;
else return 0.0;
}
if (tree->type == GRMASK) {
if ((atom->mask[i] & tree->ivalue1) &&
- (domain->regions[tree->ivalue2]->inside(atom->x[i][0],
- atom->x[i][1],
- atom->x[i][2]))) return 1.0;
+ (domain->regions[tree->ivalue2]->match(atom->x[i][0],
+ atom->x[i][1],
+ atom->x[i][2]))) return 1.0;
else return 0.0;
}
From 746deead15bf42ebc6e89009cc7b56381d986c55 Mon Sep 17 00:00:00 2001
From: sjplimp
Date: Fri, 18 Jan 2013 20:46:51 +0000
Subject: [PATCH 07/12] git-svn-id:
svn://svn.icms.temple.edu/lammps-ro/trunk@9300
f3b2605a-c512-4ea7-a41b-209d697bcdaa
---
src/region_cylinder.cpp | 60 ++++++++++++++++++++++++++++++++++++++---
src/region_cylinder.h | 7 +++++
src/region_sphere.cpp | 33 ++++++++++++++---------
3 files changed, 85 insertions(+), 15 deletions(-)
diff --git a/src/region_cylinder.cpp b/src/region_cylinder.cpp
index d6d71ba9b9..b806ea07ea 100644
--- a/src/region_cylinder.cpp
+++ b/src/region_cylinder.cpp
@@ -15,12 +15,16 @@
#include "stdlib.h"
#include "string.h"
#include "region_cylinder.h"
+#include "update.h"
#include "domain.h"
+#include "input.h"
+#include "variable.h"
#include "error.h"
using namespace LAMMPS_NS;
#define BIG 1.0e20
+enum{CONSTANT,VARIABLE};
/* ---------------------------------------------------------------------- */
@@ -36,15 +40,29 @@ RegCylinder::RegCylinder(LAMMPS *lmp, int narg, char **arg) :
if (axis == 'x') {
c1 = yscale*atof(arg[3]);
c2 = zscale*atof(arg[4]);
- radius = yscale*atof(arg[5]);
} else if (axis == 'y') {
c1 = xscale*atof(arg[3]);
c2 = zscale*atof(arg[4]);
- radius = xscale*atof(arg[5]);
} else if (axis == 'z') {
c1 = xscale*atof(arg[3]);
c2 = yscale*atof(arg[4]);
- radius = xscale*atof(arg[5]);
+ }
+
+ rstr = NULL;
+ if (strstr(arg[5],"v_") == arg[5]) {
+ int n = strlen(&arg[5][2]) + 1;
+ rstr = new char[n];
+ strcpy(rstr,&arg[5][2]);
+ radius = 0.0;
+ rstyle = VARIABLE;
+ varshape = 1;
+ variable_check();
+ shape_update();
+ } else {
+ radius = atof(arg[5]);
+ if (axis == 'x') radius *= xscale;
+ else radius *= xscale;
+ rstyle = CONSTANT;
}
if (strcmp(arg[6],"INF") == 0 || strcmp(arg[6],"EDGE") == 0) {
@@ -100,6 +118,7 @@ RegCylinder::RegCylinder(LAMMPS *lmp, int narg, char **arg) :
if (radius <= 0.0) error->all(FLERR,"Illegal region cylinder command");
// extent of cylinder
+ // for variable radius, uses initial radius
if (interior) {
bboxflag = 1;
@@ -139,9 +158,18 @@ RegCylinder::RegCylinder(LAMMPS *lmp, int narg, char **arg) :
RegCylinder::~RegCylinder()
{
+ delete [] rstr;
delete [] contact;
}
+/* ---------------------------------------------------------------------- */
+
+void RegCylinder::init()
+{
+ Region::init();
+ if (rstr) variable_check();
+}
+
/* ----------------------------------------------------------------------
inside = 1 if x,y,z is inside or on surface
inside = 0 if x,y,z is outside and not on surface
@@ -400,3 +428,29 @@ int RegCylinder::surface_exterior(double *x, double cutoff)
return 0;
}
}
+
+/* ----------------------------------------------------------------------
+ change region shape via variable evaluation
+------------------------------------------------------------------------- */
+
+void RegCylinder::shape_update()
+{
+ radius = input->variable->compute_equal(rvar);
+ if (radius < 0.0)
+ error->one(FLERR,"Variable evaluation in region gave bad value");
+ if (axis == 'x') radius *= xscale;
+ else radius *= xscale;
+}
+
+/* ----------------------------------------------------------------------
+ error check on existence of variable
+------------------------------------------------------------------------- */
+
+void RegCylinder::variable_check()
+{
+ rvar = input->variable->find(rstr);
+ if (rvar < 0)
+ error->all(FLERR,"Variable name for region cylinder does not exist");
+ if (!input->variable->equalstyle(rvar))
+ error->all(FLERR,"Variable for region cylinder is invalid style");
+}
diff --git a/src/region_cylinder.h b/src/region_cylinder.h
index 93bb74aaff..07c26ca065 100644
--- a/src/region_cylinder.h
+++ b/src/region_cylinder.h
@@ -30,15 +30,22 @@ class RegCylinder : public Region {
public:
RegCylinder(class LAMMPS *, int, char **);
~RegCylinder();
+ void init();
int inside(double, double, double);
int surface_interior(double *, double);
int surface_exterior(double *, double);
+ void shape_update();
private:
char axis;
double c1,c2;
double radius;
double lo,hi;
+ int rstyle,rvar;
+ char *rstr;
+
+ void variable_check();
+
};
}
diff --git a/src/region_sphere.cpp b/src/region_sphere.cpp
index 773fc4cb16..28436cc171 100644
--- a/src/region_sphere.cpp
+++ b/src/region_sphere.cpp
@@ -15,9 +15,9 @@
#include "stdlib.h"
#include "string.h"
#include "region_sphere.h"
+#include "update.h"
#include "input.h"
#include "variable.h"
-#include "update.h"
#include "error.h"
using namespace LAMMPS_NS;
@@ -43,14 +43,19 @@ RegSphere::RegSphere(LAMMPS *lmp, int narg, char **arg) :
radius = 0.0;
rstyle = VARIABLE;
varshape = 1;
+ variable_check();
+ shape_update();
} else {
radius = xscale*atof(arg[5]);
rstyle = CONSTANT;
}
+ // error check
+
if (radius < 0.0) error->all(FLERR,"Illegal region sphere command");
- // extent of sphere, will be 0.0 for variable radius
+ // extent of sphere
+ // for variable radius, uses initial radius
if (interior) {
bboxflag = 1;
@@ -79,16 +84,7 @@ RegSphere::~RegSphere()
void RegSphere::init()
{
Region::init();
-
- // check variable
-
- if (rstr) {
- rvar = input->variable->find(rstr);
- if (rvar < 0)
- error->all(FLERR,"Variable name for region sphere does not exist");
- if (!input->variable->equalstyle(rvar))
- error->all(FLERR,"Variable for region sphere is invalid style");
- }
+ if (rstr) variable_check();
}
/* ----------------------------------------------------------------------
@@ -168,3 +164,16 @@ void RegSphere::shape_update()
if (radius < 0.0)
error->one(FLERR,"Variable evaluation in region gave bad value");
}
+
+/* ----------------------------------------------------------------------
+ error check on existence of variable
+------------------------------------------------------------------------- */
+
+void RegSphere::variable_check()
+{
+ rvar = input->variable->find(rstr);
+ if (rvar < 0)
+ error->all(FLERR,"Variable name for region sphere does not exist");
+ if (!input->variable->equalstyle(rvar))
+ error->all(FLERR,"Variable for region sphere is invalid style");
+}
From 35769609d95cc2fa70abb0f68f8c8087129de46e Mon Sep 17 00:00:00 2001
From: sjplimp
Date: Fri, 18 Jan 2013 20:55:26 +0000
Subject: [PATCH 08/12] git-svn-id:
svn://svn.icms.temple.edu/lammps-ro/trunk@9301
f3b2605a-c512-4ea7-a41b-209d697bcdaa
---
src/region.h | 3 +--
src/region_intersect.cpp | 29 +++++++++++++++++++++++++++--
src/region_intersect.h | 2 ++
src/region_union.cpp | 32 +++++++++++++++++++++++++++++---
src/region_union.h | 2 ++
5 files changed, 61 insertions(+), 7 deletions(-)
diff --git a/src/region.h b/src/region.h
index 8f79590258..0a1d888a98 100644
--- a/src/region.h
+++ b/src/region.h
@@ -28,6 +28,7 @@ class Region : protected Pointers {
double extent_ylo,extent_yhi;
double extent_zlo,extent_zhi;
int bboxflag; // 1 if bounding box is computable
+ int varshape; // 1 if region shape changes over time
// contact = particle near region surface
@@ -56,8 +57,6 @@ class Region : protected Pointers {
virtual void shape_update() {}
protected:
- int varshape; // 1 if region shape changes over time
-
void add_contact(int, double *, double, double, double);
void options(int, char **);
diff --git a/src/region_intersect.cpp b/src/region_intersect.cpp
index 736ec3c6e1..bae73952d3 100644
--- a/src/region_intersect.cpp
+++ b/src/region_intersect.cpp
@@ -42,10 +42,14 @@ RegIntersect::RegIntersect(LAMMPS *lmp, int narg, char **arg) :
list[nregion++] = iregion;
}
- // extent of intersection of regions
- // has bounding box if interior and any sub-region has bounding box
+ // this region is variable shape if any of sub-regions are
Region **regions = domain->regions;
+ for (int ilist = 0; ilist < nregion; ilist++)
+ if (regions[list[ilist]]->varshape) varshape = 1;
+
+ // extent of intersection of regions
+ // has bounding box if interior and any sub-region has bounding box
bboxflag = 0;
for (int ilist = 0; ilist < nregion; ilist++)
@@ -91,6 +95,16 @@ RegIntersect::~RegIntersect()
delete [] contact;
}
+/* ---------------------------------------------------------------------- */
+
+void RegIntersect::init()
+{
+ Region::init();
+ Region **regions = domain->regions;
+ for (int ilist = 0; ilist < nregion; ilist++)
+ regions[list[ilist]]->init();
+}
+
/* ----------------------------------------------------------------------
return 1 if region is dynamic, 0 if static
dynamic if any sub-region is dynamic, else static
@@ -206,3 +220,14 @@ int RegIntersect::surface_exterior(double *x, double cutoff)
return n;
}
+
+/* ----------------------------------------------------------------------
+ change region shape of all sub-regions
+------------------------------------------------------------------------- */
+
+void RegIntersect::shape_update()
+{
+ Region **regions = domain->regions;
+ for (int ilist = 0; ilist < nregion; ilist++)
+ regions[list[ilist]]->shape_update();
+}
diff --git a/src/region_intersect.h b/src/region_intersect.h
index a8bd460f34..62946a65c0 100644
--- a/src/region_intersect.h
+++ b/src/region_intersect.h
@@ -28,10 +28,12 @@ class RegIntersect : public Region {
public:
RegIntersect(class LAMMPS *, int, char **);
~RegIntersect();
+ void init();
int dynamic_check();
int inside(double, double, double);
int surface_interior(double *, double);
int surface_exterior(double *, double);
+ void shape_update();
private:
int nregion;
diff --git a/src/region_union.cpp b/src/region_union.cpp
index ca1e693f37..3741e8fdd1 100644
--- a/src/region_union.cpp
+++ b/src/region_union.cpp
@@ -38,14 +38,19 @@ RegUnion::RegUnion(LAMMPS *lmp, int narg, char **arg) : Region(lmp, narg, arg)
int iregion;
for (int iarg = 0; iarg < n; iarg++) {
iregion = domain->find_region(arg[iarg+3]);
- if (iregion == -1) error->all(FLERR,"Region union region ID does not exist");
+ if (iregion == -1)
+ error->all(FLERR,"Region union region ID does not exist");
list[nregion++] = iregion;
}
- // extent of union of regions
- // has bounding box if interior and all sub-regions have bounding box
+ // this region is variable shape if any of sub-regions are
Region **regions = domain->regions;
+ for (int ilist = 0; ilist < nregion; ilist++)
+ if (regions[list[ilist]]->varshape) varshape = 1;
+
+ // extent of union of regions
+ // has bounding box if interior and all sub-regions have bounding box
bboxflag = 1;
for (int ilist = 0; ilist < nregion; ilist++)
@@ -82,6 +87,16 @@ RegUnion::~RegUnion()
delete [] contact;
}
+/* ---------------------------------------------------------------------- */
+
+void RegUnion::init()
+{
+ Region::init();
+ Region **regions = domain->regions;
+ for (int ilist = 0; ilist < nregion; ilist++)
+ regions[list[ilist]]->init();
+}
+
/* ----------------------------------------------------------------------
return 1 if region is dynamic, 0 if static
dynamic if any sub-region is dynamic, else static
@@ -197,3 +212,14 @@ int RegUnion::surface_exterior(double *x, double cutoff)
return n;
}
+
+/* ----------------------------------------------------------------------
+ change region shape of all sub-regions
+------------------------------------------------------------------------- */
+
+void RegUnion::shape_update()
+{
+ Region **regions = domain->regions;
+ for (int ilist = 0; ilist < nregion; ilist++)
+ regions[list[ilist]]->shape_update();
+}
diff --git a/src/region_union.h b/src/region_union.h
index 44d99375c9..6d0ec063cf 100644
--- a/src/region_union.h
+++ b/src/region_union.h
@@ -28,10 +28,12 @@ class RegUnion : public Region {
public:
RegUnion(class LAMMPS *, int, char **);
~RegUnion();
+ void init();
int dynamic_check();
int inside(double, double, double);
int surface_interior(double *, double);
int surface_exterior(double *, double);
+ void shape_update();
private:
int nregion;
From 6efc2340659c29ed9cba28b2337e9f4af0478721 Mon Sep 17 00:00:00 2001
From: sjplimp
Date: Fri, 18 Jan 2013 21:00:07 +0000
Subject: [PATCH 09/12] git-svn-id:
svn://svn.icms.temple.edu/lammps-ro/trunk@9302
f3b2605a-c512-4ea7-a41b-209d697bcdaa
---
doc/region.html | 13 +++++++++++++
doc/region.txt | 13 +++++++++++++
2 files changed, 26 insertions(+)
diff --git a/doc/region.html b/doc/region.html
index 58832093d3..1bd4b5392d 100644
--- a/doc/region.html
+++ b/doc/region.html
@@ -31,6 +31,7 @@
dim = x or y or z = axis of cylinder
c1,c2 = coords of cylinder axis in other 2 dimensions (distance units)
radius = cylinder radius (distance units)
+ radius can be a variable (see below)
lo,hi = bounds of cylinder in dim (distance units)
plane args = px py pz nx ny nz
px,py,pz = point on the plane (distance units)
@@ -43,6 +44,7 @@
sphere args = x y z radius
x,y,z = center of sphere (distance units)
radius = radius of sphere (distance units)
+ radius can be a variable (see below)
union args = N reg-ID1 reg-ID2 ...
N = # of regions to follow, must be 2 or greater
reg-ID1,reg-ID2, ... = IDs of regions to join together
@@ -175,6 +177,17 @@ since if the maximum tilt factor is 5 (as in this example), then
configurations with tilt = ..., -15, -5, 5, 15, 25, ... are all
geometrically equivalent.
+The radius value for style sphere and cylinder can be specified
+as an equal-style variable. If the value is a
+variable, it should be specified as v_name, where name is the variable
+name. In this case, the variable will be evaluated each timestep, and
+its value used to determine the radius of the region.
+
+Equal-style variables can specify formulas with various mathematical
+functions, and include thermo_style command
+keywords for the simulation box parameters and timestep and elapsed
+time. Thus it is easy to specify a time-dependent radius.
+
See Section_howto 12 of the doc pages
for a geometric description of triclinic boxes, as defined by LAMMPS,
and how to transform these parameters to and from other commonly used
diff --git a/doc/region.txt b/doc/region.txt
index 74744ab501..ff79470846 100644
--- a/doc/region.txt
+++ b/doc/region.txt
@@ -26,6 +26,7 @@ style = {delete} or {block} or {cone} or {cylinder} or {plane} or {prism} or {sp
dim = {x} or {y} or {z} = axis of cylinder
c1,c2 = coords of cylinder axis in other 2 dimensions (distance units)
radius = cylinder radius (distance units)
+ radius can be a variable (see below)
lo,hi = bounds of cylinder in dim (distance units)
{plane} args = px py pz nx ny nz
px,py,pz = point on the plane (distance units)
@@ -38,6 +39,7 @@ style = {delete} or {block} or {cone} or {cylinder} or {plane} or {prism} or {sp
{sphere} args = x y z radius
x,y,z = center of sphere (distance units)
radius = radius of sphere (distance units)
+ radius can be a variable (see below)
{union} args = N reg-ID1 reg-ID2 ...
N = # of regions to follow, must be 2 or greater
reg-ID1,reg-ID2, ... = IDs of regions to join together
@@ -166,6 +168,17 @@ since if the maximum tilt factor is 5 (as in this example), then
configurations with tilt = ..., -15, -5, 5, 15, 25, ... are all
geometrically equivalent.
+The {radius} value for style {sphere} and {cylinder} can be specified
+as an equal-style "variable"_variable.html. If the value is a
+variable, it should be specified as v_name, where name is the variable
+name. In this case, the variable will be evaluated each timestep, and
+its value used to determine the radius of the region.
+
+Equal-style variables can specify formulas with various mathematical
+functions, and include "thermo_style"_thermo_style.html command
+keywords for the simulation box parameters and timestep and elapsed
+time. Thus it is easy to specify a time-dependent radius.
+
See "Section_howto 12"_Section_howto.html#howto_12 of the doc pages
for a geometric description of triclinic boxes, as defined by LAMMPS,
and how to transform these parameters to and from other commonly used
From fd75622da330831ff6b488764b5475eb7578de95 Mon Sep 17 00:00:00 2001
From: sjplimp
Date: Fri, 18 Jan 2013 21:02:02 +0000
Subject: [PATCH 10/12] git-svn-id:
svn://svn.icms.temple.edu/lammps-ro/trunk@9303
f3b2605a-c512-4ea7-a41b-209d697bcdaa
---
src/version.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/version.h b/src/version.h
index 06f5372acb..7d81684e82 100644
--- a/src/version.h
+++ b/src/version.h
@@ -1 +1 @@
-#define LAMMPS_VERSION "20 Jan 2013"
+#define LAMMPS_VERSION "21 Jan 2013"
From 5b1fe9d76389d7a710104a2cc2cbf9e626bf13fd Mon Sep 17 00:00:00 2001
From: Axel Kohlmeyer
Date: Mon, 21 Jan 2013 03:28:22 -0500
Subject: [PATCH 11/12] update /omp versions of brownian and lubricate pair
styles for changes in upstream serial variants
---
src/USER-OMP/pair_brownian_omp.cpp | 4 ++--
src/USER-OMP/pair_brownian_poly_omp.cpp | 4 ++--
src/USER-OMP/pair_lubricate_omp.cpp | 4 ++--
src/USER-OMP/pair_lubricate_poly_omp.cpp | 4 ++--
4 files changed, 8 insertions(+), 8 deletions(-)
diff --git a/src/USER-OMP/pair_brownian_omp.cpp b/src/USER-OMP/pair_brownian_omp.cpp
index 561c82abf5..20cc068809 100644
--- a/src/USER-OMP/pair_brownian_omp.cpp
+++ b/src/USER-OMP/pair_brownian_omp.cpp
@@ -91,8 +91,8 @@ void PairBrownianOMP::compute(int eflag, int vflag)
for (int m = 0; m < wallfix->nwall; m++){
int dim = wallfix->wallwhich[m] / 2;
int side = wallfix->wallwhich[m] % 2;
- if (wallfix->wallstyle[m] == VARIABLE){
- wallcoord = input->variable->compute_equal(wallfix->varindex[m]);
+ if (wallfix->xstyle[m] == VARIABLE){
+ wallcoord = input->variable->compute_equal(wallfix->xindex[m]);
}
else wallcoord = wallfix->coord0[m];
if (side == 0) walllo[dim] = wallcoord;
diff --git a/src/USER-OMP/pair_brownian_poly_omp.cpp b/src/USER-OMP/pair_brownian_poly_omp.cpp
index 6affbf96cf..0378989fbc 100644
--- a/src/USER-OMP/pair_brownian_poly_omp.cpp
+++ b/src/USER-OMP/pair_brownian_poly_omp.cpp
@@ -91,8 +91,8 @@ void PairBrownianPolyOMP::compute(int eflag, int vflag)
for (int m = 0; m < wallfix->nwall; m++){
int dim = wallfix->wallwhich[m] / 2;
int side = wallfix->wallwhich[m] % 2;
- if (wallfix->wallstyle[m] == VARIABLE){
- wallcoord = input->variable->compute_equal(wallfix->varindex[m]);
+ if (wallfix->xstyle[m] == VARIABLE){
+ wallcoord = input->variable->compute_equal(wallfix->xindex[m]);
}
else wallcoord = wallfix->coord0[m];
if (side == 0) walllo[dim] = wallcoord;
diff --git a/src/USER-OMP/pair_lubricate_omp.cpp b/src/USER-OMP/pair_lubricate_omp.cpp
index 22090b2978..877be4bed2 100644
--- a/src/USER-OMP/pair_lubricate_omp.cpp
+++ b/src/USER-OMP/pair_lubricate_omp.cpp
@@ -85,8 +85,8 @@ void PairLubricateOMP::compute(int eflag, int vflag)
for (int m = 0; m < wallfix->nwall; m++){
int dim = wallfix->wallwhich[m] / 2;
int side = wallfix->wallwhich[m] % 2;
- if (wallfix->wallstyle[m] == VARIABLE){
- wallcoord = input->variable->compute_equal(wallfix->varindex[m]);
+ if (wallfix->xstyle[m] == VARIABLE){
+ wallcoord = input->variable->compute_equal(wallfix->xindex[m]);
}
else wallcoord = wallfix->coord0[m];
if (side == 0) walllo[dim] = wallcoord;
diff --git a/src/USER-OMP/pair_lubricate_poly_omp.cpp b/src/USER-OMP/pair_lubricate_poly_omp.cpp
index 26339b7749..a9161805b6 100644
--- a/src/USER-OMP/pair_lubricate_poly_omp.cpp
+++ b/src/USER-OMP/pair_lubricate_poly_omp.cpp
@@ -86,8 +86,8 @@ void PairLubricatePolyOMP::compute(int eflag, int vflag)
for (int m = 0; m < wallfix->nwall; m++){
int dim = wallfix->wallwhich[m] / 2;
int side = wallfix->wallwhich[m] % 2;
- if (wallfix->wallstyle[m] == VARIABLE){
- wallcoord = input->variable->compute_equal(wallfix->varindex[m]);
+ if (wallfix->xstyle[m] == VARIABLE){
+ wallcoord = input->variable->compute_equal(wallfix->xindex[m]);
}
else wallcoord = wallfix->coord0[m];
if (side == 0) walllo[dim] = wallcoord;
From 7930d8b34f8d547adad3602ee63cd877e89ad730 Mon Sep 17 00:00:00 2001
From: sjplimp
Date: Mon, 21 Jan 2013 16:35:54 +0000
Subject: [PATCH 12/12] git-svn-id:
svn://svn.icms.temple.edu/lammps-ro/trunk@9306
f3b2605a-c512-4ea7-a41b-209d697bcdaa
---
doc/Section_commands.html | 111 +++++++++++++++++++-------------------
doc/Section_commands.txt | 14 +++--
doc/kspace_style.html | 4 +-
doc/kspace_style.txt | 4 +-
doc/pair_born.html | 43 +++++++++------
doc/pair_born.txt | 41 ++++++++------
doc/pair_buck.html | 36 ++++++++-----
doc/pair_buck.txt | 34 +++++++-----
doc/pair_charmm.html | 28 +++++++---
doc/pair_charmm.txt | 26 ++++++---
doc/pair_coul.html | 28 ++++++----
doc/pair_coul.txt | 26 +++++----
doc/pair_lj.html | 37 ++++++++-----
doc/pair_lj.txt | 35 +++++++-----
14 files changed, 289 insertions(+), 178 deletions(-)
diff --git a/doc/Section_commands.html b/doc/Section_commands.html
index c78886303c..4a8ea4e525 100644
--- a/doc/Section_commands.html
+++ b/doc/Section_commands.html
@@ -419,25 +419,26 @@ potentials. Click on the style itself for a full description:
These are pair styles contributed by users, which can be used if
@@ -458,42 +459,42 @@ package.
@@ -637,8 +638,8 @@ built with the appropriate accelerated
package.