From f2c302c2c4b7516660eab58d2f022fca9220b8b5 Mon Sep 17 00:00:00 2001
From: Trung Nguyen <ndactrung@gmail.com>
Date: Sat, 26 May 2018 14:59:40 -0500
Subject: [PATCH] Added fix wall/body/polygon and related doc pages

---
 doc/src/fix_wall_body_polygon.txt        | 100 +++++++++++++++++++++++
 doc/src/fix_wall_body_polyhedron.txt     | 100 +++++++++++++++++++++++
 doc/src/pair_body_rounded_polygon.txt    |   4 +-
 doc/src/pair_body_rounded_polyhedron.txt |   4 +-
 src/BODY/fix_wall_body_polygon.h         |   4 +-
 5 files changed, 207 insertions(+), 5 deletions(-)
 create mode 100644 doc/src/fix_wall_body_polygon.txt
 create mode 100644 doc/src/fix_wall_body_polyhedron.txt

diff --git a/doc/src/fix_wall_body_polygon.txt b/doc/src/fix_wall_body_polygon.txt
new file mode 100644
index 0000000000..00d23c207c
--- /dev/null
+++ b/doc/src/fix_wall_body_polygon.txt
@@ -0,0 +1,100 @@
+"LAMMPS WWW Site"_lws - "LAMMPS Documentation"_ld - "LAMMPS Commands"_lc :c
+
+:link(lws,http://lammps.sandia.gov)
+:link(ld,Manual.html)
+:link(lc,Section_commands.html#comm)
+
+:line
+
+fix wall/body/polygon command :h3
+
+[Syntax:]
+
+fix ID group-ID wall/body/polygon k_n c_n c_t wallstyle args keyword values ... :pre
+
+ID, group-ID are documented in "fix"_fix.html command :ulb,l
+wall/body/polygon = style name of this fix command :l
+k_n = normal repulsion strength (force/distance units or pressure units - see discussion below) :l
+c_n = normal damping coefficient (force/distance units or pressure units - see discussion below) :l
+c_t = tangential damping coefficient (force/distance units or pressure units - see discussion below) :l
+wallstyle = {xplane} or {yplane} or {zplane} or {zcylinder} :l
+args = list of arguments for a particular style :l
+  {xplane} or {yplane} args = lo hi
+    lo,hi = position of lower and upper plane (distance units), either can be NULL)
+  {zcylinder} args = radius
+    radius = cylinder radius (distance units) :pre
+zero or more keyword/value pairs may be appended to args :l
+keyword = {wiggle} :l
+  {wiggle} values = dim amplitude period
+    dim = {x} or {y} or {z}
+    amplitude = size of oscillation (distance units)
+    period = time of oscillation (time units) :pre
+:ule
+
+[Examples:]
+
+fix 1 all wall/body/polygon 1000.0 20.0 5.0 xplane -10.0 10.0
+
+[Description:]
+
+Bound the simulation domain of systems of body particles of style
+body/rounded/polygon with wall(s). All particles in the group interact
+with the wall when they are close enough to touch it.
+The nature of the interaction between the wall and the polygons is
+the same as that between the polygons themselves, which is similar to the Hookean potential.
+
+This fix is designed for use with the "body/rounded/polygon" body style,
+which is specified as an argument to the "atom-style body" command.
+The parameters {k_n}, {c_n}, {c_t} have the same meaning and units as those specified with the
+"pair_style body/rounded/polygon"_pair_body_rounded_polygon.html commands.
+
+The {wallstyle} can be planar or cylindrical.  The 3 planar options
+specify a pair of walls in a dimension.  Wall positions are given by
+{lo} and {hi}.  Either of the values can be specified as NULL if a
+single wall is desired.  For a {zcylinder} wallstyle, the cylinder's
+axis is at x = y = 0.0, and the radius of the cylinder is specified.
+
+Optionally, the wall can be moving, if the {wiggle} keyword is appended.
+
+For the {wiggle} keyword, the wall oscillates sinusoidally, similar to
+the oscillations of particles which can be specified by the
+"fix move"_fix_move.html command.  This is useful in packing
+simulations of particles.  The arguments to the {wiggle}
+keyword specify a dimension for the motion, as well as it's
+{amplitude} and {period}.  Note that if the dimension is in the plane
+of the wall, this is effectively a shearing motion.  If the dimension
+is perpendicular to the wall, it is more of a shaking motion.  A
+{zcylinder} wall can only be wiggled in the z dimension.
+
+Each timestep, the position of a wiggled wall in the appropriate {dim}
+is set according to this equation:
+
+position = coord + A - A cos (omega * delta) :pre
+
+where {coord} is the specified initial position of the wall, {A} is
+the {amplitude}, {omega} is 2 PI / {period}, and {delta} is the time
+elapsed since the fix was specified.  The velocity of the wall is set
+to the derivative of this expression.
+
+[Restart, fix_modify, output, run start/stop, minimize info:]
+
+None of the "fix_modify"_fix_modify.html options are relevant to this
+fix.  No global or per-atom quantities are stored by this fix for
+access by various "output commands"_Section_howto.html#howto_15.  No
+parameter of this fix can be used with the {start/stop} keywords of
+the "run"_run.html command.  This fix is not invoked during "energy
+minimization"_minimize.html.
+
+[Restrictions:]
+
+This fix is part of the BODY package.  It is only enabled if
+LAMMPS was built with that package.  See the "Making
+LAMMPS"_Section_start.html#start_3 section for more info.
+
+Any dimension (xyz) that has a wall must be non-periodic.
+
+[Related commands:]
+
+"pair_style body/rounded/polygon"_pair_body_rounded_polygon.html
+
+[Default:] none
diff --git a/doc/src/fix_wall_body_polyhedron.txt b/doc/src/fix_wall_body_polyhedron.txt
new file mode 100644
index 0000000000..a1eef4df07
--- /dev/null
+++ b/doc/src/fix_wall_body_polyhedron.txt
@@ -0,0 +1,100 @@
+"LAMMPS WWW Site"_lws - "LAMMPS Documentation"_ld - "LAMMPS Commands"_lc :c
+
+:link(lws,http://lammps.sandia.gov)
+:link(ld,Manual.html)
+:link(lc,Section_commands.html#comm)
+
+:line
+
+fix wall/body/polyhedron command :h3
+
+[Syntax:]
+
+fix ID group-ID wall/body/polyhedron k_n c_n c_t wallstyle args keyword values ... :pre
+
+ID, group-ID are documented in "fix"_fix.html command :ulb,l
+wall/body/polyhedron = style name of this fix command :l
+k_n = normal repulsion strength (force/distance units or pressure units - see discussion below) :l
+c_n = normal damping coefficient (force/distance units or pressure units - see discussion below) :l
+c_t = tangential damping coefficient (force/distance units or pressure units - see discussion below) :l
+wallstyle = {xplane} or {yplane} or {zplane} or {zcylinder} :l
+args = list of arguments for a particular style :l
+  {xplane} or {yplane} args = lo hi
+    lo,hi = position of lower and upper plane (distance units), either can be NULL)
+  {zcylinder} args = radius
+    radius = cylinder radius (distance units) :pre
+zero or more keyword/value pairs may be appended to args :l
+keyword = {wiggle} :l
+  {wiggle} values = dim amplitude period
+    dim = {x} or {y} or {z}
+    amplitude = size of oscillation (distance units)
+    period = time of oscillation (time units) :pre
+:ule
+
+[Examples:]
+
+fix 1 all wall/body/polyhedron 1000.0 20.0 5.0 xplane -10.0 10.0
+
+[Description:]
+
+Bound the simulation domain of systems of body particles of style
+body/rounded/polyhedron with wall(s). All particles in the group interact
+with the wall when they are close enough to touch it.
+The nature of the interaction between the wall and the polygons is
+the same as that between the polygons themselves, which is similar to the Hookean potential.
+
+This fix is designed for use with the "body/rounded/polyhedron" body style,
+which is specified as an argument to the "atom-style body" command.
+The parameters {k_n}, {c_n}, {c_t} have the same meaning and units as those specified with the
+"pair_style body/rounded/polyhedron"_pair_body_rounded_polygon.html commands.
+
+The {wallstyle} can be planar or cylindrical.  The 3 planar options
+specify a pair of walls in a dimension.  Wall positions are given by
+{lo} and {hi}.  Either of the values can be specified as NULL if a
+single wall is desired.  For a {zcylinder} wallstyle, the cylinder's
+axis is at x = y = 0.0, and the radius of the cylinder is specified.
+
+Optionally, the wall can be moving, if the {wiggle} keyword is appended.
+
+For the {wiggle} keyword, the wall oscillates sinusoidally, similar to
+the oscillations of particles which can be specified by the
+"fix move"_fix_move.html command.  This is useful in packing
+simulations of particles.  The arguments to the {wiggle}
+keyword specify a dimension for the motion, as well as it's
+{amplitude} and {period}.  Note that if the dimension is in the plane
+of the wall, this is effectively a shearing motion.  If the dimension
+is perpendicular to the wall, it is more of a shaking motion.  A
+{zcylinder} wall can only be wiggled in the z dimension.
+
+Each timestep, the position of a wiggled wall in the appropriate {dim}
+is set according to this equation:
+
+position = coord + A - A cos (omega * delta) :pre
+
+where {coord} is the specified initial position of the wall, {A} is
+the {amplitude}, {omega} is 2 PI / {period}, and {delta} is the time
+elapsed since the fix was specified.  The velocity of the wall is set
+to the derivative of this expression.
+
+[Restart, fix_modify, output, run start/stop, minimize info:]
+
+None of the "fix_modify"_fix_modify.html options are relevant to this
+fix.  No global or per-atom quantities are stored by this fix for
+access by various "output commands"_Section_howto.html#howto_15.  No
+parameter of this fix can be used with the {start/stop} keywords of
+the "run"_run.html command.  This fix is not invoked during "energy
+minimization"_minimize.html.
+
+[Restrictions:]
+
+This fix is part of the BODY package.  It is only enabled if
+LAMMPS was built with that package.  See the "Making
+LAMMPS"_Section_start.html#start_3 section for more info.
+
+Any dimension (xyz) that has a wall must be non-periodic.
+
+[Related commands:]
+
+"pair_style body/rounded/polyhedron"_pair_body_rounded_polygon.html
+
+[Default:] none
diff --git a/doc/src/pair_body_rounded_polygon.txt b/doc/src/pair_body_rounded_polygon.txt
index 5352f695b0..00896b4c7b 100644
--- a/doc/src/pair_body_rounded_polygon.txt
+++ b/doc/src/pair_body_rounded_polygon.txt
@@ -53,8 +53,8 @@ the examples above, or in the data file or restart files read by the
 "read_data"_read_data.html or "read_restart"_read_restart.html
 commands:
 
-k_n (energy/distance^2)
-k_na (energy/distance^2) :ul
+k_n (energy/distance^2 units)
+k_na (energy/distance^2 units) :ul
 
 [Related commands:]
 
diff --git a/doc/src/pair_body_rounded_polyhedron.txt b/doc/src/pair_body_rounded_polyhedron.txt
index cfab0e6d15..9a5c20ddb6 100644
--- a/doc/src/pair_body_rounded_polyhedron.txt
+++ b/doc/src/pair_body_rounded_polyhedron.txt
@@ -53,8 +53,8 @@ the examples above, or in the data file or restart files read by the
 "read_data"_read_data.html or "read_restart"_read_restart.html
 commands:
 
-k_n (energy/distance^2)
-k_na (energy/distance^2) :ul
+k_n (energy/distance^2 units)
+k_na (energy/distance^2 units) :ul
 
 [Related commands:]
 
diff --git a/src/BODY/fix_wall_body_polygon.h b/src/BODY/fix_wall_body_polygon.h
index 3521c6c797..b71dcb0683 100644
--- a/src/BODY/fix_wall_body_polygon.h
+++ b/src/BODY/fix_wall_body_polygon.h
@@ -45,7 +45,9 @@ class FixWallBodyPolygon : public Fix {
 
  protected:
   int wallstyle,pairstyle,wiggle,axis;
-  double kn,c_n,c_t;
+  double kn;          // normal repulsion strength
+  double c_n;         // normal damping coefficient
+  double c_t;         // tangential damping coefficient
   double lo,hi,cylradius;
   double amplitude,period,omega;
   double dt;
-- 
GitLab