--- /home/sjplimp/oldlammps/src/fix_indent.cpp	2005-06-03 16:59:08.000000000 -0600
+++ /home/sjplimp/lammps/src/fix_indent.cpp	2005-11-09 09:47:33.000000000 -0700
@@ -11,6 +11,10 @@
    See the README file in the top-level LAMMPS directory.
 ------------------------------------------------------------------------- */
 
+/* ----------------------------------------------------------------------
+   Contributing author: Ravi Agrawal (Northwestern U)
+------------------------------------------------------------------------- */
+
 #include "math.h"
 #include "string.h"
 #include "fix_indent.h"
@@ -20,27 +24,69 @@
 #include "respa.h"
 #include "error.h"
 
+#define NONE     0
+#define SPHERE   1
+#define CYLINDER 2
+
 /* ---------------------------------------------------------------------- */
 
 FixIndent::FixIndent(int narg, char **arg) : Fix(narg, arg)
 {
-  if (narg != 11) error->all("Illegal fix indent command");
+  if (narg < 4) error->all("Illegal fix indent command");
+  k = atof(arg[3]);
+
+  // set input line defaults
+
+  istyle = NONE;
+  vx = vy = vz = 0.0;
+  scaleflag = 1;
+
+  // read options from end of input line
 
-  if (strcmp(domain->lattice_style,"none") == 0)
+  options(narg-4,&arg[4]);
+
+  // setup scaling
+
+  if (scaleflag && strcmp(domain->lattice_style,"none") == 0)
     error->all("Use of fix indent with undefined lattice");
 
-  double xscale = domain->xlattice;
-  double yscale = domain->ylattice;
-  double zscale = domain->zlattice;
+  double xscale,yscale,zscale;
+  if (scaleflag) {
+    xscale = domain->xlattice;
+    yscale = domain->ylattice;
+    zscale = domain->zlattice;
+  }
+  else xscale = yscale = zscale = 1.0;
 
-  k = atof(arg[3]);
-  r0 = xscale*atof(arg[4]);
-  x0 = xscale*atof(arg[5]);
-  y0 = yscale*atof(arg[6]);
-  z0 = zscale*atof(arg[7]);
-  vx = xscale * atof(arg[8]);
-  vy = yscale * atof(arg[9]);
-  vz = zscale * atof(arg[10]);
+  // apply scaling to indenter force constant, geometry, and velocity
+
+  k /= xscale;
+  vx *= xscale;
+  vy *= yscale;
+  vz *= zscale;
+
+  if (istyle == SPHERE) {
+    x0 *= xscale;
+    y0 *= yscale;
+    z0 *= zscale;
+    r0 *= xscale;
+  } else if (istyle == CYLINDER) {
+    if (cdim == 0) {
+      c1 *= yscale;
+      c2 *= zscale;
+      r0 *= xscale;
+    } else if (cdim == 1) {
+      c1 *= xscale;
+      c2 *= zscale;
+      r0 *= yscale;
+    } else if (cdim == 2) {
+      c1 *= xscale;
+      c2 *= yscale;
+      r0 *= zscale;
+    }
+  } else error->all("Illegal fix indent command");
+
+  // time 0 for the indenter movement
 
   ntimestep_initial = update->ntimestep;
 }
@@ -80,34 +126,90 @@
 
 void FixIndent::post_force(int vflag)
 {
-  // x1,y1,z1 = current position of indenter
+  // spherical indenter
 
-  double delta = (update->ntimestep - ntimestep_initial) * update->dt;
-  double x1 = x0 + delta*vx;
-  double y1 = y0 + delta*vy;
-  double z1 = z0 + delta*vz;
-
-  double **x = atom->x;
-  double **f = atom->f;
-  int *mask = atom->mask;
-  int nlocal = atom->nlocal;
-
-  double delx,dely,delz,r,dr,fmag;
-
-  for (int i = 0; i < nlocal; i++)
-    if (mask[i] & groupbit) {
-      delx = x[i][0] - x1;
-      dely = x[i][1] - y1;
-      delz = x[i][2] - z1;
-      r = sqrt(delx*delx + dely*dely + delz*delz);
-      dr = r - r0;
-      if (dr < 0.0) {
-	fmag = k*dr*dr;
-	f[i][0] += delx*fmag/r;
-	f[i][1] += dely*fmag/r;
-	f[i][2] += delz*fmag/r;
+  if (istyle == SPHERE) {
+
+    // x1,y1,z1 = current position of indenter from original x0,y0,z0
+
+    double delta = (update->ntimestep - ntimestep_initial) * update->dt;
+    double x1 = x0 + delta*vx;
+    double y1 = y0 + delta*vy;
+    double z1 = z0 + delta*vz;
+    
+    double **x = atom->x;
+    double **f = atom->f;
+    int *mask = atom->mask;
+    int nlocal = atom->nlocal;
+
+    double delx,dely,delz,r,dr,fmag;
+
+    for (int i = 0; i < nlocal; i++)
+      if (mask[i] & groupbit) {
+	delx = x[i][0] - x1;
+	dely = x[i][1] - y1;
+	delz = x[i][2] - z1;
+	r = sqrt(delx*delx + dely*dely + delz*delz);
+	dr = r - r0;
+	if (dr < 0.0) {
+	  fmag = k*dr*dr;
+	  f[i][0] += delx*fmag/r;
+	  f[i][1] += dely*fmag/r;
+	  f[i][2] += delz*fmag/r;
+	}
       }
+
+  // cylindrical indenter
+
+  } else {
+
+    // c1new,c2new = current coords of indenter axis from original c1,c2
+	      
+    double delta = (update->ntimestep - ntimestep_initial) * update->dt;
+    double c1new,c2new;
+    if (cdim == 0) {
+      c1new = c1 + delta*vy;
+      c2new = c2 + delta*vz;
+    } else if (cdim == 1) {
+      c1new = c1 + delta*vx;
+      c2new = c2 + delta*vz;
+    } else {
+      c1new = c1 + delta*vx;
+      c2new = c2 + delta*vy;
     }
+    
+    double **x = atom->x;
+    double **f = atom->f;
+    int *mask = atom->mask;
+    int nlocal = atom->nlocal;
+    
+    double delx,dely,delz,r,dr,fmag;
+    
+    for (int i = 0; i < nlocal; i++)
+      if (mask[i] & groupbit) {
+	if (cdim == 0) {
+	  delx = 0;
+	  dely = x[i][1] - c1new;
+	  delz = x[i][2] - c2new;
+	} else if (cdim == 1) {
+	  delx = x[i][0] - c1new;
+	  dely = 0;
+	  delz = x[i][2] - c2new;
+	} else {
+	  delx = x[i][0] - c1new;
+	  dely = x[i][1] - c2new;
+	  delz = 0;
+	}
+	r = sqrt(delx*delx + dely*dely + delz*delz);
+	dr = r - r0;
+	if (dr < 0.0) {
+	  fmag = k*dr*dr;
+	  f[i][0] += delx*fmag/r;
+	  f[i][1] += dely*fmag/r;
+	  f[i][2] += delz*fmag/r;
+	}
+      }
+  }
 }
 
 /* ---------------------------------------------------------------------- */
@@ -116,3 +218,48 @@
 {
   if (ilevel == nlevels_respa-1) post_force(vflag);
 }
+
+/* ----------------------------------------------------------------------
+   parse optional parameters at end of fix indent input line 
+------------------------------------------------------------------------- */
+
+void FixIndent::options(int narg, char **arg)
+{
+  if (narg < 0) error->all("Illegal fix indent command");
+
+  int iarg = 0;
+  while (iarg < narg) {
+    if (strcmp(arg[iarg],"sphere") == 0) {
+      if (iarg+5 > narg) error->all("Illegal fix indent command");
+      x0 = atof(arg[iarg+1]);
+      y0 = atof(arg[iarg+2]);
+      z0 = atof(arg[iarg+3]);
+      r0 = atof(arg[iarg+4]);
+      istyle = SPHERE;
+      iarg += 5;
+    } else if (strcmp(arg[iarg],"cylinder") == 0) {
+      if (iarg+5 > narg) error->all("Illegal fix indent command");
+      if (strcmp(arg[iarg+1],"x") == 0) cdim = 0;
+      else if (strcmp(arg[iarg+1],"y") == 0) cdim = 1;
+      else if (strcmp(arg[iarg+1],"z") == 0) cdim = 2;
+      else error->all("Illegal fix indent command");
+      c1 = atof(arg[iarg+2]);
+      c2 = atof(arg[iarg+3]);
+      r0 = atof(arg[iarg+4]);
+      istyle = CYLINDER;
+      iarg += 5;
+    } else if (strcmp(arg[iarg],"vel") == 0) {
+      if (iarg+4 > narg) error->all("Illegal fix indent command");
+      vx = atof(arg[iarg+1]);
+      vy = atof(arg[iarg+2]);
+      vz = atof(arg[iarg+3]);
+      iarg += 4;
+    } else if (strcmp(arg[iarg],"units") == 0) {
+      if (iarg+2 > narg) error->all("Illegal fix indent command");
+      if (strcmp(arg[iarg+1],"box") == 0) scaleflag = 0;
+      else if (strcmp(arg[iarg+1],"lattice") == 0) scaleflag = 1;
+      else error->all("Illegal fix indent command");
+      iarg += 2;
+    } else error->all("Incorrect args in fix indent options");
+  }
+}
--- /home/sjplimp/oldlammps/src/fix_indent.h	2005-06-03 16:59:08.000000000 -0600
+++ /home/sjplimp/lammps/src/fix_indent.h	2005-09-13 12:19:16.000000000 -0600
@@ -27,11 +27,15 @@
   void post_force_respa(int, int, int);
 
  private:
-  int ntimestep_initial;
-  double k,r0;
-  double x0,y0,z0;
+  int ntimestep_initial,istyle,scaleflag;
+  double k;
+  double x0,y0,z0,r0;
+  int cdim;
+  double c1,c2;
   double vx,vy,vz;
   int nlevels_respa;
+
+  void options(int, char **);
 };
 
 #endif
--- /home/sjplimp/oldlammps/doc/fix_indent.txt	2005-06-03 16:59:09.000000000 -0600
+++ /home/sjplimp/lammps/doc/fix_indent.txt	2005-09-13 12:35:46.000000000 -0600
@@ -10,36 +10,68 @@
 
 [Syntax:]
 
-fix ID group-ID indent k R x y z vx vy vz :pre
+fix ID group-ID indent k keyword args ... :pre
 
-ID, group-ID are documented in "fix"_fix.html command
-indent = style name of this fix command
-k = force constant for indenter surface (force/distance units)
-R = radius of indenter (distance units)
-x,y,z = initial position of center of indenter
-vx,vy,vz = velocity of center of indenter (velocity units) :ul
+ID, group-ID are documented in "fix"_fix.html command :ulb,l
+indent = style name of this fix command :l
+k = force constant for indenter surface (force/distance units) :l
+one or more keyword/value pairs may be appended to the args :l
+keyword = {sphere} or {cylinder} or {vel} or {units} :l
+  {sphere} args = x y z R
+    x,y,z = initial position of center of indenter
+    R = sphere radius of indenter (distance units)
+  {cylinder} args = dim c1 c2 R
+    dim = x or y or z = axis of cylinder
+    c1,c2 = coords of cylinder axis in other 2 dimensions (distance units)
+    R = cylinder radius of indenter (distance units)
+  {vel} args = vx vy vz
+    vx,vy,vz = velocity of center of indenter (velocity units)
+  {units} value = {lattice} or {box}
+    lattice = the geometry is defined in lattice units
+    box = the geometry is defined in simulation box units :pre
+:ule
 
 [Examples:]
 
-fix 1 all indent 10.0 3.0 0.0 0.0 15.0 0.0 0.0 -1.0 :pre
+fix 1 all indent 10.0 sphere 0.0 0.0 15.0 3.0 vel 0.0 0.0 -1.0
+fix 2 flow indent 10.0 cylinder z 0.0 0.0 10.0 units box :pre
 
 [Description:]
 
-Move a spherical indenter within a simulation box.  The indenter
-repels all atoms if touches, so it can be used to push into a block of
-material or as an obstacle in a flow.  The magnitude of the force
-exerted by the indenter on each atom is given by
+Insert an indenter within a simulation box.  The indenter repels all
+atoms that touch it, so it can be used to push into a material or as
+an obstacle in a flow.
+
+A spherical indenter exerts a force of magnitude
 
 F(r) = - k (r - R) :pre
 
-where {k} is the specified force constant, {r} is the distance from
-the atom to the center of the indenter, and {R} is the radius of the
-indenter.  The force is repulsive and F(r) = 0 for {r} > {R}.  The
-center of the indenter moves during the simulation, based on its
-initial (x,y,z) position and the specified (vx,vy,vz).
+on each atom where {k} is the specified force constant, {r} is the
+distance from the atom to the center of the indenter, and {R} is the
+radius of the indenter.  The force is repulsive and F(r) = 0 for {r} >
+{R}.
+
+A cylindrical indenter exerts the same force, except that {r} is the
+distance from the atom to the center axis of the cylinder.  The
+cylinder extends infinitely along its axis.
+
+If the {vel} keyword is specified, the center (or axis) of the
+spherical (or cylindrical) indenter will move during the simulation,
+based on its initial (x,y,z) position and the specified (vx,vy,vz).
+
+The {units} keyword determines the meaning of the distance units used
+to define the indenter.  A {box} value selects standard distance units
+as defined by the "units"_units.html command, e.g. Angstroms for units
+= real or metal.  A {lattice} value means the distance units are in
+cubic lattice spacings.  The "lattice"_lattice.html command must first
+be used to define a lattice.  Note that the units choice affects not
+only the indenter's physical geometry, but also its velocity and force
+constant since they are defined in terms of distance as well.
 
 [Restrictions:] none
 
 [Related commands:] none
 
-[Default:] none
+[Default:]
+
+The option defaults are units = lattice.
--- /home/sjplimp/oldlammps/doc/fix_indent.html	2005-06-03 16:59:09.000000000 -0600
+++ /home/sjplimp/lammps/doc/fix_indent.html	2005-11-09 09:47:25.000000000 -0700
@@ -13,38 +13,76 @@
 </H3>
 <P><B>Syntax:</B>
 </P>
-<PRE>fix ID group-ID indent k R x y z vx vy vz 
+<PRE>fix ID group-ID indent k keyword args ... 
 </PRE>
-<UL><LI>ID, group-ID are documented in <A HREF = "fix.html">fix</A> command
-<LI>indent = style name of this fix command
-<LI>k = force constant for indenter surface (force/distance units)
-<LI>R = radius of indenter (distance units)
-<LI>x,y,z = initial position of center of indenter
-<LI>vx,vy,vz = velocity of center of indenter (velocity units) 
+<UL><LI>ID, group-ID are documented in <A HREF = "fix.html">fix</A> command 
+
+<LI>indent = style name of this fix command 
+
+<LI>k = force constant for indenter surface (force/distance units) 
+
+<LI>one or more keyword/value pairs may be appended to the args 
+
+<LI>keyword = <I>sphere</I> or <I>cylinder</I> or <I>vel</I> or <I>units</I> 
+
+<PRE>  <I>sphere</I> args = x y z R
+    x,y,z = initial position of center of indenter
+    R = sphere radius of indenter (distance units)
+  <I>cylinder</I> args = dim c1 c2 R
+    dim = x or y or z = axis of cylinder
+    c1,c2 = coords of cylinder axis in other 2 dimensions (distance units)
+    R = cylinder radius of indenter (distance units)
+  <I>vel</I> args = vx vy vz
+    vx,vy,vz = velocity of center of indenter (velocity units)
+  <I>units</I> value = <I>lattice</I> or <I>box</I>
+    lattice = the geometry is defined in lattice units
+    box = the geometry is defined in simulation box units 
+</PRE>
+
 </UL>
 <P><B>Examples:</B>
 </P>
-<PRE>fix 1 all indent 10.0 3.0 0.0 0.0 15.0 0.0 0.0 -1.0 
+<PRE>fix 1 all indent 10.0 sphere 0.0 0.0 15.0 3.0 vel 0.0 0.0 -1.0
+fix 2 flow indent 10.0 cylinder z 0.0 0.0 10.0 units box 
 </PRE>
 <P><B>Description:</B>
 </P>
-<P>Move a spherical indenter within a simulation box.  The indenter
-repels all atoms if touches, so it can be used to push into a block of
-material or as an obstacle in a flow.  The magnitude of the force
-exerted by the indenter on each atom is given by
+<P>Insert an indenter within a simulation box.  The indenter repels all
+atoms that touch it, so it can be used to push into a material or as
+an obstacle in a flow.
+</P>
+<P>A spherical indenter exerts a force of magnitude
 </P>
 <PRE>F(r) = - k (r - R) 
 </PRE>
-<P>where <I>k</I> is the specified force constant, <I>r</I> is the distance from
-the atom to the center of the indenter, and <I>R</I> is the radius of the
-indenter.  The force is repulsive and F(r) = 0 for <I>r</I> > <I>R</I>.  The
-center of the indenter moves during the simulation, based on its
-initial (x,y,z) position and the specified (vx,vy,vz).
+<P>on each atom where <I>k</I> is the specified force constant, <I>r</I> is the
+distance from the atom to the center of the indenter, and <I>R</I> is the
+radius of the indenter.  The force is repulsive and F(r) = 0 for <I>r</I> >
+<I>R</I>.
+</P>
+<P>A cylindrical indenter exerts the same force, except that <I>r</I> is the
+distance from the atom to the center axis of the cylinder.  The
+cylinder extends infinitely along its axis.
+</P>
+<P>If the <I>vel</I> keyword is specified, the center (or axis) of the
+spherical (or cylindrical) indenter will move during the simulation,
+based on its initial (x,y,z) position and the specified (vx,vy,vz).
+</P>
+<P>The <I>units</I> keyword determines the meaning of the distance units used
+to define the indenter.  A <I>box</I> value selects standard distance units
+as defined by the <A HREF = "units.html">units</A> command, e.g. Angstroms for units
+= real or metal.  A <I>lattice</I> value means the distance units are in
+cubic lattice spacings.  The <A HREF = "lattice.html">lattice</A> command must first
+be used to define a lattice.  Note that the units choice affects not
+only the indenter's physical geometry, but also its velocity and force
+constant since they are defined in terms of distance as well.
 </P>
 <P><B>Restrictions:</B> none
 </P>
 <P><B>Related commands:</B> none
 </P>
-<P><B>Default:</B> none
+<P><B>Default:</B>
+</P>
+<P>The option defaults are units = lattice.
 </P>
 </HTML>
--- /home/sjplimp/oldlammps/examples/indent/in.indent	2005-06-03 16:59:10.000000000 -0600
+++ /home/sjplimp/lammps/examples/indent/in.indent	2005-11-09 09:51:22.000000000 -0700
@@ -39,7 +39,7 @@
 
 # indenter
 
-fix		4 all indent 1000.0 5.0 10 13 0 0.0 -0.02 0.0
+fix		4 all indent 1000.0 sphere 10 13 0 5.0 vel 0.0 -0.02 0.0
 fix		5 all enforce2d
 
 # Run with indenter
--- /home/sjplimp/oldlammps/examples/obstacle/in.obstacle	2005-11-09 09:54:04.000000000 -0700
+++ /home/sjplimp/lammps/examples/obstacle/in.obstacle	2005-11-09 09:51:05.000000000 -0700
@@ -58,10 +58,8 @@
 region		void2 sphere 20 7 0 3
 delete_atoms	region void2
 
-fix		7 flow indent 100 4 10 4 0 0 0 0 
-fix		8 flow indent 100 4 20 7 0 0 0 0 
-#fix		7 flow indent 100 sphere 10 4 0 4
-#fix		8 flow indent 100 sphere 20 7 0 4
+fix		7 flow indent 100 sphere 10 4 0 4
+fix		8 flow indent 100 sphere 20 7 0 4
 fix		9 all enforce2d
 
 # Run