diff --git a/doc/src/JPG/gran_funnel.png b/doc/src/JPG/gran_funnel.png
new file mode 100644
index 0000000000000000000000000000000000000000..8e26005f7838825773e7e352f4a844d31a578cc3
Binary files /dev/null and b/doc/src/JPG/gran_funnel.png differ
diff --git a/doc/src/JPG/gran_funnel_small.jpg b/doc/src/JPG/gran_funnel_small.jpg
new file mode 100644
index 0000000000000000000000000000000000000000..6e298033884409151f12b8439e8dd49539391294
Binary files /dev/null and b/doc/src/JPG/gran_funnel_small.jpg differ
diff --git a/doc/src/JPG/gran_mixer.png b/doc/src/JPG/gran_mixer.png
new file mode 100644
index 0000000000000000000000000000000000000000..6ea7221241b4b66c870fd065d97ed8e282c9f2c6
Binary files /dev/null and b/doc/src/JPG/gran_mixer.png differ
diff --git a/doc/src/JPG/gran_mixer_small.jpg b/doc/src/JPG/gran_mixer_small.jpg
new file mode 100644
index 0000000000000000000000000000000000000000..7cc85d92bf23d2e8efed340410271462f63a3f49
Binary files /dev/null and b/doc/src/JPG/gran_mixer_small.jpg differ
diff --git a/doc/src/Manual.txt b/doc/src/Manual.txt
index 10487375f95757e7e2ddf9f0530585438932efd6..21cc9bcccce19a6259ba432fa4f4e96be85785f4 100644
--- a/doc/src/Manual.txt
+++ b/doc/src/Manual.txt
@@ -1,7 +1,7 @@
 <!-- HTML_ONLY -->
 <HEAD>
 <TITLE>LAMMPS Users Manual</TITLE>
-<META NAME="docnumber" CONTENT="5 Oct 2016 version">
+<META NAME="docnumber" CONTENT="6 Oct 2016 version">
 <META NAME="author" CONTENT="http://lammps.sandia.gov - Sandia National Laboratories">
 <META NAME="copyright" CONTENT="Copyright (2003) Sandia Corporation.  This software and manual is distributed under the GNU General Public License.">
 </HEAD>
@@ -21,7 +21,7 @@
 <H1></H1>
 
 LAMMPS Documentation :c,h3
-5 Oct 2016 version :c,h4
+6 Oct 2016 version :c,h4
 
 Version info: :h4
 
diff --git a/doc/src/Section_commands.txt b/doc/src/Section_commands.txt
index 3a6de833fe90e99b3291cff83e52d64061320cc9..2eef5d1d29d0ff573c4bdf05171efad1cccdbe39 100644
--- a/doc/src/Section_commands.txt
+++ b/doc/src/Section_commands.txt
@@ -599,6 +599,7 @@ USER-INTEL, k = KOKKOS, o = USER-OMP, t = OPT.
 "viscous"_fix_viscous.html,
 "wall/colloid"_fix_wall.html,
 "wall/gran"_fix_wall_gran.html,
+"wall/gran/region"_fix_wall_gran_region.html,
 "wall/harmonic"_fix_wall.html,
 "wall/lj1043"_fix_wall.html,
 "wall/lj126"_fix_wall.html,
diff --git a/doc/src/fix_wall_gran.txt b/doc/src/fix_wall_gran.txt
index d19f243ad8dbf9aafc786d4583a08b251e5dee3e..f30872186dbefaaa1c37538684a412f88e31f29d 100644
--- a/doc/src/fix_wall_gran.txt
+++ b/doc/src/fix_wall_gran.txt
@@ -163,6 +163,8 @@ Any dimension (xyz) that has a granular wall must be non-periodic.
 
 [Related commands:]
 
-"fix move"_fix_move.html, "pair_style granular"_pair_gran.html
+"fix move"_fix_move.html, 
+"fix wall/gran/region"_fix_wall_gran_region.html, 
+"pair_style granular"_pair_gran.html
 
 [Default:] none
diff --git a/doc/src/fix_wall_gran_region.txt b/doc/src/fix_wall_gran_region.txt
new file mode 100644
index 0000000000000000000000000000000000000000..7a5597765eed4bd4ec67d41229df3a479956fe48
--- /dev/null
+++ b/doc/src/fix_wall_gran_region.txt
@@ -0,0 +1,199 @@
+"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/gran/region command :h3
+
+[Syntax:]
+
+fix ID group-ID wall/gran/region fstyle Kn Kt gamma_n gamma_t xmu dampflag wallstyle regionID :pre
+
+ID, group-ID are documented in "fix"_fix.html command :ulb,l
+wall/region = style name of this fix command :l
+fstyle = style of force interactions between particles and wall :l
+  possible choices: hooke, hooke/history, hertz/history :pre
+Kn = elastic constant for normal particle repulsion (force/distance units or pressure units - see discussion below) :l
+Kt = elastic constant for tangential contact (force/distance units or pressure units - see discussion below) :l
+gamma_n = damping coefficient for collisions in normal direction (1/time units or 1/time-distance units - see discussion below) :l
+gamma_t = damping coefficient for collisions in tangential direction (1/time units or 1/time-distance units - see discussion below) :l
+xmu = static yield criterion (unitless value between 0.0 and 1.0e4) :l
+dampflag = 0 or 1 if tangential damping force is excluded or included :l
+wallstyle = region (see "fix wall/gran"_fix_wall_gran.html for options for other kinds of walls) :l
+region-ID = region whose boundary will act as wall :l,ule
+
+[Examples:]
+
+fix wall all wall/gran/region hooke/history 1000.0 200.0 200.0 100.0 0.5 1 region myCone :pre
+
+[Description:]
+
+Treat the surface of the geometric region defined by the {region-ID}
+as a bounding frictional wall which interacts with nearby finite-size
+granular particles when they are close enough to touch the wall.  See
+the "fix wall/region"_fix_wall_region.html and "fix
+wall/gran"_fix_wall_gran.html commands for related kinds of walls for
+non-granular particles and simpler wall geometries, respectively.
+
+Here are snapshots of example models using this command.
+Corresponding input scripts can be found in examples/granregion.
+Click on the images to see a bigger picture.  Movies of these
+simulations are "here on the Movies
+page"_http://lammps.sandia.gov/movies.html#granregion.html of the
+LAMMPS web site.
+
+:image(JPG/gran_funnel_small.jpg,JPG/gran_funnel.png)
+:image(JPG/gran_mixer_small.jpg,JPG/gran_mixer.png)
+
+:line
+
+The distance between a particle and the region boundary is the
+distance to the nearest point on the region surface.  The force the
+wall exerts on the particle is along the direction between that point
+and the particle center, which is the direction normal to the surface
+at that point.  Note that if the region surface is comprised of
+multiple "faces", then each face can exert a force on the particle if
+it is close enough.  E.g. for "region_style block"_region.html, a
+particle in the interior, near a corner of the block, could feel wall
+forces from 1, 2, or 3 faces of the block.
+
+Regions are defined using the "region"_region.html command.  Note that
+the region volume can be interior or exterior to the bounding surface,
+which will determine in which direction the surface interacts with
+particles, i.e. the direction of the surface normal. The exception to
+this is if one or more {open} options are specified for the region
+command, in which case particles interact with both the interior and
+exterior surfaces of regions.
+
+Regions can either be primitive shapes (block, sphere, cylinder, etc)
+or combinations of primitive shapes specified via the {union} or
+{intersect} region styles.  These latter styles can be used to
+construct particle containers with complex shapes.  Regions can also
+move dynamically via the "region"_region.html command keywords (move)
+and {rotate}, or change their shape by use of variables as inputs to
+the "region"_region.html command.  If such a region is used with this
+fix, then the region surface will move in time in the corresponding
+manner.
+
+NOTE: As discussed on the "region"_region.html command doc page,
+regions in LAMMPS do not get wrapped across periodic boundaries.  It
+is up to you to ensure that the region location with respect to
+periodic or non-periodic boundaries is specified appropriately via the
+"region"_region.html and "boundary"_boundary.html commands when using
+a region as a wall that bounds particle motion.
+ 
+NOTE: For primitive regions with sharp corners and/or edges (e.g. a
+block or cylinder), wall/particle forces are computed accurately for
+both interior and exterior regions.  For {union} and {intersect}
+regions, additional sharp corners and edges may be present due to the
+intersection of the surfaces of 2 or more primitive volumes.  These
+corners and edges can be of two types: concave or convex.  Concave
+points/edges are like the corners of a cube as seen by particles in
+the interior of a cube.  Wall/particle forces around these features
+are computed correctly.  Convex points/edges are like the corners of a
+cube as seen by particles exterior to the cube, i.e. the points jut
+into the volume where particles are present.  LAMMPS does NOT compute
+the location of these convex points directly, and hence wall/particle
+forces in the cutoff volume around these points suffer from
+inaccuracies.  The basic problem is that the outward normal of the
+surface is not continuous at these points.  This can cause particles
+to feel no force (they don't "see" the wall) when in one location,
+then move a distance epsilon, and suddenly feel a large force because
+they now "see" the wall.  In a worst-case scenario, this can blow
+particles out of the simulation box.  Thus, as a general rule you
+should not use the fix wall/gran/region command with {union} or
+{interesect} regions that have convex points or edges resulting from
+the union/intersection (convex points/edges in the union/intersection
+due to a single sub-region are still OK).
+
+NOTE: Similarly, you should not define {union} or {intersert} regions
+for use with this command that share an overlapping common face that
+is part of the overall outer boundary (interior boundary is OK), even
+if the face is smooth.  E.g. two regions of style block in a {union}
+region, where the two blocks overlap on one or more of their faces.
+This is because LAMMPS discards points that are part of multiple
+sub-regions when calculating wall/particle interactions, to avoid
+double-counting the interaction.  Having two coincident faces could
+cause the face to become invisible to the particles.  The solution is
+to make the two faces differ by epsilon in their position.
+
+The nature of the wall/particle interactions are determined by the
+{fstyle} setting.  It can be any of the styles defined by the
+"pair_style granular"_pair_gran.html commands.  Currently this is
+{hooke}, {hooke/history}, or {hertz/history}.  The equation for the
+force between the wall and particles touching it is the same as the
+corresponding equation on the "pair_style granular"_pair_gran.html doc
+page, but the effective radius is calculated using the radius of the
+particle and the radius of curvature of the wall at the contact point.
+
+Specifically, delta = radius - r = overlap of particle with wall,
+m_eff = mass of particle, and RiRj/Ri+Rj is the effective radius, with
+Rj replaced by the radius of curvature of the wall at the contact
+point.  The radius of curvature can be negative for a concave wall
+section, e.g. the interior of cylinder.  For a flat wall, delta =
+radius - r = overlap of particle with wall, m_eff = mass of particle,
+and the effective radius of contact is just the radius of the
+particle.
+
+The parameters {Kn}, {Kt}, {gamma_n}, {gamma_t}, {xmu} and {dampflag}
+have the same meaning and units as those specified with the
+"pair_style granular"_pair_gran.html commands.  This means a NULL can
+be used for either {Kt} or {gamma_t} as described on that page.  If a
+NULL is used for {Kt}, then a default value is used where {Kt} = 2/7
+{Kn}.  If a NULL is used for {gamma_t}, then a default value is used
+where {gamma_t} = 1/2 {gamma_n}.
+
+Note that you can choose a different force styles and/or different
+values for the 6 wall/particle coefficients than for particle/particle
+interactions.  E.g. if you wish to model the wall as a different
+material.
+
+[Restart, fix_modify, output, run start/stop, minimize info:]
+
+Similiar to "fix wall/gran"_fix_wall_gran.html command, this fix
+writes the shear friction state of atoms interacting with the wall to
+"binary restart files"_restart.html, so that a simulation can continue
+correctly if granular potentials with shear "history" effects are
+being used.  This fix also includes info about a moving region in the
+restart file.  See the "read_restart"_read_restart.html command for
+info on how to re-specify a fix in an input script that reads a
+restart file, so that the operation of the fix continues in an
+uninterrupted fashion.
+
+Note that info about region definitions is NOT included in restart
+files.  So you must re-define your region and if it is a moving
+region, define its motion attributes in a way that is consistent with
+the simulation that wrote the restart file.  In particular, if you
+want to change its motion attributes (e.g. its velocity), then you
+should insure the postition/orientation of the region at the initial
+restart timestep is the same as it was on the timestep the restart
+file was written.  If this is not possible, then you may need to
+ignore info in the restart file by defining a new fix wall/gran/region
+command in your restart script (e.g. with a different fix ID).
+
+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 GRANULAR 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.
+
+[Related commands:]
+
+"fix_move"_fix_move.html,
+"fix wall/gran"_fix_wall_gran.html, 
+"fix wall/region"_fix_wall_region.html,
+"pair_style granular"_pair_gran.html,
+"region"_region.html
+
+[Default:] none
+
diff --git a/examples/README b/examples/README
index 462fa93e12f8bfa717687bbf28029c7689601097..a6925878e06ab8a19ce147d30e3bface21e45a87 100644
--- a/examples/README
+++ b/examples/README
@@ -74,6 +74,7 @@ eim:      NaCl using the EIM potential
 ellipse:  ellipsoidal particles in spherical solvent, 2d system
 flow:	  Couette and Poiseuille flow in a 2d channel
 friction: frictional contact of spherical asperities between 2d surfaces
+granregion: use of fix wall/region/gran as boundary on granular particles
 hugoniostat: Hugoniostat shock dynamics
 indent:	  spherical indenter into a 2d solid
 kim:      use of potentials in Knowledge Base for Interatomic Models (KIM)
diff --git a/examples/granregion/in.granregion.box b/examples/granregion/in.granregion.box
new file mode 100644
index 0000000000000000000000000000000000000000..91f06744d35ada733c855c1a29a09013542f056c
--- /dev/null
+++ b/examples/granregion/in.granregion.box
@@ -0,0 +1,66 @@
+# pouring spheres into container box
+
+units		lj
+atom_style      sphere
+boundary        f f f
+dimension	3
+comm_modify     vel yes
+
+region          box block -10 10 -10 10 -10 10 units box
+create_box      2 box
+
+pair_style	hybrid gran/hooke 4000.0 NULL 100.0 NULL 0.5 1
+pair_coeff	* * gran/hooke
+
+region          container block -6 6 -6 6 -6 6 units box
+fix		container all wall/gran/region hooke/history &
+		4000.0 NULL 100.0 NULL 0.5 1 region container
+
+neighbor	0.3 bin
+neigh_modify	delay 0 every 1 check yes
+
+fix             2 all nve/sphere
+fix		3 all gravity 1.0 vector 0 0 -1
+
+region          slab block -2 2 -2 2 -2 2 units box
+fix             ins all pour 100 2 4767548 vol 0.4 10 &
+	        diam one 1.0 region slab ignore
+
+timestep	0.005
+
+compute         1 all temp
+compute_modify  1 dynamic yes
+
+compute         2 all temp/sphere
+compute_modify  2 dynamic yes
+
+thermo		100
+thermo_style	custom step atoms temp c_1 c_2 press
+thermo_modify   lost ignore
+compute_modify  thermo_temp dynamic yes
+
+#dump		2 all image 100 image.*.jpg type type &
+#		zoom 1.4 adiam 1.0 box no 0.0 axes yes 0.9 0.03
+#dump_modify	2 pad 5
+
+run	        5000
+
+region          container delete
+variable        theta equal (step-5000)*(4.0*PI/5000)
+region          container block -6 6 -6 6 -6 6 units box &
+                rotate v_theta 0 0 0 0 0 1
+run	        5000
+
+region          container delete
+region          container block -6 6 -6 6 -6 6 units box
+run             5000
+
+region          container delete
+variable        theta equal (step-15000)*(4.0*PI/5000)
+region          container block -6 6 -6 6 -6 6 units box &
+                rotate v_theta 0 0 0 1 1 1
+run	        5000
+
+region          container delete
+region          container block -6 6 -6 6 -6 6 units box
+run             5000
diff --git a/examples/granregion/in.granregion.funnel b/examples/granregion/in.granregion.funnel
new file mode 100644
index 0000000000000000000000000000000000000000..63e79a7114e4b1c5d9e3910ce4a23a7dab9058cf
--- /dev/null
+++ b/examples/granregion/in.granregion.funnel
@@ -0,0 +1,157 @@
+# pour particles into cone-shaped funnel, settle them, let them run out bottom
+
+variable	name string funnel_pour
+
+thermo_modify	flush yes
+units 		si  
+variable	PI equal 3.141592653589
+variable	seed equal 14314
+
+###############################################
+# Geometry-related parameters
+###############################################
+
+variable	xlo equal 10
+variable	xhi equal 40
+variable	ylo equal 10
+variable	yhi equal 40
+variable	zlo equal -20
+variable	zhi equal 50
+
+variable	xc equal 25
+variable	yc equal 25
+
+variable	zconehi equal 50
+variable	zconelo equal 10
+variable	zcyllo equal 0
+variable	radconelo equal 2
+variable	radconehi equal 20
+
+################################################
+# Particle sizes
+################################################
+
+variable	rlo equal 0.25 
+variable	rhi equal 0.5
+variable	dlo equal 2.0*${rlo}
+variable	dhi equal 2.0*${rhi}
+
+variable 	skin equal ${rhi}
+
+###############################################
+# Granular contact parameters
+###############################################
+
+variable	coeffRes equal 0.1
+variable	coeffFric equal 0.5
+
+variable	density equal 1.0
+variable	EYoung equal 10^5
+variable 	Poisson equal 2.0/7.0
+variable	GShear equal ${EYoung}/(2*(1+${Poisson})) 
+
+variable	gravity equal 1.0
+
+variable	reff equal 0.5*(${rhi}+${rlo})
+variable	meff equal ${density}*4.0/3.0*${PI}*${reff}^3
+variable	min_mass equal ${density}*4.0/3.0*${PI}*${rlo}*${rlo}*${rlo}
+variable	max_mass equal ${density}*4.0/3.0*${PI}*${rhi}*${rhi}*${rhi}
+
+## Typical way to set kn, kt, etc.:
+variable        kn equal 4.0*${GShear}/(3*(1-${Poisson}))
+variable        kt equal 4.0*${GShear}/(2-${Poisson})
+
+variable	a equal (-2.0*log(${coeffRes})/${PI})^2
+variable        gamma_n equal sqrt($a*2*${kn}/${min_mass}/(1+0.25*$a))
+variable        gamma_t equal ${gamma_n}*0.5
+
+variable	tcol equal ${PI}/sqrt(2*${kn}/${min_mass}-${gamma_n}/4.0)
+
+variable	dt equal ${tcol}*0.05
+timestep	${dt}
+
+###############################################
+variable	dumpfreq equal 1000
+variable	logfreq equal 1000
+
+newton 		off
+atom_style	sphere
+
+boundary	p p f
+
+region		boxreg block ${xlo} ${xhi} ${ylo} ${yhi} ${zlo} ${zhi}
+create_box	1 boxreg
+
+pair_style	gran/hertz/history &
+		${kn} ${kt} ${gamma_n} ${gamma_t} ${coeffFric} 1
+pair_coeff	* *
+
+neighbor        ${skin} bin
+thermo 		${logfreq}
+
+comm_style	brick
+comm_modify 	mode multi group all vel yes
+balance		1.1 shift xyz 20 1.1
+fix		bal all balance 10000 1.1 shift xyz 20 1.01
+
+####################### Options specific to pouring #########################
+
+# insertion region for fix/pour
+
+region	     	insreg cylinder z ${xc} ${yc} 10 30 50 side in units box
+
+# define cone and cylinder regions - see lammps doc on region command
+# note new open options
+
+region	    	cylreg cylinder z ${xc} ${yc} ${radconelo} &
+		${zcyllo} ${zconelo} side in units box &
+		open 2 #Top is open
+		
+region		conereg cone z ${xc} ${yc} ${radconelo} ${radconehi} &
+		${zconelo} ${zconehi} side in units box & 
+		open 1 open 2 #Bottom and top are open
+
+region		hopreg union 2 conereg cylreg
+
+fix		grav all gravity ${gravity} vector 0 0 -1
+fix		1 all nve/sphere
+
+
+fix		hopper3 all wall/gran/region hertz/history &
+                ${kn} ${kt} ${gamma_n} ${gamma_t} ${coeffFric} 1 region hopreg
+
+fix		ins all pour 2000 1 42424 region insreg &
+		diam range ${dlo} ${dhi} dens ${density} ${density}
+
+#dump		1 all custom ${dumpfreq} ${name}.dump &
+#		id type mass diameter x y z
+
+#dump		2 all image 4000 image.*.jpg type type &
+#		axes yes 0.8 0.02 view 60 -30 zoom 3.0 &
+#                box no 0.0 axes no 0.0 0.0
+#dump_modify	2 pad 6
+
+thermo_style	custom step cpu atoms ke
+thermo_modify	flush yes lost warn
+
+# Initial run to fill up the cone
+
+run		20000 
+unfix 		ins
+run		150000
+
+# remove "plug" - need to redefine cylinder region & union
+
+region	  	cylreg delete
+region		hopreg delete
+region	    	cylreg cylinder z ${xc} ${yc} ${radconelo} &
+		${zcyllo} ${zconelo} side in units box &
+		open 1 open 2 #Bottom & top are open
+
+region		hopreg union 2 cylreg conereg
+
+unfix		hopper3
+fix		hopper3 all wall/gran/region hertz/history &
+		${kn} ${kt} ${gamma_n} ${gamma_t} ${coeffFric} 1 region hopreg
+
+run		100000
diff --git a/examples/granregion/in.granregion.mixer b/examples/granregion/in.granregion.mixer
new file mode 100644
index 0000000000000000000000000000000000000000..f9a9d04cbefa659f2cbb97d1db1d9b93d6be2d19
--- /dev/null
+++ b/examples/granregion/in.granregion.mixer
@@ -0,0 +1,96 @@
+variable	name string mixer
+
+thermo_modify	flush yes
+variable	seed equal 14314
+
+###############################################
+# Particle parameters
+################################################
+
+variable	rlo equal 0.3
+variable	rhi equal 0.6
+variable	dlo equal 2.0*${rlo}
+variable	dhi equal 2.0*${rhi}
+variable 	skin equal ${rhi}
+
+variable	coeffRes equal 0.1
+variable	coeffFric equal 0.5
+
+variable	kn equal 10^5
+variable	kt equal 0.2*${kn}
+
+variable	gravity equal 1.0
+variable	density equal 1.0
+
+variable	min_mass equal ${density}*4.0/3.0*PI*${rlo}*${rlo}*${rlo}
+variable	a equal (-2.0*log(${coeffRes})/PI)^2
+variable        gamma_n equal sqrt($a*2*${kn}/${min_mass}/(1+0.25*$a))
+variable        gamma_t equal ${gamma_n}*0.5
+
+variable	tcol equal PI/sqrt(2*${kn}/${min_mass}-${gamma_n}/4.0)
+
+variable	dt equal ${tcol}*0.02
+timestep	${dt}
+
+###############################################
+
+variable	dumpfreq equal 1000
+variable	logfreq equal 1000
+
+newton 		on
+atom_style	sphere
+
+boundary	p p f
+
+region		boxreg block 0 20 0 20 0 20
+create_box	1 boxreg
+
+pair_style	gran/hertz/history &
+		${kn} ${kt} ${gamma_n} ${gamma_t} ${coeffFric} 1
+pair_coeff	* *
+
+neighbor        ${skin} bin
+thermo 		${logfreq}
+
+comm_style	brick
+comm_modify 	mode multi group all vel yes
+balance		1.1 shift xyz 20 1.1
+fix		bal all balance 10000 1.1 shift xyz 20 1.01
+
+####################### Options specific to pouring #########################
+
+region	     	insreg cylinder z 10 10 8 10 18 side in units box
+region	    	cylreg cylinder z 10 10 10 0 20 side in units box
+
+variable	theta equal (step/400000)*2*PI
+		
+region          b1 block 2 18 9 11 0 4 side out &
+                rotate v_theta 10 10 0 0 0 1 units box
+region          b2 block 9 11 2 18 0 3.99999 side out &
+                rotate v_theta 10 10 0 0 0 1 units box
+
+region		mixer intersect 3 cylreg b1 b2 side in		
+
+fix		grav all gravity ${gravity} vector 0 0 -1
+fix		1 all nve/sphere
+
+fix		mixwall all wall/gran/region hertz/history &
+                ${kn} ${kt} ${gamma_n} ${gamma_t} ${coeffFric} 1 region mixer
+
+fix		ins all pour 1000 1 42424 region insreg &
+		diam range ${dlo} ${dhi} dens ${density} ${density}
+
+#dump		1 all custom ${dumpfreq} ${name}_pour.dump &
+#		id type mass diameter x y z
+
+#dump		2 all image 4000 image.*.jpg type type &
+#		axes yes 0.8 0.02 view 60 -30 zoom 1.5 &
+#                box no 0.0 axes no 0.0 0.0
+#dump_modify	2 pad 6
+
+thermo_style	custom step cpu atoms ke v_theta
+thermo_modify	flush yes lost warn
+
+run		200000 
+unfix 		ins
+run		200000
diff --git a/examples/granregion/log.6Oct16.granregion.box.g++.1 b/examples/granregion/log.6Oct16.granregion.box.g++.1
new file mode 100644
index 0000000000000000000000000000000000000000..ae2ec694e9573d18573d2424acd48caa74657074
--- /dev/null
+++ b/examples/granregion/log.6Oct16.granregion.box.g++.1
@@ -0,0 +1,468 @@
+LAMMPS (5 Oct 2016)
+# pouring spheres into container box
+
+units		lj
+atom_style      sphere
+boundary        f f f
+dimension	3
+comm_modify     vel yes
+
+region          box block -10 10 -10 10 -10 10 units box
+create_box      2 box
+Created orthogonal box = (-10 -10 -10) to (10 10 10)
+  1 by 1 by 1 MPI processor grid
+
+pair_style	hybrid gran/hooke 4000.0 NULL 100.0 NULL 0.5 1
+pair_coeff	* * gran/hooke
+
+region          container block -6 6 -6 6 -6 6 units box
+fix		container all wall/gran/region hooke/history 		4000.0 NULL 100.0 NULL 0.5 1 region container
+
+neighbor	0.3 bin
+neigh_modify	delay 0 every 1 check yes
+
+fix             2 all nve/sphere
+fix		3 all gravity 1.0 vector 0 0 -1
+
+region          slab block -2 2 -2 2 -2 2 units box
+fix             ins all pour 100 2 4767548 vol 0.4 10 	        diam one 1.0 region slab ignore
+Particle insertion: 48 every 566 steps, 100 by step 1133
+
+timestep	0.005
+
+compute         1 all temp
+compute_modify  1 dynamic yes
+
+compute         2 all temp/sphere
+compute_modify  2 dynamic yes
+
+thermo		100
+thermo_style	custom step atoms temp c_1 c_2 press
+thermo_modify   lost ignore
+compute_modify  thermo_temp dynamic yes
+
+#dump		2 all image 100 image.*.jpg type type #		zoom 1.4 adiam 1.0 box no 0.0 axes yes 0.9 0.03
+#dump_modify	2 pad 5
+
+run	        5000
+Neighbor list info ...
+  1 neighbor list requests
+  update every 1 steps, delay 0 steps, check yes
+  max neighbors/atom: 2000, page size: 100000
+  master list distance cutoff = 1.3
+  ghost atom cutoff = 1.3
+  binsize = 0.65 -> bins = 31 31 31
+Memory usage per processor = 0.201172 Mbytes
+Step Atoms Temp c_1 c_2 Press 
+       0        0            0            0            0            0 
+     100       21   0.54270729   0.54270729   0.26473526 0.0013567682 
+     200       21   0.87606961   0.87606961   0.42735103  0.002190174 
+     300       21    1.1428374    1.1428374   0.55748167 0.0028570936 
+     400       21    1.3543103    1.3543103   0.66829516 0.0033857758 
+     500       21    1.0677786    1.0677786   0.53582407 0.0045048164 
+     600       56    0.6744286    0.6744286    0.3502938 0.0047464584 
+     700       56   0.75569283   0.75569283   0.39779462 0.0051953882 
+     800       56   0.61597505   0.61597505   0.32943642 0.0086022783 
+     900       56   0.65260802   0.65260802   0.34474044 0.0059298996 
+    1000       56   0.51624952   0.51624952   0.28326898 0.0067827337 
+    1100       56   0.46050076   0.46050076   0.25656319 0.0061891094 
+    1200       81   0.39112377   0.39112377   0.21690744 0.0086559347 
+    1300       81   0.33302801   0.33302801   0.19110222 0.0033381288 
+    1400       81   0.39333146   0.39333146   0.21220965 0.0041348597 
+    1500       81   0.35493951   0.35493951   0.19924958   0.00373736 
+    1600       81   0.34154491   0.34154491   0.19031147  0.005349672 
+    1700      100   0.25598828   0.25598828   0.14171498 0.0092236643 
+    1800      100    0.2114074    0.2114074   0.12162965 0.0027213483 
+    1900      100   0.21810423   0.21810423   0.12176698 0.0036436034 
+    2000      100    0.2553198    0.2553198   0.13900087 0.0032844504 
+    2100      100   0.24809937   0.24809937   0.13753654 0.0088764373 
+    2200      100   0.22455642   0.22455642   0.12500977 0.0043517009 
+    2300      100   0.19586874   0.19586874   0.11064996 0.0055178814 
+    2400      100  0.059619074  0.059619074  0.045535036 0.00079051539 
+    2500      100  0.052222462  0.052222462  0.038563852 0.00098981299 
+    2600      100  0.036930777  0.036930777  0.027579114 0.0012285499 
+    2700      100  0.027937818  0.027937818  0.020587353 0.00063085447 
+    2800      100   0.02103783   0.02103783  0.015469157 0.00050316582 
+    2900      100  0.010408128  0.010408128 0.0084894275 0.00035440391 
+    3000      100 0.0077664382 0.0077664382 0.0068149074 0.0011153614 
+    3100      100 0.0088789208 0.0088789208 0.0070143391 0.00032679783 
+    3200      100 0.0077683432 0.0077683432 0.0059711038 0.00044762363 
+    3300      100      0.00411      0.00411   0.00372409 0.00015328221 
+    3400      100 0.0039192171 0.0039192171 0.0032409072 9.3603399e-05 
+    3500      100 0.0023532199 0.0023532199 0.0020924799 0.00049044152 
+    3600      100 0.0022544513 0.0022544513 0.0019545724 8.1086108e-05 
+    3700      100 0.0012696379 0.0012696379 0.0013134108 5.0058058e-05 
+    3800      100 0.0012035225 0.0012035225 0.0012490584 6.0331967e-05 
+    3900      100 0.00080361803 0.00080361803 0.00094424552 6.7229227e-05 
+    4000      100 0.00060715659 0.00060715659 0.00076521759 6.7029916e-05 
+    4100      100 0.00058510487 0.00058510487 0.00073844578 5.5867098e-05 
+    4200      100 0.00046832309 0.00046832309 0.00060848748 5.3853715e-05 
+    4300      100 0.00045207186 0.00045207186 0.00057825336 4.8367831e-05 
+    4400      100 0.00041874845 0.00041874845 0.00053103589 8.666037e-05 
+    4500      100 0.00041136295 0.00041136295 0.00052246056 6.0456585e-05 
+    4600      100 0.00041021147 0.00041021147 0.0005190668 4.8701604e-05 
+    4700      100 0.00037176253 0.00037176253 0.00049156279 5.8874891e-05 
+    4800      100 0.0003262417 0.0003262417 0.00045551846 5.0610728e-05 
+    4900      100 0.00028093583 0.00028093583 0.00042099654 4.6558605e-05 
+    5000      100 0.00027730599 0.00027730599 0.00041664922 4.7053044e-05 
+Loop time of 0.081454 on 1 procs for 5000 steps with 100 atoms
+
+Performance: 26518022.146 tau/day, 61384.311 timesteps/s
+99.4% CPU use with 1 MPI tasks x no OpenMP threads
+
+MPI task timing breakdown:
+Section |  min time  |  avg time  |  max time  |%varavg| %total
+---------------------------------------------------------------
+Pair    | 0.0085223  | 0.0085223  | 0.0085223  |   0.0 | 10.46
+Neigh   | 0.01466    | 0.01466    | 0.01466    |   0.0 | 18.00
+Comm    | 0.00076532 | 0.00076532 | 0.00076532 |   0.0 |  0.94
+Output  | 0.00052285 | 0.00052285 | 0.00052285 |   0.0 |  0.64
+Modify  | 0.05317    | 0.05317    | 0.05317    |   0.0 | 65.28
+Other   |            | 0.003814   |            |       |  4.68
+
+Nlocal:    100 ave 100 max 100 min
+Histogram: 1 0 0 0 0 0 0 0 0 0
+Nghost:    0 ave 0 max 0 min
+Histogram: 1 0 0 0 0 0 0 0 0 0
+Neighs:    158 ave 158 max 158 min
+Histogram: 1 0 0 0 0 0 0 0 0 0
+
+Total # of neighbors = 158
+Ave neighs/atom = 1.58
+Neighbor list builds = 306
+Dangerous builds = 0
+
+region          container delete
+variable        theta equal (step-5000)*(4.0*PI/5000)
+region          container block -6 6 -6 6 -6 6 units box                 rotate v_theta 0 0 0 0 0 1
+run	        5000
+Memory usage per processor = 5.26337 Mbytes
+Step Atoms Temp c_1 c_2 Press 
+    5000      100 0.00027730599 0.00027730599 0.00041664922 4.705763e-05 
+    5100      100   0.60717077   0.60717077   0.33118944  0.010686501 
+    5200      100   0.64991179   0.64991179   0.35498767  0.011370453 
+    5300      100   0.72038713   0.72038713   0.38745069  0.010507667 
+    5400      100   0.81357499   0.81357499   0.42946808  0.012920419 
+    5500      100   0.90488411   0.90488411   0.46803321  0.015077428 
+    5600      100   0.99065617   0.99065617   0.50811954  0.015556572 
+    5700      100    1.0701203    1.0701203   0.54641187  0.016464366 
+    5800      100    1.1351242    1.1351242   0.57607707  0.017832476 
+    5900      100    1.1883602    1.1883602   0.60022389  0.019571838 
+    6000      100    1.2153421    1.2153421   0.61245652  0.020549414 
+    6100      100    1.2369293    1.2369293   0.62229634   0.01827529 
+    6200      100    1.2556883    1.2556883   0.63207905  0.020286322 
+    6300      100    1.2618555    1.2618555   0.63610311  0.019844583 
+    6400      100    1.2671678    1.2671678   0.63873131  0.019817249 
+    6500      100    1.2875312    1.2875312   0.64728693  0.020097362 
+    6600      100    1.3014055    1.3014055   0.65413071  0.020000886 
+    6700      100    1.2904021    1.2904021    0.6485358  0.020009625 
+    6800      100    1.2962767    1.2962767   0.65088367  0.021340143 
+    6900      100    1.3056081    1.3056081   0.65490644  0.020455771 
+    7000      100    1.3116731    1.3116731   0.65766216  0.020475061 
+    7100      100     1.319457     1.319457   0.66105016  0.020937651 
+    7200      100    1.3213585    1.3213585   0.66207982   0.02120792 
+    7300      100    1.3232411    1.3232411   0.66392391  0.021040683 
+    7400      100    1.3300163    1.3300163   0.66599805  0.021202273 
+    7500      100    1.3350122    1.3350122   0.66894534  0.021161833 
+    7600      100    1.3344633    1.3344633    0.6688403  0.020871936 
+    7700      100    1.3492825    1.3492825    0.6751371  0.021415859 
+    7800      100    1.3539647    1.3539647   0.67757279  0.021306442 
+    7900      100    1.3527157    1.3527157   0.67722774  0.021793531 
+    8000      100    1.3526931    1.3526931   0.67713399  0.022973395 
+    8100      100    1.3568279    1.3568279   0.67936578  0.021422428 
+    8200      100    1.3599258    1.3599258   0.68113142  0.021397012 
+    8300      100    1.3601893    1.3601893   0.68165656  0.021643375 
+    8400      100    1.3752164    1.3752164   0.68788213  0.022208765 
+    8500      100    1.3821458    1.3821458   0.69165274  0.022015877 
+    8600      100    1.3784691    1.3784691   0.68964478  0.022144188 
+    8700      100    1.3801422    1.3801422    0.6904093    0.0220402 
+    8800      100    1.3900051    1.3900051    0.6947875   0.02216362 
+    8900      100    1.3897902    1.3897902   0.69427134  0.023078569 
+    9000      100    1.3909918    1.3909918   0.69456955  0.022043699 
+    9100      100    1.3925028    1.3925028   0.69519141  0.022180156 
+    9200      100    1.3923277    1.3923277   0.69512657  0.022113729 
+    9300      100    1.3945193    1.3945193   0.69625374  0.022344694 
+    9400      100    1.3960782    1.3960782   0.69705144  0.022181158 
+    9500      100    1.3932407    1.3932407   0.69560365  0.022129998 
+    9600      100    1.3925489    1.3925489   0.69532399  0.022124653 
+    9700      100    1.3935299    1.3935299   0.69581607  0.022258368 
+    9800      100    1.3933949    1.3933949   0.69579137  0.022209028 
+    9900      100    1.3934712    1.3934712   0.69587898  0.022214942 
+   10000      100    1.3935828    1.3935828   0.69598655  0.022231414 
+Loop time of 0.261407 on 1 procs for 5000 steps with 100 atoms
+
+Performance: 8262972.563 tau/day, 19127.251 timesteps/s
+99.8% CPU use with 1 MPI tasks x no OpenMP threads
+
+MPI task timing breakdown:
+Section |  min time  |  avg time  |  max time  |%varavg| %total
+---------------------------------------------------------------
+Pair    | 0.042233   | 0.042233   | 0.042233   |   0.0 | 16.16
+Neigh   | 0.035131   | 0.035131   | 0.035131   |   0.0 | 13.44
+Comm    | 0.0010462  | 0.0010462  | 0.0010462  |   0.0 |  0.40
+Output  | 0.00051785 | 0.00051785 | 0.00051785 |   0.0 |  0.20
+Modify  | 0.17687    | 0.17687    | 0.17687    |   0.0 | 67.66
+Other   |            | 0.00561    |            |       |  2.15
+
+Nlocal:    100 ave 100 max 100 min
+Histogram: 1 0 0 0 0 0 0 0 0 0
+Nghost:    0 ave 0 max 0 min
+Histogram: 1 0 0 0 0 0 0 0 0 0
+Neighs:    187 ave 187 max 187 min
+Histogram: 1 0 0 0 0 0 0 0 0 0
+
+Total # of neighbors = 187
+Ave neighs/atom = 1.87
+Neighbor list builds = 634
+Dangerous builds = 0
+
+region          container delete
+region          container block -6 6 -6 6 -6 6 units box
+run             5000
+Memory usage per processor = 5.26337 Mbytes
+Step Atoms Temp c_1 c_2 Press 
+   10000      100    1.3935828    1.3935828   0.69598655   0.02230659 
+   10100      100    0.3402861    0.3402861   0.19584226  0.014767914 
+   10200      100   0.19064555   0.19064555   0.12536788 0.0025413789 
+   10300      100   0.13281358   0.13281358   0.10275768  0.002843208 
+   10400      100   0.10124671   0.10124671  0.077914135 0.0017745353 
+   10500      100  0.082636734  0.082636734  0.063857622  0.001419336 
+   10600      100  0.066744462  0.066744462  0.051927437 0.0010830674 
+   10700      100  0.060778462  0.060778462  0.047461784 0.0011418844 
+   10800      100  0.043437178  0.043437178  0.032805669 0.0017050393 
+   10900      100  0.036483219  0.036483219  0.027387805 0.00086936813 
+   11000      100  0.027639076  0.027639076  0.021221241 0.00054920607 
+   11100      100  0.023614696  0.023614696  0.018445634 0.00058724552 
+   11200      100  0.020103248  0.020103248  0.015933089 0.00072830275 
+   11300      100  0.018645345  0.018645345  0.014559759 0.0002319388 
+   11400      100  0.015499672  0.015499672   0.01248828 0.00036020862 
+   11500      100  0.013421296  0.013421296  0.010743248 0.00043093929 
+   11600      100  0.011214892  0.011214892 0.0089653924 0.00059789544 
+   11700      100 0.0086660806 0.0086660806 0.0070563902 0.00029684573 
+   11800      100 0.0064777244 0.0064777244 0.0052946156 0.00046466386 
+   11900      100 0.0059360881 0.0059360881 0.0048568813 8.361561e-05 
+   12000      100 0.0045341025 0.0045341025  0.003883229 0.00016408047 
+   12100      100 0.0042504415 0.0042504415 0.0036944958 6.5005147e-05 
+   12200      100 0.0041367637 0.0041367637 0.0035928232 7.3025698e-05 
+   12300      100 0.0037700129 0.0037700129  0.003283398 6.381318e-05 
+   12400      100 0.0033494476 0.0033494476 0.0029274495 4.7731105e-05 
+   12500      100 0.0030903175 0.0030903175 0.0027068073 6.797313e-05 
+   12600      100 0.0026406999 0.0026406999 0.0023315387 0.0002371331 
+   12700      100 0.0025020713 0.0025020713 0.0022367855 4.2787276e-05 
+   12800      100 0.0022977381 0.0022977381 0.0020778307 3.9744567e-05 
+   12900      100  0.002039634  0.002039634 0.0018862012 0.00011669223 
+   13000      100 0.0018044702 0.0018044702   0.00171399 0.00013835538 
+   13100      100 0.0016600965 0.0016600965 0.0015553191 3.2320019e-05 
+   13200      100 0.0015596204 0.0015596204  0.001486374 1.9246911e-05 
+   13300      100  0.001316505  0.001316505 0.0012105249 9.1469679e-05 
+   13400      100 0.0012517536 0.0012517536 0.0011525753 4.815292e-05 
+   13500      100 0.0010827608 0.0010827608  0.001038339 2.0913017e-05 
+   13600      100 0.0009863908 0.0009863908 0.00095924929 9.7716736e-05 
+   13700      100 0.00094543599 0.00094543599 0.00092425645 1.378887e-05 
+   13800      100 0.00087893271 0.00087893271 0.00086801608 1.8981177e-05 
+   13900      100 0.00080241572 0.00080241572 0.0007930026 5.0987122e-05 
+   14000      100 0.00070705631 0.00070705631 0.00069238137 1.2900066e-05 
+   14100      100 0.0006525032 0.0006525032  0.000637991 0.00010838464 
+   14200      100 0.00059338444 0.00059338444 0.00057560454 7.3431324e-06 
+   14300      100 0.00058641228 0.00058641228 0.00056944735 7.256852e-06 
+   14400      100 0.00056221112 0.00056221112 0.00054625666 8.1343426e-06 
+   14500      100 0.00055493127 0.00055493127 0.00053957583 1.1713058e-05 
+   14600      100 0.00052854921 0.00052854921 0.00051816618 8.6527225e-06 
+   14700      100 0.00052630581 0.00052630581 0.00051584277 6.4890475e-06 
+   14800      100 0.00052563819 0.00052563819 0.00051493123 1.2687153e-05 
+   14900      100 0.00052131364 0.00052131364 0.00050917244 7.4589995e-08 
+   15000      100 0.00051902191 0.00051902191 0.00050725364 6.4228962e-06 
+Loop time of 0.0895741 on 1 procs for 5000 steps with 100 atoms
+
+Performance: 24114113.723 tau/day, 55819.708 timesteps/s
+99.3% CPU use with 1 MPI tasks x no OpenMP threads
+
+MPI task timing breakdown:
+Section |  min time  |  avg time  |  max time  |%varavg| %total
+---------------------------------------------------------------
+Pair    | 0.0098987  | 0.0098987  | 0.0098987  |   0.0 | 11.05
+Neigh   | 0.0061045  | 0.0061045  | 0.0061045  |   0.0 |  6.81
+Comm    | 0.00069976 | 0.00069976 | 0.00069976 |   0.0 |  0.78
+Output  | 0.00049758 | 0.00049758 | 0.00049758 |   0.0 |  0.56
+Modify  | 0.068435   | 0.068435   | 0.068435   |   0.0 | 76.40
+Other   |            | 0.003939   |            |       |  4.40
+
+Nlocal:    100 ave 100 max 100 min
+Histogram: 1 0 0 0 0 0 0 0 0 0
+Nghost:    0 ave 0 max 0 min
+Histogram: 1 0 0 0 0 0 0 0 0 0
+Neighs:    160 ave 160 max 160 min
+Histogram: 1 0 0 0 0 0 0 0 0 0
+
+Total # of neighbors = 160
+Ave neighs/atom = 1.6
+Neighbor list builds = 111
+Dangerous builds = 0
+
+region          container delete
+variable        theta equal (step-15000)*(4.0*PI/5000)
+region          container block -6 6 -6 6 -6 6 units box                 rotate v_theta 0 0 0 1 1 1
+run	        5000
+Memory usage per processor = 5.26337 Mbytes
+Step Atoms Temp c_1 c_2 Press 
+   15000      100 0.00051902191 0.00051902191 0.00050725364 6.4228962e-06 
+   15100      100    1.1235353    1.1235353   0.72003773  0.013686681 
+   15200      100    1.0778556    1.0778556   0.69137925  0.013478363 
+   15300      100     1.069015     1.069015   0.69798184  0.014165255 
+   15400      100    1.2249943    1.2249943   0.79096059  0.020933395 
+   15500      100    1.5225664    1.5225664   0.94822282  0.023932611 
+   15600      100    1.5867194    1.5867194   0.98143504  0.024565132 
+   15700      100    1.6595267    1.6595267    1.0203985  0.025152432 
+   15800      100    1.8188027    1.8188027    1.0857586  0.031597641 
+   15900      100    1.9234102    1.9234102    1.1099361  0.032381895 
+   16000      100     2.039435     2.039435    1.1656948  0.032501981 
+   16100      100      2.17315      2.17315    1.2265552  0.032675825 
+   16200      100    2.2017279    2.2017279      1.23995  0.028634878 
+   16300      100    2.3510902    2.3510902    1.3055642   0.03248003 
+   16400      100     2.373932     2.373932    1.3059254  0.031292969 
+   16500      100    2.5010862    2.5010862    1.3607219  0.032322054 
+   16600      100    2.4815092    2.4815092    1.3524159  0.031223889 
+   16700      100    2.6549226    2.6549226    1.4383508  0.033713507 
+   16800      100    2.8087564    2.8087564    1.5261538  0.036598837 
+   16900      100    2.8653588    2.8653588    1.5649123  0.035890231 
+   17000      100     2.903748     2.903748    1.5907716  0.038038745 
+   17100      100    2.9679376    2.9679376    1.6195577  0.051771432 
+   17200      100    2.9632377    2.9632377    1.6233074  0.039825751 
+   17300      100    3.0436883    3.0436883    1.6591248  0.042862982 
+   17400      100    3.0969015    3.0969015    1.6811582  0.042104811 
+   17500      100    3.0827135    3.0827135     1.691414  0.045839327 
+   17600      100    3.0854805    3.0854805     1.689399  0.041770144 
+   17700      100      3.07523      3.07523    1.6685518  0.045104715 
+   17800      100    2.9610899    2.9610899    1.6349099  0.039060791 
+   17900      100    2.8002989    2.8002989    1.5665223  0.037917927 
+   18000      100    2.9139644    2.9139644    1.6206891  0.050841302 
+   18100      100    3.0134757    3.0134757    1.6673916  0.040967255 
+   18200      100    3.0731184    3.0731184    1.6777507  0.043503474 
+   18300      100    3.0915242    3.0915242    1.6843452  0.040157898 
+   18400      100     3.098896     3.098896    1.6904524  0.039629218 
+   18500      100    3.1651814    3.1651814    1.7290259  0.042604953 
+   18600      100     3.353247     3.353247    1.8236992  0.045132486 
+   18700      100     3.540156     3.540156    1.9078363  0.046602063 
+   18800      100    3.6395129    3.6395129    1.9578976  0.045659959 
+   18900      100    3.7638134    3.7638134    2.0179445  0.051061068 
+   19000      100    3.7603453    3.7603453     2.003355  0.057123184 
+   19100      100    3.9218495    3.9218495    2.0968869  0.057671742 
+   19200      100    3.9924222    3.9924222    2.1321955  0.051824898 
+   19300      100    3.9690887    3.9690887    2.1270643  0.054832867 
+   19400      100    3.9408481    3.9408481    2.1146593  0.057020024 
+   19500      100    3.8313782    3.8313782    2.0610797  0.055164704 
+   19600      100    3.8317496    3.8317496    2.0668123  0.049840804 
+   19700      100    3.6068628    3.6068628     1.964227   0.05142407 
+   19800      100    3.5477437    3.5477437    1.9314948  0.051076014 
+   19900      100    3.6526881    3.6526881    1.9855353  0.047130029 
+   20000      100    3.7243709    3.7243709    2.0380212  0.048446835 
+Loop time of 0.206397 on 1 procs for 5000 steps with 100 atoms
+
+Performance: 10465265.522 tau/day, 24225.152 timesteps/s
+100.3% CPU use with 1 MPI tasks x no OpenMP threads
+
+MPI task timing breakdown:
+Section |  min time  |  avg time  |  max time  |%varavg| %total
+---------------------------------------------------------------
+Pair    | 0.014297   | 0.014297   | 0.014297   |   0.0 |  6.93
+Neigh   | 0.050213   | 0.050213   | 0.050213   |   0.0 | 24.33
+Comm    | 0.0011115  | 0.0011115  | 0.0011115  |   0.0 |  0.54
+Output  | 0.00051141 | 0.00051141 | 0.00051141 |   0.0 |  0.25
+Modify  | 0.13415    | 0.13415    | 0.13415    |   0.0 | 65.00
+Other   |            | 0.006114   |            |       |  2.96
+
+Nlocal:    100 ave 100 max 100 min
+Histogram: 1 0 0 0 0 0 0 0 0 0
+Nghost:    0 ave 0 max 0 min
+Histogram: 1 0 0 0 0 0 0 0 0 0
+Neighs:    142 ave 142 max 142 min
+Histogram: 1 0 0 0 0 0 0 0 0 0
+
+Total # of neighbors = 142
+Ave neighs/atom = 1.42
+Neighbor list builds = 899
+Dangerous builds = 0
+
+region          container delete
+region          container block -6 6 -6 6 -6 6 units box
+run             5000
+Memory usage per processor = 5.26337 Mbytes
+Step Atoms Temp c_1 c_2 Press 
+   20000      100    3.7243709    3.7243709    2.0380212  0.048156434 
+   20100      100    1.1186527    1.1186527   0.69104385  0.014964891 
+   20200      100   0.91445605   0.91445605   0.57005236  0.011324474 
+   20300      100    0.8936601    0.8936601   0.55534411  0.011071843 
+   20400      100   0.90773143   0.90773143   0.55999953  0.011254101 
+   20500      100   0.91995508   0.91995508   0.55837916  0.011548541 
+   20600      100   0.91682167   0.91682167   0.54095261  0.012563797 
+   20700      100   0.97806337   0.97806337   0.56016442  0.012396925 
+   20800      100   0.97778738   0.97778738   0.55606194  0.015441479 
+   20900      100   0.77253213   0.77253213   0.44636799  0.011428992 
+   21000      100   0.63053468   0.63053468   0.35995394   0.01005502 
+   21100      100   0.25437539   0.25437539   0.16544433  0.004628738 
+   21200      100   0.11828032   0.11828032  0.087911985 0.0037076362 
+   21300      100   0.11219312   0.11219312  0.080957112 0.0015847347 
+   21400      100   0.10765357   0.10765357  0.074676159 0.0022823419 
+   21500      100  0.060787093  0.060787093  0.046135213 0.00091422949 
+   21600      100  0.040447932  0.040447932  0.033050575 0.0013404194 
+   21700      100  0.035227782  0.035227782   0.02916621   0.00138779 
+   21800      100   0.03309101   0.03309101  0.026613861 0.00058184323 
+   21900      100  0.031461843  0.031461843  0.024751985 0.0013090333 
+   22000      100  0.021624144  0.021624144  0.017872639 0.0010893822 
+   22100      100  0.016728267  0.016728267   0.01403934 0.00049128736 
+   22200      100  0.016256915  0.016256915  0.013763903 0.00047288638 
+   22300      100   0.01349256   0.01349256  0.011498343 0.0013508309 
+   22400      100  0.010027007  0.010027007 0.0087924966 0.00030117996 
+   22500      100    0.0107355    0.0107355 0.0088715062  0.001043188 
+   22600      100 0.0095852245 0.0095852245  0.007965421 0.00028464236 
+   22700      100 0.0072956464 0.0072956464 0.0062403843 0.00061636772 
+   22800      100 0.0060874415 0.0060874415 0.0054788049 0.00021135824 
+   22900      100 0.0059688159 0.0059688159 0.0049530273 0.00022094116 
+   23000      100 0.0050218996 0.0050218996 0.0043518404 0.00022527705 
+   23100      100  0.005022208  0.005022208 0.0043118432 0.00052482006 
+   23200      100 0.0047096056 0.0047096056 0.0039698638 0.00026423471 
+   23300      100 0.0039510068 0.0039510068 0.0034773285 0.0001891104 
+   23400      100 0.0037308781 0.0037308781 0.0031763304 0.00027163016 
+   23500      100 0.0036278619 0.0036278619 0.0030371899 0.00017961072 
+   23600      100 0.0033598677 0.0033598677 0.0027586323 0.00015034494 
+   23700      100 0.0028530843 0.0028530843 0.0024809444 0.00012294415 
+   23800      100 0.0025388819 0.0025388819 0.0022812799 0.00018946676 
+   23900      100 0.0021129272 0.0021129272 0.0019905358 0.00015816903 
+   24000      100 0.0021010978 0.0021010978 0.0019864539 0.00017086049 
+   24100      100 0.0022189886 0.0022189886 0.0020466911 0.00030932562 
+   24200      100 0.0019226314 0.0019226314 0.0017933042 9.3246067e-05 
+   24300      100 0.0016875781 0.0016875781 0.0015999656 9.9935458e-05 
+   24400      100 0.0015929611 0.0015929611  0.001531011 9.7429139e-05 
+   24500      100 0.0015143044 0.0015143044 0.0014044175 9.807117e-05 
+   24600      100 0.0018595492 0.0018595492 0.0014740944 7.4734729e-05 
+   24700      100 0.0011646988 0.0011646988 0.0010881356 6.1197025e-05 
+   24800      100 0.0014641612 0.0014641612 0.0012316664  8.81462e-05 
+   24900      100  0.001024996  0.001024996 0.00094311114 5.8776472e-05 
+   25000      100 0.00097890442 0.00097890442 0.00090302317 3.3980657e-05 
+Loop time of 0.0954661 on 1 procs for 5000 steps with 100 atoms
+
+Performance: 22625823.872 tau/day, 52374.592 timesteps/s
+99.5% CPU use with 1 MPI tasks x no OpenMP threads
+
+MPI task timing breakdown:
+Section |  min time  |  avg time  |  max time  |%varavg| %total
+---------------------------------------------------------------
+Pair    | 0.01234    | 0.01234    | 0.01234    |   0.0 | 12.93
+Neigh   | 0.015404   | 0.015404   | 0.015404   |   0.0 | 16.14
+Comm    | 0.00077391 | 0.00077391 | 0.00077391 |   0.0 |  0.81
+Output  | 0.000494   | 0.000494   | 0.000494   |   0.0 |  0.52
+Modify  | 0.062222   | 0.062222   | 0.062222   |   0.0 | 65.18
+Other   |            | 0.004233   |            |       |  4.43
+
+Nlocal:    100 ave 100 max 100 min
+Histogram: 1 0 0 0 0 0 0 0 0 0
+Nghost:    0 ave 0 max 0 min
+Histogram: 1 0 0 0 0 0 0 0 0 0
+Neighs:    150 ave 150 max 150 min
+Histogram: 1 0 0 0 0 0 0 0 0 0
+
+Total # of neighbors = 150
+Ave neighs/atom = 1.5
+Neighbor list builds = 283
+Dangerous builds = 0
+Total wall time: 0:00:00
diff --git a/examples/granregion/log.6Oct16.granregion.box.g++.4 b/examples/granregion/log.6Oct16.granregion.box.g++.4
new file mode 100644
index 0000000000000000000000000000000000000000..daaae2019ea55852ec9165351d1e475485502312
--- /dev/null
+++ b/examples/granregion/log.6Oct16.granregion.box.g++.4
@@ -0,0 +1,468 @@
+LAMMPS (5 Oct 2016)
+# pouring spheres into container box
+
+units		lj
+atom_style      sphere
+boundary        f f f
+dimension	3
+comm_modify     vel yes
+
+region          box block -10 10 -10 10 -10 10 units box
+create_box      2 box
+Created orthogonal box = (-10 -10 -10) to (10 10 10)
+  1 by 2 by 2 MPI processor grid
+
+pair_style	hybrid gran/hooke 4000.0 NULL 100.0 NULL 0.5 1
+pair_coeff	* * gran/hooke
+
+region          container block -6 6 -6 6 -6 6 units box
+fix		container all wall/gran/region hooke/history 		4000.0 NULL 100.0 NULL 0.5 1 region container
+
+neighbor	0.3 bin
+neigh_modify	delay 0 every 1 check yes
+
+fix             2 all nve/sphere
+fix		3 all gravity 1.0 vector 0 0 -1
+
+region          slab block -2 2 -2 2 -2 2 units box
+fix             ins all pour 100 2 4767548 vol 0.4 10 	        diam one 1.0 region slab ignore
+Particle insertion: 48 every 566 steps, 100 by step 1133
+
+timestep	0.005
+
+compute         1 all temp
+compute_modify  1 dynamic yes
+
+compute         2 all temp/sphere
+compute_modify  2 dynamic yes
+
+thermo		100
+thermo_style	custom step atoms temp c_1 c_2 press
+thermo_modify   lost ignore
+compute_modify  thermo_temp dynamic yes
+
+#dump		2 all image 100 image.*.jpg type type #		zoom 1.4 adiam 1.0 box no 0.0 axes yes 0.9 0.03
+#dump_modify	2 pad 5
+
+run	        5000
+Neighbor list info ...
+  1 neighbor list requests
+  update every 1 steps, delay 0 steps, check yes
+  max neighbors/atom: 2000, page size: 100000
+  master list distance cutoff = 1.3
+  ghost atom cutoff = 1.3
+  binsize = 0.65 -> bins = 31 31 31
+Memory usage per processor = 0.0990257 Mbytes
+Step Atoms Temp c_1 c_2 Press 
+       0        0            0            0            0            0 
+     100       21   0.54270729   0.54270729   0.26473526 0.0013567682 
+     200       21   0.87606961   0.87606961   0.42735103  0.002190174 
+     300       21    1.1428374    1.1428374   0.55748167 0.0028570936 
+     400       21    1.3543103    1.3543103   0.66829516 0.0033857758 
+     500       21    1.0677786    1.0677786   0.53582407 0.0045048164 
+     600       56    0.6744286    0.6744286    0.3502938 0.0047464584 
+     700       56   0.75569283   0.75569283   0.39779462 0.0051953882 
+     800       56   0.61597505   0.61597505   0.32943642 0.0086022783 
+     900       56   0.65260802   0.65260802   0.34474044 0.0059298996 
+    1000       56   0.51624952   0.51624952   0.28326898 0.0067827337 
+    1100       56   0.46050076   0.46050076   0.25656319 0.0061891094 
+    1200       81   0.39112377   0.39112377   0.21690744 0.0086559347 
+    1300       81   0.33302801   0.33302801   0.19110222 0.0033381288 
+    1400       81   0.39333146   0.39333146   0.21220965 0.0041348597 
+    1500       81   0.35493951   0.35493951   0.19924958   0.00373736 
+    1600       81   0.34154491   0.34154491   0.19031147  0.005349672 
+    1700      100   0.25598828   0.25598828   0.14171498 0.0092236643 
+    1800      100    0.2114074    0.2114074   0.12162965 0.0027213483 
+    1900      100   0.21810423   0.21810423   0.12176698 0.0036436054 
+    2000      100    0.2553198    0.2553198   0.13900087 0.0032844518 
+    2100      100   0.24809936   0.24809936   0.13753654 0.0088764777 
+    2200      100   0.22455625   0.22455625   0.12500973 0.0043515755 
+    2300      100   0.19586871   0.19586871   0.11064996 0.0055176298 
+    2400      100  0.059621411  0.059621411  0.045535517 0.00079910861 
+    2500      100  0.052217518  0.052217518  0.038542594 0.0009759424 
+    2600      100  0.036907358  0.036907358  0.027550263 0.0014047668 
+    2700      100  0.027926944  0.027926944  0.020599405 0.00063362027 
+    2800      100  0.020876282  0.020876282  0.015385856 0.00066161626 
+    2900      100  0.010390963  0.010390963 0.0085038611 0.00026222195 
+    3000      100 0.0080105974 0.0080105974  0.006995365 0.00059521652 
+    3100      100 0.0087388005 0.0087388005 0.0069051613 0.00028045343 
+    3200      100 0.0078828927 0.0078828927 0.0060159861 0.00014819289 
+    3300      100 0.0039336821 0.0039336821 0.0036525886 0.0001439482 
+    3400      100 0.0037684472 0.0037684472 0.0031531439 0.00010653386 
+    3500      100 0.0023527874 0.0023527874 0.0020983632 6.3797052e-05 
+    3600      100 0.0018768162 0.0018768162 0.0017248798 0.00014904114 
+    3700      100   0.00135595   0.00135595 0.0013962044 6.2461444e-05 
+    3800      100 0.0012673777 0.0012673777 0.0013074364 0.00028034063 
+    3900      100 0.00081311806 0.00081311806 0.00095642595 7.9543605e-05 
+    4000      100 0.00059774673 0.00059774673 0.00074849615 6.8190201e-05 
+    4100      100 0.00052811986 0.00052811986 0.00067263919 5.012633e-05 
+    4200      100 0.00049555855 0.00049555855 0.00061736675 4.9888372e-05 
+    4300      100 0.00048274473 0.00048274473 0.00059050389 5.1381757e-05 
+    4400      100 0.00047341333 0.00047341333 0.00058083446  5.02623e-05 
+    4500      100 0.00046792237 0.00046792237 0.00057416894 4.9019652e-05 
+    4600      100 0.00046035378 0.00046035378 0.00056694823 6.0353699e-05 
+    4700      100 0.00038114933 0.00038114933 0.0004980117 6.5173515e-05 
+    4800      100 0.0003783967 0.0003783967 0.00049488428 4.8463898e-05 
+    4900      100 0.00027940611 0.00027940611 0.00041517649 5.0979155e-05 
+    5000      100 0.00026071989 0.00026071989 0.00040045214 5.151673e-05 
+Loop time of 0.0799825 on 4 procs for 5000 steps with 100 atoms
+
+Performance: 27005901.076 tau/day, 62513.660 timesteps/s
+96.6% CPU use with 4 MPI tasks x no OpenMP threads
+
+MPI task timing breakdown:
+Section |  min time  |  avg time  |  max time  |%varavg| %total
+---------------------------------------------------------------
+Pair    | 0.00093961 | 0.0032012  | 0.0054553  |   3.8 |  4.00
+Neigh   | 0.0032456  | 0.0046872  | 0.0061908  |   2.0 |  5.86
+Comm    | 0.014328   | 0.02121    | 0.029619   |   4.7 | 26.52
+Output  | 0.0011828  | 0.0014142  | 0.0015574  |   0.4 |  1.77
+Modify  | 0.002455   | 0.013876   | 0.026567   |   9.6 | 17.35
+Other   |            | 0.03559    |            |       | 44.50
+
+Nlocal:    25 ave 51 max 0 min
+Histogram: 2 0 0 0 0 0 0 0 0 2
+Nghost:    4.75 ave 11 max 0 min
+Histogram: 2 0 0 0 0 0 0 1 0 1
+Neighs:    39.5 ave 85 max 0 min
+Histogram: 2 0 0 0 0 0 0 0 1 1
+
+Total # of neighbors = 158
+Ave neighs/atom = 1.58
+Neighbor list builds = 305
+Dangerous builds = 0
+
+region          container delete
+variable        theta equal (step-5000)*(4.0*PI/5000)
+region          container block -6 6 -6 6 -6 6 units box                 rotate v_theta 0 0 0 0 0 1
+run	        5000
+Memory usage per processor = 5.16122 Mbytes
+Step Atoms Temp c_1 c_2 Press 
+    5000      100 0.00026071989 0.00026071989 0.00040045214 5.1497323e-05 
+    5100      100   0.66352492   0.66352492   0.35750241  0.015948709 
+    5200      100    0.6922229    0.6922229   0.37176131  0.011025479 
+    5300      100   0.76307067   0.76307067   0.40325027  0.010979511 
+    5400      100   0.83871418   0.83871418   0.43756084  0.012600965 
+    5500      100   0.93090048   0.93090048    0.4817574  0.012306942 
+    5600      100   0.98338567   0.98338567   0.50374148  0.015434412 
+    5700      100    1.0455442    1.0455442   0.53265847  0.017959409 
+    5800      100    1.1081511    1.1081511   0.56112842  0.018832417 
+    5900      100    1.1724309    1.1724309   0.59276447  0.019257973 
+    6000      100    1.1914813    1.1914813   0.60201665  0.019694573 
+    6100      100    1.2417733    1.2417733   0.62578893  0.019616524 
+    6200      100    1.2612898    1.2612898   0.63503847  0.020442394 
+    6300      100    1.2657345    1.2657345   0.63714395  0.020498843 
+    6400      100    1.2678009    1.2678009   0.63828941  0.019900919 
+    6500      100     1.284156     1.284156   0.64724666  0.020147256 
+    6600      100    1.3090278    1.3090278   0.65925035   0.02136883 
+    6700      100    1.3122075    1.3122075   0.66136807  0.020782325 
+    6800      100    1.3147107    1.3147107   0.66026206  0.022887611 
+    6900      100    1.3185295    1.3185295   0.66157265  0.021249838 
+    7000      100    1.3232771    1.3232771   0.66334852  0.021738995 
+    7100      100    1.3375003    1.3375003   0.67017176  0.021997185 
+    7200      100    1.3349835    1.3349835   0.66895884  0.022149977 
+    7300      100    1.3388711    1.3388711   0.67061163  0.021662545 
+    7400      100     1.338676     1.338676   0.67074642  0.021076102 
+    7500      100    1.3409052    1.3409052   0.67205098  0.021664853 
+    7600      100    1.3499236    1.3499236   0.67612412  0.021653422 
+    7700      100    1.3479719    1.3479719   0.67510646  0.021873569 
+    7800      100    1.3489138    1.3489138   0.67563223  0.021419315 
+    7900      100     1.357018     1.357018    0.6795804  0.022201202 
+    8000      100    1.3540513    1.3540513   0.67843711   0.02275761 
+    8100      100    1.3560429    1.3560429   0.67947065  0.022421723 
+    8200      100    1.3590694    1.3590694    0.6806094  0.022004213 
+    8300      100    1.3592154    1.3592154   0.68083948  0.021923269 
+    8400      100    1.3601392    1.3601392   0.68121418  0.022155184 
+    8500      100    1.3622149    1.3622149    0.6824182  0.022126924 
+    8600      100    1.3651697    1.3651697   0.68397342  0.022195287 
+    8700      100    1.3679254    1.3679254   0.68540978  0.023609651 
+    8800      100    1.3686254    1.3686254   0.68559712   0.02242291 
+    8900      100    1.3761277    1.3761277   0.68897201  0.023594162 
+    9000      100     1.379968     1.379968   0.69045216  0.022516846 
+    9100      100    1.3784732    1.3784732   0.68955121  0.022836115 
+    9200      100     1.376848     1.376848    0.6885551   0.02279321 
+    9300      100    1.3799231    1.3799231   0.68964009  0.023105818 
+    9400      100    1.3817992    1.3817992   0.69057466  0.023062265 
+    9500      100    1.3836544    1.3836544   0.69156755  0.024363244 
+    9600      100     1.388032     1.388032   0.69348762  0.024930983 
+    9700      100    1.3943738    1.3943738    0.6965703  0.024448451 
+    9800      100    1.3963094    1.3963094    0.6971039   0.02341203 
+    9900      100    1.3995489    1.3995489   0.69881652  0.023502542 
+   10000      100    1.3974742    1.3974742   0.69765474   0.02340004 
+Loop time of 0.18267 on 4 procs for 5000 steps with 100 atoms
+
+Performance: 11824571.055 tau/day, 27371.692 timesteps/s
+99.1% CPU use with 4 MPI tasks x no OpenMP threads
+
+MPI task timing breakdown:
+Section |  min time  |  avg time  |  max time  |%varavg| %total
+---------------------------------------------------------------
+Pair    | 0.0010765  | 0.012038   | 0.023519   |   9.9 |  6.59
+Neigh   | 0.0057316  | 0.010541   | 0.015351   |   4.6 |  5.77
+Comm    | 0.0067229  | 0.017007   | 0.028509   |   7.8 |  9.31
+Output  | 0.0011928  | 0.002021   | 0.0027668  |   1.6 |  1.11
+Modify  | 0.009697   | 0.053707   | 0.098413   |  19.0 | 29.40
+Other   |            | 0.08736    |            |       | 47.82
+
+Nlocal:    25 ave 51 max 0 min
+Histogram: 2 0 0 0 0 0 0 0 0 2
+Nghost:    3.25 ave 8 max 0 min
+Histogram: 2 0 0 0 0 0 1 0 0 1
+Neighs:    46.75 ave 104 max 0 min
+Histogram: 2 0 0 0 0 0 0 1 0 1
+
+Total # of neighbors = 187
+Ave neighs/atom = 1.87
+Neighbor list builds = 633
+Dangerous builds = 0
+
+region          container delete
+region          container block -6 6 -6 6 -6 6 units box
+run             5000
+Memory usage per processor = 5.16122 Mbytes
+Step Atoms Temp c_1 c_2 Press 
+   10000      100    1.3974742    1.3974742   0.69765474  0.023347613 
+   10100      100   0.34944285   0.34944285   0.20251378  0.019176827 
+   10200      100   0.22524385   0.22524385   0.14368424 0.0033260831 
+   10300      100   0.15243438   0.15243438   0.11070165 0.0064816535 
+   10400      100    0.1143586    0.1143586  0.087867032 0.0024091961 
+   10500      100  0.092025102  0.092025102  0.071291506 0.0030683413 
+   10600      100  0.071051442  0.071051442   0.05700858   0.00100243 
+   10700      100  0.058346771  0.058346771   0.04843626 0.0006073275 
+   10800      100  0.048700232  0.048700232  0.039550383 0.00091511006 
+   10900      100  0.036880936  0.036880936  0.029482183 0.0011698854 
+   11000      100  0.028768807  0.028768807  0.023865852 0.0011980794 
+   11100      100  0.022823005  0.022823005  0.018819891 0.0004639259 
+   11200      100  0.016954703  0.016954703  0.014075803 0.00085142865 
+   11300      100  0.015359685  0.015359685   0.01295219 0.00026241662 
+   11400      100  0.012748378  0.012748378  0.011085291 0.00045626939 
+   11500      100  0.010464459  0.010464459 0.0087024732 0.00029325411 
+   11600      100 0.0099186727 0.0099186727 0.0080127406 0.00031388584 
+   11700      100 0.0088308874 0.0088308874 0.0072317369 0.00017850972 
+   11800      100 0.0081740195 0.0081740195 0.0066522963 0.00012282618 
+   11900      100 0.0079005289 0.0079005289 0.0063346391 0.00010630403 
+   12000      100 0.0066277573 0.0066277573 0.0054122601 5.4791661e-05 
+   12100      100   0.00567928   0.00567928 0.0047331385 9.2668647e-05 
+   12200      100  0.005282803  0.005282803 0.0043827202 8.7820361e-05 
+   12300      100 0.0051590302 0.0051590302 0.0042806737 6.5433983e-05 
+   12400      100 0.0049013329 0.0049013329 0.0040882737 6.2007733e-05 
+   12500      100 0.0044725745 0.0044725745 0.0037535523 6.1132729e-05 
+   12600      100 0.0043131884 0.0043131884 0.0035845765 5.3375706e-05 
+   12700      100 0.0042020236 0.0042020236 0.0034902096 0.0001192142 
+   12800      100 0.0041367453 0.0041367453  0.003433341 0.00011052418 
+   12900      100 0.0039862367 0.0039862367 0.0033026224 5.2674711e-05 
+   13000      100 0.0033163769 0.0033163769 0.0028118123 5.9042575e-05 
+   13100      100 0.0030645983 0.0030645983  0.002571872 4.9521551e-05 
+   13200      100  0.002808301  0.002808301 0.0023652684 3.4748246e-05 
+   13300      100  0.002556475  0.002556475 0.0021699595 0.00042840611 
+   13400      100 0.0023430405 0.0023430405 0.0019913198 2.2687303e-05 
+   13500      100 0.0021422817 0.0021422817 0.0018017112 -6.7761855e-06 
+   13600      100 0.0020993702 0.0020993702  0.001749657 2.5979707e-05 
+   13700      100 0.0019871396 0.0019871396 0.0016647634 5.754995e-05 
+   13800      100 0.0017311886 0.0017311886 0.0014696399 2.1585018e-05 
+   13900      100 0.0016249641 0.0016249641 0.0013982224 2.0108931e-05 
+   14000      100 0.0015874763 0.0015874763 0.0013613318 0.00018348921 
+   14100      100 0.0013772541 0.0013772541 0.0012193388 1.9336869e-05 
+   14200      100 0.0013587865 0.0013587865 0.0012054213 1.807845e-05 
+   14300      100 0.0011824329 0.0011824329 0.0010348168 0.00017307518 
+   14400      100 0.0011387278 0.0011387278 0.0010010725 1.4091757e-05 
+   14500      100 0.0010441599 0.0010441599 0.00092205881 1.3630652e-05 
+   14600      100 0.00096839518 0.00096839518 0.00086828535 1.2437299e-05 
+   14700      100 0.00094215882 0.00094215882 0.00084418599 5.3989122e-05 
+   14800      100 0.00077297853 0.00077297853 0.00070382005 8.5049867e-06 
+   14900      100 0.00072181281 0.00072181281 0.00066110432 8.9324335e-06 
+   15000      100 0.00070122327 0.00070122327 0.00063826734 3.4876262e-05 
+Loop time of 0.0815294 on 4 procs for 5000 steps with 100 atoms
+
+Performance: 26493517.176 tau/day, 61327.586 timesteps/s
+97.8% CPU use with 4 MPI tasks x no OpenMP threads
+
+MPI task timing breakdown:
+Section |  min time  |  avg time  |  max time  |%varavg| %total
+---------------------------------------------------------------
+Pair    | 0.00076294 | 0.0033154  | 0.0062585  |   4.3 |  4.07
+Neigh   | 0.0010953  | 0.0020078  | 0.002914   |   2.0 |  2.46
+Comm    | 0.0021389  | 0.012184   | 0.023433   |   9.1 | 14.94
+Output  | 0.0011332  | 0.0014591  | 0.0017147  |   0.7 |  1.79
+Modify  | 0.00083971 | 0.017889   | 0.035367   |  12.7 | 21.94
+Other   |            | 0.04467    |            |       | 54.79
+
+Nlocal:    25 ave 54 max 0 min
+Histogram: 2 0 0 0 0 0 0 0 1 1
+Nghost:    3.75 ave 8 max 0 min
+Histogram: 2 0 0 0 0 0 0 0 1 1
+Neighs:    37.5 ave 97 max 0 min
+Histogram: 2 0 0 0 0 1 0 0 0 1
+
+Total # of neighbors = 150
+Ave neighs/atom = 1.5
+Neighbor list builds = 120
+Dangerous builds = 0
+
+region          container delete
+variable        theta equal (step-15000)*(4.0*PI/5000)
+region          container block -6 6 -6 6 -6 6 units box                 rotate v_theta 0 0 0 1 1 1
+run	        5000
+Memory usage per processor = 5.16122 Mbytes
+Step Atoms Temp c_1 c_2 Press 
+   15000      100 0.00070122327 0.00070122327 0.00063826734 3.4742207e-05 
+   15100      100    1.1981004    1.1981004   0.74046013  0.017300203 
+   15200      100    1.2197457    1.2197457   0.75847511  0.016724637 
+   15300      100    1.1794198    1.1794198   0.77076582  0.017228755 
+   15400      100    1.4027714    1.4027714   0.87950036  0.021028602 
+   15500      100    1.5514702    1.5514702   0.95040716  0.019935207 
+   15600      100    1.8360404    1.8360404    1.0987247   0.02494663 
+   15700      100    2.0317625    2.0317625    1.2004001  0.029286087 
+   15800      100    2.0478625    2.0478625     1.189893  0.031660426 
+   15900      100    2.1289888    2.1289888    1.2083316  0.028754408 
+   16000      100    2.2261493    2.2261493    1.2550891  0.030665647 
+   16100      100    2.3005184    2.3005184      1.29238  0.036511242 
+   16200      100    2.4515818    2.4515818    1.3563253  0.033787104 
+   16300      100    2.4524614    2.4524614    1.3571527  0.031905963 
+   16400      100    2.5592541    2.5592541     1.405001  0.035688651 
+   16500      100    2.5311864    2.5311864    1.3918694  0.032451265 
+   16600      100    2.6471904    2.6471904    1.4481739  0.034763978 
+   16700      100    2.7024085    2.7024085    1.4785065  0.037514299 
+   16800      100    2.8116979    2.8116979    1.5403269   0.03585152 
+   16900      100    2.9095374    2.9095374    1.5962283  0.038244982 
+   17000      100    2.9228985    2.9228985    1.5978628  0.037971615 
+   17100      100     2.983589     2.983589    1.6205713  0.038332341 
+   17200      100    3.1245984    3.1245984    1.6925827  0.042532223 
+   17300      100    3.1060575    3.1060575    1.6713928  0.052589575 
+   17400      100    3.2494904    3.2494904    1.7567188  0.044783721 
+   17500      100    3.2313349    3.2313349    1.7549177  0.044959213 
+   17600      100    3.3928412    3.3928412     1.822978  0.052512199 
+   17700      100    3.3064729    3.3064729    1.7924768  0.046624738 
+   17800      100    3.1907518    3.1907518    1.7406131  0.042864325 
+   17900      100    3.0224556    3.0224556    1.6641648  0.040151025 
+   18000      100     3.105271     3.105271    1.7045599  0.047137803 
+   18100      100    3.0293425    3.0293425    1.6626024   0.04198758 
+   18200      100     3.139773     3.139773    1.7310307  0.040137164 
+   18300      100    2.9732894    2.9732894    1.6555933   0.03777758 
+   18400      100    3.1250324    3.1250324     1.739812  0.038542298 
+   18500      100    3.1687407    3.1687407    1.7593494  0.041591022 
+   18600      100    3.2880821    3.2880821    1.8169373  0.042503015 
+   18700      100    3.4877047    3.4877047    1.9049979  0.048156272 
+   18800      100    3.7982973    3.7982973     2.055323  0.049805341 
+   18900      100    3.9922267    3.9922267    2.1260665  0.062688073 
+   19000      100    3.8620284    3.8620284    2.0652184  0.064418518 
+   19100      100    3.8757665    3.8757665    2.0615465  0.058600317 
+   19200      100    3.9425495    3.9425495    2.1030375  0.053714175 
+   19300      100    3.8589133    3.8589133    2.0485568   0.05531747 
+   19400      100    3.9202395    3.9202395    2.0904529  0.056324297 
+   19500      100    3.9748628    3.9748628    2.1114492  0.055590699 
+   19600      100    3.8876771    3.8876771    2.0918436  0.052415532 
+   19700      100    3.8975921    3.8975921    2.0755799  0.050647718 
+   19800      100    3.7488333    3.7488333    2.0024562  0.056966734 
+   19900      100    3.7818574    3.7818574      2.00915  0.050079148 
+   20000      100    3.4510736    3.4510736    1.8525818  0.053548452 
+Loop time of 0.156607 on 4 procs for 5000 steps with 100 atoms
+
+Performance: 13792452.627 tau/day, 31926.974 timesteps/s
+98.5% CPU use with 4 MPI tasks x no OpenMP threads
+
+MPI task timing breakdown:
+Section |  min time  |  avg time  |  max time  |%varavg| %total
+---------------------------------------------------------------
+Pair    | 0.0030923  | 0.0049732  | 0.0071678  |   2.1 |  3.18
+Neigh   | 0.012225   | 0.015592   | 0.017859   |   1.7 |  9.96
+Comm    | 0.034876   | 0.037526   | 0.040807   |   1.1 | 23.96
+Output  | 0.0013812  | 0.0015668  | 0.0017419  |   0.3 |  1.00
+Modify  | 0.026932   | 0.044011   | 0.054787   |   5.0 | 28.10
+Other   |            | 0.05294    |            |       | 33.80
+
+Nlocal:    25 ave 41 max 12 min
+Histogram: 1 0 0 1 1 0 0 0 0 1
+Nghost:    3.25 ave 6 max 1 min
+Histogram: 1 0 1 0 0 0 1 0 0 1
+Neighs:    35.75 ave 59 max 9 min
+Histogram: 1 0 0 0 0 1 1 0 0 1
+
+Total # of neighbors = 143
+Ave neighs/atom = 1.43
+Neighbor list builds = 917
+Dangerous builds = 0
+
+region          container delete
+region          container block -6 6 -6 6 -6 6 units box
+run             5000
+Memory usage per processor = 5.16122 Mbytes
+Step Atoms Temp c_1 c_2 Press 
+   20000      100    3.4510736    3.4510736    1.8525818  0.053182767 
+   20100      100   0.99241675   0.99241675   0.61590164  0.015233656 
+   20200      100   0.92799489   0.92799489   0.55540992  0.011885237 
+   20300      100    0.9171573    0.9171573   0.54477252  0.012926388 
+   20400      100   0.86718407   0.86718407    0.5145422  0.011384414 
+   20500      100   0.84470122   0.84470122   0.50181203  0.010482207 
+   20600      100   0.93025469   0.93025469   0.53939952  0.011377044 
+   20700      100   0.96631348   0.96631348   0.55772027  0.015287231 
+   20800      100   0.90708015   0.90708015   0.52037018  0.014854537 
+   20900      100   0.73319001   0.73319001   0.42824847 0.0092980012 
+   21000      100    0.3371096    0.3371096   0.21272171 0.0061783554 
+   21100      100   0.21771022   0.21771022   0.14128887 0.0082147558 
+   21200      100   0.18133275   0.18133275   0.11945636 0.0055722731 
+   21300      100   0.17117199   0.17117199   0.11048263 0.0027980106 
+   21400      100   0.15741047   0.15741047   0.10346676 0.0023057723 
+   21500      100   0.10045855   0.10045855  0.069905343 0.0023941181 
+   21600      100  0.066094864  0.066094864  0.051285108 0.0022519002 
+   21700      100  0.048622069  0.048622069  0.040662255 0.00073951939 
+   21800      100  0.046829799  0.046829799  0.037431722 0.0015913976 
+   21900      100  0.025308514  0.025308514   0.02092076 0.00064225773 
+   22000      100  0.016326886  0.016326886  0.013588504 0.00087416572 
+   22100      100  0.011892981  0.011892981  0.010417133 0.00080132313 
+   22200      100  0.011974602  0.011974602  0.010342276 0.00044437732 
+   22300      100  0.012567486  0.012567486  0.010294969 0.00048413872 
+   22400      100  0.011676022  0.011676022 0.0091714238 0.00066567365 
+   22500      100 0.0098737136 0.0098737136 0.0079252142 0.00024081335 
+   22600      100 0.0052495523 0.0052495523 0.0047802341 0.00029167814 
+   22700      100 0.0049396543 0.0049396543 0.0043570686 0.00019793167 
+   22800      100  0.004469254  0.004469254 0.0038657445 0.00052965165 
+   22900      100 0.0043837877 0.0043837877 0.0034611363 0.00045595698 
+   23000      100  0.003439309  0.003439309 0.0028031344 0.00025784869 
+   23100      100 0.0034805091 0.0034805091 0.0027537344 0.00012746906 
+   23200      100 0.0045502061 0.0045502061 0.0032298328 0.00024006432 
+   23300      100 0.0028553043 0.0028553043 0.0023107483 0.00012803066 
+   23400      100 0.0022736412 0.0022736412 0.0018560302 0.0002706771 
+   23500      100 0.0020966521 0.0020966521 0.0017106541 0.00014239612 
+   23600      100 0.0018760993 0.0018760993 0.0015415318 0.00010892634 
+   23700      100 0.0022362451 0.0022362451 0.0017014519 0.00012547256 
+   23800      100 0.0017603403 0.0017603403 0.0014681398 0.00023372731 
+   23900      100 0.0023396747 0.0023396747 0.0016700312 0.00017014305 
+   24000      100 0.0012059144 0.0012059144 0.0009982224 3.6215959e-05 
+   24100      100 0.0011739433 0.0011739433 0.00097155852 3.6169918e-05 
+   24200      100 0.0011071139 0.0011071139 0.00092095478 8.8000847e-05 
+   24300      100 0.0011078659 0.0011078659 0.00092073833 4.8706222e-05 
+   24400      100 0.0011037562 0.0011037562 0.00091673546 3.7548502e-05 
+   24500      100 0.00098422752 0.00098422752 0.00083054499 9.1151844e-05 
+   24600      100 0.00097403646 0.00097403646 0.00082364881 5.0914687e-05 
+   24700      100 0.00093082012 0.00093082012 0.00079047801 3.2230016e-05 
+   24800      100 0.0009138973 0.0009138973 0.00075880177 2.8780789e-05 
+   24900      100 0.0012881027 0.0012881027 0.00093025416 1.6385252e-05 
+   25000      100 0.00076099168 0.00076099168 0.00065175575 9.417272e-06 
+Loop time of 0.0846543 on 4 procs for 5000 steps with 100 atoms
+
+Performance: 25515528.493 tau/day, 59063.723 timesteps/s
+98.9% CPU use with 4 MPI tasks x no OpenMP threads
+
+MPI task timing breakdown:
+Section |  min time  |  avg time  |  max time  |%varavg| %total
+---------------------------------------------------------------
+Pair    | 0.0010469  | 0.0037468  | 0.0067947  |   4.3 |  4.43
+Neigh   | 0.0032442  | 0.0047541  | 0.0065064  |   2.0 |  5.62
+Comm    | 0.0085762  | 0.016923   | 0.024509   |   5.8 | 19.99
+Output  | 0.0011523  | 0.0014572  | 0.0016789  |   0.6 |  1.72
+Modify  | 0.0017715  | 0.016296   | 0.031399   |  11.1 | 19.25
+Other   |            | 0.04148    |            |       | 49.00
+
+Nlocal:    25 ave 50 max 0 min
+Histogram: 2 0 0 0 0 0 0 0 0 2
+Nghost:    6 ave 13 max 0 min
+Histogram: 2 0 0 0 0 0 0 0 1 1
+Neighs:    39 ave 80 max 0 min
+Histogram: 2 0 0 0 0 0 0 0 0 2
+
+Total # of neighbors = 156
+Ave neighs/atom = 1.56
+Neighbor list builds = 284
+Dangerous builds = 0
+Total wall time: 0:00:00
diff --git a/examples/granregion/log.6Oct16.granregion.funnel.g++.1 b/examples/granregion/log.6Oct16.granregion.funnel.g++.1
new file mode 100644
index 0000000000000000000000000000000000000000..86faeb34013154b00fba1450cf75a42f6264f489
--- /dev/null
+++ b/examples/granregion/log.6Oct16.granregion.funnel.g++.1
@@ -0,0 +1,608 @@
+LAMMPS (5 Oct 2016)
+# pour particles into cone-shaped funnel, settle them, let them run out bottom
+
+variable	name string funnel_pour
+
+thermo_modify	flush yes
+units 		si
+variable	PI equal 3.141592653589
+variable	seed equal 14314
+
+###############################################
+# Geometry-related parameters
+###############################################
+
+variable	xlo equal 10
+variable	xhi equal 40
+variable	ylo equal 10
+variable	yhi equal 40
+variable	zlo equal -20
+variable	zhi equal 50
+
+variable	xc equal 25
+variable	yc equal 25
+
+variable	zconehi equal 50
+variable	zconelo equal 10
+variable	zcyllo equal 0
+variable	radconelo equal 2
+variable	radconehi equal 20
+
+################################################
+# Particle sizes
+################################################
+
+variable	rlo equal 0.25
+variable	rhi equal 0.5
+variable	dlo equal 2.0*${rlo}
+variable	dlo equal 2.0*0.25
+variable	dhi equal 2.0*${rhi}
+variable	dhi equal 2.0*0.5
+
+variable 	skin equal ${rhi}
+variable 	skin equal 0.5
+
+###############################################
+# Granular contact parameters
+###############################################
+
+variable	coeffRes equal 0.1
+variable	coeffFric equal 0.5
+
+variable	density equal 1.0
+variable	EYoung equal 10^5
+variable 	Poisson equal 2.0/7.0
+variable	GShear equal ${EYoung}/(2*(1+${Poisson}))
+variable	GShear equal 100000/(2*(1+${Poisson}))
+variable	GShear equal 100000/(2*(1+0.285714285714286))
+
+variable	gravity equal 1.0
+
+variable	reff equal 0.5*(${rhi}+${rlo})
+variable	reff equal 0.5*(0.5+${rlo})
+variable	reff equal 0.5*(0.5+0.25)
+variable	meff equal ${density}*4.0/3.0*${PI}*${reff}^3
+variable	meff equal 1*4.0/3.0*${PI}*${reff}^3
+variable	meff equal 1*4.0/3.0*3.141592653589*${reff}^3
+variable	meff equal 1*4.0/3.0*3.141592653589*0.375^3
+variable	min_mass equal ${density}*4.0/3.0*${PI}*${rlo}*${rlo}*${rlo}
+variable	min_mass equal 1*4.0/3.0*${PI}*${rlo}*${rlo}*${rlo}
+variable	min_mass equal 1*4.0/3.0*3.141592653589*${rlo}*${rlo}*${rlo}
+variable	min_mass equal 1*4.0/3.0*3.141592653589*0.25*${rlo}*${rlo}
+variable	min_mass equal 1*4.0/3.0*3.141592653589*0.25*0.25*${rlo}
+variable	min_mass equal 1*4.0/3.0*3.141592653589*0.25*0.25*0.25
+variable	max_mass equal ${density}*4.0/3.0*${PI}*${rhi}*${rhi}*${rhi}
+variable	max_mass equal 1*4.0/3.0*${PI}*${rhi}*${rhi}*${rhi}
+variable	max_mass equal 1*4.0/3.0*3.141592653589*${rhi}*${rhi}*${rhi}
+variable	max_mass equal 1*4.0/3.0*3.141592653589*0.5*${rhi}*${rhi}
+variable	max_mass equal 1*4.0/3.0*3.141592653589*0.5*0.5*${rhi}
+variable	max_mass equal 1*4.0/3.0*3.141592653589*0.5*0.5*0.5
+
+## Typical way to set kn, kt, etc.:
+variable        kn equal 4.0*${GShear}/(3*(1-${Poisson}))
+variable        kn equal 4.0*38888.8888888889/(3*(1-${Poisson}))
+variable        kn equal 4.0*38888.8888888889/(3*(1-0.285714285714286))
+variable        kt equal 4.0*${GShear}/(2-${Poisson})
+variable        kt equal 4.0*38888.8888888889/(2-${Poisson})
+variable        kt equal 4.0*38888.8888888889/(2-0.285714285714286)
+
+variable	a equal (-2.0*log(${coeffRes})/${PI})^2
+variable	a equal (-2.0*log(0.1)/${PI})^2
+variable	a equal (-2.0*log(0.1)/3.141592653589)^2
+variable        gamma_n equal sqrt($a*2*${kn}/${min_mass}/(1+0.25*$a))
+variable        gamma_n equal sqrt(0.405284734569556*2*${kn}/${min_mass}/(1+0.25*$a))
+variable        gamma_n equal sqrt(0.405284734569556*2*72592.5925925926/${min_mass}/(1+0.25*$a))
+variable        gamma_n equal sqrt(0.405284734569556*2*72592.5925925926/0.0654498469497708/(1+0.25*$a))
+variable        gamma_n equal sqrt(0.405284734569556*2*72592.5925925926/0.0654498469497708/(1+0.25*0.405284734569556))
+variable        gamma_t equal ${gamma_n}*0.5
+variable        gamma_t equal 903.503751814138*0.5
+
+variable	tcol equal ${PI}/sqrt(2*${kn}/${min_mass}-${gamma_n}/4.0)
+variable	tcol equal 3.141592653589/sqrt(2*${kn}/${min_mass}-${gamma_n}/4.0)
+variable	tcol equal 3.141592653589/sqrt(2*72592.5925925926/${min_mass}-${gamma_n}/4.0)
+variable	tcol equal 3.141592653589/sqrt(2*72592.5925925926/0.0654498469497708-${gamma_n}/4.0)
+variable	tcol equal 3.141592653589/sqrt(2*72592.5925925926/0.0654498469497708-903.503751814138/4.0)
+
+variable	dt equal ${tcol}*0.05
+variable	dt equal 0.00210943016014969*0.05
+timestep	${dt}
+timestep	0.000105471508007485
+
+###############################################
+variable	dumpfreq equal 1000
+variable	logfreq equal 1000
+
+newton 		off
+atom_style	sphere
+
+boundary	p p f
+
+region		boxreg block ${xlo} ${xhi} ${ylo} ${yhi} ${zlo} ${zhi}
+region		boxreg block 10 ${xhi} ${ylo} ${yhi} ${zlo} ${zhi}
+region		boxreg block 10 40 ${ylo} ${yhi} ${zlo} ${zhi}
+region		boxreg block 10 40 10 ${yhi} ${zlo} ${zhi}
+region		boxreg block 10 40 10 40 ${zlo} ${zhi}
+region		boxreg block 10 40 10 40 -20 ${zhi}
+region		boxreg block 10 40 10 40 -20 50
+create_box	1 boxreg
+Created orthogonal box = (10 10 -20) to (40 40 50)
+  1 by 1 by 1 MPI processor grid
+
+pair_style	gran/hertz/history 		${kn} ${kt} ${gamma_n} ${gamma_t} ${coeffFric} 1
+pair_style	gran/hertz/history 		72592.5925925926 ${kt} ${gamma_n} ${gamma_t} ${coeffFric} 1
+pair_style	gran/hertz/history 		72592.5925925926 90740.7407407408 ${gamma_n} ${gamma_t} ${coeffFric} 1
+pair_style	gran/hertz/history 		72592.5925925926 90740.7407407408 903.503751814138 ${gamma_t} ${coeffFric} 1
+pair_style	gran/hertz/history 		72592.5925925926 90740.7407407408 903.503751814138 451.751875907069 ${coeffFric} 1
+pair_style	gran/hertz/history 		72592.5925925926 90740.7407407408 903.503751814138 451.751875907069 0.5 1
+pair_coeff	* *
+
+neighbor        ${skin} bin
+neighbor        0.5 bin
+thermo 		${logfreq}
+thermo 		1000
+
+comm_style	brick
+comm_modify 	mode multi group all vel yes
+balance		1.1 shift xyz 20 1.1
+Neighbor list info ...
+  2 neighbor list requests
+  update every 1 steps, delay 10 steps, check yes
+  max neighbors/atom: 2000, page size: 100000
+  master list distance cutoff = 0
+  ghost atom cutoff = 0
+  binsize = 30 -> bins = 1 1 3
+fix		bal all balance 10000 1.1 shift xyz 20 1.01
+
+####################### Options specific to pouring #########################
+
+# insertion region for fix/pour
+
+region	     	insreg cylinder z ${xc} ${yc} 10 30 50 side in units box
+region	     	insreg cylinder z 25 ${yc} 10 30 50 side in units box
+region	     	insreg cylinder z 25 25 10 30 50 side in units box
+
+# define cone and cylinder regions - see lammps doc on region command
+# note new open options
+
+region	    	cylreg cylinder z ${xc} ${yc} ${radconelo} 		${zcyllo} ${zconelo} side in units box 		open 2 #Top is open
+region	    	cylreg cylinder z 25 ${yc} ${radconelo} 		${zcyllo} ${zconelo} side in units box 		open 2 
+region	    	cylreg cylinder z 25 25 ${radconelo} 		${zcyllo} ${zconelo} side in units box 		open 2 
+region	    	cylreg cylinder z 25 25 2 		${zcyllo} ${zconelo} side in units box 		open 2 
+region	    	cylreg cylinder z 25 25 2 		0 ${zconelo} side in units box 		open 2 
+region	    	cylreg cylinder z 25 25 2 		0 10 side in units box 		open 2 
+
+region		conereg cone z ${xc} ${yc} ${radconelo} ${radconehi} 		${zconelo} ${zconehi} side in units box 		open 1 open 2 #Bottom and top are open
+region		conereg cone z 25 ${yc} ${radconelo} ${radconehi} 		${zconelo} ${zconehi} side in units box 		open 1 open 2 
+region		conereg cone z 25 25 ${radconelo} ${radconehi} 		${zconelo} ${zconehi} side in units box 		open 1 open 2 
+region		conereg cone z 25 25 2 ${radconehi} 		${zconelo} ${zconehi} side in units box 		open 1 open 2 
+region		conereg cone z 25 25 2 20 		${zconelo} ${zconehi} side in units box 		open 1 open 2 
+region		conereg cone z 25 25 2 20 		10 ${zconehi} side in units box 		open 1 open 2 
+region		conereg cone z 25 25 2 20 		10 50 side in units box 		open 1 open 2 
+
+region		hopreg union 2 conereg cylreg
+
+fix		grav all gravity ${gravity} vector 0 0 -1
+fix		grav all gravity 1 vector 0 0 -1
+fix		1 all nve/sphere
+
+
+fix		hopper3 all wall/gran/region hertz/history                 ${kn} ${kt} ${gamma_n} ${gamma_t} ${coeffFric} 1 region hopreg
+fix		hopper3 all wall/gran/region hertz/history                 72592.5925925926 ${kt} ${gamma_n} ${gamma_t} ${coeffFric} 1 region hopreg
+fix		hopper3 all wall/gran/region hertz/history                 72592.5925925926 90740.7407407408 ${gamma_n} ${gamma_t} ${coeffFric} 1 region hopreg
+fix		hopper3 all wall/gran/region hertz/history                 72592.5925925926 90740.7407407408 903.503751814138 ${gamma_t} ${coeffFric} 1 region hopreg
+fix		hopper3 all wall/gran/region hertz/history                 72592.5925925926 90740.7407407408 903.503751814138 451.751875907069 ${coeffFric} 1 region hopreg
+fix		hopper3 all wall/gran/region hertz/history                 72592.5925925926 90740.7407407408 903.503751814138 451.751875907069 0.5 1 region hopreg
+
+fix		ins all pour 2000 1 42424 region insreg 		diam range ${dlo} ${dhi} dens ${density} ${density}
+fix		ins all pour 2000 1 42424 region insreg 		diam range 0.5 ${dhi} dens ${density} ${density}
+fix		ins all pour 2000 1 42424 region insreg 		diam range 0.5 1 dens ${density} ${density}
+fix		ins all pour 2000 1 42424 region insreg 		diam range 0.5 1 dens 1 ${density}
+fix		ins all pour 2000 1 42424 region insreg 		diam range 0.5 1 dens 1 1
+Particle insertion: 3000 every 59965 steps, 2000 by step 1
+
+#dump		1 all custom ${dumpfreq} ${name}.dump #		id type mass diameter x y z
+
+#dump		2 all image 4000 image.*.jpg type type #		axes yes 0.8 0.02 view 60 -30 zoom 3.0 #                box no 0.0 axes no 0.0 0.0
+#dump_modify	2 pad 6
+
+thermo_style	custom step cpu atoms ke
+WARNING: New thermo_style command, previous thermo_modify settings will be lost (../output.cpp:690)
+thermo_modify	flush yes lost warn
+
+# Initial run to fill up the cone
+
+run		20000
+Neighbor list info ...
+  2 neighbor list requests
+  update every 1 steps, delay 10 steps, check yes
+  max neighbors/atom: 2000, page size: 100000
+  master list distance cutoff = 1.5
+  ghost atom cutoff = 1.5
+  binsize = 0.75 -> bins = 40 40 94
+Memory usage per processor = 3.59417 Mbytes
+Step CPU Atoms KinEng 
+       0            0        0           -0 
+    1000   0.54582715     2000           -0 
+    2000   0.93155909     2000           -0 
+    3000    1.3159981     2000           -0 
+    4000     1.697911     2000           -0 
+    5000     2.080133     2000           -0 
+    6000     2.461525     2000           -0 
+    7000     2.842278     2000           -0 
+    8000     3.222302     2000           -0 
+    9000    3.6018171     2000           -0 
+   10000    3.9843922     2000           -0 
+   11000     4.363066     2000           -0 
+   12000     4.743022     2000           -0 
+   13000     5.121953     2000           -0 
+   14000    5.5021431     2000           -0 
+   15000    5.8807089     2000           -0 
+   16000    6.2604752     2000           -0 
+   17000     6.640244     2000           -0 
+   18000    7.0199981     2000           -0 
+   19000      7.40029     2000           -0 
+   20000    7.7834539     2000           -0 
+Loop time of 7.78348 on 1 procs for 20000 steps with 2000 atoms
+
+99.9% CPU use with 1 MPI tasks x no OpenMP threads
+
+MPI task timing breakdown:
+Section |  min time  |  avg time  |  max time  |%varavg| %total
+---------------------------------------------------------------
+Pair    | 0.64588    | 0.64588    | 0.64588    |   0.0 |  8.30
+Neigh   | 0.097229   | 0.097229   | 0.097229   |   0.0 |  1.25
+Comm    | 0.011505   | 0.011505   | 0.011505   |   0.0 |  0.15
+Output  | 0.00041127 | 0.00041127 | 0.00041127 |   0.0 |  0.01
+Modify  | 6.8117     | 6.8117     | 6.8117     |   0.0 | 87.51
+Other   |            | 0.2168     |            |       |  2.79
+
+Nlocal:    2000 ave 2000 max 2000 min
+Histogram: 1 0 0 0 0 0 0 0 0 0
+Nghost:    0 ave 0 max 0 min
+Histogram: 1 0 0 0 0 0 0 0 0 0
+Neighs:    1537 ave 1537 max 1537 min
+Histogram: 1 0 0 0 0 0 0 0 0 0
+
+Total # of neighbors = 1537
+Ave neighs/atom = 0.7685
+Neighbor list builds = 69
+Dangerous builds = 0
+unfix 		ins
+run		150000
+Neighbor list info ...
+  2 neighbor list requests
+  update every 1 steps, delay 10 steps, check yes
+  max neighbors/atom: 2000, page size: 100000
+  master list distance cutoff = 1.49993
+  ghost atom cutoff = 1.49993
+  binsize = 0.749963 -> bins = 41 41 94
+Memory usage per processor = 9.40639 Mbytes
+Step CPU Atoms KinEng 
+   20000            0     2000    6443.7665 
+   21000   0.37979388     2000    6572.3531 
+   22000   0.76149178     2000    6723.8376 
+   23000    1.1449339     2000    6853.1812 
+   24000     1.529017     2000    6976.0209 
+   25000    1.9145579     2000    7096.9955 
+   26000      2.30124     2000    7215.5795 
+   27000    2.6893978     2000    7349.2382 
+   28000    3.0777299     2000    7471.8719 
+   29000    3.4699018     2000    7574.7988 
+   30000    3.8656738     2000    7660.2353 
+   31000    4.2606828     2000    7703.5736 
+   32000    4.6632309     2000    7643.5299 
+   33000    5.0728998     2000      7520.14 
+   34000    5.4878559     2000    7372.2247 
+   35000     5.910604     2000    7192.1639 
+   36000     6.340683     2000    6985.7075 
+   37000    6.8159268     2000     6858.944 
+   38000    7.2553098     2000    6717.0485 
+   39000     7.699847     2000    6541.6874 
+   40000    8.1524599     2000    6382.1661 
+   41000    8.6083429     2000    6235.6681 
+   42000    9.0669999     2000     6103.095 
+   43000    9.5359929     2000    5951.0523 
+   44000    10.012767     2000    5811.0158 
+   45000    10.497891     2000    5627.7273 
+   46000    10.988827     2000    5471.7262 
+   47000     11.48741     2000    5299.1205 
+   48000    11.990619     2000    5164.1642 
+   49000    12.497663     2000    5006.5014 
+   50000    13.020399     2000    4872.2336 
+   51000    13.548012     2000    4694.5332 
+   52000    14.082238     2000    4515.5164 
+   53000    14.622731     2000    4384.7531 
+   54000    15.170292     2000    4215.1354 
+   55000    15.721908     2000    4063.0658 
+   56000    16.285099     2000    3895.7872 
+   57000    16.858606     2000    3693.0537 
+   58000    17.440427     2000     3514.887 
+   59000     18.03239     2000    3268.5625 
+   60000    18.640969     2000    3049.7365 
+   61000    19.245721     2000    2885.6786 
+   62000     19.85574     2000    2652.9108 
+   63000     20.47405     2000    2408.6484 
+   64000     21.10165     2000    2126.9549 
+   65000    21.743939     2000    1879.2829 
+   66000     22.39462     2000    1645.0406 
+   67000    23.059044     2000    1425.8023 
+   68000    23.730976     2000    1160.2206 
+   69000    24.410132     2000    961.78467 
+   70000    25.096468     2000    785.64232 
+   71000    25.778622     2000    626.09642 
+   72000    26.474474     2000    468.40645 
+   73000    27.171065     2000    358.58331 
+   74000    27.860177     2000    299.43443 
+   75000    28.544588     2000    246.40717 
+   76000    29.226358     2000    206.30408 
+   77000    29.902697     2000    176.97739 
+   78000    30.577693     2000    144.25328 
+   79000    31.269697     2000    115.11502 
+   80000    31.977588     2000    97.780887 
+   81000    32.685445     2000    82.593472 
+   82000    33.397946     2000    72.226521 
+   83000    34.114464     2000    62.978026 
+   84000    34.831341     2000    55.350711 
+   85000    35.545558     2000    51.162661 
+   86000    36.266238     2000    46.100957 
+   87000     36.99804     2000     41.19148 
+   88000    37.743379     2000     36.31567 
+   89000    38.499655     2000    32.456379 
+   90000    39.270287     2000     30.16589 
+   91000    40.035401     2000     27.36473 
+   92000    40.799095     2000    25.488138 
+   93000    41.564371     2000    23.674866 
+   94000    42.335499     2000    22.219066 
+   95000    43.114508     2000    20.982603 
+   96000    43.897793     2000    19.840979 
+   97000    44.685675     2000    19.092279 
+   98000    45.483452     2000     18.20277 
+   99000    46.282718     2000    17.512786 
+  100000    47.085373     2000    16.921053 
+  101000    47.888376     2000    16.228234 
+  102000    48.698546     2000    15.958752 
+  103000     49.51312     2000    15.640913 
+  104000    50.330832     2000    14.016542 
+  105000    51.146589     2000    13.484725 
+  106000     51.96128     2000    13.369222 
+  107000    52.781047     2000    12.965898 
+  108000    53.604374     2000    12.268212 
+  109000    54.424389     2000    11.492904 
+  110000    55.253544     2000    11.110936 
+  111000    56.077677     2000     10.05383 
+  112000    56.904333     2000    10.159311 
+  113000    57.729366     2000    10.071694 
+  114000    58.559509     2000     9.820289 
+  115000    59.391732     2000    9.4736012 
+  116000    60.221045     2000    9.5616457 
+  117000    61.052557     2000    8.6478552 
+  118000    61.890195     2000    8.7425719 
+  119000    62.726358     2000    8.4741204 
+  120000    63.565646     2000     7.772287 
+  121000    64.397804     2000    6.9466866 
+  122000    65.231394     2000    6.7645153 
+  123000    66.064887     2000    6.6568629 
+  124000    66.901915     2000    6.7578346 
+  125000    67.741833     2000    6.7845523 
+  126000    68.582414     2000    6.8385357 
+  127000    69.421944     2000    6.8984218 
+  128000    70.262972     2000     7.031649 
+  129000    71.108668     2000    6.5894805 
+  130000    71.954121     2000    6.6452991 
+  131000    72.795366     2000    6.7278453 
+  132000    73.639866     2000     6.679577 
+  133000    74.484945     2000    6.8049542 
+  134000    75.326506     2000    6.9015567 
+  135000    76.171268     2000    7.2052436 
+  136000    77.015739     2000    7.5532841 
+  137000    77.861613     2000    7.2577958 
+  138000    78.706479     2000    7.5218509 
+  139000    79.549466     2000    7.5221639 
+  140000    80.398284     2000    7.6657717 
+  141000    81.240794     2000    7.9761942 
+  142000    82.087164     2000    8.2314258 
+  143000    82.931215     2000    8.3019975 
+  144000    83.777896     2000    8.0179905 
+  145000    84.622383     2000    8.2517491 
+  146000    85.469753     2000    6.9481522 
+  147000    86.315756     2000    6.6131212 
+  148000    87.164711     2000    6.7706881 
+  149000    88.012004     2000    6.8104528 
+  150000    88.861557     2000    6.7339102 
+  151000    89.708494     2000    6.4777998 
+  152000    90.558437     2000    6.3011889 
+  153000     91.40365     2000    6.3101502 
+  154000    92.249997     2000    6.5542552 
+  155000    93.099774     2000    6.7687268 
+  156000    93.945557     2000    6.7974687 
+  157000    94.795065     2000    6.4615869 
+  158000    95.645761     2000    6.5566144 
+  159000    96.495711     2000       6.4371 
+  160000    97.349979     2000    6.4540668 
+  161000     98.19875     2000    6.6987231 
+  162000    99.049934     2000    6.2464506 
+  163000    99.902813     2000    4.7573102 
+  164000    100.75416     2000    4.7782706 
+  165000    101.60479     2000    4.9414064 
+  166000    102.45183     2000     4.970526 
+  167000    103.30172     2000    5.1492473 
+  168000    104.15283     2000    5.3633229 
+  169000    105.00583     2000    4.3464936 
+  170000    105.85919     2000    3.6784016 
+Loop time of 105.859 on 1 procs for 150000 steps with 2000 atoms
+
+99.9% CPU use with 1 MPI tasks x no OpenMP threads
+
+MPI task timing breakdown:
+Section |  min time  |  avg time  |  max time  |%varavg| %total
+---------------------------------------------------------------
+Pair    | 46.786     | 46.786     | 46.786     |  -nan | 44.20
+Neigh   | 0.88556    | 0.88556    | 0.88556    |   0.0 |  0.84
+Comm    | 0.080127   | 0.080127   | 0.080127   |   0.0 |  0.08
+Output  | 0.0033967  | 0.0033967  | 0.0033967  |   0.0 |  0.00
+Modify  | 56.418     | 56.418     | 56.418     |   0.0 | 53.29
+Other   |            | 1.687      |            |       |  1.59
+
+Nlocal:    2000 ave 2000 max 2000 min
+Histogram: 1 0 0 0 0 0 0 0 0 0
+Nghost:    0 ave 0 max 0 min
+Histogram: 1 0 0 0 0 0 0 0 0 0
+Neighs:    15507 ave 15507 max 15507 min
+Histogram: 1 0 0 0 0 0 0 0 0 0
+
+Total # of neighbors = 15507
+Ave neighs/atom = 7.7535
+Neighbor list builds = 401
+Dangerous builds = 0
+
+# remove "plug" - need to redefine cylinder region & union
+
+region	  	cylreg delete
+region		hopreg delete
+region	    	cylreg cylinder z ${xc} ${yc} ${radconelo} 		${zcyllo} ${zconelo} side in units box 		open 1 open 2 #Bottom & top are open
+region	    	cylreg cylinder z 25 ${yc} ${radconelo} 		${zcyllo} ${zconelo} side in units box 		open 1 open 2 
+region	    	cylreg cylinder z 25 25 ${radconelo} 		${zcyllo} ${zconelo} side in units box 		open 1 open 2 
+region	    	cylreg cylinder z 25 25 2 		${zcyllo} ${zconelo} side in units box 		open 1 open 2 
+region	    	cylreg cylinder z 25 25 2 		0 ${zconelo} side in units box 		open 1 open 2 
+region	    	cylreg cylinder z 25 25 2 		0 10 side in units box 		open 1 open 2 
+
+region		hopreg union 2 cylreg conereg
+
+unfix		hopper3
+fix		hopper3 all wall/gran/region hertz/history 		${kn} ${kt} ${gamma_n} ${gamma_t} ${coeffFric} 1 region hopreg
+fix		hopper3 all wall/gran/region hertz/history 		72592.5925925926 ${kt} ${gamma_n} ${gamma_t} ${coeffFric} 1 region hopreg
+fix		hopper3 all wall/gran/region hertz/history 		72592.5925925926 90740.7407407408 ${gamma_n} ${gamma_t} ${coeffFric} 1 region hopreg
+fix		hopper3 all wall/gran/region hertz/history 		72592.5925925926 90740.7407407408 903.503751814138 ${gamma_t} ${coeffFric} 1 region hopreg
+fix		hopper3 all wall/gran/region hertz/history 		72592.5925925926 90740.7407407408 903.503751814138 451.751875907069 ${coeffFric} 1 region hopreg
+fix		hopper3 all wall/gran/region hertz/history 		72592.5925925926 90740.7407407408 903.503751814138 451.751875907069 0.5 1 region hopreg
+
+run		100000
+Memory usage per processor = 9.40667 Mbytes
+Step CPU Atoms KinEng 
+  170000            0     2000    3.6784016 
+  171000   0.84847808     2000    4.3936331 
+  172000    1.6901879     2000    5.5750342 
+  173000     2.523411     2000    6.8205762 
+  174000    3.3501492     2000    8.9700613 
+  175000    4.1766891     2000    11.336633 
+  176000    4.9954321     2000    14.225242 
+  177000     5.814229     2000    17.653262 
+  178000     6.630548     2000    21.796078 
+  179000    7.4493361     2000    26.660801 
+  180000    8.2656369     2000    32.428193 
+  181000     9.069953     2000    39.229088 
+  182000    9.8759181     2000    46.242732 
+  183000    10.674972     2000    54.604245 
+  184000     11.47082     2000     63.96931 
+  185000    12.259916     2000    74.132316 
+  186000    13.046788     2000    84.690798 
+  187000    13.832446     2000    95.486707 
+  188000    14.612976     2000    106.68052 
+  189000    15.391779     2000    118.91376 
+  190000    16.160107     2000    131.90023 
+  191000    16.919573     2000    146.30664 
+  192000    17.677855     2000    161.10142 
+  193000      18.4352     2000    174.91947 
+  194000    19.188156     2000    191.47629 
+  195000    19.937255     2000    208.19912 
+  196000    20.687716     2000    224.80045 
+  197000     21.43754     2000    243.29637 
+  198000     22.18579     2000    262.88685 
+  199000    22.932473     2000    282.34797 
+  200000    23.680828     2000    302.78689 
+  201000    24.428559     2000    323.48767 
+  202000    25.167341     2000    345.99414 
+  203000    25.904465     2000    368.54389 
+  204000    26.635727     2000    393.49643 
+  205000    27.366891     2000    417.82722 
+  206000    28.094282     2000    443.67976 
+  207000    28.821021     2000    470.35934 
+  208000    29.545596     2000    499.01368 
+  209000    30.267439     2000    528.99746 
+  210000    30.993287     2000    561.03931 
+  211000    31.713729     2000     594.0482 
+  212000     32.42933     2000    628.20118 
+  213000     33.14608     2000      662.585 
+  214000    33.863882     2000    697.41408 
+  215000    34.580495     2000    733.36799 
+  216000    35.302571     2000    770.46796 
+  217000    36.023821     2000    806.72007 
+  218000     36.74189     2000    844.06965 
+  219000    37.460105     2000    884.31774 
+  220000    38.177705     2000    926.23771 
+  221000    38.886587     2000    970.02095 
+  222000    39.594003     2000    1015.3938 
+  223000     40.29579     2000    1061.1281 
+  224000    41.001112     2000    1107.9962 
+  225000    41.706489     2000    1155.3656 
+  226000    42.417622     1998    1196.6939 
+  227000    43.133238     1996    1240.8434 
+  228000    43.844991     1990    1260.0436 
+  229000    44.545565     1986    1280.0431 
+  230000    45.246651     1974     1285.222 
+  231000    45.934355     1970    1311.8189 
+  232000    46.624066     1960    1300.7922 
+  233000    47.310339     1943     1282.113 
+  234000    47.993433     1932    1261.0871 
+  235000     48.66937     1918    1211.0667 
+  236000    49.332954     1911    1232.6411 
+  237000     49.99742     1898     1209.112 
+  238000    50.664096     1888    1189.4002 
+  239000    51.336205     1875     1151.415 
+  240000    52.010198     1863    1108.0821 
+  241000    52.680788     1856    1090.2279 
+  242000    53.343069     1843    1062.9726 
+  243000    53.996768     1830    1016.0933 
+  244000    54.635882     1825    1023.5568 
+  245000    55.271259     1817    1012.2897 
+  246000    55.902793     1811    1019.8355 
+  247000    56.541437     1802    996.81934 
+  248000    57.182244     1793    971.29353 
+  249000    57.827453     1785    947.98166 
+  250000    58.473311     1771    898.58408 
+  251000      59.1075     1762    851.46342 
+  252000     59.73473     1754    826.46301 
+  253000    60.362094     1747    808.08292 
+  254000    60.989489     1737    778.86892 
+  255000    61.616293     1720    702.90046 
+  256000    62.243096     1709    665.14293 
+  257000    62.866596     1703    628.63036 
+  258000     63.48969     1702    645.42118 
+  259000    64.119075     1696    617.03362 
+  260000    64.752187     1692    607.96874 
+  261000    65.374973     1690    619.83155 
+  262000    65.991365     1688    622.09585 
+  263000    66.608686     1682    612.86762 
+  264000    67.220696     1681    636.53769 
+  265000    67.830797     1678    638.33305 
+  266000    68.439964     1675    635.97419 
+  267000    69.043459     1672    634.91103 
+  268000    69.643043     1669    638.50196 
+  269000    70.250146     1667    646.16045 
+  270000     70.86361     1664    659.62209 
+Loop time of 70.8636 on 1 procs for 100000 steps with 1664 atoms
+
+99.9% CPU use with 1 MPI tasks x no OpenMP threads
+
+MPI task timing breakdown:
+Section |  min time  |  avg time  |  max time  |%varavg| %total
+---------------------------------------------------------------
+Pair    | 33.501     | 33.501     | 33.501     |   0.0 | 47.27
+Neigh   | 0.63279    | 0.63279    | 0.63279    |   0.0 |  0.89
+Comm    | 0.055495   | 0.055495   | 0.055495   |   0.0 |  0.08
+Output  | 0.0021648  | 0.0021648  | 0.0021648  |   0.0 |  0.00
+Modify  | 35.602     | 35.602     | 35.602     |   0.0 | 50.24
+Other   |            | 1.07       |            |       |  1.51
+
+Nlocal:    1664 ave 1664 max 1664 min
+Histogram: 1 0 0 0 0 0 0 0 0 0
+Nghost:    0 ave 0 max 0 min
+Histogram: 1 0 0 0 0 0 0 0 0 0
+Neighs:    11687 ave 11687 max 11687 min
+Histogram: 1 0 0 0 0 0 0 0 0 0
+
+Total # of neighbors = 11687
+Ave neighs/atom = 7.02344
+Neighbor list builds = 261
+Dangerous builds = 0
+Total wall time: 0:03:04
diff --git a/examples/granregion/log.6Oct16.granregion.funnel.g++.4 b/examples/granregion/log.6Oct16.granregion.funnel.g++.4
new file mode 100644
index 0000000000000000000000000000000000000000..fcbd050b76b5274ee9d29fb03563670926f98037
--- /dev/null
+++ b/examples/granregion/log.6Oct16.granregion.funnel.g++.4
@@ -0,0 +1,608 @@
+LAMMPS (5 Oct 2016)
+# pour particles into cone-shaped funnel, settle them, let them run out bottom
+
+variable	name string funnel_pour
+
+thermo_modify	flush yes
+units 		si
+variable	PI equal 3.141592653589
+variable	seed equal 14314
+
+###############################################
+# Geometry-related parameters
+###############################################
+
+variable	xlo equal 10
+variable	xhi equal 40
+variable	ylo equal 10
+variable	yhi equal 40
+variable	zlo equal -20
+variable	zhi equal 50
+
+variable	xc equal 25
+variable	yc equal 25
+
+variable	zconehi equal 50
+variable	zconelo equal 10
+variable	zcyllo equal 0
+variable	radconelo equal 2
+variable	radconehi equal 20
+
+################################################
+# Particle sizes
+################################################
+
+variable	rlo equal 0.25
+variable	rhi equal 0.5
+variable	dlo equal 2.0*${rlo}
+variable	dlo equal 2.0*0.25
+variable	dhi equal 2.0*${rhi}
+variable	dhi equal 2.0*0.5
+
+variable 	skin equal ${rhi}
+variable 	skin equal 0.5
+
+###############################################
+# Granular contact parameters
+###############################################
+
+variable	coeffRes equal 0.1
+variable	coeffFric equal 0.5
+
+variable	density equal 1.0
+variable	EYoung equal 10^5
+variable 	Poisson equal 2.0/7.0
+variable	GShear equal ${EYoung}/(2*(1+${Poisson}))
+variable	GShear equal 100000/(2*(1+${Poisson}))
+variable	GShear equal 100000/(2*(1+0.285714285714286))
+
+variable	gravity equal 1.0
+
+variable	reff equal 0.5*(${rhi}+${rlo})
+variable	reff equal 0.5*(0.5+${rlo})
+variable	reff equal 0.5*(0.5+0.25)
+variable	meff equal ${density}*4.0/3.0*${PI}*${reff}^3
+variable	meff equal 1*4.0/3.0*${PI}*${reff}^3
+variable	meff equal 1*4.0/3.0*3.141592653589*${reff}^3
+variable	meff equal 1*4.0/3.0*3.141592653589*0.375^3
+variable	min_mass equal ${density}*4.0/3.0*${PI}*${rlo}*${rlo}*${rlo}
+variable	min_mass equal 1*4.0/3.0*${PI}*${rlo}*${rlo}*${rlo}
+variable	min_mass equal 1*4.0/3.0*3.141592653589*${rlo}*${rlo}*${rlo}
+variable	min_mass equal 1*4.0/3.0*3.141592653589*0.25*${rlo}*${rlo}
+variable	min_mass equal 1*4.0/3.0*3.141592653589*0.25*0.25*${rlo}
+variable	min_mass equal 1*4.0/3.0*3.141592653589*0.25*0.25*0.25
+variable	max_mass equal ${density}*4.0/3.0*${PI}*${rhi}*${rhi}*${rhi}
+variable	max_mass equal 1*4.0/3.0*${PI}*${rhi}*${rhi}*${rhi}
+variable	max_mass equal 1*4.0/3.0*3.141592653589*${rhi}*${rhi}*${rhi}
+variable	max_mass equal 1*4.0/3.0*3.141592653589*0.5*${rhi}*${rhi}
+variable	max_mass equal 1*4.0/3.0*3.141592653589*0.5*0.5*${rhi}
+variable	max_mass equal 1*4.0/3.0*3.141592653589*0.5*0.5*0.5
+
+## Typical way to set kn, kt, etc.:
+variable        kn equal 4.0*${GShear}/(3*(1-${Poisson}))
+variable        kn equal 4.0*38888.8888888889/(3*(1-${Poisson}))
+variable        kn equal 4.0*38888.8888888889/(3*(1-0.285714285714286))
+variable        kt equal 4.0*${GShear}/(2-${Poisson})
+variable        kt equal 4.0*38888.8888888889/(2-${Poisson})
+variable        kt equal 4.0*38888.8888888889/(2-0.285714285714286)
+
+variable	a equal (-2.0*log(${coeffRes})/${PI})^2
+variable	a equal (-2.0*log(0.1)/${PI})^2
+variable	a equal (-2.0*log(0.1)/3.141592653589)^2
+variable        gamma_n equal sqrt($a*2*${kn}/${min_mass}/(1+0.25*$a))
+variable        gamma_n equal sqrt(0.405284734569556*2*${kn}/${min_mass}/(1+0.25*$a))
+variable        gamma_n equal sqrt(0.405284734569556*2*72592.5925925926/${min_mass}/(1+0.25*$a))
+variable        gamma_n equal sqrt(0.405284734569556*2*72592.5925925926/0.0654498469497708/(1+0.25*$a))
+variable        gamma_n equal sqrt(0.405284734569556*2*72592.5925925926/0.0654498469497708/(1+0.25*0.405284734569556))
+variable        gamma_t equal ${gamma_n}*0.5
+variable        gamma_t equal 903.503751814138*0.5
+
+variable	tcol equal ${PI}/sqrt(2*${kn}/${min_mass}-${gamma_n}/4.0)
+variable	tcol equal 3.141592653589/sqrt(2*${kn}/${min_mass}-${gamma_n}/4.0)
+variable	tcol equal 3.141592653589/sqrt(2*72592.5925925926/${min_mass}-${gamma_n}/4.0)
+variable	tcol equal 3.141592653589/sqrt(2*72592.5925925926/0.0654498469497708-${gamma_n}/4.0)
+variable	tcol equal 3.141592653589/sqrt(2*72592.5925925926/0.0654498469497708-903.503751814138/4.0)
+
+variable	dt equal ${tcol}*0.05
+variable	dt equal 0.00210943016014969*0.05
+timestep	${dt}
+timestep	0.000105471508007485
+
+###############################################
+variable	dumpfreq equal 1000
+variable	logfreq equal 1000
+
+newton 		off
+atom_style	sphere
+
+boundary	p p f
+
+region		boxreg block ${xlo} ${xhi} ${ylo} ${yhi} ${zlo} ${zhi}
+region		boxreg block 10 ${xhi} ${ylo} ${yhi} ${zlo} ${zhi}
+region		boxreg block 10 40 ${ylo} ${yhi} ${zlo} ${zhi}
+region		boxreg block 10 40 10 ${yhi} ${zlo} ${zhi}
+region		boxreg block 10 40 10 40 ${zlo} ${zhi}
+region		boxreg block 10 40 10 40 -20 ${zhi}
+region		boxreg block 10 40 10 40 -20 50
+create_box	1 boxreg
+Created orthogonal box = (10 10 -20) to (40 40 50)
+  1 by 1 by 4 MPI processor grid
+
+pair_style	gran/hertz/history 		${kn} ${kt} ${gamma_n} ${gamma_t} ${coeffFric} 1
+pair_style	gran/hertz/history 		72592.5925925926 ${kt} ${gamma_n} ${gamma_t} ${coeffFric} 1
+pair_style	gran/hertz/history 		72592.5925925926 90740.7407407408 ${gamma_n} ${gamma_t} ${coeffFric} 1
+pair_style	gran/hertz/history 		72592.5925925926 90740.7407407408 903.503751814138 ${gamma_t} ${coeffFric} 1
+pair_style	gran/hertz/history 		72592.5925925926 90740.7407407408 903.503751814138 451.751875907069 ${coeffFric} 1
+pair_style	gran/hertz/history 		72592.5925925926 90740.7407407408 903.503751814138 451.751875907069 0.5 1
+pair_coeff	* *
+
+neighbor        ${skin} bin
+neighbor        0.5 bin
+thermo 		${logfreq}
+thermo 		1000
+
+comm_style	brick
+comm_modify 	mode multi group all vel yes
+balance		1.1 shift xyz 20 1.1
+Neighbor list info ...
+  2 neighbor list requests
+  update every 1 steps, delay 10 steps, check yes
+  max neighbors/atom: 2000, page size: 100000
+  master list distance cutoff = 0
+  ghost atom cutoff = 0
+  binsize = 30 -> bins = 1 1 3
+fix		bal all balance 10000 1.1 shift xyz 20 1.01
+
+####################### Options specific to pouring #########################
+
+# insertion region for fix/pour
+
+region	     	insreg cylinder z ${xc} ${yc} 10 30 50 side in units box
+region	     	insreg cylinder z 25 ${yc} 10 30 50 side in units box
+region	     	insreg cylinder z 25 25 10 30 50 side in units box
+
+# define cone and cylinder regions - see lammps doc on region command
+# note new open options
+
+region	    	cylreg cylinder z ${xc} ${yc} ${radconelo} 		${zcyllo} ${zconelo} side in units box 		open 2 #Top is open
+region	    	cylreg cylinder z 25 ${yc} ${radconelo} 		${zcyllo} ${zconelo} side in units box 		open 2 
+region	    	cylreg cylinder z 25 25 ${radconelo} 		${zcyllo} ${zconelo} side in units box 		open 2 
+region	    	cylreg cylinder z 25 25 2 		${zcyllo} ${zconelo} side in units box 		open 2 
+region	    	cylreg cylinder z 25 25 2 		0 ${zconelo} side in units box 		open 2 
+region	    	cylreg cylinder z 25 25 2 		0 10 side in units box 		open 2 
+
+region		conereg cone z ${xc} ${yc} ${radconelo} ${radconehi} 		${zconelo} ${zconehi} side in units box 		open 1 open 2 #Bottom and top are open
+region		conereg cone z 25 ${yc} ${radconelo} ${radconehi} 		${zconelo} ${zconehi} side in units box 		open 1 open 2 
+region		conereg cone z 25 25 ${radconelo} ${radconehi} 		${zconelo} ${zconehi} side in units box 		open 1 open 2 
+region		conereg cone z 25 25 2 ${radconehi} 		${zconelo} ${zconehi} side in units box 		open 1 open 2 
+region		conereg cone z 25 25 2 20 		${zconelo} ${zconehi} side in units box 		open 1 open 2 
+region		conereg cone z 25 25 2 20 		10 ${zconehi} side in units box 		open 1 open 2 
+region		conereg cone z 25 25 2 20 		10 50 side in units box 		open 1 open 2 
+
+region		hopreg union 2 conereg cylreg
+
+fix		grav all gravity ${gravity} vector 0 0 -1
+fix		grav all gravity 1 vector 0 0 -1
+fix		1 all nve/sphere
+
+
+fix		hopper3 all wall/gran/region hertz/history                 ${kn} ${kt} ${gamma_n} ${gamma_t} ${coeffFric} 1 region hopreg
+fix		hopper3 all wall/gran/region hertz/history                 72592.5925925926 ${kt} ${gamma_n} ${gamma_t} ${coeffFric} 1 region hopreg
+fix		hopper3 all wall/gran/region hertz/history                 72592.5925925926 90740.7407407408 ${gamma_n} ${gamma_t} ${coeffFric} 1 region hopreg
+fix		hopper3 all wall/gran/region hertz/history                 72592.5925925926 90740.7407407408 903.503751814138 ${gamma_t} ${coeffFric} 1 region hopreg
+fix		hopper3 all wall/gran/region hertz/history                 72592.5925925926 90740.7407407408 903.503751814138 451.751875907069 ${coeffFric} 1 region hopreg
+fix		hopper3 all wall/gran/region hertz/history                 72592.5925925926 90740.7407407408 903.503751814138 451.751875907069 0.5 1 region hopreg
+
+fix		ins all pour 2000 1 42424 region insreg 		diam range ${dlo} ${dhi} dens ${density} ${density}
+fix		ins all pour 2000 1 42424 region insreg 		diam range 0.5 ${dhi} dens ${density} ${density}
+fix		ins all pour 2000 1 42424 region insreg 		diam range 0.5 1 dens ${density} ${density}
+fix		ins all pour 2000 1 42424 region insreg 		diam range 0.5 1 dens 1 ${density}
+fix		ins all pour 2000 1 42424 region insreg 		diam range 0.5 1 dens 1 1
+Particle insertion: 3000 every 59965 steps, 2000 by step 1
+
+#dump		1 all custom ${dumpfreq} ${name}.dump #		id type mass diameter x y z
+
+#dump		2 all image 4000 image.*.jpg type type #		axes yes 0.8 0.02 view 60 -30 zoom 3.0 #                box no 0.0 axes no 0.0 0.0
+#dump_modify	2 pad 6
+
+thermo_style	custom step cpu atoms ke
+WARNING: New thermo_style command, previous thermo_modify settings will be lost (../output.cpp:690)
+thermo_modify	flush yes lost warn
+
+# Initial run to fill up the cone
+
+run		20000
+Neighbor list info ...
+  2 neighbor list requests
+  update every 1 steps, delay 10 steps, check yes
+  max neighbors/atom: 2000, page size: 100000
+  master list distance cutoff = 1.5
+  ghost atom cutoff = 1.5
+  binsize = 0.75 -> bins = 40 40 94
+Memory usage per processor = 2.99539 Mbytes
+Step CPU Atoms KinEng 
+       0            0        0           -0 
+    1000   0.53632808     2000           -0 
+    2000   0.90599012     2000           -0 
+    3000    1.2640941     2000           -0 
+    4000    1.6225331     2000           -0 
+    5000    1.9735272     2000           -0 
+    6000    2.3156731     2000           -0 
+    7000    2.6499262     2000           -0 
+    8000    2.9751072     2000           -0 
+    9000    3.2918322     2000           -0 
+   10000     3.597712     2000           -0 
+   11000    3.7157061     2000           -0 
+   12000     3.833451     2000           -0 
+   13000    3.9541111     2000           -0 
+   14000     4.081727     2000           -0 
+   15000    4.2142782     2000           -0 
+   16000    4.3530872     2000           -0 
+   17000    4.4987361     2000           -0 
+   18000    4.6507492     2000           -0 
+   19000     4.807373     2000           -0 
+   20000    4.9710512     2000           -0 
+Loop time of 4.97109 on 4 procs for 20000 steps with 2000 atoms
+
+98.5% CPU use with 4 MPI tasks x no OpenMP threads
+
+MPI task timing breakdown:
+Section |  min time  |  avg time  |  max time  |%varavg| %total
+---------------------------------------------------------------
+Pair    | 0.067799   | 0.17326    | 0.37341    |  28.4 |  3.49
+Neigh   | 0.013881   | 0.025808   | 0.045841   |   7.5 |  0.52
+Comm    | 0.078163   | 0.1808     | 0.2915     |  21.0 |  3.64
+Output  | 0.0011413  | 0.0027029  | 0.0036721  |   1.8 |  0.05
+Modify  | 1.0146     | 1.8605     | 3.562      |  73.8 | 37.43
+Other   |            | 2.728      |            |       | 54.88
+
+Nlocal:    500 ave 505 max 493 min
+Histogram: 1 0 0 0 0 1 0 1 0 1
+Nghost:    159.25 ave 254 max 71 min
+Histogram: 1 0 0 1 0 1 0 0 0 1
+Neighs:    397.5 ave 616 max 214 min
+Histogram: 1 0 1 0 0 0 1 0 0 1
+
+Total # of neighbors = 1590
+Ave neighs/atom = 0.795
+Neighbor list builds = 69
+Dangerous builds = 0
+unfix 		ins
+run		150000
+Neighbor list info ...
+  2 neighbor list requests
+  update every 1 steps, delay 10 steps, check yes
+  max neighbors/atom: 2000, page size: 100000
+  master list distance cutoff = 1.49993
+  ghost atom cutoff = 1.49993
+  binsize = 0.749963 -> bins = 41 41 94
+Memory usage per processor = 9.39737 Mbytes
+Step CPU Atoms KinEng 
+   20000            0     2000    6443.7665 
+   21000   0.11240888     2000    6572.3531 
+   22000   0.23014092     2000    6723.8376 
+   23000   0.35371184     2000    6853.1812 
+   24000    0.4838469     2000    6976.0209 
+   25000   0.62193394     2000    7096.9955 
+   26000   0.76781893     2000    7215.5795 
+   27000   0.92212081     2000    7349.2382 
+   28000    1.0841098     2000    7471.8719 
+   29000    1.2593179     2000    7574.7988 
+   30000    1.4459748     2000    7660.2353 
+   31000    1.5759299     2000    7703.5736 
+   32000    1.7189329     2000    7643.5299 
+   33000     1.876133     2000      7520.14 
+   34000    2.0453629     2000    7372.2247 
+   35000    2.2281299     2000    7192.1638 
+   36000    2.4208269     2000    6985.7056 
+   37000    2.6258228     2000    6858.9422 
+   38000     2.839473     2000    6717.0655 
+   39000     3.065336     2000    6541.5809 
+   40000    3.3090389     2000    6381.8513 
+   41000    3.4969938     2000    6236.4297 
+   42000    3.6888108     2000    6104.2528 
+   43000    3.8874888     2000    5951.0314 
+   44000    4.0956569     2000    5819.0972 
+   45000     4.312974     2000    5620.6457 
+   46000    4.5343778     2000     5479.332 
+   47000     4.757262     2000     5295.328 
+   48000    4.9850328     2000    5179.9559 
+   49000    5.2210319     2000    5022.5562 
+   50000    5.4699879     2000    4899.1332 
+   51000    5.6774018     2000    4699.4456 
+   52000    5.8900218     2000    4522.5719 
+   53000     6.110677     2000    4402.8664 
+   54000    6.3361218     2000    4256.1664 
+   55000    6.5778289     2000    4093.6265 
+   56000    6.8319149     2000    3933.0179 
+   57000    7.0925779     2000    3738.4628 
+   58000    7.3578169     2000    3535.7866 
+   59000    7.6344049     2000    3298.4079 
+   60000    7.9258108     2000    3058.9356 
+   61000    8.1758959     2000    2888.0074 
+   62000    8.4278228     2000    2652.4613 
+   63000    8.6815088     2000    2435.0991 
+   64000    8.9371588     2000    2147.9441 
+   65000     9.208025     2000    1898.0657 
+   66000    9.4795358     2000    1650.5794 
+   67000    9.7519388     2000    1425.7284 
+   68000    10.025867     2000    1193.3786 
+   69000    10.313816     2000    940.55767 
+   70000    10.610488     2000     761.5312 
+   71000    10.879718     2000     599.1989 
+   72000    11.154029     2000    453.25929 
+   73000    11.424376     2000    345.73222 
+   74000    11.697359     2000    273.72167 
+   75000    11.966099     2000    222.44251 
+   76000    12.230213     2000    190.79993 
+   77000    12.481982     2000    157.71153 
+   78000     12.73433     2000    131.99208 
+   79000    12.986017     2000    111.10589 
+   80000    13.243904     2000    96.736337 
+   81000    13.500538     2000     81.24169 
+   82000    13.765755     2000    66.640863 
+   83000    14.032985     2000     53.07725 
+   84000    14.308284     2000    45.942738 
+   85000    14.586721     2000    38.811918 
+   86000    14.861759     2000     34.59113 
+   87000    15.135665     2000     31.04487 
+   88000    15.417487     2000    27.659144 
+   89000    15.698281     2000    24.596119 
+   90000     15.97969     2000    22.004865 
+   91000    16.266118     2000    20.541665 
+   92000    16.557007     2000    18.938077 
+   93000    16.846745     2000    17.293956 
+   94000    17.133408     2000    16.443596 
+   95000     17.42023     2000    15.518083 
+   96000    17.709025     2000    14.264343 
+   97000    18.001337     2000    13.410217 
+   98000    18.292414     2000    13.036621 
+   99000    18.583887     2000    12.523214 
+  100000    18.880312     2000    12.371509 
+  101000    19.176964     2000    11.828077 
+  102000    19.474371     2000    11.510333 
+  103000    19.770957     2000    11.289304 
+  104000    20.070744     2000    10.370661 
+  105000    20.372617     2000    10.217921 
+  106000    20.673949     2000    9.3275222 
+  107000      20.9765     2000    8.9156372 
+  108000    21.276062     2000    8.5850821 
+  109000    21.585305     2000    8.5326934 
+  110000     21.89079     2000    8.0579504 
+  111000    22.194207     2000    8.1084595 
+  112000    22.501593     2000    7.9190174 
+  113000     22.81251     2000    8.0127499 
+  114000    23.118514     2000    8.1791911 
+  115000    23.432862     2000    8.3333032 
+  116000    23.735549     2000    8.4833817 
+  117000    24.038329     2000     8.315498 
+  118000    24.343247     2000    7.9460007 
+  119000    24.643288     2000    7.5922134 
+  120000     24.94731     2000    7.4089143 
+  121000    25.253605     2000    7.5790659 
+  122000     25.56672     2000    7.3778204 
+  123000    25.870958     2000    7.1384456 
+  124000    26.180729     2000    6.9151887 
+  125000    26.493089     2000    6.4671685 
+  126000    26.806734     2000    5.6773128 
+  127000     27.10969     2000    5.5603057 
+  128000    27.410973     2000    5.6376136 
+  129000    27.712398     2000    5.5578044 
+  130000    28.015943     2000    5.4632646 
+  131000    28.319002     2000    4.9669466 
+  132000    28.620558     2000    5.0191026 
+  133000    28.923233     2000    4.7146653 
+  134000    29.235178     2000    4.4835803 
+  135000    29.542816     2000    4.5469703 
+  136000      29.8518     2000    4.3349926 
+  137000    30.159096     2000     4.423031 
+  138000    30.464283     2000    4.3680646 
+  139000    30.769279     2000    4.2461787 
+  140000    31.074457     2000    4.4140001 
+  141000    31.380334     2000    4.3991236 
+  142000    31.683855     2000     4.572989 
+  143000    31.987308     2000    4.7601702 
+  144000     32.28998     2000    4.7790587 
+  145000    32.594971     2000    4.8127728 
+  146000     32.89855     2000    4.8750003 
+  147000    33.205142     2000    4.9830109 
+  148000    33.509096     2000    4.9960037 
+  149000    33.812951     2000    5.2151503 
+  150000    34.117585     2000    5.2745187 
+  151000    34.420995     2000    4.8959892 
+  152000    34.725788     2000    4.7600627 
+  153000    35.032001     2000    4.6944719 
+  154000    35.337093     2000    4.7647384 
+  155000    35.645299     2000     4.312228 
+  156000    35.953225     2000    3.8513036 
+  157000    36.258107     2000    3.8798947 
+  158000    36.570122     2000    3.7116749 
+  159000    36.880424     2000    3.7246469 
+  160000    37.187331     2000    3.8165318 
+  161000    37.491939     2000    3.8954595 
+  162000    37.806365     2000    4.0109691 
+  163000    38.122006     2000    3.3864369 
+  164000    38.437246     2000    3.4533589 
+  165000    38.753073     2000    3.4967205 
+  166000    39.068713     2000    3.5758702 
+  167000    39.376388     2000    2.8913997 
+  168000    39.685628     2000     2.507523 
+  169000     39.99294     2000    2.4910068 
+  170000    40.302393     2000    2.4992886 
+Loop time of 40.3024 on 4 procs for 150000 steps with 2000 atoms
+
+99.2% CPU use with 4 MPI tasks x no OpenMP threads
+
+MPI task timing breakdown:
+Section |  min time  |  avg time  |  max time  |%varavg| %total
+---------------------------------------------------------------
+Pair    | 7.9352     | 13.451     | 15.947     |  88.7 | 33.37
+Neigh   | 0.15394    | 0.23292    | 0.28243    |  10.0 |  0.58
+Comm    | 2.1471     | 3.534      | 4.4671     |  47.3 |  8.77
+Output  | 0.0070386  | 0.011774   | 0.021483   |   5.4 |  0.03
+Modify  | 10.816     | 14.404     | 16.047     |  55.2 | 35.74
+Other   |            | 8.669      |            |       | 21.51
+
+Nlocal:    500 ave 542 max 430 min
+Histogram: 1 0 0 0 0 0 1 0 1 1
+Nghost:    449.5 ave 679 max 208 min
+Histogram: 1 0 0 0 1 0 1 0 0 1
+Neighs:    4506.75 ave 5611 max 3508 min
+Histogram: 1 0 1 0 0 0 1 0 0 1
+
+Total # of neighbors = 18027
+Ave neighs/atom = 9.0135
+Neighbor list builds = 386
+Dangerous builds = 0
+
+# remove "plug" - need to redefine cylinder region & union
+
+region	  	cylreg delete
+region		hopreg delete
+region	    	cylreg cylinder z ${xc} ${yc} ${radconelo} 		${zcyllo} ${zconelo} side in units box 		open 1 open 2 #Bottom & top are open
+region	    	cylreg cylinder z 25 ${yc} ${radconelo} 		${zcyllo} ${zconelo} side in units box 		open 1 open 2 
+region	    	cylreg cylinder z 25 25 ${radconelo} 		${zcyllo} ${zconelo} side in units box 		open 1 open 2 
+region	    	cylreg cylinder z 25 25 2 		${zcyllo} ${zconelo} side in units box 		open 1 open 2 
+region	    	cylreg cylinder z 25 25 2 		0 ${zconelo} side in units box 		open 1 open 2 
+region	    	cylreg cylinder z 25 25 2 		0 10 side in units box 		open 1 open 2 
+
+region		hopreg union 2 cylreg conereg
+
+unfix		hopper3
+fix		hopper3 all wall/gran/region hertz/history 		${kn} ${kt} ${gamma_n} ${gamma_t} ${coeffFric} 1 region hopreg
+fix		hopper3 all wall/gran/region hertz/history 		72592.5925925926 ${kt} ${gamma_n} ${gamma_t} ${coeffFric} 1 region hopreg
+fix		hopper3 all wall/gran/region hertz/history 		72592.5925925926 90740.7407407408 ${gamma_n} ${gamma_t} ${coeffFric} 1 region hopreg
+fix		hopper3 all wall/gran/region hertz/history 		72592.5925925926 90740.7407407408 903.503751814138 ${gamma_t} ${coeffFric} 1 region hopreg
+fix		hopper3 all wall/gran/region hertz/history 		72592.5925925926 90740.7407407408 903.503751814138 451.751875907069 ${coeffFric} 1 region hopreg
+fix		hopper3 all wall/gran/region hertz/history 		72592.5925925926 90740.7407407408 903.503751814138 451.751875907069 0.5 1 region hopreg
+
+run		100000
+Memory usage per processor = 9.41929 Mbytes
+Step CPU Atoms KinEng 
+  170000            0     2000    2.4992886 
+  171000   0.30864286     2000    3.6052039 
+  172000   0.62273479     2000    4.8584577 
+  173000   0.94411087     2000    6.5620833 
+  174000    1.2588799     2000    8.8636423 
+  175000     1.574302     2000    11.743197 
+  176000     1.888201     2000     15.60405 
+  177000    2.1948938     2000     20.29426 
+  178000     2.508261     2000    25.069266 
+  179000    2.8257489     2000    31.340924 
+  180000    3.1444538     2000    38.454779 
+  181000    3.4541628     2000    46.488676 
+  182000    3.7632799     2000    55.279578 
+  183000    4.0711808     2000    65.192327 
+  184000     4.386853     2000    75.466011 
+  185000    4.7000408     2000     86.06934 
+  186000      5.00436     2000    97.157035 
+  187000    5.3041189     2000    108.92242 
+  188000     5.601872     2000    120.88599 
+  189000    5.9027078     2000    134.09884 
+  190000    6.2037618     2000    148.60143 
+  191000    6.4879329     2000    163.96898 
+  192000    6.7703898     2000    180.32931 
+  193000    7.0603459     2000    198.83575 
+  194000    7.3395619     2000    217.46631 
+  195000    7.6245389     2000    235.34916 
+  196000     7.911685     2000    253.61893 
+  197000    8.1976559     2000     271.3908 
+  198000     8.483418     2000    289.60064 
+  199000    8.7664149     2000    309.44306 
+  200000    9.0593698     2000     331.9367 
+  201000    9.3373818     2000    354.86646 
+  202000     9.612149     2000    380.56766 
+  203000    9.8876739     2000    406.97399 
+  204000    10.152671     2000    435.69917 
+  205000    10.415859     2000     465.1954 
+  206000     10.67967     2000     494.6045 
+  207000    10.941435     2000    522.71704 
+  208000    11.205367     2000    550.56072 
+  209000    11.471415     2000    580.10547 
+  210000    11.738137     2000    610.36222 
+  211000    12.006432     2000    641.99128 
+  212000    12.270102     2000     676.0736 
+  213000    12.531937     2000    711.70118 
+  214000    12.797442     2000    747.84561 
+  215000    13.062646     2000    785.59575 
+  216000     13.33019     2000    826.36549 
+  217000    13.598467     2000    868.35085 
+  218000    13.863022     2000    911.07041 
+  219000    14.127777     2000    953.70251 
+  220000    14.391496     2000     997.5717 
+  221000    14.655347     2000    1043.5565 
+  222000    14.923357     2000    1090.7944 
+  223000    15.193349     2000    1140.1324 
+  224000    15.462326     2000    1190.6956 
+  225000    15.729748     1999    1238.1536 
+  226000    15.996867     1998    1286.8076 
+  227000    16.261762     1995    1326.9895 
+  228000    16.527382     1989    1349.5997 
+  229000    16.788356     1984     1370.593 
+  230000     17.05426     1968    1344.3763 
+  231000    17.320126     1962    1363.7958 
+  232000     17.58387     1949    1340.1482 
+  233000    17.850221     1940     1348.409 
+  234000    18.116595     1929    1335.9703 
+  235000    18.383276     1918     1328.201 
+  236000    18.650066     1905    1309.6469 
+  237000    18.916963     1896    1292.9758 
+  238000    19.185209     1884    1266.3598 
+  239000    19.453402     1872    1221.0069 
+  240000    19.722178     1855    1166.1488 
+  241000     19.98987     1842    1126.9482 
+  242000    20.257783     1828     1107.128 
+  243000    20.523743     1815    1060.6573 
+  244000    20.793404     1805    1026.0259 
+  245000    21.061462     1797    1009.4924 
+  246000    21.325574     1790    995.26136 
+  247000    21.587046     1782    976.04886 
+  248000    21.840234     1778    989.11589 
+  249000     22.09455     1762    903.62508 
+  250000    22.356228     1748    852.03257 
+  251000    22.602243     1738    807.41049 
+  252000    22.852106     1722    738.82529 
+  253000    23.097209     1712    706.05657 
+  254000    23.341263     1696    626.53135 
+  255000     23.58614     1692    613.89548 
+  256000     23.83122     1686     598.9367 
+  257000    24.076937     1683    589.27487 
+  258000    24.321166     1681    591.42793 
+  259000    24.566143     1678    595.25383 
+  260000    24.820743     1677    617.50379 
+  261000    25.057835     1675    623.39319 
+  262000    25.294068     1673    627.08829 
+  263000    25.526724     1669    623.52963 
+  264000    25.766729     1667    626.44957 
+  265000    26.005453     1664    631.58936 
+  266000    26.244549     1660    605.22452 
+  267000    26.478879     1657    611.76935 
+  268000     26.71252     1655    611.73538 
+  269000    26.951368     1652    624.58227 
+  270000    27.186447     1648    625.97446 
+Loop time of 27.1865 on 4 procs for 100000 steps with 1648 atoms
+
+99.2% CPU use with 4 MPI tasks x no OpenMP threads
+
+MPI task timing breakdown:
+Section |  min time  |  avg time  |  max time  |%varavg| %total
+---------------------------------------------------------------
+Pair    | 4.6257     | 9.631      | 13.049     | 100.0 | 35.43
+Neigh   | 0.1522     | 0.17549    | 0.19588    |   4.3 |  0.65
+Comm    | 1.5797     | 2.7289     | 3.602      |  48.7 | 10.04
+Output  | 0.0014181  | 0.007208   | 0.016675   |   6.8 |  0.03
+Modify  | 7.7129     | 9.0949     | 10.256     |  31.9 | 33.45
+Other   |            | 5.549      |            |       | 20.41
+
+Nlocal:    412 ave 436 max 388 min
+Histogram: 1 1 0 0 0 0 0 0 1 1
+Nghost:    391 ave 629 max 158 min
+Histogram: 1 0 0 1 0 1 0 0 0 1
+Neighs:    3406 ave 4479 max 2040 min
+Histogram: 1 0 0 0 1 0 0 1 0 1
+
+Total # of neighbors = 13624
+Ave neighs/atom = 8.26699
+Neighbor list builds = 260
+Dangerous builds = 0
+Total wall time: 0:01:12
diff --git a/examples/granregion/log.6Oct16.granregion.mixer.g++.1 b/examples/granregion/log.6Oct16.granregion.mixer.g++.1
new file mode 100644
index 0000000000000000000000000000000000000000..3cfa3eb0fc1a801668bef6da8f3b29dad96c6198
--- /dev/null
+++ b/examples/granregion/log.6Oct16.granregion.mixer.g++.1
@@ -0,0 +1,609 @@
+LAMMPS (5 Oct 2016)
+variable	name string mixer
+
+thermo_modify	flush yes
+variable	seed equal 14314
+
+###############################################
+# Particle parameters
+################################################
+
+variable	rlo equal 0.3
+variable	rhi equal 0.6
+variable	dlo equal 2.0*${rlo}
+variable	dlo equal 2.0*0.3
+variable	dhi equal 2.0*${rhi}
+variable	dhi equal 2.0*0.6
+variable 	skin equal ${rhi}
+variable 	skin equal 0.6
+
+variable	coeffRes equal 0.1
+variable	coeffFric equal 0.5
+
+variable	kn equal 10^5
+variable	kt equal 0.2*${kn}
+variable	kt equal 0.2*100000
+
+variable	gravity equal 1.0
+variable	density equal 1.0
+
+variable	min_mass equal ${density}*4.0/3.0*PI*${rlo}*${rlo}*${rlo}
+variable	min_mass equal 1*4.0/3.0*PI*${rlo}*${rlo}*${rlo}
+variable	min_mass equal 1*4.0/3.0*PI*0.3*${rlo}*${rlo}
+variable	min_mass equal 1*4.0/3.0*PI*0.3*0.3*${rlo}
+variable	min_mass equal 1*4.0/3.0*PI*0.3*0.3*0.3
+variable	a equal (-2.0*log(${coeffRes})/PI)^2
+variable	a equal (-2.0*log(0.1)/PI)^2
+variable        gamma_n equal sqrt($a*2*${kn}/${min_mass}/(1+0.25*$a))
+variable        gamma_n equal sqrt(0.405284734569351*2*${kn}/${min_mass}/(1+0.25*$a))
+variable        gamma_n equal sqrt(0.405284734569351*2*100000/${min_mass}/(1+0.25*$a))
+variable        gamma_n equal sqrt(0.405284734569351*2*100000/0.113097335529233/(1+0.25*$a))
+variable        gamma_n equal sqrt(0.405284734569351*2*100000/0.113097335529233/(1+0.25*0.405284734569351))
+variable        gamma_t equal ${gamma_n}*0.5
+variable        gamma_t equal 806.699778405191*0.5
+
+variable	tcol equal PI/sqrt(2*${kn}/${min_mass}-${gamma_n}/4.0)
+variable	tcol equal PI/sqrt(2*100000/${min_mass}-${gamma_n}/4.0)
+variable	tcol equal PI/sqrt(2*100000/0.113097335529233-${gamma_n}/4.0)
+variable	tcol equal PI/sqrt(2*100000/0.113097335529233-806.699778405191/4.0)
+
+variable	dt equal ${tcol}*0.02
+variable	dt equal 0.00236257621510454*0.02
+timestep	${dt}
+timestep	4.72515243020908e-05
+
+###############################################
+
+variable	dumpfreq equal 1000
+variable	logfreq equal 1000
+
+newton 		on
+atom_style	sphere
+
+boundary	p p f
+
+region		boxreg block 0 20 0 20 0 20
+create_box	1 boxreg
+Created orthogonal box = (0 0 0) to (20 20 20)
+  1 by 1 by 1 MPI processor grid
+
+pair_style	gran/hertz/history 		${kn} ${kt} ${gamma_n} ${gamma_t} ${coeffFric} 1
+pair_style	gran/hertz/history 		100000 ${kt} ${gamma_n} ${gamma_t} ${coeffFric} 1
+pair_style	gran/hertz/history 		100000 20000 ${gamma_n} ${gamma_t} ${coeffFric} 1
+pair_style	gran/hertz/history 		100000 20000 806.699778405191 ${gamma_t} ${coeffFric} 1
+pair_style	gran/hertz/history 		100000 20000 806.699778405191 403.349889202595 ${coeffFric} 1
+pair_style	gran/hertz/history 		100000 20000 806.699778405191 403.349889202595 0.5 1
+pair_coeff	* *
+
+neighbor        ${skin} bin
+neighbor        0.6 bin
+thermo 		${logfreq}
+thermo 		1000
+
+comm_style	brick
+comm_modify 	mode multi group all vel yes
+balance		1.1 shift xyz 20 1.1
+Neighbor list info ...
+  2 neighbor list requests
+  update every 1 steps, delay 10 steps, check yes
+  max neighbors/atom: 2000, page size: 100000
+  master list distance cutoff = 0
+  ghost atom cutoff = 0
+  binsize = 20 -> bins = 1 1 1
+fix		bal all balance 10000 1.1 shift xyz 20 1.01
+
+####################### Options specific to pouring #########################
+
+region	     	insreg cylinder z 10 10 8 10 18 side in units box
+region	    	cylreg cylinder z 10 10 10 0 20 side in units box
+
+variable	theta equal (step/400000)*2*PI
+
+region          b1 block 2 18 9 11 0 4 side out                 rotate v_theta 10 10 0 0 0 1 units box
+region          b2 block 9 11 2 18 0 3.99999 side out                 rotate v_theta 10 10 0 0 0 1 units box
+
+region		mixer intersect 3 cylreg b1 b2 side in
+
+fix		grav all gravity ${gravity} vector 0 0 -1
+fix		grav all gravity 1 vector 0 0 -1
+fix		1 all nve/sphere
+
+fix		mixwall all wall/gran/region hertz/history                 ${kn} ${kt} ${gamma_n} ${gamma_t} ${coeffFric} 1 region mixer
+fix		mixwall all wall/gran/region hertz/history                 100000 ${kt} ${gamma_n} ${gamma_t} ${coeffFric} 1 region mixer
+fix		mixwall all wall/gran/region hertz/history                 100000 20000 ${gamma_n} ${gamma_t} ${coeffFric} 1 region mixer
+fix		mixwall all wall/gran/region hertz/history                 100000 20000 806.699778405191 ${gamma_t} ${coeffFric} 1 region mixer
+fix		mixwall all wall/gran/region hertz/history                 100000 20000 806.699778405191 403.349889202595 ${coeffFric} 1 region mixer
+fix		mixwall all wall/gran/region hertz/history                 100000 20000 806.699778405191 403.349889202595 0.5 1 region mixer
+
+fix		ins all pour 1000 1 42424 region insreg 		diam range ${dlo} ${dhi} dens ${density} ${density}
+fix		ins all pour 1000 1 42424 region insreg 		diam range 0.6 ${dhi} dens ${density} ${density}
+fix		ins all pour 1000 1 42424 region insreg 		diam range 0.6 1.2 dens ${density} ${density}
+fix		ins all pour 1000 1 42424 region insreg 		diam range 0.6 1.2 dens 1 ${density}
+fix		ins all pour 1000 1 42424 region insreg 		diam range 0.6 1.2 dens 1 1
+Particle insertion: 444 every 84653 steps, 1000 by step 169307
+
+#dump		1 all custom ${dumpfreq} ${name}_pour.dump #		id type mass diameter x y z
+
+#dump		2 all image 4000 image.*.jpg type type #		axes yes 0.8 0.02 view 60 -30 zoom 1.5 #                box no 0.0 axes no 0.0 0.0
+#dump_modify	2 pad 6
+
+thermo_style	custom step cpu atoms ke v_theta
+WARNING: New thermo_style command, previous thermo_modify settings will be lost (../output.cpp:690)
+thermo_modify	flush yes lost warn
+
+run		200000
+Neighbor list info ...
+  2 neighbor list requests
+  update every 1 steps, delay 10 steps, check yes
+  max neighbors/atom: 2000, page size: 100000
+  master list distance cutoff = 1.8
+  ghost atom cutoff = 1.8
+  binsize = 0.9 -> bins = 23 23 23
+Memory usage per processor = 2.80779 Mbytes
+Step CPU Atoms KinEng v_theta 
+       0            0        0           -0            0 
+    1000   0.16771817      444           -0  0.015707963 
+    2000   0.33019304      444           -0  0.031415927 
+    3000    0.4894321      444           -0   0.04712389 
+    4000   0.64879322      444           -0  0.062831853 
+    5000   0.80816507      444           -0  0.078539816 
+    6000   0.96711302      444           -0   0.09424778 
+    7000    1.1265812      444           -0   0.10995574 
+    8000     1.286129      444           -0   0.12566371 
+    9000     1.445487      444           -0   0.14137167 
+   10000    1.6056392      444           -0   0.15707963 
+   11000    1.7650061      444           -0    0.1727876 
+   12000    1.9249642      444           -0   0.18849556 
+   13000    2.0851831      444           -0   0.20420352 
+   14000     2.244523      444           -0   0.21991149 
+   15000    2.4043641      444           -0   0.23561945 
+   16000    2.5638251      444           -0   0.25132741 
+   17000    2.7155962      444           -0   0.26703538 
+   18000     2.866904      444           -0   0.28274334 
+   19000    3.0188181      444           -0    0.2984513 
+   20000      3.17047      444           -0   0.31415927 
+   21000    3.3214712      444           -0   0.32986723 
+   22000     3.472692      444           -0   0.34557519 
+   23000    3.6240032      444           -0   0.36128316 
+   24000    3.7753551      444           -0   0.37699112 
+   25000     3.926239      444           -0   0.39269908 
+   26000    4.0782132      444           -0   0.40840704 
+   27000    4.2301712      444           -0   0.42411501 
+   28000     4.382267      444           -0   0.43982297 
+   29000    4.5339992      444           -0   0.45553093 
+   30000    4.6860211      444           -0    0.4712389 
+   31000    4.8376751      444           -0   0.48694686 
+   32000     4.989748      444           -0   0.50265482 
+   33000    5.1418142      444           -0   0.51836279 
+   34000     5.294476      444           -0   0.53407075 
+   35000    5.4472861      444           -0   0.54977871 
+   36000    5.5999811      444           -0   0.56548668 
+   37000    5.7526181      444           -0   0.58119464 
+   38000    5.9061031      444           -0    0.5969026 
+   39000    6.0593271      444           -0   0.61261057 
+   40000    6.2123802      444           -0   0.62831853 
+   41000    6.3652351      444           -0   0.64402649 
+   42000    6.5186551      444           -0   0.65973446 
+   43000     6.672132      444           -0   0.67544242 
+   44000    6.8245611      444           -0   0.69115038 
+   45000    6.9778051      444           -0   0.70685835 
+   46000     7.131258      444           -0   0.72256631 
+   47000    7.2841291      444           -0   0.73827427 
+   48000    7.4379101      444           -0   0.75398224 
+   49000       7.5915      444           -0    0.7696902 
+   50000    7.7461231      444           -0   0.78539816 
+   51000    7.9047191      444           -0   0.80110613 
+   52000    8.0634432      444           -0   0.81681409 
+   53000    8.2226322      444           -0   0.83252205 
+   54000    8.3817451      444           -0   0.84823002 
+   55000    8.5419021      444           -0   0.86393798 
+   56000     8.701194      444           -0   0.87964594 
+   57000    8.8613491      444           -0   0.89535391 
+   58000    9.0211501      444           -0   0.91106187 
+   59000     9.180917      444           -0   0.92676983 
+   60000     9.341964      444           -0    0.9424778 
+   61000    9.5026722      444           -0   0.95818576 
+   62000    9.6630561      444           -0   0.97389372 
+   63000    9.8236201      444           -0   0.98960169 
+   64000    9.9854801      444           -0    1.0053096 
+   65000    10.148318      444           -0    1.0210176 
+   66000    10.311267      444           -0    1.0367256 
+   67000    10.476498      444           -0    1.0524335 
+   68000    10.640768      444           -0    1.0681415 
+   69000    10.804709      444           -0    1.0838495 
+   70000    10.969271      444           -0    1.0995574 
+   71000    11.133451      444           -0    1.1152654 
+   72000    11.299253      444           -0    1.1309734 
+   73000    11.463999      444           -0    1.1466813 
+   74000     11.62903      444           -0    1.1623893 
+   75000    11.795109      444           -0    1.1780972 
+   76000    11.962154      444           -0    1.1938052 
+   77000      12.1292      444           -0    1.2095132 
+   78000    12.298106      444           -0    1.2252211 
+   79000     12.46744      444           -0    1.2409291 
+   80000    12.637916      444           -0    1.2566371 
+   81000    12.808494      444           -0     1.272345 
+   82000     12.97813      444           -0     1.288053 
+   83000    13.149135      444           -0     1.303761 
+   84000     13.32082      444           -0    1.3194689 
+   85000     13.56205      888           -0    1.3351769 
+   86000    13.908699      888           -0    1.3508848 
+   87000    14.254615      888           -0    1.3665928 
+   88000    14.600851      888           -0    1.3823008 
+   89000    14.946295      888           -0    1.3980087 
+   90000    15.291315      888           -0    1.4137167 
+   91000    15.637396      888           -0    1.4294247 
+   92000    15.981426      888           -0    1.4451326 
+   93000    16.327519      888           -0    1.4608406 
+   94000    16.675434      888           -0    1.4765485 
+   95000    17.023515      888           -0    1.4922565 
+   96000    17.372152      888           -0    1.5079645 
+   97000    17.719346      888           -0    1.5236724 
+   98000    18.067159      888           -0    1.5393804 
+   99000    18.414599      888           -0    1.5550884 
+  100000    18.764775      888           -0    1.5707963 
+  101000    19.114239      888           -0    1.5865043 
+  102000    19.464285      888           -0    1.6022123 
+  103000    19.813956      888           -0    1.6179202 
+  104000    20.163276      888           -0    1.6336282 
+  105000    20.553808      888           -0    1.6493361 
+  106000    20.904093      888           -0    1.6650441 
+  107000     21.25918      888           -0    1.6807521 
+  108000    21.615056      888           -0      1.69646 
+  109000    21.971067      888           -0     1.712168 
+  110000    22.326407      888           -0     1.727876 
+  111000     22.68062      888           -0    1.7435839 
+  112000     23.03653      888           -0    1.7592919 
+  113000     23.39161      888           -0    1.7749998 
+  114000    23.751273      888           -0    1.7907078 
+  115000    24.106946      888           -0    1.8064158 
+  116000    24.461182      888           -0    1.8221237 
+  117000    24.797533      888           -0    1.8378317 
+  118000    25.133924      888           -0    1.8535397 
+  119000    25.472617      888           -0    1.8692476 
+  120000    25.810786      888           -0    1.8849556 
+  121000    26.147399      888           -0    1.9006636 
+  122000    26.485868      888           -0    1.9163715 
+  123000     26.82395      888           -0    1.9320795 
+  124000    27.162345      888           -0    1.9477874 
+  125000    27.501503      888           -0    1.9634954 
+  126000    27.843318      888           -0    1.9792034 
+  127000    28.183379      888           -0    1.9949113 
+  128000    28.525406      888           -0    2.0106193 
+  129000    28.869601      888           -0    2.0263273 
+  130000    29.216232      888           -0    2.0420352 
+  131000    29.562432      888           -0    2.0577432 
+  132000     29.95624      888           -0    2.0734512 
+  133000    30.308919      888           -0    2.0891591 
+  134000    30.662184      888           -0    2.1048671 
+  135000    31.015509      888           -0     2.120575 
+  136000    31.366132      888           -0     2.136283 
+  137000     31.71887      888           -0     2.151991 
+  138000      32.0723      888           -0    2.1676989 
+  139000    32.428657      888           -0    2.1834069 
+  140000    32.781484      888           -0    2.1991149 
+  141000    33.133593      888           -0    2.2148228 
+  142000    33.487376      888           -0    2.2305308 
+  143000    33.838656      888           -0    2.2462387 
+  144000    34.188723      888           -0    2.2619467 
+  145000    34.540083      888           -0    2.2776547 
+  146000    34.895624      888           -0    2.2933626 
+  147000     35.25153      888           -0    2.3090706 
+  148000    35.607482      888           -0    2.3247786 
+  149000      35.9642      888           -0    2.3404865 
+  150000    36.321759      888           -0    2.3561945 
+  151000    36.667172      888           -0    2.3719025 
+  152000    37.013822      888           -0    2.3876104 
+  153000    37.362735      888           -0    2.4033184 
+  154000    37.712576      888           -0    2.4190263 
+  155000    38.063528      888           -0    2.4347343 
+  156000    38.414666      888           -0    2.4504423 
+  157000    38.766119      888           -0    2.4661502 
+  158000    39.115828      888           -0    2.4818582 
+  159000    39.470874      888           -0    2.4975662 
+  160000    39.827871      888           -0    2.5132741 
+  161000    40.184885      888           -0    2.5289821 
+  162000    40.543838      888           -0      2.54469 
+  163000    40.901814      888           -0     2.560398 
+  164000    41.258631      888           -0     2.576106 
+  165000    41.619086      888           -0    2.5918139 
+  166000    41.977332      888           -0    2.6075219 
+  167000     42.33775      888           -0    2.6232299 
+  168000    42.701344      888           -0    2.6389378 
+  169000    43.067663      888           -0    2.6546458 
+  170000    43.461687     1000           -0    2.6703538 
+  171000    43.866086     1000           -0    2.6860617 
+  172000    44.271406     1000           -0    2.7017697 
+  173000    44.677085     1000           -0    2.7174776 
+  174000    45.082441     1000           -0    2.7331856 
+  175000    45.491593     1000           -0    2.7488936 
+  176000    45.903002     1000           -0    2.7646015 
+  177000    46.315031     1000           -0    2.7803095 
+  178000    46.726531     1000           -0    2.7960175 
+  179000    47.140818     1000           -0    2.8117254 
+  180000    47.553784     1000           -0    2.8274334 
+  181000    47.964021     1000           -0    2.8431414 
+  182000    48.376739     1000           -0    2.8588493 
+  183000    48.789612     1000           -0    2.8745573 
+  184000    49.204073     1000           -0    2.8902652 
+  185000    49.642401     1000           -0    2.9059732 
+  186000    50.083479     1000           -0    2.9216812 
+  187000    50.523357     1000           -0    2.9373891 
+  188000    50.963685     1000           -0    2.9530971 
+  189000    51.404166     1000           -0    2.9688051 
+  190000    51.849094     1000           -0     2.984513 
+  191000    52.291805     1000           -0     3.000221 
+  192000    52.731855     1000           -0    3.0159289 
+  193000    53.174104     1000           -0    3.0316369 
+  194000    53.619739     1000           -0    3.0473449 
+  195000    54.061019     1000           -0    3.0630528 
+  196000    54.501149     1000           -0    3.0787608 
+  197000    54.940486     1000           -0    3.0944688 
+  198000    55.381843     1000           -0    3.1101767 
+  199000    55.822243     1000           -0    3.1258847 
+  200000    56.264319     1000           -0    3.1415927 
+Loop time of 56.2643 on 1 procs for 200000 steps with 1000 atoms
+
+Performance: 14511.970 tau/day, 3554.650 timesteps/s
+99.9% CPU use with 1 MPI tasks x no OpenMP threads
+
+MPI task timing breakdown:
+Section |  min time  |  avg time  |  max time  |%varavg| %total
+---------------------------------------------------------------
+Pair    | 4.6309     | 4.6309     | 4.6309     |   0.0 |  8.23
+Neigh   | 0.071456   | 0.071456   | 0.071456   |   0.0 |  0.13
+Comm    | 0.50064    | 0.50064    | 0.50064    |   0.0 |  0.89
+Output  | 0.0039163  | 0.0039163  | 0.0039163  |   0.0 |  0.01
+Modify  | 50.189     | 50.189     | 50.189     |   0.0 | 89.20
+Other   |            | 0.8688     |            |       |  1.54
+
+Nlocal:    1000 ave 1000 max 1000 min
+Histogram: 1 0 0 0 0 0 0 0 0 0
+Nghost:    183 ave 183 max 183 min
+Histogram: 1 0 0 0 0 0 0 0 0 0
+Neighs:    3926 ave 3926 max 3926 min
+Histogram: 1 0 0 0 0 0 0 0 0 0
+
+Total # of neighbors = 3926
+Ave neighs/atom = 3.926
+Neighbor list builds = 217
+Dangerous builds = 0
+unfix 		ins
+run		200000
+Neighbor list info ...
+  2 neighbor list requests
+  update every 1 steps, delay 10 steps, check yes
+  max neighbors/atom: 2000, page size: 100000
+  master list distance cutoff = 1.79826
+  ghost atom cutoff = 1.79826
+  binsize = 0.899132 -> bins = 23 23 23
+Memory usage per processor = 8.62017 Mbytes
+Step CPU Atoms KinEng v_theta 
+  200000            0     1000   0.90078559    3.1415927 
+  201000   0.44072509     1000   0.90377135    3.1573006 
+  202000    0.8800211     1000   0.89194106    3.1730086 
+  203000    1.3210881     1000    0.8940532    3.1887165 
+  204000     1.762887     1000    0.8967696    3.2044245 
+  205000    2.2080901     1000   0.89758718    3.2201325 
+  206000    2.6548181     1000   0.89434418    3.2358404 
+  207000    3.1002531     1000   0.87633906    3.2515484 
+  208000     3.547334     1000   0.86721615    3.2672564 
+  209000     3.993988     1000   0.86214817    3.2829643 
+  210000    4.4423161     1000   0.85463743    3.2986723 
+  211000     4.889446     1000   0.85744914    3.3143802 
+  212000    5.3357229     1000   0.84702799    3.3300882 
+  213000     5.780273     1000   0.84375104    3.3457962 
+  214000    6.2249129     1000   0.83820701    3.3615041 
+  215000     6.670651     1000   0.83566708    3.3772121 
+  216000     7.113143     1000   0.83620798    3.3929201 
+  217000    7.5359521     1000   0.83581605     3.408628 
+  218000    7.9623129     1000   0.84045719     3.424336 
+  219000    8.3878851     1000   0.85410521     3.440044 
+  220000    8.8153811     1000   0.84336839    3.4557519 
+  221000     9.244349     1000   0.85145747    3.4714599 
+  222000    9.6728511     1000    0.8476916    3.4871678 
+  223000    10.104052     1000    0.8412701    3.5028758 
+  224000    10.532736     1000    0.8390277    3.5185838 
+  225000    10.959564     1000    0.8359107    3.5342917 
+  226000     11.38617     1000   0.83920631    3.5499997 
+  227000    11.814104     1000   0.83930526    3.5657077 
+  228000    12.241758     1000   0.83152308    3.5814156 
+  229000     12.67198     1000   0.81211079    3.5971236 
+  230000    13.101597     1000   0.80395018    3.6128316 
+  231000    13.532943     1000   0.79991397    3.6285395 
+  232000    13.969412     1000   0.80828959    3.6442475 
+  233000    14.403885     1000   0.80892923    3.6599554 
+  234000    14.833452     1000   0.82048914    3.6756634 
+  235000    15.266211     1000    0.8174713    3.6913714 
+  236000    15.697822     1000   0.81898551    3.7070793 
+  237000    16.133023     1000   0.82034714    3.7227873 
+  238000    16.569559     1000   0.81950728    3.7384953 
+  239000    17.006308     1000   0.82152915    3.7542032 
+  240000    17.445493     1000   0.83217597    3.7699112 
+  241000    17.885585     1000   0.83464253    3.7856191 
+  242000    18.324268     1000   0.84326166    3.8013271 
+  243000    18.763748     1000   0.84235055    3.8170351 
+  244000    19.203869     1000   0.83325408     3.832743 
+  245000       19.645     1000   0.82577315     3.848451 
+  246000     20.08666     1000   0.83923456     3.864159 
+  247000    20.530596     1000   0.84153419    3.8798669 
+  248000    20.971984     1000   0.85768309    3.8955749 
+  249000    21.413571     1000   0.86910799    3.9112829 
+  250000    21.854153     1000    0.8775521    3.9269908 
+  251000    22.302884     1000   0.87299296    3.9426988 
+  252000    22.753789     1000   0.86613861    3.9584067 
+  253000    23.202458     1000   0.85513456    3.9741147 
+  254000    23.655372     1000   0.84629733    3.9898227 
+  255000    24.108225     1000   0.84154885    4.0055306 
+  256000    24.561535     1000   0.84162715    4.0212386 
+  257000    25.012338     1000   0.83959672    4.0369466 
+  258000    25.466506     1000   0.83577695    4.0526545 
+  259000    25.919168     1000   0.83021368    4.0683625 
+  260000     26.37215     1000   0.81106893    4.0840704 
+  261000    26.823834     1000   0.79884608    4.0997784 
+  262000    27.276505     1000   0.78360303    4.1154864 
+  263000    27.728503     1000   0.77030843    4.1311943 
+  264000    28.181969     1000   0.76127974    4.1469023 
+  265000    28.636329     1000   0.75553065    4.1626103 
+  266000    29.090593     1000   0.75332019    4.1783182 
+  267000    29.549547     1000   0.74670528    4.1940262 
+  268000    30.008774     1000   0.74216141    4.2097342 
+  269000    30.463826     1000   0.74564756    4.2254421 
+  270000    30.920159     1000    0.7416035    4.2411501 
+  271000    31.377192     1000   0.73061389     4.256858 
+  272000    31.836268     1000   0.71620113     4.272566 
+  273000    32.291662     1000   0.70840181     4.288274 
+  274000    32.743646     1000   0.70946906    4.3039819 
+  275000    33.197723     1000   0.70418049    4.3196899 
+  276000    33.651405     1000   0.69591327    4.3353979 
+  277000    34.106289     1000   0.69499716    4.3511058 
+  278000    34.564324     1000   0.69242545    4.3668138 
+  279000    35.020887     1000   0.69690811    4.3825218 
+  280000    35.478222     1000   0.70402124    4.3982297 
+  281000    35.938226     1000   0.71936578    4.4139377 
+  282000     36.39808     1000   0.72439386    4.4296456 
+  283000    36.855587     1000   0.72221632    4.4453536 
+  284000    37.309629     1000   0.70387029    4.4610616 
+  285000    37.791869     1000   0.70505716    4.4767695 
+  286000    38.277853     1000   0.70731734    4.4924775 
+  287000    38.764774     1000   0.71149743    4.5081855 
+  288000     39.24815     1000   0.70994023    4.5238934 
+  289000    39.728005     1000   0.69794225    4.5396014 
+  290000    40.206798     1000    0.6905751    4.5553093 
+  291000    40.678802     1000   0.68652972    4.5710173 
+  292000    41.147991     1000    0.6743341    4.5867253 
+  293000    41.618836     1000   0.67357205    4.6024332 
+  294000     42.08982     1000   0.66465346    4.6181412 
+  295000    42.561323     1000   0.65587678    4.6338492 
+  296000    43.034196     1000   0.65455827    4.6495571 
+  297000    43.505748     1000   0.65135145    4.6652651 
+  298000    43.975299     1000   0.65400349    4.6809731 
+  299000    44.447556     1000   0.66186899     4.696681 
+  300000    44.926073     1000   0.66844193     4.712389 
+  301000    45.402658     1000   0.67720506    4.7280969 
+  302000    45.880643     1000   0.68554918    4.7438049 
+  303000    46.359444     1000   0.69321489    4.7595129 
+  304000    46.841542     1000   0.70345329    4.7752208 
+  305000    47.323539     1000   0.70172137    4.7909288 
+  306000    47.809358     1000   0.70989191    4.8066368 
+  307000    48.291664     1000   0.70546377    4.8223447 
+  308000    48.770327     1000   0.70820389    4.8380527 
+  309000    49.248974     1000   0.69637815    4.8537606 
+  310000     49.72965     1000   0.68679532    4.8694686 
+  311000    50.204503     1000   0.68824984    4.8851766 
+  312000    50.683502     1000   0.68647935    4.9008845 
+  313000    51.161407     1000   0.68289956    4.9165925 
+  314000    51.638365     1000   0.68356788    4.9323005 
+  315000    52.114341     1000   0.68269829    4.9480084 
+  316000    52.590791     1000   0.67961769    4.9637164 
+  317000    53.043198     1000   0.67437047    4.9794244 
+  318000    53.499062     1000   0.66534726    4.9951323 
+  319000    53.954004     1000   0.66052125    5.0108403 
+  320000    54.409776     1000   0.65351962    5.0265482 
+  321000    54.867935     1000   0.64155441    5.0422562 
+  322000    55.324528     1000   0.63463177    5.0579642 
+  323000    55.780399     1000   0.62945691    5.0736721 
+  324000    56.239189     1000   0.63156746    5.0893801 
+  325000    56.697767     1000   0.63883759    5.1050881 
+  326000    57.155746     1000   0.64703516     5.120796 
+  327000    57.618744     1000   0.65532057     5.136504 
+  328000    58.083021     1000   0.66697061     5.152212 
+  329000    58.547646     1000   0.66896271    5.1679199 
+  330000    59.011518     1000   0.66551963    5.1836279 
+  331000    59.478689     1000   0.65083894    5.1993358 
+  332000     59.94887     1000   0.65171641    5.2150438 
+  333000    60.416096     1000   0.65122777    5.2307518 
+  334000    60.889826     1000   0.65844334    5.2464597 
+  335000    61.363105     1000   0.66931264    5.2621677 
+  336000    61.832482     1000   0.66847415    5.2778757 
+  337000    62.300731     1000   0.65863495    5.2935836 
+  338000    62.769011     1000   0.64977739    5.3092916 
+  339000    63.232862     1000    0.6454395    5.3249995 
+  340000    63.699228     1000   0.63484999    5.3407075 
+  341000    64.165101     1000   0.62753448    5.3564155 
+  342000    64.631118     1000   0.62781442    5.3721234 
+  343000    65.099469     1000   0.63813963    5.3878314 
+  344000    65.576568     1000    0.6485183    5.4035394 
+  345000    66.054068     1000   0.67111606    5.4192473 
+  346000    66.531747     1000   0.68435581    5.4349553 
+  347000    67.007296     1000   0.69526046    5.4506633 
+  348000    67.478242     1000    0.6876531    5.4663712 
+  349000    67.944422     1000   0.67962108    5.4820792 
+  350000    68.410281     1000    0.6800934    5.4977871 
+  351000    68.862112     1000   0.67658657    5.5134951 
+  352000    69.316476     1000   0.67043355    5.5292031 
+  353000     69.76356     1000   0.66863154     5.544911 
+  354000    70.212144     1000   0.65806572     5.560619 
+  355000    70.658375     1000    0.6498301     5.576327 
+  356000    71.103688     1000   0.64384284    5.5920349 
+  357000    71.551545     1000   0.64228421    5.6077429 
+  358000    72.001238     1000    0.6408188    5.6234508 
+  359000     72.45158     1000   0.64388002    5.6391588 
+  360000    72.906369     1000   0.64347896    5.6548668 
+  361000    73.358316     1000   0.65055455    5.6705747 
+  362000    73.814119     1000   0.65545061    5.6862827 
+  363000    74.277034     1000    0.6667431    5.7019907 
+  364000    74.737593     1000    0.6869856    5.7176986 
+  365000     75.20209     1000   0.69651407    5.7334066 
+  366000    75.667448     1000   0.70824091    5.7491146 
+  367000    76.132389     1000    0.7144853    5.7648225 
+  368000    76.596067     1000   0.71780876    5.7805305 
+  369000    77.059749     1000    0.7159398    5.7962384 
+  370000    77.519236     1000   0.70648968    5.8119464 
+  371000    77.977404     1000   0.69796557    5.8276544 
+  372000    78.434017     1000   0.69876891    5.8433623 
+  373000    78.887217     1000   0.70908957    5.8590703 
+  374000    79.341658     1000   0.70831124    5.8747783 
+  375000    79.802381     1000   0.70631178    5.8904862 
+  376000    80.265165     1000   0.70533876    5.9061942 
+  377000    80.727821     1000   0.70097225    5.9219022 
+  378000    81.187538     1000   0.70139806    5.9376101 
+  379000    81.645627     1000   0.69691027    5.9533181 
+  380000    82.105692     1000   0.69163881     5.969026 
+  381000     82.56483     1000   0.68973183     5.984734 
+  382000    83.025126     1000   0.68059207     6.000442 
+  383000    83.482786     1000   0.68096466    6.0161499 
+  384000    83.939808     1000    0.6698933    6.0318579 
+  385000    84.418408     1000   0.66795846    6.0475659 
+  386000    84.898757     1000   0.66153854    6.0632738 
+  387000    85.376756     1000   0.66560025    6.0789818 
+  388000    85.853575     1000   0.66671699    6.0946897 
+  389000     86.32865     1000   0.66013733    6.1103977 
+  390000    86.807772     1000   0.66181942    6.1261057 
+  391000    87.290335     1000   0.66281334    6.1418136 
+  392000    87.773899     1000   0.66657879    6.1575216 
+  393000    88.248567     1000   0.66608992    6.1732296 
+  394000    88.723817     1000   0.66128929    6.1889375 
+  395000    89.200089     1000   0.65764538    6.2046455 
+  396000    89.671826     1000   0.65073015    6.2203535 
+  397000    90.142595     1000   0.64967355    6.2360614 
+  398000    90.616654     1000   0.65193957    6.2517694 
+  399000    91.093856     1000   0.64936977    6.2674773 
+  400000    91.571678     1000   0.65849743    6.2831853 
+Loop time of 91.5717 on 1 procs for 200000 steps with 1000 atoms
+
+Performance: 8916.580 tau/day, 2184.081 timesteps/s
+99.9% CPU use with 1 MPI tasks x no OpenMP threads
+
+MPI task timing breakdown:
+Section |  min time  |  avg time  |  max time  |%varavg| %total
+---------------------------------------------------------------
+Pair    | 13.827     | 13.827     | 13.827     |   0.0 | 15.10
+Neigh   | 0.097679   | 0.097679   | 0.097679   |   0.0 |  0.11
+Comm    | 1.5668     | 1.5668     | 1.5668     |   0.0 |  1.71
+Output  | 0.0042615  | 0.0042615  | 0.0042615  |   0.0 |  0.00
+Modify  | 74.804     | 74.804     | 74.804     |   0.0 | 81.69
+Other   |            | 1.273      |            |       |  1.39
+
+Nlocal:    1000 ave 1000 max 1000 min
+Histogram: 1 0 0 0 0 0 0 0 0 0
+Nghost:    289 ave 289 max 289 min
+Histogram: 1 0 0 0 0 0 0 0 0 0
+Neighs:    5091 ave 5091 max 5091 min
+Histogram: 1 0 0 0 0 0 0 0 0 0
+
+Total # of neighbors = 5091
+Ave neighs/atom = 5.091
+Neighbor list builds = 160
+Dangerous builds = 0
+Total wall time: 0:02:27
diff --git a/examples/granregion/log.6Oct16.granregion.mixer.g++.4 b/examples/granregion/log.6Oct16.granregion.mixer.g++.4
new file mode 100644
index 0000000000000000000000000000000000000000..726b31f8fe5e0ce08dedb2ee3bb64bc974f407be
--- /dev/null
+++ b/examples/granregion/log.6Oct16.granregion.mixer.g++.4
@@ -0,0 +1,609 @@
+LAMMPS (5 Oct 2016)
+variable	name string mixer
+
+thermo_modify	flush yes
+variable	seed equal 14314
+
+###############################################
+# Particle parameters
+################################################
+
+variable	rlo equal 0.3
+variable	rhi equal 0.6
+variable	dlo equal 2.0*${rlo}
+variable	dlo equal 2.0*0.3
+variable	dhi equal 2.0*${rhi}
+variable	dhi equal 2.0*0.6
+variable 	skin equal ${rhi}
+variable 	skin equal 0.6
+
+variable	coeffRes equal 0.1
+variable	coeffFric equal 0.5
+
+variable	kn equal 10^5
+variable	kt equal 0.2*${kn}
+variable	kt equal 0.2*100000
+
+variable	gravity equal 1.0
+variable	density equal 1.0
+
+variable	min_mass equal ${density}*4.0/3.0*PI*${rlo}*${rlo}*${rlo}
+variable	min_mass equal 1*4.0/3.0*PI*${rlo}*${rlo}*${rlo}
+variable	min_mass equal 1*4.0/3.0*PI*0.3*${rlo}*${rlo}
+variable	min_mass equal 1*4.0/3.0*PI*0.3*0.3*${rlo}
+variable	min_mass equal 1*4.0/3.0*PI*0.3*0.3*0.3
+variable	a equal (-2.0*log(${coeffRes})/PI)^2
+variable	a equal (-2.0*log(0.1)/PI)^2
+variable        gamma_n equal sqrt($a*2*${kn}/${min_mass}/(1+0.25*$a))
+variable        gamma_n equal sqrt(0.405284734569351*2*${kn}/${min_mass}/(1+0.25*$a))
+variable        gamma_n equal sqrt(0.405284734569351*2*100000/${min_mass}/(1+0.25*$a))
+variable        gamma_n equal sqrt(0.405284734569351*2*100000/0.113097335529233/(1+0.25*$a))
+variable        gamma_n equal sqrt(0.405284734569351*2*100000/0.113097335529233/(1+0.25*0.405284734569351))
+variable        gamma_t equal ${gamma_n}*0.5
+variable        gamma_t equal 806.699778405191*0.5
+
+variable	tcol equal PI/sqrt(2*${kn}/${min_mass}-${gamma_n}/4.0)
+variable	tcol equal PI/sqrt(2*100000/${min_mass}-${gamma_n}/4.0)
+variable	tcol equal PI/sqrt(2*100000/0.113097335529233-${gamma_n}/4.0)
+variable	tcol equal PI/sqrt(2*100000/0.113097335529233-806.699778405191/4.0)
+
+variable	dt equal ${tcol}*0.02
+variable	dt equal 0.00236257621510454*0.02
+timestep	${dt}
+timestep	4.72515243020908e-05
+
+###############################################
+
+variable	dumpfreq equal 1000
+variable	logfreq equal 1000
+
+newton 		on
+atom_style	sphere
+
+boundary	p p f
+
+region		boxreg block 0 20 0 20 0 20
+create_box	1 boxreg
+Created orthogonal box = (0 0 0) to (20 20 20)
+  1 by 2 by 2 MPI processor grid
+
+pair_style	gran/hertz/history 		${kn} ${kt} ${gamma_n} ${gamma_t} ${coeffFric} 1
+pair_style	gran/hertz/history 		100000 ${kt} ${gamma_n} ${gamma_t} ${coeffFric} 1
+pair_style	gran/hertz/history 		100000 20000 ${gamma_n} ${gamma_t} ${coeffFric} 1
+pair_style	gran/hertz/history 		100000 20000 806.699778405191 ${gamma_t} ${coeffFric} 1
+pair_style	gran/hertz/history 		100000 20000 806.699778405191 403.349889202595 ${coeffFric} 1
+pair_style	gran/hertz/history 		100000 20000 806.699778405191 403.349889202595 0.5 1
+pair_coeff	* *
+
+neighbor        ${skin} bin
+neighbor        0.6 bin
+thermo 		${logfreq}
+thermo 		1000
+
+comm_style	brick
+comm_modify 	mode multi group all vel yes
+balance		1.1 shift xyz 20 1.1
+Neighbor list info ...
+  2 neighbor list requests
+  update every 1 steps, delay 10 steps, check yes
+  max neighbors/atom: 2000, page size: 100000
+  master list distance cutoff = 0
+  ghost atom cutoff = 0
+  binsize = 20 -> bins = 1 1 1
+fix		bal all balance 10000 1.1 shift xyz 20 1.01
+
+####################### Options specific to pouring #########################
+
+region	     	insreg cylinder z 10 10 8 10 18 side in units box
+region	    	cylreg cylinder z 10 10 10 0 20 side in units box
+
+variable	theta equal (step/400000)*2*PI
+
+region          b1 block 2 18 9 11 0 4 side out                 rotate v_theta 10 10 0 0 0 1 units box
+region          b2 block 9 11 2 18 0 3.99999 side out                 rotate v_theta 10 10 0 0 0 1 units box
+
+region		mixer intersect 3 cylreg b1 b2 side in
+
+fix		grav all gravity ${gravity} vector 0 0 -1
+fix		grav all gravity 1 vector 0 0 -1
+fix		1 all nve/sphere
+
+fix		mixwall all wall/gran/region hertz/history                 ${kn} ${kt} ${gamma_n} ${gamma_t} ${coeffFric} 1 region mixer
+fix		mixwall all wall/gran/region hertz/history                 100000 ${kt} ${gamma_n} ${gamma_t} ${coeffFric} 1 region mixer
+fix		mixwall all wall/gran/region hertz/history                 100000 20000 ${gamma_n} ${gamma_t} ${coeffFric} 1 region mixer
+fix		mixwall all wall/gran/region hertz/history                 100000 20000 806.699778405191 ${gamma_t} ${coeffFric} 1 region mixer
+fix		mixwall all wall/gran/region hertz/history                 100000 20000 806.699778405191 403.349889202595 ${coeffFric} 1 region mixer
+fix		mixwall all wall/gran/region hertz/history                 100000 20000 806.699778405191 403.349889202595 0.5 1 region mixer
+
+fix		ins all pour 1000 1 42424 region insreg 		diam range ${dlo} ${dhi} dens ${density} ${density}
+fix		ins all pour 1000 1 42424 region insreg 		diam range 0.6 ${dhi} dens ${density} ${density}
+fix		ins all pour 1000 1 42424 region insreg 		diam range 0.6 1.2 dens ${density} ${density}
+fix		ins all pour 1000 1 42424 region insreg 		diam range 0.6 1.2 dens 1 ${density}
+fix		ins all pour 1000 1 42424 region insreg 		diam range 0.6 1.2 dens 1 1
+Particle insertion: 444 every 84653 steps, 1000 by step 169307
+
+#dump		1 all custom ${dumpfreq} ${name}_pour.dump #		id type mass diameter x y z
+
+#dump		2 all image 4000 image.*.jpg type type #		axes yes 0.8 0.02 view 60 -30 zoom 1.5 #                box no 0.0 axes no 0.0 0.0
+#dump_modify	2 pad 6
+
+thermo_style	custom step cpu atoms ke v_theta
+WARNING: New thermo_style command, previous thermo_modify settings will be lost (../output.cpp:690)
+thermo_modify	flush yes lost warn
+
+run		200000
+Neighbor list info ...
+  2 neighbor list requests
+  update every 1 steps, delay 10 steps, check yes
+  max neighbors/atom: 2000, page size: 100000
+  master list distance cutoff = 1.8
+  ghost atom cutoff = 1.8
+  binsize = 0.9 -> bins = 23 23 23
+Memory usage per processor = 2.76258 Mbytes
+Step CPU Atoms KinEng v_theta 
+       0            0        0           -0            0 
+    1000   0.10398197      444           -0  0.015707963 
+    2000   0.20485091      444           -0  0.031415927 
+    3000    0.3069241      444           -0   0.04712389 
+    4000   0.40875912      444           -0  0.062831853 
+    5000   0.50989199      444           -0  0.078539816 
+    6000   0.60949397      444           -0   0.09424778 
+    7000     0.708915      444           -0   0.10995574 
+    8000   0.80870605      444           -0   0.12566371 
+    9000   0.90752602      444           -0   0.14137167 
+   10000    1.0054469      444           -0   0.15707963 
+   11000     1.072515      444           -0    0.1727876 
+   12000     1.139096      444           -0   0.18849556 
+   13000    1.2049479      444           -0   0.20420352 
+   14000    1.2707851      444           -0   0.21991149 
+   15000    1.3377919      444           -0   0.23561945 
+   16000     1.405757      444           -0   0.25132741 
+   17000     1.471797      444           -0   0.26703538 
+   18000     1.538343      444           -0   0.28274334 
+   19000    1.6035659      444           -0    0.2984513 
+   20000    1.6690421      444           -0   0.31415927 
+   21000     1.729399      444           -0   0.32986723 
+   22000    1.7885301      444           -0   0.34557519 
+   23000    1.8496239      444           -0   0.36128316 
+   24000     1.913486      444           -0   0.37699112 
+   25000     1.977428      444           -0   0.39269908 
+   26000      2.04282      444           -0   0.40840704 
+   27000    2.1089439      444           -0   0.42411501 
+   28000    2.1759491      444           -0   0.43982297 
+   29000     2.243813      444           -0   0.45553093 
+   30000     2.312156      444           -0    0.4712389 
+   31000    2.3742449      444           -0   0.48694686 
+   32000     2.435447      444           -0   0.50265482 
+   33000     2.495765      444           -0   0.51836279 
+   34000     2.556865      444           -0   0.53407075 
+   35000    2.6201291      444           -0   0.54977871 
+   36000    2.6843281      444           -0   0.56548668 
+   37000    2.7505059      444           -0   0.58119464 
+   38000     2.817348      444           -0    0.5969026 
+   39000    2.8837919      444           -0   0.61261057 
+   40000     2.951216      444           -0   0.62831853 
+   41000     3.012845      444           -0   0.64402649 
+   42000     3.074688      444           -0   0.65973446 
+   43000      3.13556      444           -0   0.67544242 
+   44000    3.1965449      444           -0   0.69115038 
+   45000    3.2582009      444           -0   0.70685835 
+   46000    3.3201971      444           -0   0.72256631 
+   47000    3.3819821      444           -0   0.73827427 
+   48000    3.4455171      444           -0   0.75398224 
+   49000     3.508738      444           -0    0.7696902 
+   50000    3.5734961      444           -0   0.78539816 
+   51000    3.6333289      444           -0   0.80110613 
+   52000     3.694531      444           -0   0.81681409 
+   53000     3.757041      444           -0   0.83252205 
+   54000     3.820612      444           -0   0.84823002 
+   55000    3.8852711      444           -0   0.86393798 
+   56000     3.950211      444           -0   0.87964594 
+   57000     4.015795      444           -0   0.89535391 
+   58000    4.0818441      444           -0   0.91106187 
+   59000    4.1476641      444           -0   0.92676983 
+   60000    4.2141221      444           -0    0.9424778 
+   61000     4.276612      444           -0   0.95818576 
+   62000     4.339952      444           -0   0.97389372 
+   63000     4.404351      444           -0   0.98960169 
+   64000    4.4700999      444           -0    1.0053096 
+   65000    4.5364759      444           -0    1.0210176 
+   66000     4.605715      444           -0    1.0367256 
+   67000     4.677629      444           -0    1.0524335 
+   68000    4.7494669      444           -0    1.0681415 
+   69000    4.8212609      444           -0    1.0838495 
+   70000     4.894326      444           -0    1.0995574 
+   71000    4.9639831      444           -0    1.1152654 
+   72000    5.0345671      444           -0    1.1309734 
+   73000    5.1048689      444           -0    1.1466813 
+   74000     5.175498      444           -0    1.1623893 
+   75000    5.2477591      444           -0    1.1780972 
+   76000    5.3205409      444           -0    1.1938052 
+   77000     5.394573      444           -0    1.2095132 
+   78000    5.4685309      444           -0    1.2252211 
+   79000    5.5431759      444           -0    1.2409291 
+   80000    5.6212411      444           -0    1.2566371 
+   81000    5.6890731      444           -0     1.272345 
+   82000    5.7582159      444           -0     1.288053 
+   83000    5.8298571      444           -0     1.303761 
+   84000    5.9029069      444           -0    1.3194689 
+   85000    6.0061591      888           -0    1.3351769 
+   86000    6.1541281      888           -0    1.3508848 
+   87000    6.3004079      888           -0    1.3665928 
+   88000    6.4460659      888           -0    1.3823008 
+   89000     6.591886      888           -0    1.3980087 
+   90000    6.7376239      888           -0    1.4137167 
+   91000     6.850734      888           -0    1.4294247 
+   92000    6.9631939      888           -0    1.4451326 
+   93000    7.0786369      888           -0    1.4608406 
+   94000    7.1958089      888           -0    1.4765485 
+   95000    7.3130219      888           -0    1.4922565 
+   96000     7.430867      888           -0    1.5079645 
+   97000    7.5498819      888           -0    1.5236724 
+   98000     7.673686      888           -0    1.5393804 
+   99000    7.7966969      888           -0    1.5550884 
+  100000     7.921546      888           -0    1.5707963 
+  101000    8.0396931      888           -0    1.5865043 
+  102000    8.1583791      888           -0    1.6022123 
+  103000     8.276613      888           -0    1.6179202 
+  104000    8.3952639      888           -0    1.6336282 
+  105000     8.514308      888           -0    1.6493361 
+  106000    8.6361439      888           -0    1.6650441 
+  107000     8.762326      888           -0    1.6807521 
+  108000    8.8900061      888           -0      1.69646 
+  109000    9.0179789      888           -0     1.712168 
+  110000    9.1496761      888           -0     1.727876 
+  111000    9.2728269      888           -0    1.7435839 
+  112000     9.398078      888           -0    1.7592919 
+  113000     9.519841      888           -0    1.7749998 
+  114000     9.642343      888           -0    1.7907078 
+  115000    9.7643859      888           -0    1.8064158 
+  116000    9.8893411      888           -0    1.8221237 
+  117000     10.01295      888           -0    1.8378317 
+  118000    10.137574      888           -0    1.8535397 
+  119000    10.263738      888           -0    1.8692476 
+  120000    10.388673      888           -0    1.8849556 
+  121000    10.507599      888           -0    1.9006636 
+  122000    10.623901      888           -0    1.9163715 
+  123000    10.740251      888           -0    1.9320795 
+  124000    10.857467      888           -0    1.9477874 
+  125000    10.975856      888           -0    1.9634954 
+  126000    11.096002      888           -0    1.9792034 
+  127000    11.217218      888           -0    1.9949113 
+  128000    11.341925      888           -0    2.0106193 
+  129000    11.467607      888           -0    2.0263273 
+  130000     11.59517      888           -0    2.0420352 
+  131000     11.71358      888           -0    2.0577432 
+  132000    11.833024      888           -0    2.0734512 
+  133000    11.954967      888           -0    2.0891591 
+  134000    12.078482      888           -0    2.1048671 
+  135000    12.202435      888           -0     2.120575 
+  136000    12.327202      888           -0     2.136283 
+  137000    12.453334      888           -0     2.151991 
+  138000    12.583142      888           -0    2.1676989 
+  139000    12.718396      888           -0    2.1834069 
+  140000    12.854459      888           -0    2.1991149 
+  141000    12.981024      888           -0    2.2148228 
+  142000    13.108875      888           -0    2.2305308 
+  143000    13.236802      888           -0    2.2462387 
+  144000     13.36691      888           -0    2.2619467 
+  145000    13.500126      888           -0    2.2776547 
+  146000    13.633748      888           -0    2.2933626 
+  147000    13.769077      888           -0    2.3090706 
+  148000     13.90522      888           -0    2.3247786 
+  149000    14.040417      888           -0    2.3404865 
+  150000    14.176483      888           -0    2.3561945 
+  151000    14.303389      888           -0    2.3719025 
+  152000    14.432187      888           -0    2.3876104 
+  153000    14.559857      888           -0    2.4033184 
+  154000    14.691256      888           -0    2.4190263 
+  155000    14.823413      888           -0    2.4347343 
+  156000    14.956581      888           -0    2.4504423 
+  157000    15.090666      888           -0    2.4661502 
+  158000    15.228012      888           -0    2.4818582 
+  159000    15.364569      888           -0    2.4975662 
+  160000    15.501847      888           -0    2.5132741 
+  161000    15.642772      888           -0    2.5289821 
+  162000    15.783889      888           -0      2.54469 
+  163000    15.926508      888           -0     2.560398 
+  164000     16.07293      888           -0     2.576106 
+  165000    16.221293      888           -0    2.5918139 
+  166000    16.371738      888           -0    2.6075219 
+  167000    16.523027      888           -0    2.6232299 
+  168000    16.675525      888           -0    2.6389378 
+  169000    16.830527      888           -0    2.6546458 
+  170000    16.989955     1000           -0    2.6703538 
+  171000     17.14772     1000           -0    2.6860617 
+  172000    17.305565     1000           -0    2.7017697 
+  173000    17.463517     1000           -0    2.7174776 
+  174000    17.623862     1000           -0    2.7331856 
+  175000    17.788165     1000           -0    2.7488936 
+  176000    17.952028     1000           -0    2.7646015 
+  177000    18.119269     1000           -0    2.7803095 
+  178000    18.285714     1000           -0    2.7960175 
+  179000    18.452439     1000           -0    2.8117254 
+  180000    18.621119     1000           -0    2.8274334 
+  181000    18.777982     1000           -0    2.8431414 
+  182000    18.940248     1000           -0    2.8588493 
+  183000    19.105385     1000           -0    2.8745573 
+  184000    19.273934     1000           -0    2.8902652 
+  185000    19.450922     1000           -0    2.9059732 
+  186000    19.625563     1000           -0    2.9216812 
+  187000    19.801329     1000           -0    2.9373891 
+  188000    19.976869     1000           -0    2.9530971 
+  189000    20.151134     1000           -0    2.9688051 
+  190000    20.319214     1000           -0     2.984513 
+  191000    20.485033     1000           -0     3.000221 
+  192000    20.652254     1000           -0    3.0159289 
+  193000    20.820876     1000           -0    3.0316369 
+  194000    20.988597     1000           -0    3.0473449 
+  195000    21.154705     1000           -0    3.0630528 
+  196000    21.322634     1000           -0    3.0787608 
+  197000    21.489394     1000           -0    3.0944688 
+  198000    21.659512     1000           -0    3.1101767 
+  199000    21.833228     1000           -0    3.1258847 
+  200000    22.006487     1000           -0    3.1415927 
+Loop time of 22.0065 on 4 procs for 200000 steps with 1000 atoms
+
+Performance: 37102.953 tau/day, 9088.222 timesteps/s
+99.1% CPU use with 4 MPI tasks x no OpenMP threads
+
+MPI task timing breakdown:
+Section |  min time  |  avg time  |  max time  |%varavg| %total
+---------------------------------------------------------------
+Pair    | 0.67692    | 1.166      | 1.6704     |  44.4 |  5.30
+Neigh   | 0.01562    | 0.018723   | 0.0222     |   2.3 |  0.09
+Comm    | 3.845      | 4.4454     | 5.0282     |  26.1 | 20.20
+Output  | 0.0043464  | 0.0052906  | 0.0056455  |   0.8 |  0.02
+Modify  | 12.239     | 13.152     | 14.347     |  25.1 | 59.76
+Other   |            | 3.22       |            |       | 14.63
+
+Nlocal:    250 ave 257 max 244 min
+Histogram: 1 1 0 0 0 0 1 0 0 1
+Nghost:    305.75 ave 372 max 242 min
+Histogram: 1 0 0 1 0 1 0 0 0 1
+Neighs:    982.5 ave 1380 max 572 min
+Histogram: 2 0 0 0 0 0 0 0 0 2
+
+Total # of neighbors = 3930
+Ave neighs/atom = 3.93
+Neighbor list builds = 216
+Dangerous builds = 0
+unfix 		ins
+run		200000
+Neighbor list info ...
+  2 neighbor list requests
+  update every 1 steps, delay 10 steps, check yes
+  max neighbors/atom: 2000, page size: 100000
+  master list distance cutoff = 1.79826
+  ghost atom cutoff = 1.79826
+  binsize = 0.899132 -> bins = 23 23 23
+Memory usage per processor = 8.63577 Mbytes
+Step CPU Atoms KinEng v_theta 
+  200000            0     1000   0.90316284    3.1415927 
+  201000   0.16518497     1000    0.8867387    3.1573006 
+  202000   0.33065486     1000   0.88745316    3.1730086 
+  203000    0.4991529     1000   0.87793424    3.1887165 
+  204000    0.6695168     1000   0.87009551    3.2044245 
+  205000   0.83599901     1000   0.86431259    3.2201325 
+  206000     1.001833     1000   0.85039776    3.2358404 
+  207000     1.166487     1000   0.82897867    3.2515484 
+  208000    1.3331649     1000   0.82069182    3.2672564 
+  209000    1.5031869     1000   0.82349024    3.2829643 
+  210000    1.6751509     1000   0.81859611    3.2986723 
+  211000     1.846776     1000   0.82053992    3.3143802 
+  212000    2.0198569     1000   0.82832647    3.3300882 
+  213000    2.1932938     1000   0.82676865    3.3457962 
+  214000    2.3676898     1000   0.82425781    3.3615041 
+  215000    2.5424879     1000   0.83127148    3.3772121 
+  216000     2.715348     1000   0.83925992    3.3929201 
+  217000    2.8844988     1000   0.84390181     3.408628 
+  218000    3.0485029     1000   0.85705713     3.424336 
+  219000     3.211767     1000   0.85325946     3.440044 
+  220000    3.3767338     1000   0.85641557    3.4557519 
+  221000    3.5419538     1000   0.86922287    3.4714599 
+  222000     3.710084     1000   0.89591143    3.4871678 
+  223000     3.880873     1000   0.90395821    3.5028758 
+  224000     4.054816     1000   0.91161431    3.5185838 
+  225000    4.2260928     1000   0.92716425    3.5342917 
+  226000    4.3996999     1000   0.91664886    3.5499997 
+  227000    4.5679309     1000    0.9128853    3.5657077 
+  228000    4.7353978     1000   0.91063998    3.5814156 
+  229000    4.9045198     1000   0.90616712    3.5971236 
+  230000     5.079206     1000    0.9042797    3.6128316 
+  231000     5.252316     1000   0.91588137    3.6285395 
+  232000    5.4218178     1000   0.92322871    3.6442475 
+  233000     5.592988     1000   0.92370885    3.6599554 
+  234000     5.753634     1000   0.91531408    3.6756634 
+  235000    5.9159088     1000   0.91016621    3.6913714 
+  236000    6.0817358     1000   0.89501073    3.7070793 
+  237000     6.249059     1000   0.88504426    3.7227873 
+  238000    6.4182718     1000   0.88268268    3.7384953 
+  239000    6.5897119     1000   0.87811868    3.7542032 
+  240000     6.758353     1000   0.88272663    3.7699112 
+  241000     6.928581     1000   0.87751512    3.7856191 
+  242000    7.0978079     1000   0.87017281    3.8013271 
+  243000     7.268832     1000   0.86587613    3.8170351 
+  244000     7.439904     1000   0.85157794     3.832743 
+  245000    7.6105168     1000    0.8291738     3.848451 
+  246000    7.7830069     1000   0.82315948     3.864159 
+  247000    7.9578128     1000   0.81231703    3.8798669 
+  248000     8.134944     1000   0.79931415    3.8955749 
+  249000    8.3061719     1000   0.78877578    3.9112829 
+  250000     8.476692     1000   0.78519942    3.9269908 
+  251000    8.6525538     1000   0.78837716    3.9426988 
+  252000    8.8288019     1000   0.79621044    3.9584067 
+  253000     9.006846     1000   0.78744385    3.9741147 
+  254000    9.1839809     1000   0.78810047    3.9898227 
+  255000    9.3600328     1000   0.79053484    4.0055306 
+  256000     9.538172     1000   0.79976932    4.0212386 
+  257000    9.7188668     1000   0.81724577    4.0369466 
+  258000    9.9032769     1000   0.81135963    4.0526545 
+  259000    10.084928     1000   0.82017101    4.0683625 
+  260000    10.266693     1000   0.82352898    4.0840704 
+  261000    10.449515     1000   0.81662689    4.0997784 
+  262000    10.630166     1000   0.82707216    4.1154864 
+  263000    10.812056     1000   0.82001278    4.1311943 
+  264000    10.991668     1000   0.81136264    4.1469023 
+  265000    11.172162     1000   0.80507755    4.1626103 
+  266000    11.353101     1000   0.80247583    4.1783182 
+  267000    11.533476     1000   0.78870449    4.1940262 
+  268000    11.716022     1000   0.77775428    4.2097342 
+  269000    11.900351     1000   0.78170639    4.2254421 
+  270000    12.083609     1000   0.78023258    4.2411501 
+  271000    12.266298     1000   0.76257507     4.256858 
+  272000    12.449454     1000   0.75871195     4.272566 
+  273000    12.633748     1000   0.75909277     4.288274 
+  274000    12.820916     1000   0.76329234    4.3039819 
+  275000    13.004197     1000   0.76188557    4.3196899 
+  276000    13.188507     1000   0.75974847    4.3353979 
+  277000    13.372202     1000   0.75392834    4.3511058 
+  278000    13.557712     1000   0.74837333    4.3668138 
+  279000    13.747933     1000   0.74268307    4.3825218 
+  280000    13.934871     1000   0.73840427    4.3982297 
+  281000     14.11717     1000   0.73817851    4.4139377 
+  282000     14.30208     1000   0.73666069    4.4296456 
+  283000    14.485039     1000   0.74064713    4.4453536 
+  284000    14.671087     1000   0.73916222    4.4610616 
+  285000    14.863267     1000   0.73225442    4.4767695 
+  286000    15.050005     1000    0.7312283    4.4924775 
+  287000    15.234556     1000   0.72947519    4.5081855 
+  288000    15.422593     1000   0.72469992    4.5238934 
+  289000    15.609153     1000   0.70843645    4.5396014 
+  290000    15.797906     1000   0.69731415    4.5553093 
+  291000    15.983677     1000   0.69099822    4.5710173 
+  292000    16.168935     1000   0.68855366    4.5867253 
+  293000    16.355853     1000   0.69826256    4.6024332 
+  294000    16.544831     1000   0.70211589    4.6181412 
+  295000    16.733875     1000    0.7055847    4.6338492 
+  296000    16.918698     1000   0.69692413    4.6495571 
+  297000    17.100869     1000   0.68027227    4.6652651 
+  298000    17.280404     1000   0.67254493    4.6809731 
+  299000     17.46406     1000   0.67767946     4.696681 
+  300000    17.652748     1000   0.68480172     4.712389 
+  301000     17.84199     1000   0.67864643    4.7280969 
+  302000    18.025759     1000   0.67656342    4.7438049 
+  303000    18.208747     1000   0.67719641    4.7595129 
+  304000    18.391225     1000   0.68049491    4.7752208 
+  305000    18.576276     1000   0.68230722    4.7909288 
+  306000    18.764125     1000      0.67985    4.8066368 
+  307000    18.956063     1000   0.67790944    4.8223447 
+  308000    19.147159     1000    0.6836647    4.8380527 
+  309000    19.339173     1000   0.69705355    4.8537606 
+  310000    19.530591     1000   0.69858847    4.8694686 
+  311000    19.720214     1000   0.69448554    4.8851766 
+  312000    19.907717     1000   0.68878539    4.9008845 
+  313000    20.088793     1000   0.68810484    4.9165925 
+  314000    20.268118     1000   0.68483484    4.9323005 
+  315000    20.445564     1000   0.67732034    4.9480084 
+  316000    20.627415     1000   0.67943319    4.9637164 
+  317000    20.807826     1000   0.67326868    4.9794244 
+  318000    20.983587     1000   0.67762092    4.9951323 
+  319000    21.156655     1000   0.68914624    5.0108403 
+  320000    21.331391     1000   0.69872806    5.0265482 
+  321000    21.506313     1000   0.71510434    5.0422562 
+  322000    21.679505     1000   0.71452122    5.0579642 
+  323000     21.85396     1000   0.71765429    5.0736721 
+  324000     22.02904     1000   0.72748838    5.0893801 
+  325000    22.205191     1000   0.72974854    5.1050881 
+  326000     22.38063     1000   0.73324928     5.120796 
+  327000    22.555817     1000   0.72479525     5.136504 
+  328000    22.729859     1000   0.71942855     5.152212 
+  329000    22.903234     1000   0.71890587    5.1679199 
+  330000    23.078575     1000   0.73495891    5.1836279 
+  331000    23.252865     1000   0.74306733    5.1993358 
+  332000    23.427175     1000   0.75274051    5.2150438 
+  333000    23.604881     1000   0.75981346    5.2307518 
+  334000    23.789045     1000   0.75410165    5.2464597 
+  335000    23.971105     1000   0.74802374    5.2621677 
+  336000    24.150954     1000   0.73111266    5.2778757 
+  337000    24.331991     1000   0.72226021    5.2935836 
+  338000    24.515157     1000   0.70866271    5.3092916 
+  339000     24.69639     1000   0.70253496    5.3249995 
+  340000    24.879524     1000   0.69381505    5.3407075 
+  341000    25.061928     1000   0.68285569    5.3564155 
+  342000      25.2437     1000   0.67262303    5.3721234 
+  343000    25.423809     1000   0.67160137    5.3878314 
+  344000    25.605531     1000   0.67658439    5.4035394 
+  345000     25.78848     1000   0.67113748    5.4192473 
+  346000    25.969866     1000   0.67506296    5.4349553 
+  347000    26.152485     1000   0.67686518    5.4506633 
+  348000    26.335445     1000   0.68878941    5.4663712 
+  349000    26.522271     1000   0.70728493    5.4820792 
+  350000    26.709942     1000   0.70870657    5.4977871 
+  351000    26.889998     1000   0.71541489    5.5134951 
+  352000    27.069872     1000   0.71827633    5.5292031 
+  353000    27.249259     1000    0.7099127     5.544911 
+  354000    27.428386     1000   0.70507946     5.560619 
+  355000    27.607797     1000   0.70709703     5.576327 
+  356000    27.788887     1000   0.70637714    5.5920349 
+  357000    27.975344     1000    0.7088694    5.6077429 
+  358000    28.164236     1000   0.70907948    5.6234508 
+  359000    28.352999     1000   0.71504714    5.6391588 
+  360000    28.539172     1000   0.71417205    5.6548668 
+  361000    28.722691     1000   0.70716852    5.6705747 
+  362000    28.906856     1000   0.70193967    5.6862827 
+  363000    29.087598     1000   0.69786793    5.7019907 
+  364000    29.268141     1000   0.68714789    5.7176986 
+  365000    29.450765     1000   0.68170443    5.7334066 
+  366000    29.633131     1000   0.67832571    5.7491146 
+  367000    29.816219     1000   0.67809457    5.7648225 
+  368000    29.999479     1000   0.66886004    5.7805305 
+  369000    30.182675     1000   0.67233336    5.7962384 
+  370000     30.36698     1000   0.67433369    5.8119464 
+  371000    30.550787     1000   0.67478226    5.8276544 
+  372000    30.736018     1000   0.67882814    5.8433623 
+  373000    30.922576     1000   0.68494254    5.8590703 
+  374000    31.107558     1000   0.69046765    5.8747783 
+  375000    31.291329     1000   0.69398953    5.8904862 
+  376000    31.474582     1000   0.68692367    5.9061942 
+  377000    31.656979     1000     0.674184    5.9219022 
+  378000     31.83851     1000   0.65899449    5.9376101 
+  379000    32.019869     1000   0.65198402    5.9533181 
+  380000    32.200375     1000   0.64366122     5.969026 
+  381000    32.381651     1000   0.64443345     5.984734 
+  382000    32.561897     1000   0.64655912     6.000442 
+  383000    32.743947     1000   0.64894161    6.0161499 
+  384000    32.927231     1000   0.65259561    6.0318579 
+  385000     33.11882     1000   0.65230446    6.0475659 
+  386000    33.311072     1000   0.64177598    6.0632738 
+  387000     33.50435     1000   0.63900349    6.0789818 
+  388000    33.695734     1000   0.64611067    6.0946897 
+  389000    33.885915     1000   0.64943993    6.1103977 
+  390000    34.076093     1000   0.66303716    6.1261057 
+  391000    34.264909     1000   0.68916583    6.1418136 
+  392000     34.45411     1000   0.71501556    6.1575216 
+  393000    34.644116     1000   0.73685375    6.1732296 
+  394000    34.834608     1000   0.74461041    6.1889375 
+  395000    35.025693     1000   0.75251204    6.2046455 
+  396000    35.217372     1000   0.75493054    6.2203535 
+  397000    35.407008     1000   0.77028775    6.2360614 
+  398000    35.594868     1000    0.7686439    6.2517694 
+  399000    35.778411     1000   0.75167376    6.2674773 
+  400000    35.962646     1000   0.73505917    6.2831853 
+Loop time of 35.9627 on 4 procs for 200000 steps with 1000 atoms
+
+Performance: 22704.278 tau/day, 5561.323 timesteps/s
+99.0% CPU use with 4 MPI tasks x no OpenMP threads
+
+MPI task timing breakdown:
+Section |  min time  |  avg time  |  max time  |%varavg| %total
+---------------------------------------------------------------
+Pair    | 2.0549     | 3.4094     | 4.9773     |  72.1 |  9.48
+Neigh   | 0.022087   | 0.026923   | 0.032716   |   2.9 |  0.07
+Comm    | 7.3555     | 9.2143     | 10.854     |  53.0 | 25.62
+Output  | 0.0046289  | 0.0058927  | 0.0071292  |   1.4 |  0.02
+Modify  | 17.504     | 19.601     | 22.342     |  44.9 | 54.50
+Other   |            | 3.705      |            |       | 10.30
+
+Nlocal:    250 ave 269 max 225 min
+Histogram: 1 0 0 0 0 1 0 1 0 1
+Nghost:    408.5 ave 500 max 320 min
+Histogram: 2 0 0 0 0 0 0 0 0 2
+Neighs:    1262.25 ave 1665 max 880 min
+Histogram: 1 0 1 0 0 0 0 1 0 1
+
+Total # of neighbors = 5049
+Ave neighs/atom = 5.049
+Neighbor list builds = 166
+Dangerous builds = 0
+Total wall time: 0:00:57
diff --git a/src/GRANULAR/fix_wall_gran.cpp b/src/GRANULAR/fix_wall_gran.cpp
index 4e927b2579d2dbc0d2b4fabd256dd3192baada73..781ec91447368da078f9f11b798e1f9a3a383b16 100644
--- a/src/GRANULAR/fix_wall_gran.cpp
+++ b/src/GRANULAR/fix_wall_gran.cpp
@@ -12,7 +12,8 @@
 ------------------------------------------------------------------------- */
 
 /* ----------------------------------------------------------------------
-   Contributing authors: Leo Silbert (SNL), Gary Grest (SNL)
+   Contributing authors: Leo Silbert (SNL), Gary Grest (SNL),
+                         Dan Bolintineanu (SNL)
 ------------------------------------------------------------------------- */
 
 #include <math.h>
@@ -34,8 +35,11 @@ using namespace LAMMPS_NS;
 using namespace FixConst;
 using namespace MathConst;
 
-enum{XPLANE=0,YPLANE=1,ZPLANE=2,ZCYLINDER};    // XYZ PLANE need to be 0,1,2
-enum{HOOKE,HOOKE_HISTORY,HERTZ_HISTORY};
+// XYZ PLANE need to be 0,1,2
+
+enum{XPLANE=0,YPLANE=1,ZPLANE=2,ZCYLINDER,REGION}; 
+enum{HOOKE,HOOKE_HISTORY,HERTZ_HISTORY,BONDED_HISTORY};
+enum{NONE,CONSTANT,EQUAL};
 
 #define BIG 1.0e20
 
@@ -44,7 +48,7 @@ enum{HOOKE,HOOKE_HISTORY,HERTZ_HISTORY};
 FixWallGran::FixWallGran(LAMMPS *lmp, int narg, char **arg) :
   Fix(lmp, narg, arg)
 {
-  if (narg < 11) error->all(FLERR,"Illegal fix wall/gran command");
+  if (narg < 4) error->all(FLERR,"Illegal fix wall/gran command");
 
   if (!atom->sphere_flag)
     error->all(FLERR,"Fix wall/gran requires atom style sphere");
@@ -53,43 +57,71 @@ FixWallGran::FixWallGran(LAMMPS *lmp, int narg, char **arg) :
   create_attribute = 1;
 
   // set interaction style
+  // disable bonded/history option for now
 
   if (strcmp(arg[3],"hooke") == 0) pairstyle = HOOKE;
   else if (strcmp(arg[3],"hooke/history") == 0) pairstyle = HOOKE_HISTORY;
   else if (strcmp(arg[3],"hertz/history") == 0) pairstyle = HERTZ_HISTORY;
+  //else if (strcmp(arg[3],"bonded/history") == 0) pairstyle = BONDED_HISTORY;
   else error->all(FLERR,"Invalid fix wall/gran interaction style");
 
   history = 1;
   if (pairstyle == HOOKE) history = 0;
 
-  // particle/wall coefficients
-
-  kn = force->numeric(FLERR,arg[4]);
-  if (strcmp(arg[5],"NULL") == 0) kt = kn * 2.0/7.0;
-  else kt = force->numeric(FLERR,arg[5]);
+  // wall/particle coefficients
+
+  int iarg;
+
+  if (pairstyle != BONDED_HISTORY) {
+    if (narg < 11) error->all(FLERR,"Illegal fix wall/gran command");
+
+    kn = force->numeric(FLERR,arg[4]);
+    if (strcmp(arg[5],"NULL") == 0) kt = kn * 2.0/7.0;
+    else kt = force->numeric(FLERR,arg[5]);
+    
+    gamman = force->numeric(FLERR,arg[6]);
+    if (strcmp(arg[7],"NULL") == 0) gammat = 0.5 * gamman;
+    else gammat = force->numeric(FLERR,arg[7]);
+    
+    xmu = force->numeric(FLERR,arg[8]);
+    int dampflag = force->inumeric(FLERR,arg[9]);
+    if (dampflag == 0) gammat = 0.0;
+    
+    if (kn < 0.0 || kt < 0.0 || gamman < 0.0 || gammat < 0.0 ||
+        xmu < 0.0 || xmu > 10000.0 || dampflag < 0 || dampflag > 1)
+      error->all(FLERR,"Illegal fix wall/gran command");
+    
+    // convert Kn and Kt from pressure units to force/distance^2 if Hertzian
+    
+    if (pairstyle == HERTZ_HISTORY) {
+      kn /= force->nktv2p;
+      kt /= force->nktv2p;
+    }
 
-  gamman = force->numeric(FLERR,arg[6]);
-  if (strcmp(arg[7],"NULL") == 0) gammat = 0.5 * gamman;
-  else gammat = force->numeric(FLERR,arg[7]);
+    iarg = 10;
+  }
 
-  xmu = force->numeric(FLERR,arg[8]);
-  int dampflag = force->inumeric(FLERR,arg[9]);
-  if (dampflag == 0) gammat = 0.0;
+  else {
+    if (narg < 10) error->all(FLERR,"Illegal fix wall/gran command");
 
-  if (kn < 0.0 || kt < 0.0 || gamman < 0.0 || gammat < 0.0 ||
-      xmu < 0.0 || xmu > 10000.0 || dampflag < 0 || dampflag > 1)
-    error->all(FLERR,"Illegal fix wall/gran command");
+    E = force->numeric(FLERR,arg[4]);
+    G = force->numeric(FLERR,arg[5]);
+    SurfEnergy = force->numeric(FLERR,arg[6]);
+    // Note: this doesn't get used, check w/ Jeremy?
+    gamman = force->numeric(FLERR,arg[7]);
 
-  // convert Kn and Kt from pressure units to force/distance^2 if Hertzian
+    xmu = force->numeric(FLERR,arg[8]);
+    // pois = E/(2.0*G) - 1.0;
+    // kn = 2.0*E/(3.0*(1.0+pois)*(1.0-pois));
+    // gammat=0.5*gamman;
 
-  if (pairstyle == HERTZ_HISTORY) {
-    kn /= force->nktv2p;
-    kt /= force->nktv2p;
+    iarg = 9;
   }
 
   // wallstyle args
+  
+  idregion = NULL;
 
-  int iarg = 10;
   if (strcmp(arg[iarg],"xplane") == 0) {
     if (narg < iarg+3) error->all(FLERR,"Illegal fix wall/gran command");
     wallstyle = XPLANE;
@@ -118,15 +150,22 @@ FixWallGran::FixWallGran(LAMMPS *lmp, int narg, char **arg) :
     if (narg < iarg+2) error->all(FLERR,"Illegal fix wall/gran command");
     wallstyle = ZCYLINDER;
     lo = hi = 0.0;
-    cylradius = force->numeric(FLERR,arg[iarg+1]);
+    cylradius = force->numeric(FLERR,arg[iarg+3]);
+    iarg += 2;
+  } else if (strcmp(arg[iarg],"region") == 0) {
+    if (narg < iarg+2) error->all(FLERR,"Illegal fix wall/gran command");
+    wallstyle = REGION;
+    int n = strlen(arg[iarg+1]) + 1;
+    idregion = new char[n];
+    strcpy(idregion,arg[iarg+1]);
     iarg += 2;
   }
-
-  // check for trailing keyword/values
+  
+  // optional args
 
   wiggle = 0;
   wshear = 0;
-
+    
   while (iarg < narg) {
     if (strcmp(arg[iarg],"wiggle") == 0) {
       if (iarg+4 > narg) error->all(FLERR,"Illegal fix wall/gran command");
@@ -149,7 +188,7 @@ FixWallGran::FixWallGran(LAMMPS *lmp, int narg, char **arg) :
       iarg += 3;
     } else error->all(FLERR,"Illegal fix wall/gran command");
   }
-
+  
   if (wallstyle == XPLANE && domain->xperiodic)
     error->all(FLERR,"Cannot use wall in periodic dimension");
   if (wallstyle == YPLANE && domain->yperiodic)
@@ -158,7 +197,7 @@ FixWallGran::FixWallGran(LAMMPS *lmp, int narg, char **arg) :
     error->all(FLERR,"Cannot use wall in periodic dimension");
   if (wallstyle == ZCYLINDER && (domain->xperiodic || domain->yperiodic))
     error->all(FLERR,"Cannot use wall in periodic dimension");
-
+  
   if (wiggle && wshear)
     error->all(FLERR,"Cannot wiggle and shear fix wall/gran");
   if (wiggle && wallstyle == ZCYLINDER && axis != 2)
@@ -169,15 +208,20 @@ FixWallGran::FixWallGran(LAMMPS *lmp, int narg, char **arg) :
     error->all(FLERR,"Invalid shear direction for fix wall/gran");
   if (wshear && wallstyle == ZPLANE && axis == 2)
     error->all(FLERR,"Invalid shear direction for fix wall/gran");
+  if ((wiggle || wshear) && wallstyle == REGION)
+    error->all(FLERR,"Cannot wiggle or shear with fix wall/gran/region");
 
   // setup oscillations
-
+  
   if (wiggle) omega = 2.0*MY_PI / period;
-
+    
   // perform initial allocation of atom-based arrays
   // register with Atom class
 
-  shear = NULL;
+  if (pairstyle == BONDED_HISTORY) sheardim = 7;
+  else sheardim = 3;
+  
+  shearone = NULL;
   grow_arrays(atom->nmax);
   atom->add_callback(0);
   atom->add_callback(1);
@@ -185,12 +229,14 @@ FixWallGran::FixWallGran(LAMMPS *lmp, int narg, char **arg) :
   nmax = 0;
   mass_rigid = NULL;
 
-  // initialize as if particle is not touching wall
+  // initialize shear history as if particle is not touching region
+  // shearone will be NULL for wallstyle = REGION
 
-  if (history) {
+  if (history && shearone) {
     int nlocal = atom->nlocal;
     for (int i = 0; i < nlocal; i++)
-      shear[i][0] = shear[i][1] = shear[i][2] = 0.0;
+      for (int j = 0; j < sheardim; j++)
+        shearone[i][j] = 0.0;
   }
 
   time_origin = update->ntimestep;
@@ -205,9 +251,10 @@ FixWallGran::~FixWallGran()
   atom->delete_callback(id,0);
   atom->delete_callback(id,1);
 
-  // delete locally stored arrays
+  // delete local storage
 
-  memory->destroy(shear);
+  delete [] idregion;
+  memory->destroy(shearone);
   memory->destroy(mass_rigid);
 }
 
@@ -257,8 +304,8 @@ void FixWallGran::setup(int vflag)
 
 void FixWallGran::post_force(int vflag)
 {
-  int i;
-  double dx,dy,dz,del1,del2,delxy,delr,rsq,meff;
+  int i,j;
+  double dx,dy,dz,del1,del2,delxy,delr,rsq,rwall,meff;
   double vwall[3];
 
   // do not update shear history during setup
@@ -301,7 +348,7 @@ void FixWallGran::post_force(int vflag)
     }
     vwall[axis] = amplitude*omega*sin(arg);
   } else if (wshear) vwall[axis] = vshear;
-
+  
   // loop over all my atoms
   // rsq = distance from wall
   // dx,dy,dz = signed distance from wall
@@ -311,7 +358,7 @@ void FixWallGran::post_force(int vflag)
   // compute force and torque on atom if close enough to wall
   //   via wall potential matched to pair potential
   // set shear if pair potential stores history
-
+  
   double **x = atom->x;
   double **v = atom->v;
   double **f = atom->f;
@@ -321,12 +368,14 @@ void FixWallGran::post_force(int vflag)
   double *rmass = atom->rmass;
   int *mask = atom->mask;
   int nlocal = atom->nlocal;
+  
+  rwall = 0.0;
 
   for (int i = 0; i < nlocal; i++) {
     if (mask[i] & groupbit) {
-
+      
       dx = dy = dz = 0.0;
-
+      
       if (wallstyle == XPLANE) {
         del1 = x[i][0] - wlo;
         del2 = whi - x[i][0];
@@ -345,26 +394,29 @@ void FixWallGran::post_force(int vflag)
       } else if (wallstyle == ZCYLINDER) {
         delxy = sqrt(x[i][0]*x[i][0] + x[i][1]*x[i][1]);
         delr = cylradius - delxy;
-        if (delr > radius[i]) dz = cylradius;
-        else {
+        if (delr > radius[i]) {
+          dz = cylradius;
+          rwall = 0.0;
+        } else {
           dx = -delr/delxy * x[i][0];
           dy = -delr/delxy * x[i][1];
+          // rwall = -2r_c if inside cylinder, 2r_c outside
+          rwall = 2*(1-2*(delxy < cylradius))*cylradius; 
           if (wshear && axis != 2) {
-            vwall[0] = vshear * x[i][1]/delxy;
-            vwall[1] = -vshear * x[i][0]/delxy;
+            vwall[0] += vshear * x[i][1]/delxy;
+            vwall[1] += -vshear * x[i][0]/delxy;
             vwall[2] = 0.0;
           }
         }
       }
-
+      
       rsq = dx*dx + dy*dy + dz*dz;
-
+      
       if (rsq > radius[i]*radius[i]) {
-        if (pairstyle != HOOKE) {
-          shear[i][0] = 0.0;
-          shear[i][1] = 0.0;
-          shear[i][2] = 0.0;
-        }
+        if (history)
+          for (j = 0; j < sheardim; j++) 
+            shearone[i][j] = 0.0;
+
       } else {
 
         // meff = effective mass of sphere
@@ -373,17 +425,20 @@ void FixWallGran::post_force(int vflag)
         meff = rmass[i];
         if (fix_rigid && mass_rigid[i] > 0.0) meff = mass_rigid[i];
 
-        // inovke sphere/wall interaction
+        // invoke sphere/wall interaction
 
         if (pairstyle == HOOKE)
-          hooke(rsq,dx,dy,dz,vwall,v[i],f[i],omega[i],torque[i],
-                radius[i],meff);
+          hooke(rsq,dx,dy,dz,vwall,v[i],f[i],
+                omega[i],torque[i],radius[i],meff);
         else if (pairstyle == HOOKE_HISTORY)
-          hooke_history(rsq,dx,dy,dz,vwall,v[i],f[i],omega[i],torque[i],
-                        radius[i],meff,shear[i]);
+          hooke_history(rsq,dx,dy,dz,vwall,v[i],f[i],
+                        omega[i],torque[i],radius[i],meff,shearone[i]);
         else if (pairstyle == HERTZ_HISTORY)
-          hertz_history(rsq,dx,dy,dz,vwall,v[i],f[i],omega[i],torque[i],
-                        radius[i],meff,shear[i]);
+          hertz_history(rsq,dx,dy,dz,vwall,rwall,v[i],f[i],
+                        omega[i],torque[i],radius[i],meff,shearone[i]);
+        else if (pairstyle == BONDED_HISTORY)
+          bonded_history(rsq,dx,dy,dz,vwall,rwall,v[i],f[i],
+                         omega[i],torque[i],radius[i],meff,shearone[i]);
       }
     }
   }
@@ -412,66 +467,66 @@ void FixWallGran::hooke(double rsq, double dx, double dy, double dz,
   rsqinv = 1.0/rsq;
 
   // relative translational velocity
-
+  
   vr1 = v[0] - vwall[0];
   vr2 = v[1] - vwall[1];
   vr3 = v[2] - vwall[2];
-
+  
   // normal component
-
+  
   vnnr = vr1*dx + vr2*dy + vr3*dz;
   vn1 = dx*vnnr * rsqinv;
   vn2 = dy*vnnr * rsqinv;
   vn3 = dz*vnnr * rsqinv;
-
+  
   // tangential component
-
+  
   vt1 = vr1 - vn1;
   vt2 = vr2 - vn2;
   vt3 = vr3 - vn3;
-
+  
   // relative rotational velocity
-
+  
   wr1 = radius*omega[0] * rinv;
   wr2 = radius*omega[1] * rinv;
   wr3 = radius*omega[2] * rinv;
-
+  
   // normal forces = Hookian contact + normal velocity damping
-
+  
   damp = meff*gamman*vnnr*rsqinv;
   ccel = kn*(radius-r)*rinv - damp;
-
+  
   // relative velocities
-
+  
   vtr1 = vt1 - (dz*wr2-dy*wr3);
   vtr2 = vt2 - (dx*wr3-dz*wr1);
   vtr3 = vt3 - (dy*wr1-dx*wr2);
   vrel = vtr1*vtr1 + vtr2*vtr2 + vtr3*vtr3;
   vrel = sqrt(vrel);
-
+  
   // force normalization
-
+  
   fn = xmu * fabs(ccel*r);
   fs = meff*gammat*vrel;
   if (vrel != 0.0) ft = MIN(fn,fs) / vrel;
   else ft = 0.0;
-
+  
   // tangential force due to tangential velocity damping
-
+  
   fs1 = -ft*vtr1;
   fs2 = -ft*vtr2;
   fs3 = -ft*vtr3;
-
+  
   // forces & torques
-
+  
   fx = dx*ccel + fs1;
   fy = dy*ccel + fs2;
   fz = dz*ccel + fs3;
-
+  
   f[0] += fx;
   f[1] += fy;
   f[2] += fz;
-
+  
   tor1 = rinv * (dy*fs3 - dz*fs2);
   tor2 = rinv * (dz*fs1 - dx*fs3);
   tor3 = rinv * (dx*fs2 - dy*fs1);
@@ -491,60 +546,60 @@ void FixWallGran::hooke_history(double rsq, double dx, double dy, double dz,
   double wr1,wr2,wr3,damp,ccel,vtr1,vtr2,vtr3,vrel;
   double fn,fs,fs1,fs2,fs3,fx,fy,fz,tor1,tor2,tor3;
   double shrmag,rsht,rinv,rsqinv;
-
+  
   r = sqrt(rsq);
   rinv = 1.0/r;
   rsqinv = 1.0/rsq;
-
+  
   // relative translational velocity
-
+  
   vr1 = v[0] - vwall[0];
   vr2 = v[1] - vwall[1];
   vr3 = v[2] - vwall[2];
-
+  
   // normal component
-
+  
   vnnr = vr1*dx + vr2*dy + vr3*dz;
   vn1 = dx*vnnr * rsqinv;
   vn2 = dy*vnnr * rsqinv;
   vn3 = dz*vnnr * rsqinv;
-
+  
   // tangential component
-
+  
   vt1 = vr1 - vn1;
   vt2 = vr2 - vn2;
   vt3 = vr3 - vn3;
-
+  
   // relative rotational velocity
-
+  
   wr1 = radius*omega[0] * rinv;
   wr2 = radius*omega[1] * rinv;
   wr3 = radius*omega[2] * rinv;
-
+  
   // normal forces = Hookian contact + normal velocity damping
-
+  
   damp = meff*gamman*vnnr*rsqinv;
   ccel = kn*(radius-r)*rinv - damp;
-
+  
   // relative velocities
-
+  
   vtr1 = vt1 - (dz*wr2-dy*wr3);
   vtr2 = vt2 - (dx*wr3-dz*wr1);
   vtr3 = vt3 - (dy*wr1-dx*wr2);
   vrel = vtr1*vtr1 + vtr2*vtr2 + vtr3*vtr3;
   vrel = sqrt(vrel);
-
+  
   // shear history effects
-
+  
   if (shearupdate) {
     shear[0] += vtr1*dt;
     shear[1] += vtr2*dt;
     shear[2] += vtr3*dt;
   }
   shrmag = sqrt(shear[0]*shear[0] + shear[1]*shear[1] + shear[2]*shear[2]);
-
+  
   // rotate shear displacements
-
+  
   rsht = shear[0]*dx + shear[1]*dy + shear[2]*dz;
   rsht = rsht*rsqinv;
   if (shearupdate) {
@@ -552,18 +607,18 @@ void FixWallGran::hooke_history(double rsq, double dx, double dy, double dz,
     shear[1] -= rsht*dy;
     shear[2] -= rsht*dz;
   }
-
+  
   // tangential forces = shear + tangential velocity damping
-
+  
   fs1 = - (kt*shear[0] + meff*gammat*vtr1);
   fs2 = - (kt*shear[1] + meff*gammat*vtr2);
   fs3 = - (kt*shear[2] + meff*gammat*vtr3);
-
+  
   // rescale frictional displacements and forces if needed
-
+  
   fs = sqrt(fs1*fs1 + fs2*fs2 + fs3*fs3);
   fn = xmu * fabs(ccel*r);
-
+  
   if (fs > fn) {
     if (shrmag != 0.0) {
       shear[0] = (fn/fs) * (shear[0] + meff*gammat*vtr1/kt) -
@@ -577,17 +632,17 @@ void FixWallGran::hooke_history(double rsq, double dx, double dy, double dz,
       fs3 *= fn/fs;
     } else fs1 = fs2 = fs3 = 0.0;
   }
-
+  
   // forces & torques
-
+  
   fx = dx*ccel + fs1;
   fy = dy*ccel + fs2;
   fz = dz*ccel + fs3;
-
+  
   f[0] += fx;
   f[1] += fy;
   f[2] += fz;
-
+  
   tor1 = rinv * (dy*fs3 - dz*fs2);
   tor2 = rinv * (dz*fs1 - dx*fs3);
   tor3 = rinv * (dx*fs2 - dy*fs1);
@@ -599,7 +654,7 @@ void FixWallGran::hooke_history(double rsq, double dx, double dy, double dz,
 /* ---------------------------------------------------------------------- */
 
 void FixWallGran::hertz_history(double rsq, double dx, double dy, double dz,
-                                double *vwall, double *v,
+                                double *vwall, double rwall, double *v,
                                 double *f, double *omega, double *torque,
                                 double radius, double meff, double *shear)
 {
@@ -607,6 +662,141 @@ void FixWallGran::hertz_history(double rsq, double dx, double dy, double dz,
   double wr1,wr2,wr3,damp,ccel,vtr1,vtr2,vtr3,vrel;
   double fn,fs,fs1,fs2,fs3,fx,fy,fz,tor1,tor2,tor3;
   double shrmag,rsht,polyhertz,rinv,rsqinv;
+  
+  r = sqrt(rsq);
+  rinv = 1.0/r;
+  rsqinv = 1.0/rsq;
+  
+  // relative translational velocity
+  
+  vr1 = v[0] - vwall[0];
+  vr2 = v[1] - vwall[1];
+  vr3 = v[2] - vwall[2];
+  
+  // normal component
+  
+  vnnr = vr1*dx + vr2*dy + vr3*dz;
+  vn1 = dx*vnnr / rsq;
+  vn2 = dy*vnnr / rsq;
+  vn3 = dz*vnnr / rsq;
+  
+  // tangential component
+  
+  vt1 = vr1 - vn1;
+  vt2 = vr2 - vn2;
+  vt3 = vr3 - vn3;
+  
+  // relative rotational velocity
+  
+  wr1 = radius*omega[0] * rinv;
+  wr2 = radius*omega[1] * rinv;
+  wr3 = radius*omega[2] * rinv;
+  
+  // normal forces = Hertzian contact + normal velocity damping
+  // rwall = 0 is flat wall case
+  // rwall positive or negative is curved wall
+  //   will break (as it should) if rwall is negative and 
+  //   its absolute value < radius of particle
+  
+  damp = meff*gamman*vnnr*rsqinv;
+  ccel = kn*(radius-r)*rinv - damp;
+  if (rwall == 0.0) polyhertz = sqrt((radius-r)*radius);
+  else polyhertz = sqrt((radius-r)*radius*rwall/(rwall+radius));
+  ccel *= polyhertz;
+  
+  // relative velocities
+  
+  vtr1 = vt1 - (dz*wr2-dy*wr3);
+  vtr2 = vt2 - (dx*wr3-dz*wr1);
+  vtr3 = vt3 - (dy*wr1-dx*wr2);
+  vrel = vtr1*vtr1 + vtr2*vtr2 + vtr3*vtr3;
+  vrel = sqrt(vrel);
+  
+  // shear history effects
+
+  if (shearupdate) {
+    shear[0] += vtr1*dt;
+    shear[1] += vtr2*dt;
+    shear[2] += vtr3*dt;
+  }
+  shrmag = sqrt(shear[0]*shear[0] + shear[1]*shear[1] + shear[2]*shear[2]);
+  
+  // rotate shear displacements
+  
+  rsht = shear[0]*dx + shear[1]*dy + shear[2]*dz;
+  rsht = rsht*rsqinv;
+  if (shearupdate) {
+    shear[0] -= rsht*dx;
+    shear[1] -= rsht*dy;
+    shear[2] -= rsht*dz;
+  }
+  
+  // tangential forces = shear + tangential velocity damping
+  
+  fs1 = -polyhertz * (kt*shear[0] + meff*gammat*vtr1);
+  fs2 = -polyhertz * (kt*shear[1] + meff*gammat*vtr2);
+  fs3 = -polyhertz * (kt*shear[2] + meff*gammat*vtr3);
+  
+  // rescale frictional displacements and forces if needed
+  
+  fs = sqrt(fs1*fs1 + fs2*fs2 + fs3*fs3);
+  fn = xmu * fabs(ccel*r);
+  
+  if (fs > fn) {
+    if (shrmag != 0.0) {
+      shear[0] = (fn/fs) * (shear[0] + meff*gammat*vtr1/kt) -
+        meff*gammat*vtr1/kt;
+      shear[1] = (fn/fs) * (shear[1] + meff*gammat*vtr2/kt) -
+        meff*gammat*vtr2/kt;
+      shear[2] = (fn/fs) * (shear[2] + meff*gammat*vtr3/kt) -
+        meff*gammat*vtr3/kt;
+      fs1 *= fn/fs ;
+      fs2 *= fn/fs;
+      fs3 *= fn/fs;
+    } else fs1 = fs2 = fs3 = 0.0;
+  }
+
+  // forces & torques
+  
+  fx = dx*ccel + fs1;
+  fy = dy*ccel + fs2;
+  fz = dz*ccel + fs3;
+
+  f[0] += fx;
+  f[1] += fy;
+  f[2] += fz;
+  
+  tor1 = rinv * (dy*fs3 - dz*fs2);
+  tor2 = rinv * (dz*fs1 - dx*fs3);
+  tor3 = rinv * (dx*fs2 - dy*fs1);
+  torque[0] -= radius*tor1;
+  torque[1] -= radius*tor2;
+  torque[2] -= radius*tor3;
+}
+
+
+/* ---------------------------------------------------------------------- */
+
+void FixWallGran::bonded_history(double rsq, double dx, double dy, double dz,
+                                 double *vwall, double rwall, double *v,
+                                 double *f, double *omega, double *torque,
+                                 double radius, double meff, double *shear)
+{
+  double r,vr1,vr2,vr3,vnnr,vn1,vn2,vn3,vt1,vt2,vt3;
+  double wr1,wr2,wr3,damp,ccel,vtr1,vtr2,vtr3,vrel;
+  double fn,fs,fs1,fs2,fs3,fx,fy,fz,tor1,tor2,tor3;
+  double shrmag,rsht,polyhertz,rinv,rsqinv;
+
+  double pois,E_eff,G_eff,rad_eff;
+  double a0,Fcrit,delcrit,delcritinv;
+  double overlap,olapsq,olapcubed,sqrtterm,tmp,keyterm,keyterm2,keyterm3;
+  double aovera0,foverFc;
+  double gammatsuji;
+
+  double ktwist,kroll,twistcrit,rollcrit;
+  double relrot1,relrot2,relrot3,vrl1,vrl2,vrl3,vrlmag,vrlmaginv;
+  double magtwist,magtortwist;
+  double magrollsq,magroll,magrollinv,magtorroll;
 
   r = sqrt(rsq);
   rinv = 1.0/r;
@@ -638,11 +828,49 @@ void FixWallGran::hertz_history(double rsq, double dx, double dy, double dz,
   wr3 = radius*omega[2] * rinv;
 
   // normal forces = Hertzian contact + normal velocity damping
-
-  damp = meff*gamman*vnnr*rsqinv;
-  ccel = kn*(radius-r)*rinv - damp;
-  polyhertz = sqrt((radius-r)*radius);
-  ccel *= polyhertz;
+  // material properties: currently assumes identical materials
+
+  pois = E/(2.0*G) - 1.0;
+  E_eff=0.5*E/(1.0-pois*pois);
+  G_eff=G/(4.0-2.0*pois);
+
+  // rwall = 0 is infinite wall radius of curvature (flat wall)
+
+  if (rwall == 0) rad_eff = radius;
+  else rad_eff = radius*rwall/(radius+rwall);
+
+  Fcrit = rad_eff * (3.0 * M_PI * SurfEnergy);
+  a0=pow(9.0*M_PI*SurfEnergy*rad_eff*rad_eff/E_eff,1.0/3.0);
+  delcrit = 1.0/rad_eff*(0.5 * a0*a0/pow(6.0,1.0/3.0));
+  delcritinv = 1.0/delcrit;
+
+  overlap = (radius-r) * delcritinv;
+  olapsq = overlap*overlap;
+  olapcubed = olapsq*overlap;
+  sqrtterm = sqrt(1.0 + olapcubed);
+  tmp = 2.0 + olapcubed + 2.0*sqrtterm;
+  keyterm = pow(tmp,THIRD);
+  keyterm2 = olapsq/keyterm;
+  keyterm3 = sqrt(overlap + keyterm2 + keyterm);
+  aovera0 = pow(6.0,-TWOTHIRDS) * (keyterm3 +
+            sqrt(2.0*overlap - keyterm2 - keyterm + 4.0/keyterm3));
+  foverFc = 4.0*((aovera0*aovera0*aovera0) - pow(aovera0,1.5));
+  ccel = Fcrit*foverFc*rinv;
+
+  // damp = meff*gamman*vnnr*rsqinv;
+  // ccel = kn*(radius-r)*rinv - damp;
+  // polyhertz = sqrt((radius-r)*radius);
+  // ccel *= polyhertz;
+
+  // use Tsuji et al form
+
+  polyhertz = 1.2728- 4.2783*0.9 + 11.087*0.9*0.9 - 22.348*0.9*0.9*0.9 + 
+    27.467*0.9*0.9*0.9*0.9 - 18.022*0.9*0.9*0.9*0.9*0.9 + 
+    4.8218*0.9*0.9*0.9*0.9*0.9*0.9;
+
+  gammatsuji = 0.2*sqrt(meff*kn);
+  damp = gammatsuji*vnnr/rsq;
+  ccel = ccel - polyhertz * damp;
 
   // relative velocities
 
@@ -677,25 +905,90 @@ void FixWallGran::hertz_history(double rsq, double dx, double dy, double dz,
   fs2 = -polyhertz * (kt*shear[1] + meff*gammat*vtr2);
   fs3 = -polyhertz * (kt*shear[2] + meff*gammat*vtr3);
 
+  kt=8.0*G_eff*a0*aovera0;
+
+  // shear damping uses Tsuji et al form also
+
+  fs1 = -kt*shear[0] - polyhertz*gammatsuji*vtr1;
+  fs2 = -kt*shear[1] - polyhertz*gammatsuji*vtr2;
+  fs3 = -kt*shear[2] - polyhertz*gammatsuji*vtr3;
+
   // rescale frictional displacements and forces if needed
 
   fs = sqrt(fs1*fs1 + fs2*fs2 + fs3*fs3);
-  fn = xmu * fabs(ccel*r);
+  fn = xmu * fabs(ccel*r + 2.0*Fcrit);
 
   if (fs > fn) {
     if (shrmag != 0.0) {
-      shear[0] = (fn/fs) * (shear[0] + meff*gammat*vtr1/kt) -
-        meff*gammat*vtr1/kt;
-      shear[1] = (fn/fs) * (shear[1] + meff*gammat*vtr2/kt) -
-        meff*gammat*vtr2/kt;
-      shear[2] = (fn/fs) * (shear[2] + meff*gammat*vtr3/kt) -
-        meff*gammat*vtr3/kt;
+      shear[0] = (fn/fs) * (shear[0] + polyhertz*gammatsuji*vtr1/kt) -
+      polyhertz*gammatsuji*vtr1/kt;
+      shear[1] = (fn/fs) * (shear[1] + polyhertz*gammatsuji*vtr2/kt) -
+      polyhertz*gammatsuji*vtr2/kt;
+      shear[2] = (fn/fs) * (shear[2] + polyhertz*gammatsuji*vtr3/kt) -
+      polyhertz*gammatsuji*vtr3/kt;
       fs1 *= fn/fs ;
       fs2 *= fn/fs;
       fs3 *= fn/fs;
     } else fs1 = fs2 = fs3 = 0.0;
   }
 
+  // calculate twisting and rolling components of torque
+  // NOTE: this assumes spheres!
+
+  relrot1 = omega[0];
+  relrot2 = omega[1];
+  relrot3 = omega[2];
+
+  // rolling velocity
+  // NOTE: this assumes mondisperse spheres!
+
+  vrl1 = -rad_eff*rinv * (relrot2*dz - relrot3*dy);
+  vrl2 = -rad_eff*rinv * (relrot3*dx - relrot1*dz);
+  vrl3 = -rad_eff*rinv * (relrot1*dy - relrot2*dx);
+  vrlmag = sqrt(vrl1*vrl1+vrl2*vrl2+vrl3*vrl3);
+  if (vrlmag != 0.0) vrlmaginv = 1.0/vrlmag;
+  else vrlmaginv = 0.0;
+
+  // bond history effects
+
+  shear[3] += vrl1*dt;
+  shear[4] += vrl2*dt;
+  shear[5] += vrl3*dt;
+
+  // rotate bonded displacements correctly
+
+  double rlt = shear[3]*dx + shear[4]*dy + shear[5]*dz;
+  rlt /= rsq;
+  shear[3] -= rlt*dx;
+  shear[4] -= rlt*dy;
+  shear[5] -= rlt*dz;
+
+  // twisting torque
+
+  magtwist = rinv*(relrot1*dx + relrot2*dy + relrot3*dz);
+  shear[6] += magtwist*dt;
+
+  ktwist = 0.5*kt*(a0*aovera0)*(a0*aovera0);
+  magtortwist = -ktwist*shear[6] - 
+    0.5*polyhertz*gammatsuji*(a0*aovera0)*(a0*aovera0)*magtwist;
+
+  twistcrit=TWOTHIRDS*a0*aovera0*Fcrit;
+  if (fabs(magtortwist) > twistcrit)
+    magtortwist = -twistcrit * magtwist/fabs(magtwist);
+
+  // rolling torque
+
+  magrollsq = shear[3]*shear[3] + shear[4]*shear[4] + shear[5]*shear[5];
+  magroll = sqrt(magrollsq);
+  if (magroll != 0.0) magrollinv = 1.0/magroll;
+  else magrollinv = 0.0;
+
+  kroll = 1.0*4.0*Fcrit*pow(aovera0,1.5);
+  magtorroll = -kroll*magroll - 0.1*gammat*vrlmag;
+
+  rollcrit = 0.01;
+  if (magroll > rollcrit) magtorroll = -kroll*rollcrit;
+
   // forces & torques
 
   fx = dx*ccel + fs1;
@@ -712,6 +1005,14 @@ void FixWallGran::hertz_history(double rsq, double dx, double dy, double dz,
   torque[0] -= radius*tor1;
   torque[1] -= radius*tor2;
   torque[2] -= radius*tor3;
+
+  torque[0] += magtortwist * dx*rinv;
+  torque[1] += magtortwist * dy*rinv;
+  torque[2] += magtortwist * dz*rinv;
+
+  torque[0] += magtorroll * (shear[4]*dz - shear[5]*dy)*rinv*magrollinv;
+  torque[1] += magtorroll * (shear[5]*dx - shear[3]*dz)*rinv*magrollinv;
+  torque[2] += magtorroll * (shear[3]*dy - shear[4]*dx)*rinv*magrollinv;
 }
 
 /* ----------------------------------------------------------------------
@@ -722,8 +1023,8 @@ double FixWallGran::memory_usage()
 {
   int nmax = atom->nmax;
   double bytes = 0.0;
-  if (history) bytes += 3*nmax * sizeof(double);   // shear history
-  if (fix_rigid) bytes += nmax * sizeof(int);      // mass_rigid
+  if (history) bytes += nmax*sheardim * sizeof(double);   // shear history
+  if (fix_rigid) bytes += nmax * sizeof(int);             // mass_rigid
   return bytes;
 }
 
@@ -733,7 +1034,7 @@ double FixWallGran::memory_usage()
 
 void FixWallGran::grow_arrays(int nmax)
 {
-  if (history) memory->grow(shear,nmax,3,"fix_wall_gran:shear");
+  if (history) memory->grow(shearone,nmax,sheardim,"fix_wall_gran:shearone");
 }
 
 /* ----------------------------------------------------------------------
@@ -742,11 +1043,9 @@ void FixWallGran::grow_arrays(int nmax)
 
 void FixWallGran::copy_arrays(int i, int j, int delflag)
 {
-  if (history) {
-    shear[j][0] = shear[i][0];
-    shear[j][1] = shear[i][1];
-    shear[j][2] = shear[i][2];
-  }
+  if (history)
+    for (int m = 0; m < sheardim; m++)
+      shearone[j][m] = shearone[i][m];
 }
 
 /* ----------------------------------------------------------------------
@@ -755,7 +1054,9 @@ void FixWallGran::copy_arrays(int i, int j, int delflag)
 
 void FixWallGran::set_arrays(int i)
 {
-  if (history) shear[i][0] = shear[i][1] = shear[i][2] = 0.0;
+  if (history)
+    for (int m = 0; m < sheardim; m++)
+      shearone[i][m] = 0;
 }
 
 /* ----------------------------------------------------------------------
@@ -766,10 +1067,10 @@ int FixWallGran::pack_exchange(int i, double *buf)
 {
   if (!history) return 0;
 
-  buf[0] = shear[i][0];
-  buf[1] = shear[i][1];
-  buf[2] = shear[i][2];
-  return 3;
+  int n = 0;
+  for (int m = 0; m < sheardim; m++)
+    buf[n++] = shearone[i][m];
+  return n;
 }
 
 /* ----------------------------------------------------------------------
@@ -780,10 +1081,10 @@ int FixWallGran::unpack_exchange(int nlocal, double *buf)
 {
   if (!history) return 0;
 
-  shear[nlocal][0] = buf[0];
-  shear[nlocal][1] = buf[1];
-  shear[nlocal][2] = buf[2];
-  return 3;
+  int n = 0;
+  for (int m = 0; m < sheardim; m++)
+    shearone[nlocal][m] = buf[n++];
+  return n;
 }
 
 /* ----------------------------------------------------------------------
@@ -794,12 +1095,11 @@ int FixWallGran::pack_restart(int i, double *buf)
 {
   if (!history) return 0;
 
-  int m = 0;
-  buf[m++] = 4;
-  buf[m++] = shear[i][0];
-  buf[m++] = shear[i][1];
-  buf[m++] = shear[i][2];
-  return m;
+  int n = 0;
+  buf[n++] = sheardim + 1;
+  for (int m = 0; m < sheardim; m++)
+    buf[n++] = shearone[i][m];
+  return n;
 }
 
 /* ----------------------------------------------------------------------
@@ -808,19 +1108,18 @@ int FixWallGran::pack_restart(int i, double *buf)
 
 void FixWallGran::unpack_restart(int nlocal, int nth)
 {
-  double **extra = atom->extra;
-
   if (!history) return;
 
-  // skip to Nth set of extra values
+  double **extra = atom->extra;
 
+  // skip to Nth set of extra values
+  
   int m = 0;
   for (int i = 0; i < nth; i++) m += static_cast<int> (extra[nlocal][m]);
   m++;
-
-  shear[nlocal][0] = extra[nlocal][m++];
-  shear[nlocal][1] = extra[nlocal][m++];
-  shear[nlocal][2] = extra[nlocal][m++];
+  
+  for (int i = 0; i < sheardim; i++)
+    shearone[nlocal][i] = extra[nlocal][m++];
 }
 
 /* ----------------------------------------------------------------------
@@ -830,7 +1129,7 @@ void FixWallGran::unpack_restart(int nlocal, int nth)
 int FixWallGran::maxsize_restart()
 {
   if (!history) return 0;
-  return 4;
+  return 1 + sheardim;
 }
 
 /* ----------------------------------------------------------------------
@@ -840,7 +1139,7 @@ int FixWallGran::maxsize_restart()
 int FixWallGran::size_restart(int nlocal)
 {
   if (!history) return 0;
-  return 4;
+  return 1 + sheardim;
 }
 
 /* ---------------------------------------------------------------------- */
diff --git a/src/GRANULAR/fix_wall_gran.h b/src/GRANULAR/fix_wall_gran.h
index df15cd739cd7ea9a2cfa59042fb5d56757a1d5d6..e9b6a73b9d3ad9875d1a40847e3144af5970bda0 100644
--- a/src/GRANULAR/fix_wall_gran.h
+++ b/src/GRANULAR/fix_wall_gran.h
@@ -29,51 +29,59 @@ class FixWallGran : public Fix {
   FixWallGran(class LAMMPS *, int, char **);
   virtual ~FixWallGran();
   int setmask();
-  void init();
+  virtual void init();
   void setup(int);
   virtual void post_force(int);
   virtual void post_force_respa(int, int, int);
 
-  double memory_usage();
-  void grow_arrays(int);
-  void copy_arrays(int, int, int);
-  void set_arrays(int);
-  int pack_exchange(int, double *);
-  int unpack_exchange(int, double *);
-  int pack_restart(int, double *);
-  void unpack_restart(int, int);
-  int size_restart(int);
-  int maxsize_restart();
+  virtual double memory_usage();
+  virtual void grow_arrays(int);
+  virtual void copy_arrays(int, int, int);
+  virtual void set_arrays(int);
+  virtual int pack_exchange(int, double *);
+  virtual int unpack_exchange(int, double *);
+  virtual int pack_restart(int, double *);
+  virtual void unpack_restart(int, int);
+  virtual int size_restart(int);
+  virtual int maxsize_restart();
   void reset_dt();
 
+  void hooke(double, double, double, double, double *,
+             double *, double *, double *, double *, double, double);
+  void hooke_history(double, double, double, double, double *,
+                     double *, double *, double *, double *, double, double,
+                     double *);
+  void hertz_history(double, double, double, double, double *, double,
+                     double *, double *, double *, double *, double, double,
+                     double *);
+  void bonded_history(double, double, double, double, double *, double,
+                       double *, double *, double *, double *, double, double,
+                       double *);
+
  protected:
-  int wallstyle,pairstyle,history,wiggle,wshear,axis;
+  int wallstyle,wiggle,wshear,axis;
+  int pairstyle,nlevels_respa;
+  bigint time_origin;
   double kn,kt,gamman,gammat,xmu;
+  double E,G,SurfEnergy;
   double lo,hi,cylradius;
   double amplitude,period,omega,vshear;
   double dt;
-  int nlevels_respa;
-  int time_origin;
+  char *idregion;
+
+  int history;       // if particle/wall interaction stores history
+  int shearupdate;   // flag for whether shear history is updated
+  int sheardim;      // # of shear history values per contact
 
-  // shear history values
+  // shear history for single contact per particle
 
-  double **shear;
-  int shearupdate;
+  double **shearone;
 
   // rigid body masses for use in granular interactions
 
   class Fix *fix_rigid;    // ptr to rigid body fix, NULL if none
   double *mass_rigid;      // rigid mass for owned+ghost atoms
   int nmax;                // allocated size of mass_rigid
-
-  void hooke(double, double, double, double, double *,
-             double *, double *, double *, double *, double, double);
-  void hooke_history(double, double, double, double, double *,
-                     double *, double *, double *, double *, double, double,
-                     double *);
-  void hertz_history(double, double, double, double, double *,
-                     double *, double *, double *, double *, double, double,
-                     double *);
 };
 
 }
diff --git a/src/GRANULAR/fix_wall_gran_region.cpp b/src/GRANULAR/fix_wall_gran_region.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..3ed7cf3d90ff4c1fda21ae89f14991397efca4cd
--- /dev/null
+++ b/src/GRANULAR/fix_wall_gran_region.cpp
@@ -0,0 +1,548 @@
+/* ----------------------------------------------------------------------
+   LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator
+   http://lammps.sandia.gov, Sandia National Laboratories
+   Steve Plimpton, sjplimp@sandia.gov
+
+   Copyright (2003) Sandia Corporation.  Under the terms of Contract
+   DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains
+   certain rights in this software.  This software is distributed under
+   the GNU General Public License.
+
+   See the README file in the top-level LAMMPS directory.
+   ------------------------------------------------------------------------- */
+
+/* ----------------------------------------------------------------------
+   Contributing authors: Dan Bolintineanu (SNL)
+------------------------------------------------------------------------- */
+
+#include "math.h"
+#include "stdlib.h"
+#include "string.h"
+#include "fix_wall_gran_region.h"
+#include "region.h"
+#include "atom.h"
+#include "domain.h"
+#include "update.h"
+#include "force.h"
+#include "pair.h"
+#include "modify.h"
+#include "respa.h"
+#include "math_const.h"
+#include "memory.h"
+#include "error.h"
+
+using namespace LAMMPS_NS;
+using namespace FixConst;
+using namespace MathConst;
+
+// same as FixWallGran
+
+enum{HOOKE,HOOKE_HISTORY,HERTZ_HISTORY,BONDED_HISTORY};
+
+#define BIG 1.0e20
+
+/* ---------------------------------------------------------------------- */
+
+FixWallGranRegion::FixWallGranRegion(LAMMPS *lmp, int narg, char **arg) :
+  FixWallGran(lmp, narg, arg)
+{
+  restart_global = 1;
+  motion_resetflag = 0;
+
+  int iregion = domain->find_region(idregion);
+  if (iregion == -1)
+    error->all(FLERR,"Region ID for fix wall/gran/region does not exist");
+  region = domain->regions[iregion];
+  region_style = new char[strlen(region->style)+1];
+  strcpy(region_style,region->style);
+  nregion = region->nregion;
+  
+  tmax = domain->regions[iregion]->tmax;
+  c2r = new int[tmax];
+
+  // re-allocate atom-based arrays with nshear
+  // do not register with Atom class, since parent class did that
+  
+  memory->destroy(shearone);
+  shearone = NULL;
+
+  ncontact = NULL;
+  walls = NULL;
+  shearmany = NULL;
+  grow_arrays(atom->nmax);
+  
+  // initialize shear history as if particle is not touching region
+
+  if (history) {
+    int nlocal = atom->nlocal;
+    for (int i = 0; i < nlocal; i++)
+      ncontact[i] = 0;
+  }
+}
+
+/* ---------------------------------------------------------------------- */
+
+FixWallGranRegion::~FixWallGranRegion()
+{
+  delete [] c2r;
+  memory->destroy(ncontact);
+  memory->destroy(walls);
+  memory->destroy(shearmany);
+}
+
+/* ---------------------------------------------------------------------- */
+
+void FixWallGranRegion::init()
+{
+  FixWallGran::init();
+
+  int iregion = domain->find_region(idregion);
+  if (iregion == -1)
+    error->all(FLERR,"Region ID for fix wall/gran/region does not exist");
+  region = domain->regions[iregion];
+
+  // region displacement and orientation theta at previous step
+  // check if region properties changed between runs
+
+  if (motion_resetflag) {
+    if (comm->me == 0) {
+      char str[128];
+      sprintf(str,"Properties for region %s do not match restart file, "
+              "resetting its motion",idregion);
+      error->warning(FLERR,str);
+    }
+    region->reset_vel();
+  }  
+}
+
+
+/* ---------------------------------------------------------------------- */
+
+void FixWallGranRegion::post_force(int vflag)
+{
+  int i,m,nc,iwall;
+  double rinv,fx,fy,fz,tooclose;
+  double dx,dy,dz,rsq,meff;
+  double xc[3],vwall[3];
+
+  // do not update shear history during setup
+
+  shearupdate = 1;
+  if (update->setupflag) shearupdate = 0;
+
+  // if just reneighbored:
+  // update rigid body masses for owned atoms if using FixRigid
+  //   body[i] = which body atom I is in, -1 if none
+  //   mass_body = mass of each rigid body
+
+  if (neighbor->ago == 0 && fix_rigid) {
+    int tmp;
+    int *body = (int *) fix_rigid->extract("body",tmp);
+    double *mass_body = (double *) fix_rigid->extract("masstotal",tmp);
+    if (atom->nmax > nmax) {
+      memory->destroy(mass_rigid);
+      nmax = atom->nmax;
+      memory->create(mass_rigid,nmax,"wall/gran:mass_rigid");
+    }
+    int nlocal = atom->nlocal;
+    for (i = 0; i < nlocal; i++) {
+      if (body[i] >= 0) mass_rigid[i] = mass_body[body[i]];
+      else mass_rigid[i] = 0.0;
+    }
+  }
+
+  int regiondynamic = region->dynamic_check();
+  if (!regiondynamic) vwall[0] = vwall[1] = vwall[2] = 0.0;
+
+  double **x = atom->x;
+  double **v = atom->v;
+  double **f = atom->f;
+  double **omega = atom->omega;
+  double **torque = atom->torque;
+  double *radius = atom->radius;
+  double *rmass = atom->rmass;
+
+  int *mask = atom->mask;
+  int nlocal = atom->nlocal;
+
+  // set current motion attributes of region
+  // set_velocity() also updates prev to current step
+
+  if (regiondynamic) {
+    region->prematch();
+    region->set_velocity(); 
+  }
+
+  for (i = 0; i < nlocal; i++) {
+    if (mask[i] & groupbit) {
+      if (!region->match(x[i][0],x[i][1],x[i][2])) continue;
+      
+      nc = region->surface(x[i][0],x[i][1],x[i][2],radius[i]);
+      if (nc > tmax) 
+        error->one(FLERR,"Too many wall/gran/region contacts for one particle");
+
+      // shear history maintenance
+      // update ncontact,walls,shear2many for particle I
+      //   to reflect new and persistent shear history values
+      // also set c2r[] = indices into region->contact[] for each of N contacts
+      // process zero or one contact here, otherwise invoke update_contacts()
+
+      if (history) {
+        if (nc == 0) {
+          ncontact[i] = 0;
+          continue;
+        }
+        if (nc == 1) {
+          c2r[0] = 0;
+          iwall = region->contact[0].iwall;
+          if (ncontact[i] == 0) {
+            ncontact[i] = 1;
+            walls[i][0] = iwall;
+            for (m = 0; m < sheardim; m++)
+              shearmany[i][0][m] = 0.0;
+          } else if (ncontact[i] > 1 || iwall != walls[i][0]) 
+            update_contacts(i,nc);
+        } else update_contacts(i,nc);
+      }
+
+      // process current contacts
+
+      for (int ic = 0; ic < nc; ic++) {
+
+        // rsq = squared contact distance
+        // xc = contact point
+
+        rsq = region->contact[ic].r*region->contact[ic].r;
+
+        dx = region->contact[ic].delx;
+        dy = region->contact[ic].dely;
+        dz = region->contact[ic].delz;
+
+        if (regiondynamic) region->velocity_contact(vwall, x[i], ic);
+
+
+        // meff = effective mass of sphere
+        // if I is part of rigid body, use body mass
+          
+        meff = rmass[i];
+        if (fix_rigid && mass_rigid[i] > 0.0) meff = mass_rigid[i];
+
+        // invoke sphere/wall interaction
+        
+        if (pairstyle == HOOKE)
+          hooke(rsq,dx,dy,dz,vwall,v[i],f[i],
+                omega[i],torque[i],radius[i],meff);
+        else if (pairstyle == HOOKE_HISTORY)
+          hooke_history(rsq,dx,dy,dz,vwall,v[i],f[i],
+                        omega[i],torque[i],radius[i],meff,
+                        shearmany[i][c2r[ic]]);
+        else if (pairstyle == HERTZ_HISTORY)
+          hertz_history(rsq,dx,dy,dz,vwall,region->contact[ic].radius,
+                        v[i],f[i],omega[i],torque[i],
+                        radius[i],meff,shearmany[i][c2r[ic]]);
+        else if (pairstyle == BONDED_HISTORY)
+          bonded_history(rsq,dx,dy,dz,vwall,region->contact[ic].radius,
+                         v[i],f[i],omega[i],torque[i],
+                         radius[i],meff,shearmany[i][c2r[ic]]);
+      }
+    }
+  }
+}
+
+/* ----------------------------------------------------------------------
+   update contact info in ncontact, walls, shear2many for particle I
+   based on ncontacts[i] old contacts and N new contacts
+     matched via their associated walls
+   delete/zero shear history for broken/new contacts
+   also set c2r[i] = index of Ith contact in region list of contacts
+------------------------------------------------------------------------- */
+
+void FixWallGranRegion::update_contacts(int i, int nc)
+{
+  int j,m,iold,nold,ilast,inew,iadd,iwall;
+
+  // loop over old contacts
+  // if not in new contact list:
+  //   delete old contact by copying last contact over it
+
+  iold = 0;
+  while (iold < ncontact[i]) {
+    for (m = 0; m < nc; m++)
+      if (region->contact[m].iwall = walls[i][iold]) break;
+    if (m < nc) {
+      ilast = ncontact[i]-1;
+      for (j = 0; j < sheardim; j++)
+        shearmany[i][iold][j] = shearmany[i][ilast][j];
+      walls[i][iold] = walls[i][ilast];
+      ncontact[i]--;
+    } else iold++;
+  }
+
+  // loop over new contacts
+  // if not in newly compressed contact list of length nold:
+  //   add it with zeroed shear history
+  // set all values in c2r
+
+  nold = ncontact[i];
+
+  for (inew = 0; inew < nc; inew++) {
+    iwall = region->contact[inew].iwall;
+    for (m = 0; m < nold; m++)
+      if (walls[i][m] == iwall) break;
+    if (m < nold) c2r[m] = inew;
+    else {
+      iadd = ncontact[i];
+
+      c2r[iadd] = inew;
+      for (j = 0; j < sheardim; j++)
+        shearmany[i][iadd][j] = 0.0;
+      walls[i][iadd] = iwall;
+      ncontact[i]++;
+    }
+  }
+}
+
+/* ----------------------------------------------------------------------
+   memory usage of local atom-based arrays
+------------------------------------------------------------------------- */
+
+double FixWallGranRegion::memory_usage()
+{
+  int nmax = atom->nmax;
+  double bytes = 0.0;
+  if (history) {                                   // shear history
+    bytes += nmax * sizeof(int);                   // ncontact
+    bytes += nmax*tmax * sizeof(int);              // walls
+    bytes += nmax*tmax*sheardim * sizeof(double);  // shearmany
+  }
+  if (fix_rigid) bytes += nmax * sizeof(int);      // mass_rigid
+  return bytes;
+}
+
+/* ----------------------------------------------------------------------
+   allocate local atom-based arrays
+------------------------------------------------------------------------- */
+
+void FixWallGranRegion::grow_arrays(int nmax)
+{
+  if (history) {
+    memory->grow(ncontact,nmax,"fix_wall_gran:ncontact");
+    memory->grow(walls,nmax,tmax,"fix_wall_gran:walls");
+    memory->grow(shearmany,nmax,tmax,sheardim,"fix_wall_gran:shearmany");
+  }
+}
+
+/* ----------------------------------------------------------------------
+   copy values within local atom-based arrays
+------------------------------------------------------------------------- */
+
+void FixWallGranRegion::copy_arrays(int i, int j, int delflag)
+{
+  int m,n,iwall;
+
+  if (!history) return;
+
+  n = ncontact[i];
+
+  for (iwall = 0; iwall < n; iwall++) {
+    walls[j][iwall] = walls[i][iwall];
+    for (m = 0; m < sheardim; m++)
+      shearmany[j][iwall][m] = shearmany[i][iwall][m];
+  }
+  ncontact[j] = ncontact[i];
+}
+
+/* ----------------------------------------------------------------------
+   initialize one atom's array values, called when atom is created
+------------------------------------------------------------------------- */
+
+void FixWallGranRegion::set_arrays(int i)
+{
+  if (!history) return;
+  ncontact[i] = 0;
+}
+
+/* ----------------------------------------------------------------------
+   pack values in local atom-based arrays for exchange with another proc
+------------------------------------------------------------------------- */
+
+int FixWallGranRegion::pack_exchange(int i, double *buf)
+{
+  int m;
+
+  if (!history) return 0;
+
+  int n = 0;
+  int count = ncontact[i];
+
+  buf[n++] = ubuf(count).d;
+  for (int iwall = 0; iwall < count; iwall++) {
+    buf[n++] = ubuf(walls[i][iwall]).d;
+    for (m = 0; m < sheardim; m++)
+      buf[n++] = shearmany[i][iwall][m];
+  }
+
+  return n;
+}
+
+/* ----------------------------------------------------------------------
+   unpack values into local atom-based arrays after exchange
+------------------------------------------------------------------------- */
+
+int FixWallGranRegion::unpack_exchange(int nlocal, double *buf)
+{
+  int m;
+
+  if (!history) return 0;
+
+  int n = 0;
+  int count = ncontact[nlocal] = (int) ubuf(buf[n++]).i;
+
+  for (int iwall = 0; iwall < count; iwall++) {
+    walls[nlocal][iwall] = (int) ubuf(buf[n++]).i;
+    for (m = 0; m < sheardim; m++)
+      shearmany[nlocal][iwall][m] = buf[n++];
+  }
+
+  return n;
+}
+
+/* ----------------------------------------------------------------------
+   pack values in local atom-based arrays for restart file
+------------------------------------------------------------------------- */
+
+int FixWallGranRegion::pack_restart(int i, double *buf)
+{
+  int m;
+
+  if (!history) return 0;
+
+  int n = 1;
+  int count = ncontact[i];
+
+  buf[n++] = ubuf(count).d;
+  for (int iwall = 0; iwall < count; iwall++) {
+    buf[n++] = ubuf(walls[i][iwall]).d;
+    for (m = 0; m < sheardim; m++)
+      buf[n++] = shearmany[i][iwall][m];
+  }
+  buf[0] = n;
+  return n;
+}
+
+/* ----------------------------------------------------------------------
+   unpack values from atom->extra array to restart the fix
+------------------------------------------------------------------------- */
+
+void FixWallGranRegion::unpack_restart(int nlocal, int nth)
+{
+  int k;
+
+  if (!history) return;
+
+  double **extra = atom->extra;
+
+  // skip to Nth set of extra values
+  
+  int m = 0;
+  for (int i = 0; i < nth; i++) m += static_cast<int> (extra[nlocal][m]);
+  m++;
+  
+  int count = ncontact[nlocal] = (int) ubuf(extra[nlocal][m++]).i;
+  for (int iwall = 0; iwall < count; iwall++) {
+    walls[nlocal][iwall] = (int) ubuf(extra[nlocal][m++]).i;
+    for (k = 0; k < sheardim; k++)
+      shearmany[nlocal][iwall][k] = extra[nlocal][m++];
+  }
+}
+
+/* ----------------------------------------------------------------------
+   maxsize of any atom's restart data
+------------------------------------------------------------------------- */
+
+int FixWallGranRegion::maxsize_restart()
+{
+  if (!history) return 0;
+  return 2 + tmax*(sheardim+1);
+}
+
+/* ----------------------------------------------------------------------
+   size of atom nlocal's restart data
+------------------------------------------------------------------------- */
+
+int FixWallGranRegion::size_restart(int nlocal)
+{
+  if (!history) return 0;
+  return 2 + ncontact[nlocal]*(sheardim+1);
+}
+
+/* ----------------------------------------------------------------------
+   pack entire state of Fix into one write
+------------------------------------------------------------------------- */
+
+void FixWallGranRegion::write_restart(FILE *fp)
+{
+  if (comm->me) return;
+  int size_id_str = (strlen(region->id) + 1) * sizeof(char);
+  int size_style_str = (strlen(region->style) + 1) * sizeof(char);
+  int size_tot = sizeof(int) + size_id_str + 
+    sizeof(int) + size_style_str + sizeof(int) + 
+    region->size_restart*sizeof(double);
+
+  fwrite(&size_tot,sizeof(int),1,fp);
+  fwrite(&size_id_str,sizeof(int),1,fp);
+  fwrite(region->id,sizeof(char),size_id_str,fp);
+  fwrite(&size_style_str,sizeof(int),1,fp);
+  fwrite(region->style,sizeof(char),size_style_str,fp);  
+  fwrite(&region->nregion,sizeof(int),1,fp);
+
+  region->write_restart(fp);
+}
+
+/* ----------------------------------------------------------------------
+   use state info from restart file to restart the Fix
+------------------------------------------------------------------------- */
+
+void FixWallGranRegion::restart(char *buf)
+{
+  int n = 0;  
+  int size_id_str = buf[n];
+  n += sizeof(int);
+  char *region_id_restart = new char[size_id_str];
+  for (int i = 0; i < size_id_str; i++){
+    region_id_restart[i] = buf[n++];  
+  }
+  
+  int size_style_str = buf[n];
+  n += sizeof(int);
+  char *region_style_restart = new char[size_style_str];
+  for (int i = 0; i < size_style_str; i++)
+    region_style_restart[i] = buf[n++];  
+  
+  int nregion_restart = buf[n];
+  n += sizeof(int);
+
+  if (check_consistent_region(region,region_id_restart,
+                              region_style_restart,nregion_restart))
+    region->restart(buf,n);
+  else motion_resetflag = 1;
+
+  delete [] region_id_restart;
+  delete [] region_style_restart;
+}
+
+
+/* ----------------------------------------------------------------------
+   check that region id/style/number of sub-regions are consistent
+------------------------------------------------------------------------- */
+
+int FixWallGranRegion::check_consistent_region(Region *region, 
+                                               char* region_id, 
+                                               char* region_style, int nregion)
+{
+  if (strcmp(region_id, region->id) != 0 ||
+      strcmp(region_style, region->style) != 0 ||
+      nregion != region->nregion)
+    return 0;       
+  return 1;
+}
diff --git a/src/GRANULAR/fix_wall_gran_region.h b/src/GRANULAR/fix_wall_gran_region.h
new file mode 100644
index 0000000000000000000000000000000000000000..d7bc8be53e4351cc623aeaf3afd05f1aa8089fc3
--- /dev/null
+++ b/src/GRANULAR/fix_wall_gran_region.h
@@ -0,0 +1,106 @@
+/* -*- c++ -*- ----------------------------------------------------------
+   LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator
+   http://lammps.sandia.gov, Sandia National Laboratories
+   Steve Plimpton, sjplimp@sandia.gov
+
+   Copyright (2003) Sandia Corporation.  Under the terms of Contract
+   DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains
+   certain rights in this software.  This software is distributed under
+   the GNU General Public License.
+
+   See the README file in the top-level LAMMPS directory.
+------------------------------------------------------------------------- */
+
+#ifdef FIX_CLASS
+
+FixStyle(wall/gran/region,FixWallGranRegion)
+
+#else
+
+#ifndef LMP_FIX_WALL_GRAN_REGION_H
+#define LMP_FIX_WALL_GRAN_REGION_H
+
+#include "fix_wall_gran.h"
+
+namespace LAMMPS_NS {
+
+class FixWallGranRegion : public FixWallGran {
+ public:
+  FixWallGranRegion(class LAMMPS *, int, char **);
+  ~FixWallGranRegion();
+  void post_force(int);
+  void write_restart(FILE *);
+  void restart(char* );
+  void init();
+    
+  double memory_usage();
+  void grow_arrays(int);
+  void copy_arrays(int, int, int);
+  void set_arrays(int);
+  int pack_exchange(int, double *);
+  int unpack_exchange(int, double *);
+  int pack_restart(int, double *);
+  void unpack_restart(int, int);
+  int size_restart(int);
+  int maxsize_restart();
+
+ private:
+  class Region *region;
+  char *region_style;
+  int nregion;
+  
+  // shear history for multiple contacts per particle
+
+  int tmax;              // max # of region walls one particle can touch 
+  int *ncontact;         // # of shear contacts per particle
+  int **walls;           // which wall each contact is with
+  double ***shearmany;   // shear history per particle per contact
+  int *c2r;              // contact to region mapping
+                         // c2r[i] = index of Ith contact in
+                         //   region-contact[] list of contacts
+  int motion_resetflag;  // used by restart to indicate that region 
+                         //    vel info is to be reset
+
+  void update_contacts(int, int);
+  int check_consistent_region(Region *, char*, char*, int);
+};
+
+}
+
+#endif
+#endif
+
+/* ERROR/WARNING messages:
+
+E: Illegal ... command
+
+Self-explanatory.  Check the input script syntax and compare to the
+documentation for the command.  You can use -echo screen as a
+command-line option when running LAMMPS to see the offending line.
+
+E: Fix wall/gran requires atom style sphere
+
+Self-explanatory.
+
+E: Cannot use wall in periodic dimension
+
+Self-explanatory.
+
+E: Cannot wiggle and shear fix wall/gran
+
+Cannot specify both options at the same time.
+
+E: Invalid wiggle direction for fix wall/gran
+
+Self-explanatory.
+
+E: Invalid shear direction for fix wall/gran
+
+Self-explanatory.
+
+E: Fix wall/gran is incompatible with Pair style
+
+Must use a granular pair style to define the parameters needed for
+this fix.
+
+*/
diff --git a/src/KOKKOS/atom_kokkos.cpp b/src/KOKKOS/atom_kokkos.cpp
index 4d343367f1029fef74b6023004d2e4067a1f4b24..577eff2364bf8e053a04ba47dfad387ca204210e 100644
--- a/src/KOKKOS/atom_kokkos.cpp
+++ b/src/KOKKOS/atom_kokkos.cpp
@@ -21,6 +21,7 @@
 #include "atom_masks.h"
 #include "memory.h"
 #include "error.h"
+#include "kokkos.h"
 
 using namespace LAMMPS_NS;
 
@@ -78,6 +79,9 @@ AtomKokkos::~AtomKokkos()
 
 void AtomKokkos::sync(const ExecutionSpace space, unsigned int mask)
 {
+  if (space == Device && lmp->kokkos->auto_sync)
+    ((AtomVecKokkos *) avec)->modified(Host,mask);
+
   ((AtomVecKokkos *) avec)->sync(space,mask);
 }
 
@@ -86,6 +90,9 @@ void AtomKokkos::sync(const ExecutionSpace space, unsigned int mask)
 void AtomKokkos::modified(const ExecutionSpace space, unsigned int mask)
 {
   ((AtomVecKokkos *) avec)->modified(space,mask);
+
+  if (space == Device && lmp->kokkos->auto_sync)
+    ((AtomVecKokkos *) avec)->sync(Host,mask);
 }
 
 void AtomKokkos::sync_overlapping_device(const ExecutionSpace space, unsigned int mask)
diff --git a/src/KOKKOS/fix_deform_kokkos.cpp b/src/KOKKOS/fix_deform_kokkos.cpp
index b3316022f1076afe074fa4858729c70484b56bc1..52953207340546890af19b6470f91f4b4b4c1f82 100644
--- a/src/KOKKOS/fix_deform_kokkos.cpp
+++ b/src/KOKKOS/fix_deform_kokkos.cpp
@@ -49,6 +49,7 @@ enum{NO_REMAP,X_REMAP,V_REMAP};
 
 FixDeformKokkos::FixDeformKokkos(LAMMPS *lmp, int narg, char **arg) : FixDeform(lmp, narg, arg)
 {
+  kokkosable = 1;
   domainKK = (DomainKokkos *) domain;
 
   datamask_read = EMPTY_MASK;
diff --git a/src/KOKKOS/fix_langevin_kokkos.cpp b/src/KOKKOS/fix_langevin_kokkos.cpp
index 43af4168f3996e06dea2625e9952f9cafa481d94..b51c934c3e602de7198f475c2deb0ff7f228f5ad 100644
--- a/src/KOKKOS/fix_langevin_kokkos.cpp
+++ b/src/KOKKOS/fix_langevin_kokkos.cpp
@@ -44,6 +44,7 @@ template<class DeviceType>
 FixLangevinKokkos<DeviceType>::FixLangevinKokkos(LAMMPS *lmp, int narg, char **arg) :
   FixLangevin(lmp, narg, arg),rand_pool(seed + comm->me)
 {
+  kokkosable = 1;
   atomKK = (AtomKokkos *) atom;
   int ntypes = atomKK->ntypes;
 
diff --git a/src/KOKKOS/fix_nh_kokkos.cpp b/src/KOKKOS/fix_nh_kokkos.cpp
index 8cc06fc52cd0cd0b2f43e3efab7a0cb66fea13f2..2b55259365d5100ced33316ea81f272b49bdb0cc 100644
--- a/src/KOKKOS/fix_nh_kokkos.cpp
+++ b/src/KOKKOS/fix_nh_kokkos.cpp
@@ -55,6 +55,7 @@ enum{ISO,ANISO,TRICLINIC};
 template<class DeviceType>
 FixNHKokkos<DeviceType>::FixNHKokkos(LAMMPS *lmp, int narg, char **arg) : FixNH(lmp, narg, arg)
 {
+  kokkosable = 1;
   domainKK = (DomainKokkos *) domain;
   execution_space = ExecutionSpaceFromDevice<DeviceType>::space;
 
diff --git a/src/KOKKOS/fix_nph_kokkos.cpp b/src/KOKKOS/fix_nph_kokkos.cpp
index f3f7c271d65737e46d427f336891bbacbeaeeab6..34fc212c0f996adbed0597d479e63bcc929722f1 100644
--- a/src/KOKKOS/fix_nph_kokkos.cpp
+++ b/src/KOKKOS/fix_nph_kokkos.cpp
@@ -25,6 +25,7 @@ template<class DeviceType>
 FixNPHKokkos<DeviceType>::FixNPHKokkos(LAMMPS *lmp, int narg, char **arg) :
   FixNHKokkos<DeviceType>(lmp, narg, arg)
 {
+  this->kokkosable = 1;
   if (this->tstat_flag)
     this->error->all(FLERR,"Temperature control can not be used with fix nph");
   if (!this->pstat_flag)
diff --git a/src/KOKKOS/fix_npt_kokkos.cpp b/src/KOKKOS/fix_npt_kokkos.cpp
index bbc26b8e884e1867f777d75f45c65ac1c55f5f6c..c99a322a01679f0667c1de85d51c1d3afacc8ab3 100644
--- a/src/KOKKOS/fix_npt_kokkos.cpp
+++ b/src/KOKKOS/fix_npt_kokkos.cpp
@@ -25,6 +25,7 @@ template<class DeviceType>
 FixNPTKokkos<DeviceType>::FixNPTKokkos(LAMMPS *lmp, int narg, char **arg) :
   FixNHKokkos<DeviceType>(lmp, narg, arg)
 {
+  this->kokkosable = 1;
   if (!this->tstat_flag)
     this->error->all(FLERR,"Temperature control must be used with fix npt");
   if (!this->pstat_flag)
diff --git a/src/KOKKOS/fix_nve_kokkos.cpp b/src/KOKKOS/fix_nve_kokkos.cpp
index 5e7e9b5298943331ee1863ab8eee723778bdb55a..4c041f85b0794a2f63ff2d803c27ed84db275b61 100644
--- a/src/KOKKOS/fix_nve_kokkos.cpp
+++ b/src/KOKKOS/fix_nve_kokkos.cpp
@@ -30,6 +30,7 @@ template<class DeviceType>
 FixNVEKokkos<DeviceType>::FixNVEKokkos(LAMMPS *lmp, int narg, char **arg) :
   FixNVE(lmp, narg, arg)
 {
+  kokkosable = 1;
   atomKK = (AtomKokkos *) atom;
   execution_space = ExecutionSpaceFromDevice<DeviceType>::space;
 
diff --git a/src/KOKKOS/fix_nvt_kokkos.cpp b/src/KOKKOS/fix_nvt_kokkos.cpp
index c479251c3308ca46f0a888486f03c86b3e518610..9628ff023126b13286d3c5594050bf501c5e322d 100644
--- a/src/KOKKOS/fix_nvt_kokkos.cpp
+++ b/src/KOKKOS/fix_nvt_kokkos.cpp
@@ -26,6 +26,7 @@ template<class DeviceType>
 FixNVTKokkos<DeviceType>::FixNVTKokkos(LAMMPS *lmp, int narg, char **arg) :
   FixNHKokkos<DeviceType>(lmp, narg, arg)
 {
+  this->kokkosable = 1;
   if (!this->tstat_flag)
     this->error->all(FLERR,"Temperature control must be used with fix nvt");
   if (this->pstat_flag)
diff --git a/src/KOKKOS/fix_qeq_reax_kokkos.cpp b/src/KOKKOS/fix_qeq_reax_kokkos.cpp
index 8ae132e5752e58fd24222bcebff709502173341f..e54be7412402736e71243395442839753c01bb95 100644
--- a/src/KOKKOS/fix_qeq_reax_kokkos.cpp
+++ b/src/KOKKOS/fix_qeq_reax_kokkos.cpp
@@ -53,6 +53,7 @@ template<class DeviceType>
 FixQEqReaxKokkos<DeviceType>::FixQEqReaxKokkos(LAMMPS *lmp, int narg, char **arg) :
   FixQEqReax(lmp, narg, arg)
 {
+  kokkosable = 1;
   atomKK = (AtomKokkos *) atom;
   execution_space = ExecutionSpaceFromDevice<DeviceType>::space;
 
diff --git a/src/KOKKOS/fix_setforce_kokkos.cpp b/src/KOKKOS/fix_setforce_kokkos.cpp
index 93e5e19377dfb798089a115a7c83436d03022ef2..27f7d100fa57f0a86ddc3c311f6f3b4a98cd6d5d 100644
--- a/src/KOKKOS/fix_setforce_kokkos.cpp
+++ b/src/KOKKOS/fix_setforce_kokkos.cpp
@@ -38,6 +38,7 @@ template<class DeviceType>
 FixSetForceKokkos<DeviceType>::FixSetForceKokkos(LAMMPS *lmp, int narg, char **arg) :
   FixSetForce(lmp, narg, arg)
 {
+  kokkosable = 1;
   atomKK = (AtomKokkos *) atom;
   execution_space = ExecutionSpaceFromDevice<DeviceType>::space;
   datamask_read = EMPTY_MASK;
diff --git a/src/KOKKOS/fix_wall_reflect_kokkos.cpp b/src/KOKKOS/fix_wall_reflect_kokkos.cpp
index 27c0080234261ad1034b99ab5da6f7c764f82d72..55be7e5cd7c5c86335a0a8208cbf8ca39005c520 100644
--- a/src/KOKKOS/fix_wall_reflect_kokkos.cpp
+++ b/src/KOKKOS/fix_wall_reflect_kokkos.cpp
@@ -40,6 +40,7 @@ template<class DeviceType>
 FixWallReflectKokkos<DeviceType>::FixWallReflectKokkos(LAMMPS *lmp, int narg, char **arg) :
   FixWallReflect(lmp, narg, arg)
 {
+  kokkosable = 1;
   atomKK = (AtomKokkos *) atom;
   execution_space = ExecutionSpaceFromDevice<DeviceType>::space;
   datamask_read = X_MASK | V_MASK | MASK_MASK;
diff --git a/src/KOKKOS/kokkos.cpp b/src/KOKKOS/kokkos.cpp
index 180e3d84999340b589aebf5b0443a0b33e193645..72bf094e4b94334d15e8940584a871c8e4791837 100644
--- a/src/KOKKOS/kokkos.cpp
+++ b/src/KOKKOS/kokkos.cpp
@@ -33,6 +33,8 @@ KokkosLMP::KokkosLMP(LAMMPS *lmp, int narg, char **arg) : Pointers(lmp)
   kokkos_exists = 1;
   lmp->kokkos = this;
 
+  auto_sync = 1;
+
   int me = 0;
   MPI_Comm_rank(world,&me);
   if (me == 0) error->message(FLERR,"KOKKOS mode is enabled");
diff --git a/src/KOKKOS/kokkos.h b/src/KOKKOS/kokkos.h
index f6d3404283a5582707eb44c799f94673bb5ef001..1058affcfc838e3d316ca5247f0102a8cb521fec 100644
--- a/src/KOKKOS/kokkos.h
+++ b/src/KOKKOS/kokkos.h
@@ -29,6 +29,7 @@ class KokkosLMP : protected Pointers {
   int forward_comm_on_host;
   int num_threads,ngpu;
   int numa;
+  int auto_sync;
 
   KokkosLMP(class LAMMPS *, int, char **);
   ~KokkosLMP();
diff --git a/src/KOKKOS/modify_kokkos.cpp b/src/KOKKOS/modify_kokkos.cpp
index b1b98144a604b6f832a1222667ffcad0790711b4..9a035ac20c7f096541a933d72f9281a9d8f761b8 100644
--- a/src/KOKKOS/modify_kokkos.cpp
+++ b/src/KOKKOS/modify_kokkos.cpp
@@ -16,6 +16,7 @@
 #include "update.h"
 #include "fix.h"
 #include "compute.h"
+#include "kokkos.h"
 
 using namespace LAMMPS_NS;
 
@@ -43,13 +44,17 @@ void ModifyKokkos::setup(int vflag)
   if (update->whichflag == 1)
     for (int i = 0; i < nfix; i++) {
       atomKK->sync(fix[i]->execution_space,fix[i]->datamask_read);
+      if (!fix[i]->kokkosable) lmp->kokkos->auto_sync = 1;
       fix[i]->setup(vflag);
+      lmp->kokkos->auto_sync = 0;
       atomKK->modified(fix[i]->execution_space,fix[i]->datamask_modify);
     }
   else if (update->whichflag == 2)
     for (int i = 0; i < nfix; i++) {
       atomKK->sync(fix[i]->execution_space,fix[i]->datamask_read);
+      if (!fix[i]->kokkosable) lmp->kokkos->auto_sync = 1;
       fix[i]->min_setup(vflag);
+      lmp->kokkos->auto_sync = 0;
       atomKK->modified(fix[i]->execution_space,fix[i]->datamask_modify);
     }
 }
@@ -65,7 +70,9 @@ void ModifyKokkos::setup_pre_exchange()
     for (int i = 0; i < n_pre_exchange; i++) {
       atomKK->sync(fix[list_pre_exchange[i]]->execution_space,
                    fix[list_pre_exchange[i]]->datamask_read);
+      if (!fix[list_pre_exchange[i]]->kokkosable) lmp->kokkos->auto_sync = 1;
       fix[list_pre_exchange[i]]->setup_pre_exchange();
+      lmp->kokkos->auto_sync = 0;
       atomKK->modified(fix[list_pre_exchange[i]]->execution_space,
                        fix[list_pre_exchange[i]]->datamask_modify);
     }
@@ -73,7 +80,9 @@ void ModifyKokkos::setup_pre_exchange()
     for (int i = 0; i < n_min_pre_exchange; i++) {
       atomKK->sync(fix[list_min_pre_exchange[i]]->execution_space,
                    fix[list_min_pre_exchange[i]]->datamask_read);
+      if (!fix[list_min_pre_exchange[i]]->kokkosable) lmp->kokkos->auto_sync = 1;
       fix[list_min_pre_exchange[i]]->min_setup_pre_exchange();
+      lmp->kokkos->auto_sync = 0;
       atomKK->modified(fix[list_min_pre_exchange[i]]->execution_space,
                        fix[list_min_pre_exchange[i]]->datamask_modify);
     }
@@ -90,7 +99,9 @@ void ModifyKokkos::setup_pre_neighbor()
     for (int i = 0; i < n_pre_neighbor; i++) {
       atomKK->sync(fix[list_pre_neighbor[i]]->execution_space,
                    fix[list_pre_neighbor[i]]->datamask_read);
+      if (!fix[list_pre_neighbor[i]]->kokkosable) lmp->kokkos->auto_sync = 1;
       fix[list_pre_neighbor[i]]->setup_pre_neighbor();
+      lmp->kokkos->auto_sync = 0;
       atomKK->modified(fix[list_pre_neighbor[i]]->execution_space,
                        fix[list_pre_neighbor[i]]->datamask_modify);
     }
@@ -98,7 +109,9 @@ void ModifyKokkos::setup_pre_neighbor()
     for (int i = 0; i < n_min_pre_neighbor; i++) {
       atomKK->sync(fix[list_min_pre_neighbor[i]]->execution_space,
                    fix[list_min_pre_neighbor[i]]->datamask_read);
+      if (!fix[list_min_pre_neighbor[i]]->kokkosable) lmp->kokkos->auto_sync = 1;
       fix[list_min_pre_neighbor[i]]->min_setup_pre_neighbor();
+      lmp->kokkos->auto_sync = 0;
       atomKK->modified(fix[list_min_pre_neighbor[i]]->execution_space,
                        fix[list_min_pre_neighbor[i]]->datamask_modify);
     }
@@ -115,7 +128,9 @@ void ModifyKokkos::setup_pre_force(int vflag)
     for (int i = 0; i < n_pre_force; i++) {
       atomKK->sync(fix[list_pre_force[i]]->execution_space,
                    fix[list_pre_force[i]]->datamask_read);
+      if (!fix[list_pre_force[i]]->kokkosable) lmp->kokkos->auto_sync = 1;
       fix[list_pre_force[i]]->setup_pre_force(vflag);
+      lmp->kokkos->auto_sync = 0;
       atomKK->modified(fix[list_pre_force[i]]->execution_space,
                        fix[list_pre_force[i]]->datamask_modify);
     }
@@ -123,7 +138,9 @@ void ModifyKokkos::setup_pre_force(int vflag)
     for (int i = 0; i < n_min_pre_force; i++) {
       atomKK->sync(fix[list_min_pre_force[i]]->execution_space,
                    fix[list_min_pre_force[i]]->datamask_read);
+      if (!fix[list_min_pre_force[i]]->kokkosable) lmp->kokkos->auto_sync = 1;
       fix[list_min_pre_force[i]]->min_setup_pre_force(vflag);
+      lmp->kokkos->auto_sync = 0;
       atomKK->modified(fix[list_min_pre_force[i]]->execution_space,
                        fix[list_min_pre_force[i]]->datamask_modify);
     }
@@ -138,7 +155,9 @@ void ModifyKokkos::initial_integrate(int vflag)
   for (int i = 0; i < n_initial_integrate; i++) {
     atomKK->sync(fix[list_initial_integrate[i]]->execution_space,
                  fix[list_initial_integrate[i]]->datamask_read);
+    if (!fix[list_initial_integrate[i]]->kokkosable) lmp->kokkos->auto_sync = 1;
     fix[list_initial_integrate[i]]->initial_integrate(vflag);
+    lmp->kokkos->auto_sync = 0;
     atomKK->modified(fix[list_initial_integrate[i]]->execution_space,
                      fix[list_initial_integrate[i]]->datamask_modify);
   }
@@ -153,7 +172,9 @@ void ModifyKokkos::post_integrate()
   for (int i = 0; i < n_post_integrate; i++) {
     atomKK->sync(fix[list_post_integrate[i]]->execution_space,
                  fix[list_post_integrate[i]]->datamask_read);
+    if (!fix[list_post_integrate[i]]->kokkosable) lmp->kokkos->auto_sync = 1;
     fix[list_post_integrate[i]]->post_integrate();
+    lmp->kokkos->auto_sync = 0;
     atomKK->modified(fix[list_post_integrate[i]]->execution_space,
                      fix[list_post_integrate[i]]->datamask_modify);
   }
@@ -168,7 +189,9 @@ void ModifyKokkos::pre_exchange()
   for (int i = 0; i < n_pre_exchange; i++) {
     atomKK->sync(fix[list_pre_exchange[i]]->execution_space,
                  fix[list_pre_exchange[i]]->datamask_read);
+    if (!fix[list_pre_exchange[i]]->kokkosable) lmp->kokkos->auto_sync = 1;
     fix[list_pre_exchange[i]]->pre_exchange();
+    lmp->kokkos->auto_sync = 0;
     atomKK->modified(fix[list_pre_exchange[i]]->execution_space,
                      fix[list_pre_exchange[i]]->datamask_modify);
   }
@@ -183,7 +206,9 @@ void ModifyKokkos::pre_neighbor()
   for (int i = 0; i < n_pre_neighbor; i++) {
     atomKK->sync(fix[list_pre_neighbor[i]]->execution_space,
                  fix[list_pre_neighbor[i]]->datamask_read);
+    if (!fix[list_pre_neighbor[i]]->kokkosable) lmp->kokkos->auto_sync = 1;
     fix[list_pre_neighbor[i]]->pre_neighbor();
+    lmp->kokkos->auto_sync = 0;
     atomKK->modified(fix[list_pre_neighbor[i]]->execution_space,
                      fix[list_pre_neighbor[i]]->datamask_modify);
   }
@@ -198,7 +223,9 @@ void ModifyKokkos::pre_force(int vflag)
   for (int i = 0; i < n_pre_force; i++) {
     atomKK->sync(fix[list_pre_force[i]]->execution_space,
                  fix[list_pre_force[i]]->datamask_read);
+    if (!fix[list_pre_force[i]]->kokkosable) lmp->kokkos->auto_sync = 1;
     fix[list_pre_force[i]]->pre_force(vflag);
+    lmp->kokkos->auto_sync = 0;
     atomKK->modified(fix[list_pre_force[i]]->execution_space,
                      fix[list_pre_force[i]]->datamask_modify);
   }
@@ -213,7 +240,9 @@ void ModifyKokkos::post_force(int vflag)
   for (int i = 0; i < n_post_force; i++) {
     atomKK->sync(fix[list_post_force[i]]->execution_space,
                  fix[list_post_force[i]]->datamask_read);
+    if (!fix[list_post_force[i]]->kokkosable) lmp->kokkos->auto_sync = 1;
     fix[list_post_force[i]]->post_force(vflag);
+    lmp->kokkos->auto_sync = 0;
     atomKK->modified(fix[list_post_force[i]]->execution_space,
                      fix[list_post_force[i]]->datamask_modify);
   }
@@ -228,7 +257,9 @@ void ModifyKokkos::final_integrate()
   for (int i = 0; i < n_final_integrate; i++) {
     atomKK->sync(fix[list_final_integrate[i]]->execution_space,
                  fix[list_final_integrate[i]]->datamask_read);
+    if (!fix[list_final_integrate[i]]->kokkosable) lmp->kokkos->auto_sync = 1;
     fix[list_final_integrate[i]]->final_integrate();
+    lmp->kokkos->auto_sync = 0;
     atomKK->modified(fix[list_final_integrate[i]]->execution_space,
                      fix[list_final_integrate[i]]->datamask_modify);
   }
@@ -245,7 +276,9 @@ void ModifyKokkos::end_of_step()
     if (update->ntimestep % end_of_step_every[i] == 0) {
       atomKK->sync(fix[list_end_of_step[i]]->execution_space,
                    fix[list_end_of_step[i]]->datamask_read);
+      if (!fix[list_end_of_step[i]]->kokkosable) lmp->kokkos->auto_sync = 1;
       fix[list_end_of_step[i]]->end_of_step();
+      lmp->kokkos->auto_sync = 0;
       atomKK->modified(fix[list_end_of_step[i]]->execution_space,
                        fix[list_end_of_step[i]]->datamask_modify);
     }
@@ -263,7 +296,9 @@ double ModifyKokkos::thermo_energy()
   for (int i = 0; i < n_thermo_energy; i++) {
     atomKK->sync(fix[list_thermo_energy[i]]->execution_space,
                  fix[list_thermo_energy[i]]->datamask_read);
+    if (!fix[list_thermo_energy[i]]->kokkosable) lmp->kokkos->auto_sync = 1;
     energy += fix[list_thermo_energy[i]]->compute_scalar();
+    lmp->kokkos->auto_sync = 0;
     atomKK->modified(fix[list_thermo_energy[i]]->execution_space,
                      fix[list_thermo_energy[i]]->datamask_modify);
   }
@@ -279,7 +314,9 @@ void ModifyKokkos::post_run()
   for (int i = 0; i < nfix; i++) {
     atomKK->sync(fix[i]->execution_space,
                  fix[i]->datamask_read);
+    if (!fix[i]->kokkosable) lmp->kokkos->auto_sync = 1;
     fix[i]->post_run();
+    lmp->kokkos->auto_sync = 0;
     atomKK->modified(fix[i]->execution_space,
                      fix[i]->datamask_modify);
   }
@@ -294,7 +331,9 @@ void ModifyKokkos::setup_pre_force_respa(int vflag, int ilevel)
   for (int i = 0; i < n_pre_force; i++) {
     atomKK->sync(fix[list_pre_force[i]]->execution_space,
                  fix[list_pre_force[i]]->datamask_read);
+    if (!fix[list_pre_force[i]]->kokkosable) lmp->kokkos->auto_sync = 1;
     fix[list_pre_force[i]]->setup_pre_force_respa(vflag,ilevel);
+    lmp->kokkos->auto_sync = 0;
     atomKK->modified(fix[list_pre_force[i]]->execution_space,
                      fix[list_pre_force[i]]->datamask_modify);
   }
@@ -309,8 +348,10 @@ void ModifyKokkos::initial_integrate_respa(int vflag, int ilevel, int iloop)
   for (int i = 0; i < n_initial_integrate_respa; i++) {
     atomKK->sync(fix[list_initial_integrate_respa[i]]->execution_space,
                  fix[list_initial_integrate_respa[i]]->datamask_read);
+    if (!fix[list_initial_integrate_respa[i]]->kokkosable) lmp->kokkos->auto_sync = 1;
     fix[list_initial_integrate_respa[i]]->
       initial_integrate_respa(vflag,ilevel,iloop);
+    lmp->kokkos->auto_sync = 0;
     atomKK->modified(fix[list_initial_integrate_respa[i]]->execution_space,
                      fix[list_initial_integrate_respa[i]]->datamask_modify);
   }
@@ -325,7 +366,9 @@ void ModifyKokkos::post_integrate_respa(int ilevel, int iloop)
   for (int i = 0; i < n_post_integrate_respa; i++) {
     atomKK->sync(fix[list_post_integrate_respa[i]]->execution_space,
                  fix[list_post_integrate_respa[i]]->datamask_read);
+    if (!fix[list_post_integrate_respa[i]]->kokkosable) lmp->kokkos->auto_sync = 1;
     fix[list_post_integrate_respa[i]]->post_integrate_respa(ilevel,iloop);
+    lmp->kokkos->auto_sync = 0;
     atomKK->modified(fix[list_post_integrate_respa[i]]->execution_space,
                      fix[list_post_integrate_respa[i]]->datamask_modify);
   }
@@ -340,7 +383,9 @@ void ModifyKokkos::pre_force_respa(int vflag, int ilevel, int iloop)
   for (int i = 0; i < n_pre_force_respa; i++) {
     atomKK->sync(fix[list_pre_force_respa[i]]->execution_space,
                  fix[list_pre_force_respa[i]]->datamask_read);
+    if (!fix[list_pre_force_respa[i]]->kokkosable) lmp->kokkos->auto_sync = 1;
     fix[list_pre_force_respa[i]]->pre_force_respa(vflag,ilevel,iloop);
+    lmp->kokkos->auto_sync = 0;
     atomKK->modified(fix[list_pre_force_respa[i]]->execution_space,
                      fix[list_pre_force_respa[i]]->datamask_modify);
   }
@@ -355,7 +400,9 @@ void ModifyKokkos::post_force_respa(int vflag, int ilevel, int iloop)
   for (int i = 0; i < n_post_force_respa; i++) {
     atomKK->sync(fix[list_post_force_respa[i]]->execution_space,
                  fix[list_post_force_respa[i]]->datamask_read);
+    if (!fix[list_post_force_respa[i]]->kokkosable) lmp->kokkos->auto_sync = 1;
     fix[list_post_force_respa[i]]->post_force_respa(vflag,ilevel,iloop);
+    lmp->kokkos->auto_sync = 0;
     atomKK->modified(fix[list_post_force_respa[i]]->execution_space,
                      fix[list_post_force_respa[i]]->datamask_modify);
   }
@@ -370,7 +417,9 @@ void ModifyKokkos::final_integrate_respa(int ilevel, int iloop)
   for (int i = 0; i < n_final_integrate_respa; i++) {
     atomKK->sync(fix[list_final_integrate_respa[i]]->execution_space,
                  fix[list_final_integrate_respa[i]]->datamask_read);
+    if (!fix[list_final_integrate_respa[i]]->kokkosable) lmp->kokkos->auto_sync = 1;
     fix[list_final_integrate_respa[i]]->final_integrate_respa(ilevel,iloop);
+    lmp->kokkos->auto_sync = 0;
     atomKK->modified(fix[list_final_integrate_respa[i]]->execution_space,
                      fix[list_final_integrate_respa[i]]->datamask_modify);
   }
@@ -385,7 +434,9 @@ void ModifyKokkos::min_pre_exchange()
   for (int i = 0; i < n_min_pre_exchange; i++) {
     atomKK->sync(fix[list_min_pre_exchange[i]]->execution_space,
                  fix[list_min_pre_exchange[i]]->datamask_read);
+    if (!fix[list_min_pre_exchange[i]]->kokkosable) lmp->kokkos->auto_sync = 1;
     fix[list_min_pre_exchange[i]]->min_pre_exchange();
+    lmp->kokkos->auto_sync = 0;
     atomKK->modified(fix[list_min_pre_exchange[i]]->execution_space,
                      fix[list_min_pre_exchange[i]]->datamask_modify);
   }
@@ -400,7 +451,9 @@ void ModifyKokkos::min_pre_neighbor()
   for (int i = 0; i < n_min_pre_neighbor; i++) {
     atomKK->sync(fix[list_min_pre_neighbor[i]]->execution_space,
                  fix[list_min_pre_neighbor[i]]->datamask_read);
+    if (!fix[list_min_pre_neighbor[i]]->kokkosable) lmp->kokkos->auto_sync = 1;
     fix[list_min_pre_neighbor[i]]->min_pre_neighbor();
+    lmp->kokkos->auto_sync = 0;
     atomKK->modified(fix[list_min_pre_neighbor[i]]->execution_space,
                      fix[list_min_pre_neighbor[i]]->datamask_modify);
   }
@@ -415,7 +468,9 @@ void ModifyKokkos::min_pre_force(int vflag)
   for (int i = 0; i < n_min_pre_force; i++) {
     atomKK->sync(fix[list_min_pre_force[i]]->execution_space,
                  fix[list_min_pre_force[i]]->datamask_read);
+    if (!fix[list_min_pre_force[i]]->kokkosable) lmp->kokkos->auto_sync = 1;
     fix[list_min_pre_force[i]]->min_pre_force(vflag);
+    lmp->kokkos->auto_sync = 0;
     atomKK->modified(fix[list_min_pre_force[i]]->execution_space,
                      fix[list_min_pre_force[i]]->datamask_modify);
   }
@@ -430,7 +485,9 @@ void ModifyKokkos::min_post_force(int vflag)
   for (int i = 0; i < n_min_post_force; i++) {
     atomKK->sync(fix[list_min_post_force[i]]->execution_space,
                  fix[list_min_post_force[i]]->datamask_read);
+    if (!fix[list_min_post_force[i]]->kokkosable) lmp->kokkos->auto_sync = 1;
     fix[list_min_post_force[i]]->min_post_force(vflag);
+    lmp->kokkos->auto_sync = 0;
     atomKK->modified(fix[list_min_post_force[i]]->execution_space,
                      fix[list_min_post_force[i]]->datamask_modify);
   }
@@ -450,8 +507,10 @@ double ModifyKokkos::min_energy(double *fextra)
   for (int i = 0; i < n_min_energy; i++) {
     ifix = list_min_energy[i];
     atomKK->sync(fix[ifix]->execution_space,fix[ifix]->datamask_read);
+    if (!fix[ifix]->kokkosable) lmp->kokkos->auto_sync = 1;
     eng += fix[ifix]->min_energy(&fextra[index]);
     index += fix[ifix]->min_dof();
+    lmp->kokkos->auto_sync = 0;
     atomKK->modified(fix[ifix]->execution_space,fix[ifix]->datamask_modify);
   }
   return eng;
@@ -466,7 +525,9 @@ void ModifyKokkos::min_store()
   for (int i = 0; i < n_min_energy; i++) {
     atomKK->sync(fix[list_min_energy[i]]->execution_space,
                  fix[list_min_energy[i]]->datamask_read);
+    if (!fix[list_min_energy[i]]->kokkosable) lmp->kokkos->auto_sync = 1;
     fix[list_min_energy[i]]->min_store();
+    lmp->kokkos->auto_sync = 0;
     atomKK->modified(fix[list_min_energy[i]]->execution_space,
                      fix[list_min_energy[i]]->datamask_modify);
   }
@@ -481,7 +542,9 @@ void ModifyKokkos::min_clearstore()
   for (int i = 0; i < n_min_energy; i++) {
     atomKK->sync(fix[list_min_energy[i]]->execution_space,
                  fix[list_min_energy[i]]->datamask_read);
+    if (!fix[list_min_energy[i]]->kokkosable) lmp->kokkos->auto_sync = 1;
     fix[list_min_energy[i]]->min_clearstore();
+    lmp->kokkos->auto_sync = 0;
     atomKK->modified(fix[list_min_energy[i]]->execution_space,
                      fix[list_min_energy[i]]->datamask_modify);
   }
@@ -492,7 +555,9 @@ void ModifyKokkos::min_pushstore()
   for (int i = 0; i < n_min_energy; i++) {
     atomKK->sync(fix[list_min_energy[i]]->execution_space,
                  fix[list_min_energy[i]]->datamask_read);
+    if (!fix[list_min_energy[i]]->kokkosable) lmp->kokkos->auto_sync = 1;
     fix[list_min_energy[i]]->min_pushstore();
+    lmp->kokkos->auto_sync = 0;
     atomKK->modified(fix[list_min_energy[i]]->execution_space,
                      fix[list_min_energy[i]]->datamask_modify);
   }
@@ -503,7 +568,9 @@ void ModifyKokkos::min_popstore()
   for (int i = 0; i < n_min_energy; i++) {
     atomKK->sync(fix[list_min_energy[i]]->execution_space,
                  fix[list_min_energy[i]]->datamask_read);
+    if (!fix[list_min_energy[i]]->kokkosable) lmp->kokkos->auto_sync = 1;
     fix[list_min_energy[i]]->min_popstore();
+    lmp->kokkos->auto_sync = 0;
     atomKK->modified(fix[list_min_energy[i]]->execution_space,
                      fix[list_min_energy[i]]->datamask_modify);
   }
@@ -521,8 +588,10 @@ void ModifyKokkos::min_step(double alpha, double *hextra)
   for (int i = 0; i < n_min_energy; i++) {
     ifix = list_min_energy[i];
     atomKK->sync(fix[ifix]->execution_space,fix[ifix]->datamask_read);
+    if (!fix[ifix]->kokkosable) lmp->kokkos->auto_sync = 1;
     fix[ifix]->min_step(alpha,&hextra[index]);
     index += fix[ifix]->min_dof();
+    lmp->kokkos->auto_sync = 0;
     atomKK->modified(fix[ifix]->execution_space,fix[ifix]->datamask_modify);
   }
 }
@@ -540,9 +609,11 @@ double ModifyKokkos::max_alpha(double *hextra)
   for (int i = 0; i < n_min_energy; i++) {
     ifix = list_min_energy[i];
     atomKK->sync(fix[ifix]->execution_space,fix[ifix]->datamask_read);
+    if (!fix[ifix]->kokkosable) lmp->kokkos->auto_sync = 1;
     double alpha_one = fix[ifix]->max_alpha(&hextra[index]);
     alpha = MIN(alpha,alpha_one);
     index += fix[ifix]->min_dof();
+    lmp->kokkos->auto_sync = 0;
     atomKK->modified(fix[ifix]->execution_space,fix[ifix]->datamask_modify);
   }
   return alpha;
@@ -558,7 +629,9 @@ int ModifyKokkos::min_dof()
   for (int i = 0; i < n_min_energy; i++) {
     atomKK->sync(fix[list_min_energy[i]]->execution_space,
                  fix[list_min_energy[i]]->datamask_read);
+    if (!fix[list_min_energy[i]]->kokkosable) lmp->kokkos->auto_sync = 1;
     ndof += fix[list_min_energy[i]]->min_dof();
+    lmp->kokkos->auto_sync = 0;
     atomKK->modified(fix[list_min_energy[i]]->execution_space,
                      fix[list_min_energy[i]]->datamask_modify);
   }
@@ -576,7 +649,9 @@ int ModifyKokkos::min_reset_ref()
   for (int i = 0; i < n_min_energy; i++) {
     atomKK->sync(fix[list_min_energy[i]]->execution_space,
                  fix[list_min_energy[i]]->datamask_read);
+    if (!fix[list_min_energy[i]]->kokkosable) lmp->kokkos->auto_sync = 1;
     itmp = fix[list_min_energy[i]]->min_reset_ref();
+    lmp->kokkos->auto_sync = 0;
     if (itmp) itmpall = 1;
     atomKK->modified(fix[list_min_energy[i]]->execution_space,
                      fix[list_min_energy[i]]->datamask_modify);
diff --git a/src/KOKKOS/neighbor_kokkos.cpp b/src/KOKKOS/neighbor_kokkos.cpp
index c420f34e8e298c70b5caea5915a4a2116abbb70f..3bb8b0dce4a20bfea8f88b4c7d5cd8b4facb32dd 100644
--- a/src/KOKKOS/neighbor_kokkos.cpp
+++ b/src/KOKKOS/neighbor_kokkos.cpp
@@ -589,6 +589,11 @@ void NeighborKokkos::build_topology_kokkos() {
     k_dihedrallist = neighbond_device.k_dihedrallist;
     k_improperlist = neighbond_device.k_improperlist;
 
+    k_bondlist.sync<LMPDeviceType>();
+    k_anglelist.sync<LMPDeviceType>();
+    k_dihedrallist.sync<LMPDeviceType>();
+    k_improperlist.sync<LMPDeviceType>();
+
     k_bondlist.modify<LMPDeviceType>();
     k_anglelist.modify<LMPDeviceType>();
     k_dihedrallist.modify<LMPDeviceType>();
@@ -601,6 +606,11 @@ void NeighborKokkos::build_topology_kokkos() {
     k_dihedrallist = neighbond_host.k_dihedrallist;
     k_improperlist = neighbond_host.k_improperlist;
 
+    k_bondlist.sync<LMPHostType>();
+    k_anglelist.sync<LMPHostType>();
+    k_dihedrallist.sync<LMPHostType>();
+    k_improperlist.sync<LMPHostType>();
+
     k_bondlist.modify<LMPHostType>();
     k_anglelist.modify<LMPHostType>();
     k_dihedrallist.modify<LMPHostType>();
diff --git a/src/KOKKOS/verlet_kokkos.cpp b/src/KOKKOS/verlet_kokkos.cpp
index f225249d535f7c85d8935cb4fb54996b8a0788f5..20c4035276ad56514389fe02e1932ee35aeb928e 100644
--- a/src/KOKKOS/verlet_kokkos.cpp
+++ b/src/KOKKOS/verlet_kokkos.cpp
@@ -75,11 +75,13 @@ void VerletKokkos::setup()
   }
 
   update->setupflag = 1;
+  lmp->kokkos->auto_sync = 0;
 
   // setup domain, communication and neighboring
   // acquire ghosts
   // build neighbor lists
 
+  atomKK->sync(Host,ALL_MASK);
   atomKK->modified(Host,ALL_MASK);
 
   atomKK->setup();
@@ -124,8 +126,8 @@ void VerletKokkos::setup()
 
   if (pair_compute_flag) {
     atomKK->sync(force->pair->execution_space,force->pair->datamask_read);
-    atomKK->modified(force->pair->execution_space,force->pair->datamask_modify);
     force->pair->compute(eflag,vflag);
+    atomKK->modified(force->pair->execution_space,force->pair->datamask_modify);
     timer->stamp(Timer::PAIR);
   }
   else if (force->pair) force->pair->compute_dummy(eflag,vflag);
@@ -134,23 +136,23 @@ void VerletKokkos::setup()
   if (atomKK->molecular) {
     if (force->bond) {
       atomKK->sync(force->bond->execution_space,force->bond->datamask_read);
-      atomKK->modified(force->bond->execution_space,force->bond->datamask_modify);
       force->bond->compute(eflag,vflag);
+      atomKK->modified(force->bond->execution_space,force->bond->datamask_modify);
     }
     if (force->angle) {
       atomKK->sync(force->angle->execution_space,force->angle->datamask_read);
-      atomKK->modified(force->angle->execution_space,force->angle->datamask_modify);
       force->angle->compute(eflag,vflag);
+      atomKK->modified(force->angle->execution_space,force->angle->datamask_modify);
     }
     if (force->dihedral) {
       atomKK->sync(force->dihedral->execution_space,force->dihedral->datamask_read);
-      atomKK->modified(force->dihedral->execution_space,force->dihedral->datamask_modify);
       force->dihedral->compute(eflag,vflag);
+      atomKK->modified(force->dihedral->execution_space,force->dihedral->datamask_modify);
     }
     if (force->improper) {
       atomKK->sync(force->improper->execution_space,force->improper->datamask_read);
-      atomKK->modified(force->improper->execution_space,force->improper->datamask_modify);
       force->improper->compute(eflag,vflag);
+      atomKK->modified(force->improper->execution_space,force->improper->datamask_modify);
     }
     timer->stamp(Timer::BOND);
   }
@@ -159,17 +161,17 @@ void VerletKokkos::setup()
     force->kspace->setup();
     if (kspace_compute_flag) {
       atomKK->sync(force->kspace->execution_space,force->kspace->datamask_read);
-      atomKK->modified(force->kspace->execution_space,force->kspace->datamask_modify);
       force->kspace->compute(eflag,vflag);
+      atomKK->modified(force->kspace->execution_space,force->kspace->datamask_modify);
       timer->stamp(Timer::KSPACE);
     } else force->kspace->compute_dummy(eflag,vflag);
   }
-
   if (force->newton) comm->reverse_comm();
 
   modify->setup(vflag);
   output->setup();
-  update->setupflag = 0;
+  lmp->kokkos->auto_sync = 0;
+  update->setupflag = 1;
 }
 
 /* ----------------------------------------------------------------------
@@ -181,12 +183,14 @@ void VerletKokkos::setup()
 void VerletKokkos::setup_minimal(int flag)
 {
   update->setupflag = 1;
+  lmp->kokkos->auto_sync = 0;
 
   // setup domain, communication and neighboring
   // acquire ghosts
   // build neighbor lists
 
   if (flag) {
+    atomKK->sync(Host,ALL_MASK);
     atomKK->modified(Host,ALL_MASK);
 
     modify->setup_pre_exchange();
@@ -226,8 +230,8 @@ void VerletKokkos::setup_minimal(int flag)
 
   if (pair_compute_flag) {
     atomKK->sync(force->pair->execution_space,force->pair->datamask_read);
-    atomKK->modified(force->pair->execution_space,force->pair->datamask_modify);
     force->pair->compute(eflag,vflag);
+    atomKK->modified(force->pair->execution_space,force->pair->datamask_modify);
     timer->stamp(Timer::PAIR);
   }
   else if (force->pair) force->pair->compute_dummy(eflag,vflag);
@@ -236,23 +240,23 @@ void VerletKokkos::setup_minimal(int flag)
   if (atomKK->molecular) {
     if (force->bond) {
       atomKK->sync(force->bond->execution_space,force->bond->datamask_read);
-      atomKK->modified(force->bond->execution_space,force->bond->datamask_modify);
       force->bond->compute(eflag,vflag);
+      atomKK->modified(force->bond->execution_space,force->bond->datamask_modify);
     }
     if (force->angle) {
       atomKK->sync(force->angle->execution_space,force->angle->datamask_read);
-      atomKK->modified(force->angle->execution_space,force->angle->datamask_modify);
       force->angle->compute(eflag,vflag);
+      atomKK->modified(force->angle->execution_space,force->angle->datamask_modify);
     }
     if (force->dihedral) {
       atomKK->sync(force->dihedral->execution_space,force->dihedral->datamask_read);
-      atomKK->modified(force->dihedral->execution_space,force->dihedral->datamask_modify);
       force->dihedral->compute(eflag,vflag);
+      atomKK->modified(force->dihedral->execution_space,force->dihedral->datamask_modify);
     }
     if (force->improper) {
       atomKK->sync(force->improper->execution_space,force->improper->datamask_read);
-      atomKK->modified(force->improper->execution_space,force->improper->datamask_modify);
       force->improper->compute(eflag,vflag);
+      atomKK->modified(force->improper->execution_space,force->improper->datamask_modify);
     }
     timer->stamp(Timer::BOND);
   }
@@ -261,8 +265,8 @@ void VerletKokkos::setup_minimal(int flag)
     force->kspace->setup();
     if (kspace_compute_flag) {
       atomKK->sync(force->kspace->execution_space,force->kspace->datamask_read);
-      atomKK->modified(force->kspace->execution_space,force->kspace->datamask_modify);
       force->kspace->compute(eflag,vflag);
+      atomKK->modified(force->kspace->execution_space,force->kspace->datamask_modify);
       timer->stamp(Timer::KSPACE);
     } else force->kspace->compute_dummy(eflag,vflag);
   }
@@ -270,6 +274,7 @@ void VerletKokkos::setup_minimal(int flag)
   if (force->newton) comm->reverse_comm();
 
   modify->setup(vflag);
+  lmp->kokkos->auto_sync = 1;
   update->setupflag = 0;
 }
 
@@ -289,6 +294,8 @@ void VerletKokkos::run(int n)
   int n_post_force = modify->n_post_force;
   int n_end_of_step = modify->n_end_of_step;
 
+  lmp->kokkos->auto_sync = 0;
+
   if (atomKK->sortfreq > 0) sortflag = 1;
   else sortflag = 0;
 
@@ -453,11 +460,11 @@ void VerletKokkos::run(int n)
 
     if (pair_compute_flag) {
       atomKK->sync(force->pair->execution_space,force->pair->datamask_read);
-      atomKK->modified(force->pair->execution_space,force->pair->datamask_modify);
       atomKK->sync(force->pair->execution_space,~(~force->pair->datamask_read|(F_MASK | ENERGY_MASK | VIRIAL_MASK)));
-      atomKK->modified(force->pair->execution_space,~(~force->pair->datamask_modify|(F_MASK | ENERGY_MASK | VIRIAL_MASK)));
       Kokkos::Impl::Timer ktimer;
       force->pair->compute(eflag,vflag);
+      atomKK->modified(force->pair->execution_space,force->pair->datamask_modify);
+      atomKK->modified(force->pair->execution_space,~(~force->pair->datamask_modify|(F_MASK | ENERGY_MASK | VIRIAL_MASK)));
       timer->stamp(Timer::PAIR);
     }
 
@@ -473,31 +480,31 @@ void VerletKokkos::run(int n)
     if (atomKK->molecular) {
       if (force->bond) {
         atomKK->sync(force->bond->execution_space,~(~force->bond->datamask_read|(F_MASK | ENERGY_MASK | VIRIAL_MASK)));
-        atomKK->modified(force->bond->execution_space,~(~force->bond->datamask_modify|(F_MASK | ENERGY_MASK | VIRIAL_MASK)));
         force->bond->compute(eflag,vflag);
+        atomKK->modified(force->bond->execution_space,~(~force->bond->datamask_modify|(F_MASK | ENERGY_MASK | VIRIAL_MASK)));
       }
       if (force->angle) {
         atomKK->sync(force->angle->execution_space,~(~force->angle->datamask_read|(F_MASK | ENERGY_MASK | VIRIAL_MASK)));
-        atomKK->modified(force->angle->execution_space,~(~force->angle->datamask_modify|(F_MASK | ENERGY_MASK | VIRIAL_MASK)));
         force->angle->compute(eflag,vflag);
+        atomKK->modified(force->angle->execution_space,~(~force->angle->datamask_modify|(F_MASK | ENERGY_MASK | VIRIAL_MASK)));
       }
       if (force->dihedral) {
         atomKK->sync(force->dihedral->execution_space,~(~force->dihedral->datamask_read|(F_MASK | ENERGY_MASK | VIRIAL_MASK)));
-        atomKK->modified(force->dihedral->execution_space,~(~force->dihedral->datamask_modify|(F_MASK | ENERGY_MASK | VIRIAL_MASK)));
         force->dihedral->compute(eflag,vflag);
+        atomKK->modified(force->dihedral->execution_space,~(~force->dihedral->datamask_modify|(F_MASK | ENERGY_MASK | VIRIAL_MASK)));
       }
       if (force->improper) {
         atomKK->sync(force->improper->execution_space,~(~force->improper->datamask_read|(F_MASK | ENERGY_MASK | VIRIAL_MASK)));
-        atomKK->modified(force->improper->execution_space,~(~force->improper->datamask_modify|(F_MASK | ENERGY_MASK | VIRIAL_MASK)));
         force->improper->compute(eflag,vflag);
+        atomKK->modified(force->improper->execution_space,~(~force->improper->datamask_modify|(F_MASK | ENERGY_MASK | VIRIAL_MASK)));
       }
       timer->stamp(Timer::BOND);
     }
 
     if (kspace_compute_flag) {
       atomKK->sync(force->kspace->execution_space,~(~force->kspace->datamask_read|(F_MASK | ENERGY_MASK | VIRIAL_MASK)));
-      atomKK->modified(force->kspace->execution_space,~(~force->kspace->datamask_modify|(F_MASK | ENERGY_MASK | VIRIAL_MASK)));
       force->kspace->compute(eflag,vflag);
+      atomKK->modified(force->kspace->execution_space,~(~force->kspace->datamask_modify|(F_MASK | ENERGY_MASK | VIRIAL_MASK)));
       timer->stamp(Timer::KSPACE);
     }
 
@@ -509,6 +516,7 @@ void VerletKokkos::run(int n)
       Kokkos::deep_copy(LMPHostType(),f_merge_copy,atomKK->k_f.h_view);
       Kokkos::parallel_for(atomKK->k_f.dimension_0(),
         ForceAdder<DAT::t_f_array,DAT::t_f_array>(atomKK->k_f.d_view,f_merge_copy));
+      atomKK->k_f.modified_host() = 0; // special case
       atomKK->k_f.modify<LMPDeviceType>();
     }
 
@@ -535,6 +543,9 @@ void VerletKokkos::run(int n)
       timer->stamp(Timer::OUTPUT);
     }
   }
+
+  atomKK->sync(Host,ALL_MASK);
+  lmp->kokkos->auto_sync = 1;
 }
 
 /* ----------------------------------------------------------------------
@@ -561,8 +572,9 @@ void VerletKokkos::force_clear()
 
     if (nbytes) {
       if (atomKK->k_f.modified_host() > atomKK->k_f.modified_device()) {
-    	memset_kokkos(atomKK->k_f.view<LMPHostType>());
-    	atomKK->modified(Host,F_MASK);
+        memset_kokkos(atomKK->k_f.view<LMPHostType>());
+        atomKK->modified(Host,F_MASK);
+        atomKK->sync(Device,F_MASK);
       } else {
         memset_kokkos(atomKK->k_f.view<LMPDeviceType>());
         atomKK->modified(Device,F_MASK);
diff --git a/src/MANYBODY/pair_airebo.cpp b/src/MANYBODY/pair_airebo.cpp
index 2bb1c1da22f1baf9f8bf65034149e6cd984db8a2..51cf2216680a3747c00b6791e459cbb5ddfb4983 100644
--- a/src/MANYBODY/pair_airebo.cpp
+++ b/src/MANYBODY/pair_airebo.cpp
@@ -155,6 +155,11 @@ void PairAIREBO::settings(int narg, char **arg)
     ljflag = force->inumeric(FLERR,arg[1]);
     torflag = force->inumeric(FLERR,arg[2]);
   }
+
+  // this one parameter for C-C interactions is different in AIREBO vs REBO
+  // see Favata, Micheletti, Ryu, Pugno, Comp Phys Comm (2016)
+  
+  PCCf_2_0 = -0.0276030;
 }
 
 /* ----------------------------------------------------------------------
@@ -4090,7 +4095,12 @@ void PairAIREBO::spline_init()
   PCCf[0][3] = 0.0161253646;
   PCCf[1][1] = -0.010960;
   PCCf[1][2] = 0.00632624824;
-  PCCf[2][0] = -0.0276030;
+
+  // this one parameter for C-C interactions is different in REBO vs AIREBO
+  // see Favata, Micheletti, Ryu, Pugno, Comp Phys Comm (2016)
+
+  PCCf[2][0] = PCCf_2_0;
+
   PCCf[2][1] = 0.00317953083;
 
   PCHf[0][1] = 0.209336733;
diff --git a/src/MANYBODY/pair_airebo.h b/src/MANYBODY/pair_airebo.h
index 06bf6da554a6083feba6b268d3ae57d0b259f952..e927794ec03876c30e0144e0b624075bf3a25615 100644
--- a/src/MANYBODY/pair_airebo.h
+++ b/src/MANYBODY/pair_airebo.h
@@ -70,6 +70,7 @@ class PairAIREBO : public Pair {
   double epsilon[2][2],sigma[2][2],epsilonT[2][2];
 
   // parameters for Morse variant
+
   double epsilonM[2][2],alphaM[2][2],reqM[2][2];
 
   // spline coefficients
@@ -82,6 +83,7 @@ class PairAIREBO : public Pair {
 
   // spline knot values
 
+  double PCCf_2_0;
   double PCCf[5][5],PCCdfdx[5][5],PCCdfdy[5][5],PCHf[5][5];
   double PCHdfdx[5][5],PCHdfdy[5][5];
   double piCCf[5][5][11],piCCdfdx[5][5][11];
diff --git a/src/MANYBODY/pair_rebo.cpp b/src/MANYBODY/pair_rebo.cpp
index 5b28eae4dd263a0261c0f97919d7fa7f65b3d9db..1cec1aef40a027da4961929df882e74eadedb339 100644
--- a/src/MANYBODY/pair_rebo.cpp
+++ b/src/MANYBODY/pair_rebo.cpp
@@ -30,4 +30,9 @@ void PairREBO::settings(int narg, char **arg)
 
   cutlj = 0.0;
   ljflag = torflag = 0;
+
+  // this one parameter for C-C interactions is different in REBO vs AIREBO
+  // see Favata, Micheletti, Ryu, Pugno, Comp Phys Comm (2016)
+  
+  PCCf_2_0 = 0.0;
 }
diff --git a/src/accelerator_kokkos.h b/src/accelerator_kokkos.h
index 2a787ef116995c5a2647449ebb708cc210b931de..a98263fad08b1d5bc2339bb88d6ee6d39c82300f 100644
--- a/src/accelerator_kokkos.h
+++ b/src/accelerator_kokkos.h
@@ -58,6 +58,8 @@ class AtomKokkos : public Atom {
   tagint **k_special;
   AtomKokkos(class LAMMPS *lmp) : Atom(lmp) {}
   ~AtomKokkos() {}
+  void sync(const ExecutionSpace space, unsigned int mask) {}
+  void modified(const ExecutionSpace space, unsigned int mask) {}
 };
 
 class CommKokkos : public CommBrick {
diff --git a/src/fix.cpp b/src/fix.cpp
index 9918e40e0f94aef291da4ee473e7f66345d29219..fbb7450225b6838a1f283794fc60d8b24f0e331c 100644
--- a/src/fix.cpp
+++ b/src/fix.cpp
@@ -101,6 +101,7 @@ id(NULL), style(NULL), eatom(NULL), vatom(NULL)
   datamask_read = ALL_MASK;
   datamask_modify = ALL_MASK;
 
+  kokkosable = 0;
   copymode = 0;
 }
 
diff --git a/src/fix.h b/src/fix.h
index 62cb565b155b1ec90fbdcd49c39319d62932b54e..65ababf2878cae27ec82c56e40d9cfde53424d77 100644
--- a/src/fix.h
+++ b/src/fix.h
@@ -96,6 +96,7 @@ class Fix : protected Pointers {
 
   // KOKKOS host/device flag and data masks
 
+  int kokkosable;                // 1 if Kokkos fix
   ExecutionSpace execution_space;
   unsigned int datamask_read,datamask_modify;
 
diff --git a/src/region.cpp b/src/region.cpp
index ea0b6f1bc554708f5dc687bccecc76ca3f9f54c7..08505d1ba571634f04080a798e16608fb80a8788 100644
--- a/src/region.cpp
+++ b/src/region.cpp
@@ -20,6 +20,7 @@
 #include "lattice.h"
 #include "input.h"
 #include "variable.h"
+#include "math_extra.h"
 #include "error.h"
 #include "force.h"
 
@@ -41,7 +42,15 @@ Region::Region(LAMMPS *lmp, int narg, char **arg) : Pointers(lmp)
   xstr = ystr = zstr = tstr = NULL;
   dx = dy = dz = 0.0;
 
+  // used by set_velocity() even if no rotation specified
+
+  point[0] = point[1] = point[2] = 0.0;
+
+  size_restart = 5;
+  reset_vel();
   copymode = 0;
+  list = NULL;
+  nregion = 1;
 }
 
 /* ---------------------------------------------------------------------- */
@@ -87,6 +96,7 @@ void Region::init()
     if (!input->variable->equalstyle(tvar))
       error->all(FLERR,"Variable for region is not equal style");
   }
+  vel_timestep = -1;
 }
 
 /* ----------------------------------------------------------------------
@@ -103,9 +113,9 @@ int Region::dynamic_check()
 /* ----------------------------------------------------------------------
    called before looping over atoms with match() or surface()
    this insures any variables used by region are invoked once per timestep
-   also insures variables are invoked by all procs even those w/out atoms
+     also insures variables are invoked by all procs even those w/out atoms
      necessary if equal-style variable invokes global operation
-     with MPI_Allreduce, e.g. xcm() or count()
+   with MPI_Allreduce, e.g. xcm() or count()
 ------------------------------------------------------------------------- */
 
 void Region::prematch()
@@ -129,6 +139,7 @@ void Region::prematch()
 int Region::match(double x, double y, double z)
 {
   if (dynamic) inverse_transform(x,y,z);
+  if (openflag) return 1;
   return !(inside(x,y,z) ^ interior);
 }
 
@@ -170,8 +181,15 @@ int Region::surface(double x, double y, double z, double cutoff)
   xnear[1] = y;
   xnear[2] = z;
 
-  if (interior) ncontact = surface_interior(xnear,cutoff);
-  else ncontact = surface_exterior(xnear,cutoff);
+  if (!openflag) {
+    if (interior) ncontact = surface_interior(xnear,cutoff);
+    else ncontact = surface_exterior(xnear,cutoff);
+  }
+  else{
+    // one of surface_int/ext() will return 0
+    // so no need to worry about offset of contact indices
+    ncontact = surface_exterior(xnear,cutoff) + surface_interior(xnear,cutoff);
+  }
 
   if (rotateflag && ncontact) {
     for (int i = 0; i < ncontact; i++) {
@@ -200,6 +218,7 @@ void Region::add_contact(int n, double *x, double xp, double yp, double zp)
   double dely = x[1] - yp;
   double delz = x[2] - zp;
   contact[n].r = sqrt(delx*delx + dely*dely + delz*delz);
+  contact[n].radius = 0;
   contact[n].delx = delx;
   contact[n].dely = dely;
   contact[n].delz = delz;
@@ -307,6 +326,9 @@ void Region::options(int narg, char **arg)
   scaleflag = 1;
   moveflag = rotateflag = 0;
 
+  openflag = 0;
+  for (int i  = 0; i < 6; i++) open_faces[i] = 0;
+
   int iarg = 0;
   while (iarg < narg) {
     if (strcmp(arg[iarg],"units") == 0) {
@@ -363,9 +385,20 @@ void Region::options(int narg, char **arg)
       axis[2] = force->numeric(FLERR,arg[iarg+7]);
       rotateflag = 1;
       iarg += 8;
-    } else error->all(FLERR,"Illegal region command");
+
+    } else if (strcmp(arg[iarg],"open") == 0) {
+      if (iarg+2 > narg) error->all(FLERR,"Illegal region command");
+      int iface = force->inumeric(FLERR,arg[iarg+1]);
+      if (iface < 1 || iface > 6) error->all(FLERR,"Illegal region command");
+      // additional checks on valid face index are done by region classes
+      open_faces[iface-1] = 1;
+      openflag = 1;
+      iarg += 2;
+    }
+    else error->all(FLERR,"Illegal region command");
   }
 
+
   // error check
 
   if ((moveflag || rotateflag) &&
@@ -401,3 +434,140 @@ void Region::options(int narg, char **arg)
   if (moveflag || rotateflag) dynamic = 1;
   else dynamic = 0;
 }
+
+/* ----------------------------------------------------------------------
+   find nearest point to C on line segment A,B and return it as D
+   project (C-A) onto (B-A)
+   t = length of that projection, normalized by length of (B-A)
+   t <= 0, C is closest to A
+   t >= 1, C is closest to B
+   else closest point is between A and B
+------------------------------------------------------------------------- */
+
+void Region::point_on_line_segment(double *a, double *b,
+                                   double *c, double *d)
+{
+  double ba[3],ca[3];
+
+  MathExtra::sub3(b,a,ba);
+  MathExtra::sub3(c,a,ca);
+  double t = MathExtra::dot3(ca,ba) / MathExtra::dot3(ba,ba);
+  if (t <= 0.0) {
+    d[0] = a[0];
+    d[1] = a[1];
+    d[2] = a[2];
+  } else if (t >= 1.0) {
+    d[0] = b[0];
+    d[1] = b[1];
+    d[2] = b[2];
+  } else {
+    d[0] = a[0] + t*ba[0];
+    d[1] = a[1] + t*ba[1];
+    d[2] = a[2] + t*ba[2];
+  }
+}
+
+/* ----------------------------------------------------------------------
+   infer translational and angular velocity of region
+   necessary b/c motion variables are for displacement & theta
+     there is no analytic formula for v & omega
+   prev[4] contains values of dx,dy,dz,theta at previous step
+     used for difference, then updated to current step values
+   dt is time elapsed since previous step
+   rpoint = point updated by current displacement
+   called by fix wall/gran/region every timestep
+------------------------------------------------------------------------- */
+
+void Region::set_velocity()
+{
+  if (vel_timestep == update->ntimestep) return;
+  vel_timestep = update->ntimestep;
+  if (moveflag) {
+    if (update->ntimestep > 0) {
+      v[0] = (dx - prev[0])/update->dt;
+      v[1] = (dy - prev[1])/update->dt;
+      v[2] = (dz - prev[2])/update->dt;
+    }
+    else v[0] = v[1] = v[2] = 0.0;
+    prev[0] = dx;
+    prev[1] = dy;
+    prev[2] = dz;    
+  }
+
+  if (rotateflag) {
+    rpoint[0] = point[0] + dx;
+    rpoint[1] = point[1] + dy;
+    rpoint[2] = point[2] + dz;
+    if (update->ntimestep > 0) {
+      double angvel = (theta-prev[3]) / update->dt;
+      omega[0] = angvel*axis[0];
+      omega[1] = angvel*axis[1];
+      omega[2] = angvel*axis[2];
+    }
+    else omega[0] = omega[1] = omega[2] = 0.0;
+    prev[3] = theta;
+  }
+
+  if (varshape){
+    set_velocity_shape();
+  }
+}
+
+/* ----------------------------------------------------------------------
+   compute velocity of wall for given contact
+   since contacts only store delx/y/z, need to pass particle coords
+     to compute contact point
+   called by fix/wall/gran/region every contact every timestep
+------------------------------------------------------------------------- */
+
+void Region::velocity_contact(double *vwall, double *x, int ic)
+{
+  Contact c = contact[ic];
+  double xc[3];
+  xc[0] = x[0] - contact[ic].delx;
+  xc[1] = x[1] - contact[ic].dely;
+  xc[2] = x[2] - contact[ic].delz;
+  
+  vwall[0] = v[0] + omega[1]*(xc[2] - rpoint[2]) - omega[2]*(xc[1] - rpoint[1]);
+  vwall[1] = v[1] + omega[2]*(xc[0] - rpoint[0]) - omega[0]*(xc[2] - rpoint[2]);
+  vwall[2] = v[2] + omega[0]*(xc[1] - rpoint[1]) - omega[1]*(xc[0] - rpoint[0]);
+
+  if (varshape && contact[ic].varflag) velocity_contact_shape(vwall,xc);
+}
+
+/* ----------------------------------------------------------------------
+   region writes its current position/angle
+   needed by fix/wall/gran/region to compute velocity by differencing scheme
+------------------------------------------------------------------------- */
+
+void Region::write_restart(FILE *fp)
+{
+  fwrite(prev, sizeof(double), size_restart, fp);  
+}
+
+/* ----------------------------------------------------------------------
+   region reads its previous position/angle
+   needed by fix/wall/gran/region to compute velocity by differencing scheme
+------------------------------------------------------------------------- */
+
+int Region::restart(char *buf, int n)
+{
+  char *rlist = new char[size_restart*sizeof(double)];  
+  for (int i = 0; i < size_restart*sizeof(double); i++)
+    rlist[i] = buf[n++]; 
+  for (int i = 0; i < size_restart; i++) {
+    prev[i] = ((double *)rlist)[i];
+  }
+  delete [] rlist;
+  return n;
+}
+
+/* ----------------------------------------------------------------------
+   set prev vector to zero
+------------------------------------------------------------------------- */
+
+void Region::reset_vel()
+{
+  for (int i = 0; i < size_restart; i++)
+    prev[i] = 0;
+}
diff --git a/src/region.h b/src/region.h
index d330a9bf3e57710ec5101bfa7cbc1985b37e3d47..4b53c4e23b5c1588196be827ad69b4719d87230c 100644
--- a/src/region.h
+++ b/src/region.h
@@ -31,17 +31,44 @@ class Region : protected Pointers {
   int bboxflag;                     // 1 if bounding box is computable
   int varshape;                     // 1 if region shape changes over time
   int dynamic;                      // 1 if position/orient changes over time
+  int moveflag,rotateflag;          // 1 if position/orientation changes
+  int openflag;			    // 1 if any face is open
+  int open_faces[6];		    // flags for which faces are open
 
   int copymode;                     // 1 if copy of original class
 
-  // contact = particle near region surface
+  // contact = particle near region surface (for soft interactions)
+  // touch = particle touching region surface (for granular interactions)
 
   struct Contact {
     double r;                 // distance between particle & surf, r > 0.0
     double delx,dely,delz;    // vector from surface pt to particle
+    double radius;            // curvature of region at contact point
+    int iwall;		      // unique id of wall for storing shear history
+    int varflag;              // 1 if wall can be variable-controlled
   };
   Contact *contact;           // list of contacts
   int cmax;                   // max # of contacts possible with region
+  int tmax;		      // max # of touching contacts possible
+
+  // motion attributes of region
+  // public so can be accessed by other classes
+
+  double dx,dy,dz,theta;      // current displacement and orientation
+  double v[3];	 	      // translational velocity
+  double rpoint[3];	      // current origin of rotation axis
+  double omega[3];	      // angular velocity
+  double rprev;               // speed of time-dependent radius, if applicable
+  double xcenter[3];          // translated/rotated center of cylinder/sphere
+                              //   only used with varshape
+  double prev[5];             // stores displacement (X3), angle and if 
+                              //  necessary, region variable size (e.g. radius)
+                              //  at previous time step
+  int vel_timestep;           // store timestep at which set_velocity was called
+                              //   prevents multiple fix/wall/gran/region calls
+  int nregion;                // For union and intersect
+  int size_restart;
+  int *list;
 
   Region(class LAMMPS *, int, char **);
   virtual ~Region();
@@ -54,6 +81,12 @@ class Region : protected Pointers {
   int match(double, double, double);
   int surface(double, double, double, double);
 
+  virtual void set_velocity();
+  void velocity_contact(double *, double *, int);
+  virtual void write_restart(FILE *);
+  virtual int restart(char *, int);
+  virtual void reset_vel();
+
   // implemented by each region, not called by other classes
 
   virtual int inside(double, double, double) = 0;
@@ -61,6 +94,8 @@ class Region : protected Pointers {
   virtual int surface_exterior(double *, double) = 0;
   virtual void shape_update() {}
   virtual void pretransform();
+  virtual void set_velocity_shape() {}
+  virtual void velocity_contact_shape(double*, double*) {}
 
   // Kokkos function, implemented by each Kokkos region
 
@@ -69,15 +104,14 @@ class Region : protected Pointers {
  protected:
   void add_contact(int, double *, double, double, double);
   void options(int, char **);
+  void point_on_line_segment(double *, double *, double *, double *);
+  void forward_transform(double &, double &, double &);
 
-  int moveflag,rotateflag;         // 1 if position/orientation changes
-
-  double point[3],axis[3],runit[3];
+ private:
   char *xstr,*ystr,*zstr,*tstr;
   int xvar,yvar,zvar,tvar;
-  double dx,dy,dz,theta;
+  double axis[3],point[3],runit[3];
 
-  void forward_transform(double &, double &, double &);
   void inverse_transform(double &, double &, double &);
   void rotate(double &, double &, double &, double);
 };
@@ -100,10 +134,6 @@ E: Variable for region is not equal style
 
 Self-explanatory.
 
-E: Can only use Kokkos supported regions with Kokkos package
-
-Self-explanatory.
-
 E: Illegal ... command
 
 Self-explanatory.  Check the input script syntax and compare to the
diff --git a/src/region_block.cpp b/src/region_block.cpp
index f866903f3db85f629c9008cc032d872db3e2ef11..f48aa5af89bf27b3ca3dc9254906504b0046a259 100644
--- a/src/region_block.cpp
+++ b/src/region_block.cpp
@@ -14,9 +14,10 @@
 #include <stdlib.h>
 #include <string.h>
 #include "region_block.h"
+#include "force.h"
 #include "domain.h"
+#include "math_extra.h"
 #include "error.h"
-#include "force.h"
 
 using namespace LAMMPS_NS;
 
@@ -94,9 +95,91 @@ RegBlock::RegBlock(LAMMPS *lmp, int narg, char **arg) : Region(lmp, narg, arg)
   } else bboxflag = 0;
 
   // particle could be close to all 6 planes
+  // particle can only touch 3 planes
 
   cmax = 6;
   contact = new Contact[cmax];
+  if (interior) tmax = 3;
+  else tmax = 1;
+
+  // open face data structs
+
+  face[0][0] = -1.0;
+  face[0][1] = 0.0;
+  face[0][2] = 0.0;
+  face[1][0] = 1.0;
+  face[1][1] = 0.0;
+  face[1][2] = 0.0;
+  face[2][0] = 0.0;
+  face[2][1] = -1.0;
+  face[2][2] = 0.0;
+  face[3][0] = 0.0;
+  face[3][1] = 1.0;
+  face[3][2] = 0.0;
+  face[4][0] = 0.0;
+  face[4][1] = 0.0;
+  face[4][2] = -1.0;
+  face[5][0] = 0.0;
+  face[5][1] = 0.0;
+  face[5][2] = 1.0;
+
+  // face[0]
+
+  corners[0][0][0] = xlo;
+  corners[0][0][1] = ylo;
+  corners[0][0][2] = zlo;
+  corners[0][1][0] = xlo;
+  corners[0][1][1] = ylo;
+  corners[0][1][2] = zhi;
+  corners[0][2][0] = xlo;
+  corners[0][2][1] = yhi;
+  corners[0][2][2] = zhi;
+  corners[0][3][0] = xlo;
+  corners[0][3][1] = yhi;
+  corners[0][3][2] = zlo;
+
+  // face[1]
+
+  corners[1][0][0] = xhi;
+  corners[1][0][1] = ylo;
+  corners[1][0][2] = zlo;
+  corners[1][1][0] = xhi;
+  corners[1][1][1] = ylo;
+  corners[1][1][2] = zhi;
+  corners[1][2][0] = xhi;
+  corners[1][2][1] = yhi;
+  corners[1][2][2] = zhi;
+  corners[1][3][0] = xhi;
+  corners[1][3][1] = yhi;
+  corners[1][3][2] = zlo;
+
+  // face[2]
+
+  MathExtra::copy3(corners[2][0],corners[0][0]);
+  MathExtra::copy3(corners[2][1],corners[1][0]);
+  MathExtra::copy3(corners[2][2],corners[1][1]);
+  MathExtra::copy3(corners[2][3],corners[0][1]);
+
+  // face[3]
+
+  MathExtra::copy3(corners[3][0],corners[0][3]);
+  MathExtra::copy3(corners[3][1],corners[0][2]);
+  MathExtra::copy3(corners[3][2],corners[1][2]);
+  MathExtra::copy3(corners[3][3],corners[1][3]);
+
+  // face[4]
+
+  MathExtra::copy3(corners[4][0],corners[0][0]);
+  MathExtra::copy3(corners[4][1],corners[0][3]);
+  MathExtra::copy3(corners[4][2],corners[1][3]);
+  MathExtra::copy3(corners[4][3],corners[1][0]);
+
+  // face[5]
+
+  MathExtra::copy3(corners[5][0],corners[0][1]);
+  MathExtra::copy3(corners[5][1],corners[1][1]);
+  MathExtra::copy3(corners[5][2],corners[1][2]);
+  MathExtra::copy3(corners[5][3],corners[0][2]);
 }
 
 /* ---------------------------------------------------------------------- */
@@ -141,47 +224,59 @@ int RegBlock::surface_interior(double *x, double cutoff)
   int n = 0;
 
   delta = x[0] - xlo;
-  if (delta < cutoff) {
+  if (delta < cutoff && !open_faces[0]) {
     contact[n].r = delta;
     contact[n].delx = delta;
     contact[n].dely = contact[n].delz = 0.0;
+    contact[n].radius = 0;
+    contact[n].iwall = 0;
     n++;
   }
   delta = xhi - x[0];
-  if (delta < cutoff) {
+  if (delta < cutoff && !open_faces[1]) {
     contact[n].r = delta;
     contact[n].delx = -delta;
     contact[n].dely = contact[n].delz = 0.0;
+    contact[n].radius = 0;
+    contact[n].iwall = 1;
     n++;
   }
 
   delta = x[1] - ylo;
-  if (delta < cutoff) {
+  if (delta < cutoff && !open_faces[2]) {
     contact[n].r = delta;
     contact[n].dely = delta;
     contact[n].delx = contact[n].delz = 0.0;
+    contact[n].radius = 0;
+    contact[n].iwall = 2;
     n++;
   }
   delta = yhi - x[1];
-  if (delta < cutoff) {
+  if (delta < cutoff && !open_faces[3]) {
     contact[n].r = delta;
     contact[n].dely = -delta;
     contact[n].delx = contact[n].delz = 0.0;
+    contact[n].radius = 0;
+    contact[n].iwall = 3;
     n++;
   }
 
   delta = x[2] - zlo;
-  if (delta < cutoff) {
+  if (delta < cutoff && !open_faces[4]) {
     contact[n].r = delta;
     contact[n].delz = delta;
     contact[n].delx = contact[n].dely = 0.0;
+    contact[n].radius = 0;
+    contact[n].iwall = 4;
     n++;
   }
   delta = zhi - x[2];
-  if (delta < cutoff) {
+  if (delta < cutoff && !open_faces[5]) {
     contact[n].r = delta;
     contact[n].delz = -delta;
     contact[n].delx = contact[n].dely = 0.0;
+    contact[n].radius = 0;
+    contact[n].iwall = 5;
     n++;
   }
 
@@ -197,6 +292,7 @@ int RegBlock::surface_interior(double *x, double cutoff)
 int RegBlock::surface_exterior(double *x, double cutoff)
 {
   double xp,yp,zp;
+  double xc,yc,zc,dist,mindist;
 
   // x is far enough from block that there is no contact
   // x is interior to block
@@ -212,17 +308,129 @@ int RegBlock::surface_exterior(double *x, double cutoff)
   //            could be edge or corner pt of block
   // do not add contact point if r >= cutoff
 
-  if (x[0] < xlo) xp = xlo;
-  else if (x[0] > xhi) xp = xhi;
-  else xp = x[0];
-  if (x[1] < ylo) yp = ylo;
-  else if (x[1] > yhi) yp = yhi;
-  else yp = x[1];
-  if (x[2] < zlo) zp = zlo;
-  else if (x[2] > zhi) zp = zhi;
-  else zp = x[2];
+  if (!openflag){
+    if (x[0] < xlo) xp = xlo;
+    else if (x[0] > xhi) xp = xhi;
+    else xp = x[0];
+    if (x[1] < ylo) yp = ylo;
+    else if (x[1] > yhi) yp = yhi;
+    else yp = x[1];
+    if (x[2] < zlo) zp = zlo;
+    else if (x[2] > zhi) zp = zhi;
+    else zp = x[2];
+  }
+  else{
+    mindist = BIG;
+    for (int i = 0; i < 6; i++){
+      if (open_faces[i]) continue;
+      dist = find_closest_point(i,x,xc,yc,zc);
+      if (dist < mindist){
+        xp = xc;
+        yp = yc;
+        zp = zc;
+        mindist = dist;
+      }
+    }
+  }
 
   add_contact(0,x,xp,yp,zp);
+  contact[0].iwall = 0;
   if (contact[0].r < cutoff) return 1;
   return 0;
 }
+
+/*------------------------------------------------------------------------
+  return distance to closest point on surface I of block region
+  store closest point in xc,yc,zc
+--------------------------------------------------------------------------*/
+
+double RegBlock::find_closest_point(int i, double *x, 
+                                    double &xc, double &yc, double &zc)
+{
+  double dot,d2,d2min;
+  double xr[3],xproj[3],p[3];
+
+  xr[0] = x[0] - corners[i][0][0];
+  xr[1] = x[1] - corners[i][0][1];
+  xr[2] = x[2] - corners[i][0][2];
+  dot = face[i][0]*xr[0] + face[i][1]*xr[1] + face[i][2]*xr[2];
+  xproj[0] = xr[0] - dot*face[i][0];
+  xproj[1] = xr[1] - dot*face[i][1];
+  xproj[2] = xr[2] - dot*face[i][2];
+
+  d2min = BIG;
+
+  // check if point projects inside of face
+
+  if (inside_face(xproj, i)){
+    d2 = d2min = dot*dot;
+    xc = xproj[0] + corners[i][0][0];
+    yc = xproj[1] + corners[i][0][1];
+    zc = xproj[2] + corners[i][0][2];
+
+ // check each edge
+
+  } else {
+    point_on_line_segment(corners[i][0],corners[i][1],x,p);
+    d2 = (p[0]-x[0])*(p[0]-x[0]) + (p[1]-x[1])*(p[1]-x[1]) + 
+      (p[2]-x[2])*(p[2]-x[2]);
+    if (d2 < d2min) {
+      d2min = d2;
+      xc = p[0];
+      yc = p[1];
+      zc = p[2];
+    }
+
+    point_on_line_segment(corners[i][1],corners[i][2],x,p);
+    d2 = (p[0]-x[0])*(p[0]-x[0]) + (p[1]-x[1])*(p[1]-x[1]) + 
+      (p[2]-x[2])*(p[2]-x[2]);
+    if (d2 < d2min) {
+      d2min = d2;
+      xc = p[0];
+      yc = p[1];
+      zc = p[2];
+    }
+
+    point_on_line_segment(corners[i][2],corners[i][3],x,p);
+    d2 = (p[0]-x[0])*(p[0]-x[0]) + (p[1]-x[1])*(p[1]-x[1]) + 
+      (p[2]-x[2])*(p[2]-x[2]);
+    if (d2 < d2min) {
+      d2min = d2;
+      xc = p[0];
+      yc = p[1];
+      zc = p[2];
+    }
+
+    point_on_line_segment(corners[i][3],corners[i][4],x,p);
+    d2 = (p[0]-x[0])*(p[0]-x[0]) + (p[1]-x[1])*(p[1]-x[1]) + 
+      (p[2]-x[2])*(p[2]-x[2]);
+    if (d2 < d2min) {
+      d2min = d2;
+      xc = p[0];
+      yc = p[1];
+      zc = p[2];
+    }
+  }
+
+  return d2min;
+}
+
+/*------------------------------------------------------------------------
+  determine if projected point is inside given face of the block
+--------------------------------------------------------------------------*/
+
+int RegBlock::inside_face(double *xproj, int iface)
+{
+  if (iface < 2) {
+    if (xproj[1] > 0 && (xproj[1] < yhi-ylo) &&
+        xproj[2] > 0 && (xproj[2] < zhi-zlo)) return 1;
+  } else if (iface < 4) {
+    if (xproj[0] > 0 && (xproj[0] < (xhi-xlo)) &&
+        xproj[2] > 0 && (xproj[2] < (zhi-zlo))) return 1;
+  } else {
+    if (xproj[0] > 0 && xproj[0] < (xhi-xlo) &&
+        xproj[1] > 0 && xproj[1] < (yhi-ylo)) return 1;
+  }
+
+  return 0;
+}
diff --git a/src/region_block.h b/src/region_block.h
index fb9dcb3f5e637ffc316a23e49fe020d8ff125e48..7989ddb8afd82de7d29ca76babc87646693346f0 100644
--- a/src/region_block.h
+++ b/src/region_block.h
@@ -36,6 +36,11 @@ class RegBlock : public Region {
 
  protected:
   double xlo,xhi,ylo,yhi,zlo,zhi;
+  double corners[6][4][3];
+  double face[6][3];
+
+  double find_closest_point(int, double *, double &, double &, double &);
+  int inside_face(double *, int);
 };
 
 }
diff --git a/src/region_cone.cpp b/src/region_cone.cpp
index bc3197a02ded9e481c3a82d4d81c938da9468e8d..786b92d3b7c793bb7ab9797302037998b3f79f97 100644
--- a/src/region_cone.cpp
+++ b/src/region_cone.cpp
@@ -34,6 +34,11 @@ RegCone::RegCone(LAMMPS *lmp, int narg, char **arg) :
 {
   options(narg-9,&arg[9]);
 
+  // check open face settings
+
+  if (openflag && (open_faces[3] || open_faces[4] || open_faces[5]))
+    error->all(FLERR,"Invalid region cone open setting");
+
   if (strcmp(arg[2],"x") && strcmp(arg[2],"y") && strcmp(arg[2],"z"))
     error->all(FLERR,"Illegal region cylinder command");
   axis = arg[2][0];
@@ -118,7 +123,6 @@ RegCone::RegCone(LAMMPS *lmp, int narg, char **arg) :
 
   if (interior) {
     bboxflag = 1;
-
     if (axis == 'x') {
       extent_xlo = lo;
       extent_xhi = hi;
@@ -145,10 +149,13 @@ RegCone::RegCone(LAMMPS *lmp, int narg, char **arg) :
     }
   } else bboxflag = 0;
 
-  // particle could be contact cone surface and 2 ends
+  // particle could be close to cone surface and 2 ends
+  // particle can only touch surface and 1 end
 
   cmax = 3;
   contact = new Contact[cmax];
+  if (interior) tmax = 2;
+  else tmax = 1;
 }
 
 /* ---------------------------------------------------------------------- */
@@ -167,7 +174,7 @@ int RegCone::inside(double x, double y, double z)
 {
   double del1,del2,dist;
   double currentradius;
-  int inside = 0;
+  int inside;
 
   if (axis == 'x') {
     del1 = y - c1;
@@ -226,7 +233,7 @@ int RegCone::surface_interior(double *x, double cutoff)
     // surflo = pt on outer circle of bottom end plane, same dir as x vs axis
     // surfhi = pt on outer circle of top end plane, same dir as x vs axis
 
-    if (r > 0.0) {
+    if (r > 0.0 && !open_faces[2]) {
       surflo[0] = lo;
       surflo[1] = c1 + del1*radiuslo/r;
       surflo[2] = c2 + del2*radiuslo/r;
@@ -243,22 +250,29 @@ int RegCone::surface_interior(double *x, double cutoff)
         contact[n].delx = delx;
         contact[n].dely = dely;
         contact[n].delz = delz;
+        contact[n].radius = -2.0*(radiuslo + (xs[0]-lo)*
+                                  (radiushi-radiuslo)/(hi-lo));
+        contact[n].iwall = 2;
         n++;
       }
     }
 
     delta = x[0] - lo;
-    if (delta < cutoff) {
+    if (delta < cutoff && !open_faces[0]) {
       contact[n].r = delta;
       contact[n].delx = delta;
       contact[n].dely = contact[n].delz = 0.0;
+      contact[n].radius = 0;
+      contact[n].iwall = 0;
       n++;
     }
     delta = hi - x[0];
-    if (delta < cutoff) {
+    if (delta < cutoff && !open_faces[1]) {
       contact[n].r = delta;
       contact[n].delx = -delta;
       contact[n].dely = contact[n].delz = 0.0;
+      contact[n].radius = 0;
+      contact[n].iwall = 1;
       n++;
     }
 
@@ -266,7 +280,8 @@ int RegCone::surface_interior(double *x, double cutoff)
     del1 = x[0] - c1;
     del2 = x[2] - c2;
     r = sqrt(del1*del1 + del2*del2);
-    currentradius = radiuslo + (x[1]-lo)*(radiushi-radiuslo)/(hi-lo);
+    currentradius = radiuslo + (x[1]-lo)*
+      (radiushi-radiuslo)/(hi-lo);
 
     // y is exterior to cone
 
@@ -276,7 +291,7 @@ int RegCone::surface_interior(double *x, double cutoff)
     // surflo = pt on outer circle of bottom end plane, same dir as y vs axis
     // surfhi = pt on outer circle of top end plane, same dir as y vs axis
 
-    if (r > 0.0) {
+    if (r > 0.0 && !open_faces[2]) {
       surflo[0] = c1 + del1*radiuslo/r;
       surflo[1] = lo;
       surflo[2] = c2 + del2*radiuslo/r;
@@ -293,22 +308,29 @@ int RegCone::surface_interior(double *x, double cutoff)
         contact[n].delx = delx;
         contact[n].dely = dely;
         contact[n].delz = delz;
+        contact[n].iwall = 2;
+        contact[n].radius = -2.0*(radiuslo + (xs[1]-lo)*
+                                  (radiushi-radiuslo)/(hi-lo));
         n++;
       }
     }
 
     delta = x[1] - lo;
-    if (delta < cutoff) {
+    if (delta < cutoff && !open_faces[0]) {
       contact[n].r = delta;
       contact[n].delz = delta;
       contact[n].delx = contact[n].dely = 0.0;
+      contact[n].iwall = 0;
+      contact[n].radius = 0;
       n++;
     }
     delta = hi - x[1];
-    if (delta < cutoff) {
+    if (delta < cutoff && !open_faces[1]) {
       contact[n].r = delta;
       contact[n].delz = -delta;
       contact[n].delx = contact[n].dely = 0.0;
+      contact[n].iwall = 1;
+      contact[n].radius = 0;
       n++;
     }
 
@@ -326,7 +348,7 @@ int RegCone::surface_interior(double *x, double cutoff)
     // surflo = pt on outer circle of bottom end plane, same dir as z vs axis
     // surfhi = pt on outer circle of top end plane, same dir as z vs axis
 
-    if (r > 0.0) {
+    if (r > 0.0 && !open_faces[2]) {
       surflo[0] = c1 + del1*radiuslo/r;
       surflo[1] = c2 + del2*radiuslo/r;
       surflo[2] = lo;
@@ -343,22 +365,29 @@ int RegCone::surface_interior(double *x, double cutoff)
         contact[n].delx = delx;
         contact[n].dely = dely;
         contact[n].delz = delz;
+        contact[n].iwall = 2;
+        contact[n].radius = -2.0*(radiuslo + (xs[2]-lo)*
+                                  (radiushi-radiuslo)/(hi-lo));
         n++;
       }
     }
 
     delta = x[2] - lo;
-    if (delta < cutoff) {
+    if (delta < cutoff  && !open_faces[0]) {
       contact[n].r = delta;
       contact[n].delz = delta;
       contact[n].delx = contact[n].dely = 0.0;
+      contact[n].iwall = 0;
+      contact[n].radius = 0;
       n++;
     }
     delta = hi - x[2];
-    if (delta < cutoff) {
+    if (delta < cutoff  && !open_faces[1]) {
       contact[n].r = delta;
       contact[n].delz = -delta;
       contact[n].delx = contact[n].dely = 0.0;
+      contact[n].iwall = 1;
+      contact[n].radius = 0;
       n++;
     }
   }
@@ -374,7 +403,7 @@ int RegCone::surface_interior(double *x, double cutoff)
 
 int RegCone::surface_exterior(double *x, double cutoff)
 {
-  double del1,del2,r,currentradius,distsq;
+  double del1,del2,r,currentradius,distsq,distsqprev,crad;
   double corner1[3],corner2[3],corner3[3],corner4[3],xp[3],nearest[3];
 
   if (axis == 'x') {
@@ -383,11 +412,15 @@ int RegCone::surface_exterior(double *x, double cutoff)
     r = sqrt(del1*del1 + del2*del2);
     currentradius = radiuslo + (x[0]-lo)*(radiushi-radiuslo)/(hi-lo);
 
+    // radius of curvature, only used for granular walls
+
+    double crad = 0.0; 
+
     // x is far enough from cone that there is no contact
     // x is interior to cone
 
-    if (r >= maxradius+cutoff ||
-        x[0] <= lo-cutoff || x[0] >= hi+cutoff) return 0;
+    if (r >= maxradius+cutoff || x[0] <= lo-cutoff || x[0] >= hi+cutoff) 
+      return 0;
     if (r < currentradius && x[0] > lo && x[0] < hi) return 0;
 
     // x is exterior to cone or on its surface
@@ -411,14 +444,31 @@ int RegCone::surface_exterior(double *x, double cutoff)
     corner4[2] = c2;
 
     distsq = BIG;
-    point_on_line_segment(corner1,corner2,x,xp);
-    distsq = closest(x,xp,nearest,distsq);
-    point_on_line_segment(corner1,corner3,x,xp);
-    distsq = closest(x,xp,nearest,distsq);
-    point_on_line_segment(corner2,corner4,x,xp);
-    distsq = closest(x,xp,nearest,distsq);
 
+    if (!open_faces[2]) {
+      point_on_line_segment(corner1,corner2,x,xp);
+      distsq = closest(x,xp,nearest,distsq);
+      crad = -2.0*(radiuslo + (nearest[0]-lo)*(radiushi-radiuslo)/(hi-lo));
+    }
+
+    if (!open_faces[0]) {
+      point_on_line_segment(corner1,corner3,x,xp);
+      distsqprev = distsq;
+      distsq = closest(x,xp,nearest,distsq);
+      if (distsq < distsqprev) crad = 0.0;
+    }
+
+    if (!open_faces[1]) {
+      point_on_line_segment(corner2,corner4,x,xp);
+      distsqprev = distsq;
+      distsq = closest(x,xp,nearest,distsq);
+      if (distsq < distsqprev) crad = 0.0;
+    }
+
+    if (distsq == BIG) return 0;
     add_contact(0,x,nearest[0],nearest[1],nearest[2]);
+    contact[0].radius = crad;
+    contact[0].iwall = 0;
     if (contact[0].r < cutoff) return 1;
     return 0;
 
@@ -456,14 +506,30 @@ int RegCone::surface_exterior(double *x, double cutoff)
     corner4[2] = c2;
 
     distsq = BIG;
-    point_on_line_segment(corner1,corner2,x,xp);
-    distsq = closest(x,xp,nearest,distsq);
-    point_on_line_segment(corner1,corner3,x,xp);
-    distsq = closest(x,xp,nearest,distsq);
-    point_on_line_segment(corner2,corner4,x,xp);
-    distsq = closest(x,xp,nearest,distsq);
+
+    if (!open_faces[2]){
+      point_on_line_segment(corner1,corner2,x,xp);
+      distsq = closest(x,xp,nearest,distsq);
+      crad = -2.0*(radiuslo + (nearest[1]-lo)*(radiushi-radiuslo)/(hi-lo));
+    }
+
+    if (!open_faces[0]) {
+      point_on_line_segment(corner1,corner3,x,xp);
+      distsqprev = distsq;
+      distsq = closest(x,xp,nearest,distsq);
+      if (distsq < distsqprev) crad = 0;
+    }
+
+    if (!open_faces[1]) {
+      point_on_line_segment(corner2,corner4,x,xp);
+      distsqprev = distsq;
+      distsq = closest(x,xp,nearest,distsq);
+      if (distsq < distsqprev) crad = 0;
+    }
 
     add_contact(0,x,nearest[0],nearest[1],nearest[2]);
+    contact[0].radius = crad;
+    contact[0].iwall = 0;
     if (contact[0].r < cutoff) return 1;
     return 0;
 
@@ -476,8 +542,8 @@ int RegCone::surface_exterior(double *x, double cutoff)
     // z is far enough from cone that there is no contact
     // z is interior to cone
 
-    if (r >= maxradius+cutoff ||
-        x[2] <= lo-cutoff || x[2] >= hi+cutoff) return 0;
+    if (r >= maxradius+cutoff || x[2] <= lo-cutoff || x[2] >= hi+cutoff)
+      return 0;
     if (r < currentradius && x[2] > lo && x[2] < hi) return 0;
 
     // z is exterior to cone or on its surface
@@ -501,52 +567,35 @@ int RegCone::surface_exterior(double *x, double cutoff)
     corner4[2] = hi;
 
     distsq = BIG;
-    point_on_line_segment(corner1,corner2,x,xp);
-    distsq = closest(x,xp,nearest,distsq);
-    point_on_line_segment(corner1,corner3,x,xp);
-    distsq = closest(x,xp,nearest,distsq);
-    point_on_line_segment(corner2,corner4,x,xp);
-    distsq = closest(x,xp,nearest,distsq);
+
+    if (!open_faces[2]){
+      point_on_line_segment(corner1,corner2,x,xp);
+      distsq = closest(x,xp,nearest,distsq);
+      crad = -2.0*(radiuslo + (nearest[2]-lo)*(radiushi-radiuslo)/(hi-lo));
+    }
+
+    if (!open_faces[0]) {
+      point_on_line_segment(corner1,corner3,x,xp);
+      distsqprev = distsq;
+      distsq = closest(x,xp,nearest,distsq);
+      if (distsq < distsqprev) crad = 0;
+    }
+
+    if (!open_faces[1]) {
+      point_on_line_segment(corner2,corner4,x,xp);
+      distsqprev = distsq;
+      distsq = closest(x,xp,nearest,distsq);
+      if (distsq < distsqprev) crad = 0;
+    }
 
     add_contact(0,x,nearest[0],nearest[1],nearest[2]);
+    contact[0].radius = crad;
+    contact[0].iwall = 0;
     if (contact[0].r < cutoff) return 1;
     return 0;
   }
 }
 
-/* ----------------------------------------------------------------------
-   find nearest point to C on line segment A,B and return it as D
-   project (C-A) onto (B-A)
-   t = length of that projection, normalized by length of (B-A)
-   t <= 0, C is closest to A
-   t >= 1, C is closest to B
-   else closest point is between A and B
-------------------------------------------------------------------------- */
-
-void RegCone::point_on_line_segment(double *a, double *b,
-                                    double *c, double *d)
-{
-  double ba[3],ca[3];
-
-  subtract(a,b,ba);
-  subtract(a,c,ca);
-  double t = dotproduct(ca,ba) / dotproduct(ba,ba);
-
-  if (t <= 0.0) {
-    d[0] = a[0];
-    d[1] = a[1];
-    d[2] = a[2];
-  } else if (t >= 1.0) {
-    d[0] = b[0];
-    d[1] = b[1];
-    d[2] = b[2];
-  } else {
-    d[0] = a[0] + t*ba[0];
-    d[1] = a[1] + t*ba[1];
-    d[2] = a[2] + t*ba[2];
-  }
-}
-
 /* ---------------------------------------------------------------------- */
 
 double RegCone::closest(double *x, double *near, double *nearest, double dsq)
@@ -562,23 +611,3 @@ double RegCone::closest(double *x, double *near, double *nearest, double dsq)
   nearest[2] = near[2];
   return rsq;
 }
-
-/* ----------------------------------------------------------------------
-   v3 = v2 - v1
-------------------------------------------------------------------------- */
-
-void RegCone::subtract(double *v1, double *v2, double *v3)
-{
-  v3[0] = v2[0] - v1[0];
-  v3[1] = v2[1] - v1[1];
-  v3[2] = v2[2] - v1[2];
-}
-
-/* ----------------------------------------------------------------------
-   return dotproduct = v1 dot v2
-------------------------------------------------------------------------- */
-
-double RegCone::dotproduct(double *v1, double *v2)
-{
-  return (v1[0]*v2[0] + v1[1]*v2[1] + v1[2]*v2[2]);
-}
diff --git a/src/region_cone.h b/src/region_cone.h
index 0f6ac71debfe15529dadf6c5312e2cc2f5b4e26c..62b2d05a8ddd846ccc46c62cbf1870f9e9a2f293 100644
--- a/src/region_cone.h
+++ b/src/region_cone.h
@@ -39,11 +39,7 @@ class RegCone : public Region {
   double lo,hi;
   double maxradius;
 
-  void point_on_line_segment(double *, double *, double *, double *);
   double closest(double *, double *, double *, double);
-
-  void subtract(double *, double *, double *);
-  double dotproduct(double *, double *);
 };
 
 }
diff --git a/src/region_cylinder.cpp b/src/region_cylinder.cpp
index b77ff2a88120de41a3ce023c6df8190e0ecf8733..b2935f22cb8805d380c04109bc0277398f5efa27 100644
--- a/src/region_cylinder.cpp
+++ b/src/region_cylinder.cpp
@@ -34,6 +34,12 @@ RegCylinder::RegCylinder(LAMMPS *lmp, int narg, char **arg) :
 {
   options(narg-8,&arg[8]);
 
+  // check open face settings
+
+  if (openflag && (open_faces[2] || open_faces[3] || 
+                   open_faces[4] || open_faces[5]))
+    error->all(FLERR,"Invalid region cylinder open setting");
+
   if (strcmp(arg[2],"x") && strcmp(arg[2],"y") && strcmp(arg[2],"z"))
     error->all(FLERR,"Illegal region cylinder command");
   axis = arg[2][0];
@@ -61,7 +67,7 @@ RegCylinder::RegCylinder(LAMMPS *lmp, int narg, char **arg) :
     shape_update();
   } else {
     radius = force->numeric(FLERR,arg[5]);
-    if (axis == 'x') radius *= yscale;
+    if (axis == 'x') radius *= xscale;
     else radius *= xscale;
     rstyle = CONSTANT;
   }
@@ -149,10 +155,13 @@ RegCylinder::RegCylinder(LAMMPS *lmp, int narg, char **arg) :
     }
   } else bboxflag = 0;
 
-  // particle could be contact cylinder surface and 2 ends
+  // particle could be close to cylinder surface and 2 ends
+  // particle can only touch surface and 1 end
 
   cmax = 3;
   contact = new Contact[cmax];
+  if (interior) tmax = 2;
+  else tmax = 1;
 }
 
 /* ---------------------------------------------------------------------- */
@@ -230,25 +239,34 @@ int RegCylinder::surface_interior(double *x, double cutoff)
     // x is interior to cylinder or on its surface
 
     delta = radius - r;
-    if (delta < cutoff && r > 0.0) {
+    if (delta < cutoff && r > 0.0 && !open_faces[2]) {
       contact[n].r = delta;
       contact[n].delx = 0.0;
       contact[n].dely = del1*(1.0-radius/r);
       contact[n].delz = del2*(1.0-radius/r);
+      contact[n].radius = -2.0*radius;
+      contact[n].iwall = 2;
+      contact[n].varflag = 1;
       n++;
     }
     delta = x[0] - lo;
-    if (delta < cutoff) {
+    if (delta < cutoff && !open_faces[0]) {
       contact[n].r = delta;
       contact[n].delx = delta;
       contact[n].dely = contact[n].delz = 0.0;
+      contact[n].radius = 0;
+      contact[n].iwall = 0;
+      contact[n].varflag = 0;
       n++;
     }
     delta = hi - x[0];
-    if (delta < cutoff) {
+    if (delta < cutoff && !open_faces[1]) {
       contact[n].r = delta;
       contact[n].delx = -delta;
       contact[n].dely = contact[n].delz = 0.0;
+      contact[n].radius = 0;
+      contact[n].iwall = 1;
+      contact[n].varflag = 0;
       n++;
     }
 
@@ -264,25 +282,34 @@ int RegCylinder::surface_interior(double *x, double cutoff)
     // y is interior to cylinder or on its surface
 
     delta = radius - r;
-    if (delta < cutoff && r > 0.0) {
+    if (delta < cutoff && r > 0.0 && !open_faces[2]) {
       contact[n].r = delta;
       contact[n].delx = del1*(1.0-radius/r);
       contact[n].dely = 0.0;
       contact[n].delz = del2*(1.0-radius/r);
+      contact[n].radius = -2.0*radius;
+      contact[n].iwall = 2;
+      contact[n].varflag = 1;
       n++;
     }
     delta = x[1] - lo;
-    if (delta < cutoff) {
+    if (delta < cutoff && !open_faces[0]) {
       contact[n].r = delta;
       contact[n].dely = delta;
       contact[n].delx = contact[n].delz = 0.0;
+      contact[n].radius = 0;
+      contact[n].iwall = 0;
+      contact[n].varflag = 0;
       n++;
     }
     delta = hi - x[1];
-    if (delta < cutoff) {
+    if (delta < cutoff && !open_faces[1]) {
       contact[n].r = delta;
       contact[n].dely = -delta;
       contact[n].delx = contact[n].delz = 0.0;
+      contact[n].radius = 0;
+      contact[n].iwall = 1;
+      contact[n].varflag = 0;
       n++;
     }
 
@@ -298,25 +325,34 @@ int RegCylinder::surface_interior(double *x, double cutoff)
     // z is interior to cylinder or on its surface
 
     delta = radius - r;
-    if (delta < cutoff && r > 0.0) {
+    if (delta < cutoff && r > 0.0 && !open_faces[2]) {
       contact[n].r = delta;
       contact[n].delx = del1*(1.0-radius/r);
       contact[n].dely = del2*(1.0-radius/r);
       contact[n].delz = 0.0;
+      contact[n].radius = -2.0*radius;
+      contact[n].iwall = 2;
+      contact[n].varflag = 1;
       n++;
     }
     delta = x[2] - lo;
-    if (delta < cutoff) {
+    if (delta < cutoff && !open_faces[0]) {
       contact[n].r = delta;
       contact[n].delz = delta;
       contact[n].delx = contact[n].dely = 0.0;
+      contact[n].radius = 0;
+      contact[n].iwall = 0;
+      contact[n].varflag = 0;
       n++;
     }
     delta = hi - x[2];
-    if (delta < cutoff) {
+    if (delta < cutoff && !open_faces[1]) {
       contact[n].r = delta;
       contact[n].delz = -delta;
       contact[n].delx = contact[n].dely = 0.0;
+      contact[n].radius = 0;
+      contact[n].iwall = 1;
+      contact[n].varflag = 0;
       n++;
     }
   }
@@ -334,6 +370,13 @@ int RegCylinder::surface_exterior(double *x, double cutoff)
 {
   double del1,del2,r;
   double xp,yp,zp;
+  double dx, dr, dr2, d2, d2prev;
+
+ // radius of curvature for granular
+ // 0 for flat surfaces (infinite case), 2*radius for curved portion
+
+  double crad = 0.0;
+  int varflag = 0;
 
   if (axis == 'x') {
     del1 = x[1] - c1;
@@ -351,18 +394,81 @@ int RegCylinder::surface_exterior(double *x, double cutoff)
     //            could be edge of cylinder
     // do not add contact point if r >= cutoff
 
-    if (r > radius) {
-      yp = c1 + del1*radius/r;
-      zp = c2 + del2*radius/r;
-    } else {
-      yp = x[1];
-      zp = x[2];
+    d2prev = BIG;
+    if (!openflag) {
+      if (r > radius) {
+        yp = c1 + del1*radius/r;
+        zp = c2 + del2*radius/r;
+        crad = 2.0*radius;
+	varflag = 1;
+      } else {
+        yp = x[1];
+        zp = x[2];
+      }
+      if (x[0] < lo) xp = lo;
+      else if (x[0] > hi)	xp = hi;
+      else xp = x[0];
+    }
+
+    // closest point on curved surface
+
+    else {
+      dr = r - radius;
+      dr2 = dr*dr;
+      if (!open_faces[2]){
+        yp = c1 + del1*radius/r;
+        zp = c2 + del2*radius/r;
+        if (x[0] < lo) {
+          dx = lo-x[0];
+          xp = lo;
+        }
+        else if (x[0] > hi) {
+          dx = x[0]-hi;
+          xp = hi;
+        }
+        else {
+          dx = 0;
+          xp = x[0];
+        }
+        d2 = d2prev = dr2 + dx*dx;
+      }
+
+      // closest point on bottom cap
+
+      if (!open_faces[0]) {
+        dx = lo - x[0];
+        if (r < radius) d2 = dx*dx;
+        else d2 = dr2 + dx*dx;
+        if (d2 < d2prev) {
+          xp = lo;
+          if (r < radius){
+            yp = x[1];
+            zp = x[2];
+          }
+          d2prev = d2;
+        }
+      }
+
+      // closest point on top cap
+
+      if (!open_faces[1]) {
+        dx = hi - x[0];
+        if (r < radius) d2 = dx*dx;
+        else d2 = dr2 + dx*dx;
+        if (d2 < d2prev) {
+          xp = hi;
+          if (r < radius){
+            yp = x[1];
+            zp = x[2];
+          }
+        }
+      }
     }
-    if (x[0] < lo) xp = lo;
-    else if (x[0] > hi) xp = hi;
-    else xp = x[0];
 
     add_contact(0,x,xp,yp,zp);
+    contact[0].radius = crad;
+    contact[0].varflag = varflag;
+    contact[0].iwall = 0;
     if (contact[0].r < cutoff) return 1;
     return 0;
 
@@ -382,18 +488,81 @@ int RegCylinder::surface_exterior(double *x, double cutoff)
     //            could be edge of cylinder
     // do not add contact point if r >= cutoff
 
-    if (r > radius) {
-      xp = c1 + del1*radius/r;
-      zp = c2 + del2*radius/r;
-    } else {
-      xp = x[0];
-      zp = x[2];
+    d2prev = BIG;
+    if (!openflag) {
+      if (r > radius) {
+        xp = c1 + del1*radius/r;
+        zp = c2 + del2*radius/r;
+        crad = 2.0*radius;
+	varflag = 1;
+      } else {
+        xp = x[0];
+        zp = x[2];
+      }
+      if (x[1] < lo) yp = lo;
+      else if (x[1] > hi) yp = hi;
+      else yp = x[1];
+    }
+
+    // closest point on curved surface
+
+    else {
+      dr = r - radius;
+      dr2 = dr*dr;
+      if (!open_faces[2]){
+        xp = c1 + del1*radius/r;
+        zp = c2 + del2*radius/r;
+        if (x[1] < lo) {
+          dx = lo-x[1];
+          yp = lo;
+        }
+        else if (x[1] > hi) {
+          dx = x[1]-hi;
+          yp = hi;
+        }
+        else {
+          dx = 0;
+          yp = x[1];
+        }
+        d2 = d2prev = dr2 + dx*dx;
+      }
+
+      // closest point on bottom cap
+
+      if (!open_faces[0]) {
+        dx = lo - x[1];
+        if (r < radius) d2 = dx*dx;
+        else d2 = dr2 + dx*dx;
+        if (d2 < d2prev) {
+          yp = lo;
+          if (r < radius) {
+            xp = x[0];
+            zp = x[2];
+          }
+          d2prev = d2;
+        }
+      }
+
+      // closest point on top cap
+
+      if (!open_faces[1]) {
+        dx = hi - x[1];
+        if (r < radius) d2 = dx*dx;
+        else d2 = dr2 + dx*dx;
+        if (d2 < d2prev) {
+          yp = hi;
+          if (r < radius) {
+            xp = x[0];
+            zp = x[2];
+          }
+        }
+      }
     }
-    if (x[1] < lo) yp = lo;
-    else if (x[1] > hi) yp = hi;
-    else yp = x[1];
 
     add_contact(0,x,xp,yp,zp);
+    contact[0].radius = crad;
+    contact[0].varflag = varflag;
+    contact[0].iwall = 0;
     if (contact[0].r < cutoff) return 1;
     return 0;
 
@@ -413,18 +582,81 @@ int RegCylinder::surface_exterior(double *x, double cutoff)
     //            could be edge of cylinder
     // do not add contact point if r >= cutoff
 
-    if (r > radius) {
-      xp = c1 + del1*radius/r;
-      yp = c2 + del2*radius/r;
-    } else {
-      xp = x[0];
-      yp = x[1];
+    d2prev = BIG;
+    if (!openflag) {
+      if (r > radius) {
+        xp = c1 + del1*radius/r;
+        yp = c2 + del2*radius/r;
+        crad = 2.0*radius;
+	varflag = 1;
+      } else {
+        xp = x[0];
+        yp = x[1];
+      }
+      if (x[2] < lo) zp = lo;
+      else if (x[2] > hi) zp = hi;
+      else zp = x[2];
+    }
+
+    // closest point on curved surface
+
+    else {
+      dr = r - radius;
+      dr2 = dr*dr;
+      if (!open_faces[2]){
+        xp = c1 + del1*radius/r;
+        yp = c2 + del2*radius/r;
+        if (x[2] < lo) {
+          dx = lo-x[2];
+          zp = lo;
+        }
+        else if (x[2] > hi) {
+          dx = x[2]-hi;
+          zp = hi;
+        }
+        else {
+          dx = 0;
+          zp = x[2];
+        }
+        d2 = d2prev = dr2 + dx*dx;
+      }
+
+      // closest point on bottom cap
+
+      if (!open_faces[0]) {
+        dx = lo - x[2];
+        if (r < radius) d2 = dx*dx;
+        else d2 = dr2 + dx*dx;
+        if (d2 < d2prev) {
+          zp = lo;
+          if (r < radius) {
+            xp = x[0];
+            yp = x[1];
+          }
+          d2prev = d2;
+        }
+      }
+
+      // closest point on top cap
+
+      if (!open_faces[1]) {
+        dx = hi - x[2];
+        if (r < radius) d2 = dx*dx;
+        else d2 = dr2 + dx*dx;
+        if (d2 < d2prev) {
+          zp = hi;
+          if (r < radius) {
+            xp = x[0];
+            yp = x[1];
+          }
+        }
+      }
     }
-    if (x[2] < lo) zp = lo;
-    else if (x[2] > hi) zp = hi;
-    else zp = x[2];
 
     add_contact(0,x,xp,yp,zp);
+    contact[0].radius = crad;
+    contact[0].varflag = varflag;
+    contact[0].iwall = 0;
     if (contact[0].r < cutoff) return 1;
     return 0;
   }
@@ -439,8 +671,9 @@ 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 *= yscale;
-  else radius *= xscale;
+  if (axis == 'x') radius *= xscale;
+  else if (axis == 'y') radius*= yscale;
+  else radius *= zscale;
 }
 
 /* ----------------------------------------------------------------------
@@ -455,3 +688,65 @@ void RegCylinder::variable_check()
   if (!input->variable->equalstyle(rvar))
     error->all(FLERR,"Variable for region cylinder is invalid style");
 }
+
+
+/* ----------------------------------------------------------------------
+   Set values needed to calculate velocity due to shape changes. 
+   These values do not depend on the contact, so this function is
+   called once per timestep by fix/wall/gran/region.
+   
+------------------------------------------------------------------------- */
+
+void RegCylinder::set_velocity_shape()
+{
+  if (axis == 'x'){
+    xcenter[0] = 0; 
+    xcenter[1] = c1;
+    xcenter[2] = c2;
+  }
+  else if (axis == 'y'){
+    xcenter[0] = c1;
+    xcenter[1] = 0;
+    xcenter[2] = c2;
+  }
+  else{
+    xcenter[0] = c1;
+    xcenter[1] = c2;
+    xcenter[2] = 0;
+  }
+  forward_transform(xcenter[0], xcenter[1], xcenter[2]);
+  if (update->ntimestep > 0) rprev = prev[4];  
+  else rprev = radius;
+  prev[4] = radius;     
+}
+
+
+
+/* ----------------------------------------------------------------------
+   add velocity due to shape change to wall velocity 
+------------------------------------------------------------------------- */
+
+void RegCylinder::velocity_contact_shape(double *vwall, double *xc)
+{
+  double delx, dely, delz; // Displacement of contact point in x,y,z
+  if (axis == 'x'){
+    delx = 0;
+    dely = (xc[1] - xcenter[1])*(1 - rprev/radius);
+    delz = (xc[2] - xcenter[2])*(1 - rprev/radius);
+  }
+  else if (axis == 'y'){
+    delx = (xc[0] - xcenter[0])*(1 - rprev/radius);
+    dely = 0;
+    delz = (xc[2] - xcenter[2])*(1 - rprev/radius);
+  }
+  else{
+    delx = (xc[0] - xcenter[0])*(1 - rprev/radius);
+    dely = (xc[1] - xcenter[1])*(1 - rprev/radius);
+    delz = 0;
+  }
+  vwall[0] += delx/update->dt;
+  vwall[1] += dely/update->dt;
+  vwall[2] += delz/update->dt;     
+  //printf ("R is %g, prev %g, velocity of wall at %g %g %g is %g %g %g\n",radius,rprev,xc[0],xc[1],xc[2],vwall[0],vwall[1],vwall[2]);
+}
+
diff --git a/src/region_cylinder.h b/src/region_cylinder.h
index 247d939c4fa0d5272b8e59f3335cb4aecb0cbc40..bc5255b343019d5c312758c98d4c5bffffc210cc 100644
--- a/src/region_cylinder.h
+++ b/src/region_cylinder.h
@@ -35,6 +35,8 @@ class RegCylinder : public Region {
   int surface_interior(double *, double);
   int surface_exterior(double *, double);
   void shape_update();
+  void set_velocity_shape();
+  void velocity_contact_shape(double *, double *);
 
  private:
   char axis;
diff --git a/src/region_intersect.cpp b/src/region_intersect.cpp
index bfbe579367ccb6bb850a8c255d0874f2d2bbb8b3..39e8d90d5986e0783220ffe27b8ee3379e2b9c07 100644
--- a/src/region_intersect.cpp
+++ b/src/region_intersect.cpp
@@ -43,7 +43,7 @@ RegIntersect::RegIntersect(LAMMPS *lmp, int narg, char **arg) :
     idsub[nregion] = new char[m];
     strcpy(idsub[nregion],arg[iarg+3]);
     iregion = domain->find_region(idsub[nregion]);
-    if (iregion == -1)
+    if (iregion == -1) 
       error->all(FLERR,"Region intersect region ID does not exist");
     list[nregion++] = iregion;
   }
@@ -88,11 +88,21 @@ RegIntersect::RegIntersect(LAMMPS *lmp, int narg, char **arg) :
   }
 
   // possible contacts = sum of possible contacts in all sub-regions
+  // for near contacts and touching contacts
 
   cmax = 0;
-  for (int ilist = 0; ilist < nregion; ilist++)
+  size_restart = 0;
+  for (int ilist = 0; ilist < nregion; ilist++){
     cmax += regions[list[ilist]]->cmax;
+    size_restart += regions[list[ilist]]->size_restart;
+  }
   contact = new Contact[cmax];
+
+  tmax = 0;
+  for (int ilist = 0; ilist < nregion; ilist++) {
+    if (interior) tmax += regions[list[ilist]]->tmax;
+    else tmax++;
+  }
 }
 
 /* ---------------------------------------------------------------------- */
@@ -117,7 +127,7 @@ void RegIntersect::init()
   int iregion;
   for (int ilist = 0; ilist < nregion; ilist++) {
     iregion = domain->find_region(idsub[ilist]);
-    if (iregion == -1)
+    if (iregion == -1) 
       error->all(FLERR,"Region union region ID does not exist");
     list[ilist] = iregion;
   }
@@ -159,6 +169,7 @@ int RegIntersect::surface_interior(double *x, double cutoff)
   Region **regions = domain->regions;
   int n = 0;
 
+  int walloffset = 0;
   for (ilist = 0; ilist < nregion; ilist++) {
     iregion = list[ilist];
     ncontacts = regions[iregion]->surface(x[0],x[1],x[2],cutoff);
@@ -173,12 +184,18 @@ int RegIntersect::surface_interior(double *x, double cutoff)
       }
       if (jlist == nregion) {
         contact[n].r = regions[iregion]->contact[m].r;
+        contact[n].radius = regions[iregion]->contact[m].radius;
         contact[n].delx = regions[iregion]->contact[m].delx;
         contact[n].dely = regions[iregion]->contact[m].dely;
         contact[n].delz = regions[iregion]->contact[m].delz;
+        contact[n].iwall = regions[iregion]->contact[m].iwall + walloffset;
+        contact[n].varflag = regions[iregion]->contact[m].varflag;
         n++;
       }
     }
+    // increment by cmax instead of tmax to insure
+    // possible wall IDs for sub-regions are non overlapping
+    walloffset += regions[iregion]->cmax;
   }
 
   return n;
@@ -218,9 +235,12 @@ int RegIntersect::surface_exterior(double *x, double cutoff)
       }
       if (jlist == nregion) {
         contact[n].r = regions[iregion]->contact[m].r;
+        contact[n].radius = regions[iregion]->contact[m].radius;
         contact[n].delx = regions[iregion]->contact[m].delx;
         contact[n].dely = regions[iregion]->contact[m].dely;
         contact[n].delz = regions[iregion]->contact[m].delz;
+        contact[n].iwall = ilist;
+        contact[n].varflag = regions[iregion]->contact[m].varflag;
         n++;
       }
     }
@@ -253,3 +273,48 @@ void RegIntersect::pretransform()
   for (int ilist = 0; ilist < nregion; ilist++)
     regions[list[ilist]]->pretransform();
 }
+
+/* ----------------------------------------------------------------------
+   get translational/angular velocities of all subregions
+------------------------------------------------------------------------- */
+
+void RegIntersect::set_velocity()
+{
+  Region **regions = domain->regions;
+  for (int ilist = 0; ilist < nregion; ilist++)
+    regions[list[ilist]]->set_velocity();
+}
+
+/* ----------------------------------------------------------------------
+   region writes its current position/angle
+   needed by fix/wall/gran/region to compute velocity by differencing scheme
+------------------------------------------------------------------------- */
+
+void RegIntersect::write_restart(FILE *fp)
+{
+  for (int ilist = 0; ilist < nregion; ilist++)
+    domain->regions[list[ilist]]->write_restart(fp);
+}
+
+/* ----------------------------------------------------------------------
+   region reads its previous position/angle
+   needed by fix/wall/gran/region to compute velocity by differencing scheme
+------------------------------------------------------------------------- */
+
+int RegIntersect::restart(char *buf, int n)
+{
+  for (int ilist = 0; ilist < nregion; ilist++)
+    n = domain->regions[list[ilist]]->restart(buf, n);
+  return n;
+}
+
+/* ----------------------------------------------------------------------
+   set prev vector to zero
+------------------------------------------------------------------------- */
+
+void RegIntersect::reset_vel()
+{
+  for (int ilist = 0; ilist < nregion; ilist++)
+    domain->regions[list[ilist]]->reset_vel();
+}
+
diff --git a/src/region_intersect.h b/src/region_intersect.h
index 71399fb251bcec78305e103a122ef633aacd48ac..546baac2651377ca9eb3f7d51fa99dfbc1398ce7 100644
--- a/src/region_intersect.h
+++ b/src/region_intersect.h
@@ -34,10 +34,12 @@ class RegIntersect : public Region {
   int surface_exterior(double *, double);
   void shape_update();
   void pretransform();
+  void set_velocity();
+  void write_restart(FILE *);
+  int restart(char *, int);
+  void reset_vel();
 
  private:
-  int nregion;
-  int *list;
   char **idsub;
 };
 
diff --git a/src/region_plane.cpp b/src/region_plane.cpp
index 38d5b92bcb82623c10e1033ff273e2b0f57ebd2c..3c945eb553401844159156b549577d4f975d5816 100644
--- a/src/region_plane.cpp
+++ b/src/region_plane.cpp
@@ -45,9 +45,9 @@ RegPlane::RegPlane(LAMMPS *lmp, int narg, char **arg) :
   // plane has no bounding box
 
   bboxflag = 0;
-
   cmax = 1;
   contact = new Contact[cmax];
+  tmax = 1;
 }
 
 /* ---------------------------------------------------------------------- */
@@ -85,6 +85,8 @@ int RegPlane::surface_interior(double *x, double cutoff)
     contact[0].delx = dot*normal[0];
     contact[0].dely = dot*normal[1];
     contact[0].delz = dot*normal[2];
+    contact[0].radius = 0;
+    contact[0].iwall = 0;
     return 1;
   }
   return 0;
@@ -105,6 +107,8 @@ int RegPlane::surface_exterior(double *x, double cutoff)
     contact[0].delx = -dot*normal[0];
     contact[0].dely = -dot*normal[1];
     contact[0].delz = -dot*normal[2];
+    contact[0].radius = 0;
+    contact[0].iwall = 0;
     return 1;
   }
   return 0;
diff --git a/src/region_prism.cpp b/src/region_prism.cpp
index 1efd3d964b5b8081447d404bcc17bf7db2092c6a..b8b7b30368ad2dfe565065c69e4b6c6b95376b6c 100644
--- a/src/region_prism.cpp
+++ b/src/region_prism.cpp
@@ -21,6 +21,7 @@
 #include "region_prism.h"
 #include "domain.h"
 #include "force.h"
+#include "math_extra.h"
 #include "error.h"
 
 using namespace LAMMPS_NS;
@@ -116,10 +117,13 @@ RegPrism::RegPrism(LAMMPS *lmp, int narg, char **arg) : Region(lmp, narg, arg)
     extent_zhi = zhi;
   } else bboxflag = 0;
 
-  // particle could contact all 6 planes
+  // particle could be close to all 6 planes
+  // particle can only touch 3 planes
 
   cmax = 6;
   contact = new Contact[cmax];
+  if (interior) tmax = 3;
+  else tmax = 1;
 
   // h = transformation matrix from tilt coords (0-1) to box coords (xyz)
   // columns of h are edge vectors of tilted box
@@ -191,14 +195,28 @@ RegPrism::RegPrism(LAMMPS *lmp, int narg, char **arg) : Region(lmp, narg, arg)
   // face = 6 inward-facing unit normals to prism faces
   // order = xy plane, xz plane, yz plane
 
-  cross(a,b,face[0]);
-  cross(b,a,face[1]);
-  cross(c,a,face[2]);
-  cross(a,c,face[3]);
-  cross(b,c,face[4]);
-  cross(c,b,face[5]);
+  MathExtra::cross3(a,b,face[0]);
+  MathExtra::cross3(b,a,face[1]);
+  MathExtra::cross3(c,a,face[2]);
+  MathExtra::cross3(a,c,face[3]);
+  MathExtra::cross3(b,c,face[4]);
+  MathExtra::cross3(c,b,face[5]);
+
+  // remap open face indices to be consistent
+
+  if (openflag) {
+    int temp[6];
+    for (int i = 0; i < 6; i++)
+      temp[i] = open_faces[i];
+    open_faces[0] = temp[4];
+    open_faces[1] = temp[5];
+    open_faces[2] = temp[2];
+    open_faces[3] = temp[3];
+    open_faces[4] = temp[0];
+    open_faces[5] = temp[1];
+  }
 
-  for (int i = 0; i < 6; i++) normalize(face[i]);
+  for (int i = 0; i < 6; i++) MathExtra::norm3(face[i]);
 
   // tri = 3 vertices (0-7) in each of 12 triangles on 6 faces
   // verts in each tri are ordered so that right-hand rule gives inward norm
@@ -275,7 +293,8 @@ int RegPrism::surface_interior(double *x, double cutoff)
 
   int n = 0;
 
-  for (int i = 0; i < 6; i++) {
+  for (i = 0; i < 6; i++) {
+    if (open_faces[i]) continue;
     if (i % 2) corner = chi;
     else corner = clo;
     dot = (x[0]-corner[0])*face[i][0] + (x[1]-corner[1])*face[i][1] +
@@ -285,6 +304,8 @@ int RegPrism::surface_interior(double *x, double cutoff)
       contact[n].delx = dot*face[i][0];
       contact[n].dely = dot*face[i][1];
       contact[n].delz = dot*face[i][2];
+      contact[n].radius = 0;
+      contact[n].iwall = i;
       n++;
     }
   }
@@ -334,6 +355,8 @@ int RegPrism::surface_exterior(double *x, double cutoff)
 
   find_nearest(x,xp,yp,zp);
   add_contact(0,x,xp,yp,zp);
+  contact[0].radius = 0;
+  contact[0].iwall = 0;
   if (contact[0].r < cutoff) return 1;
   return 0;
 }
@@ -361,6 +384,7 @@ void RegPrism::find_nearest(double *x, double &xp, double &yp, double &zp)
 
   for (int itri = 0; itri < 12; itri++) {
     iface = itri/2;
+    if (open_faces[iface]) continue;
     i = tri[itri][0];
     j = tri[itri][1];
     k = tri[itri][2];
@@ -370,8 +394,9 @@ void RegPrism::find_nearest(double *x, double &xp, double &yp, double &zp)
     xproj[0] = x[0] - dot*face[iface][0];
     xproj[1] = x[1] - dot*face[iface][1];
     xproj[2] = x[2] - dot*face[iface][2];
-    if (inside_tri(xproj,corners[i],corners[j],corners[k],face[iface]))
+    if (inside_tri(xproj,corners[i],corners[j],corners[k],face[iface])){
       distsq = closest(x,xproj,nearest,distsq);
+    }
     else {
       point_on_line_segment(corners[i],corners[j],xproj,xline);
       distsq = closest(x,xline,nearest,distsq);
@@ -401,57 +426,24 @@ int RegPrism::inside_tri(double *x, double *v1, double *v2, double *v3,
 {
   double edge[3],pvec[3],xproduct[3];
 
-  subtract(v1,v2,edge);
-  subtract(v1,x,pvec);
-  cross(edge,pvec,xproduct);
-  if (dotproduct(xproduct,norm) < 0.0) return 0;
+  MathExtra::sub3(v2,v1,edge);
+  MathExtra::sub3(x,v1,pvec);
+  MathExtra::cross3(edge,pvec,xproduct);
+  if (MathExtra::dot3(xproduct,norm) < 0.0) return 0;
 
-  subtract(v2,v3,edge);
-  subtract(v2,x,pvec);
-  cross(edge,pvec,xproduct);
-  if (dotproduct(xproduct,norm) < 0.0) return 0;
+  MathExtra::sub3(v3,v2,edge);
+  MathExtra::sub3(x,v2,pvec);
+  MathExtra::cross3(edge,pvec,xproduct);
+  if (MathExtra::dot3(xproduct,norm) < 0.0) return 0;
 
-  subtract(v3,v1,edge);
-  subtract(v3,x,pvec);
-  cross(edge,pvec,xproduct);
-  if (dotproduct(xproduct,norm) < 0.0) return 0;
+  MathExtra::sub3(v1,v3,edge);
+  MathExtra::sub3(x,v3,pvec);
+  MathExtra::cross3(edge,pvec,xproduct);
+  if (MathExtra::dot3(xproduct,norm) < 0.0) return 0;
 
   return 1;
 }
 
-/* ----------------------------------------------------------------------
-   find nearest point to C on line segment A,B and return it as D
-   project (C-A) onto (B-A)
-   t = length of that projection, normalized by length of (B-A)
-   t <= 0, C is closest to A
-   t >= 1, C is closest to B
-   else closest point is between A and B
-------------------------------------------------------------------------- */
-
-void RegPrism::point_on_line_segment(double *a, double *b,
-                                     double *c, double *d)
-{
-  double ba[3],ca[3];
-
-  subtract(a,b,ba);
-  subtract(a,c,ca);
-  double t = dotproduct(ca,ba) / dotproduct(ba,ba);
-
-  if (t <= 0.0) {
-    d[0] = a[0];
-    d[1] = a[1];
-    d[2] = a[2];
-  } else if (t >= 1.0) {
-    d[0] = b[0];
-    d[1] = b[1];
-    d[2] = b[2];
-  } else {
-    d[0] = a[0] + t*ba[0];
-    d[1] = a[1] + t*ba[1];
-    d[2] = a[2] + t*ba[2];
-  }
-}
-
 /* ---------------------------------------------------------------------- */
 
 double RegPrism::closest(double *x, double *near, double *nearest, double dsq)
@@ -467,44 +459,3 @@ double RegPrism::closest(double *x, double *near, double *nearest, double dsq)
   nearest[2] = near[2];
   return rsq;
 }
-
-/* ----------------------------------------------------------------------
-   v3 = v2 - v1
-------------------------------------------------------------------------- */
-
-void RegPrism::subtract(double *v1, double *v2, double *v3)
-{
-  v3[0] = v2[0] - v1[0];
-  v3[1] = v2[1] - v1[1];
-  v3[2] = v2[2] - v1[2];
-}
-
-/* ----------------------------------------------------------------------
-   v3 = v1 x v2
-------------------------------------------------------------------------- */
-
-void RegPrism::cross(double *v1, double *v2, double *v3)
-{
-  v3[0] = v1[1]*v2[2] - v1[2]*v2[1];
-  v3[1] = v1[2]*v2[0] - v1[0]*v2[2];
-  v3[2] = v1[0]*v2[1] - v1[1]*v2[0];
-}
-
-/* ----------------------------------------------------------------------
-   return dotproduct = v1 dot v2
-------------------------------------------------------------------------- */
-
-double RegPrism::dotproduct(double *v1, double *v2)
-{
-  return (v1[0]*v2[0] + v1[1]*v2[1] + v1[2]*v2[2]);
-}
-
-/* ---------------------------------------------------------------------- */
-
-void RegPrism::normalize(double *x)
-{
-  double invlen = 1.0/sqrt(x[0]*x[0] + x[1]*x[1] + x[2]*x[2]);
-  x[0] *= invlen;
-  x[1] *= invlen;
-  x[2] *= invlen;
-}
diff --git a/src/region_prism.h b/src/region_prism.h
index fefe20ce80bd5b8da7898ecf16663fe2059ff22c..4b518def741477249e0c6228107cf51ed0c7ec57 100644
--- a/src/region_prism.h
+++ b/src/region_prism.h
@@ -47,13 +47,7 @@ class RegPrism : public Region {
 
   void find_nearest(double *, double &, double &, double &);
   int inside_tri(double *, double *, double *, double *, double *);
-  void point_on_line_segment(double *, double *, double *, double *);
   double closest(double *, double *, double *, double);
-
-  void subtract(double *, double *, double *);
-  void cross(double *, double *, double *);
-  double dotproduct(double *, double *);
-  void normalize(double *);
 };
 
 }
diff --git a/src/region_sphere.cpp b/src/region_sphere.cpp
index 409a497f1118def64350c64c4eca7b9ee5014c2b..2f51baacc4c1f63d0e680fac5cf87415c97df32c 100644
--- a/src/region_sphere.cpp
+++ b/src/region_sphere.cpp
@@ -70,6 +70,7 @@ RegSphere::RegSphere(LAMMPS *lmp, int narg, char **arg) :
 
   cmax = 1;
   contact = new Contact[cmax];
+  tmax = 1;
 }
 
 /* ---------------------------------------------------------------------- */
@@ -125,6 +126,9 @@ int RegSphere::surface_interior(double *x, double cutoff)
     contact[0].delx = delx*(1.0-radius/r);
     contact[0].dely = dely*(1.0-radius/r);
     contact[0].delz = delz*(1.0-radius/r);
+    contact[0].radius = -radius;
+    contact[0].iwall = 0;
+    contact[0].varflag = 1;
     return 1;
   }
   return 0;
@@ -150,6 +154,9 @@ int RegSphere::surface_exterior(double *x, double cutoff)
     contact[0].delx = delx*(1.0-radius/r);
     contact[0].dely = dely*(1.0-radius/r);
     contact[0].delz = delz*(1.0-radius/r);
+    contact[0].radius = radius;
+    contact[0].iwall = 0;
+    contact[0].varflag = 1;
     return 1;
   }
   return 0;
@@ -178,3 +185,42 @@ void RegSphere::variable_check()
   if (!input->variable->equalstyle(rvar))
     error->all(FLERR,"Variable for region sphere is invalid style");
 }
+
+
+/* ----------------------------------------------------------------------
+   Set values needed to calculate velocity due to shape changes. 
+   These values do not depend on the contact, so this function is
+   called once per timestep by fix/wall/gran/region.
+   
+------------------------------------------------------------------------- */
+
+void RegSphere::set_velocity_shape()
+{
+  xcenter[0] = xc;
+  xcenter[1] = yc;
+  xcenter[2] = zc;
+  forward_transform(xcenter[0], xcenter[1], xcenter[2]);
+  if (update->ntimestep > 0) rprev = prev[4];  
+  else rprev = radius;
+  prev[4] = radius;     
+}
+
+
+
+/* ----------------------------------------------------------------------
+   add velocity due to shape change to wall velocity 
+------------------------------------------------------------------------- */
+
+void RegSphere::velocity_contact_shape(double *vwall, double *xc)
+{
+  double delx, dely, delz; // Displacement of contact point in x,y,z
+ 
+  delx = (xc[0] - xcenter[0])*(1 - rprev/radius);
+  dely = (xc[1] - xcenter[1])*(1 - rprev/radius);
+  delz = (xc[2] - xcenter[2])*(1 - rprev/radius);
+
+  vwall[0] += delx/update->dt;
+  vwall[1] += dely/update->dt;
+  vwall[2] += delz/update->dt;     
+}
+
diff --git a/src/region_sphere.h b/src/region_sphere.h
index 283493fb332bec100cab0a16c8a09af74239d7f4..9e1fb4e739ce56b696ed9bfc462a716f6e192215 100644
--- a/src/region_sphere.h
+++ b/src/region_sphere.h
@@ -33,6 +33,9 @@ class RegSphere : public Region {
   int surface_interior(double *, double);
   int surface_exterior(double *, double);
   void shape_update();
+  void set_velocity_shape();
+  void velocity_contact_shape(double *, double *);
+
 
  private:
   double xc,yc,zc;
diff --git a/src/region_union.cpp b/src/region_union.cpp
index 2772d7b4d52b7d6fa19edc504293ebef5b296e44..b516af98d06484deb9bab20e40d376c35e8aaf35 100644
--- a/src/region_union.cpp
+++ b/src/region_union.cpp
@@ -44,7 +44,7 @@ RegUnion::RegUnion(LAMMPS *lmp, int narg, char **arg) : Region(lmp, narg, arg)
     idsub[nregion] = new char[m];
     strcpy(idsub[nregion],arg[iarg+3]);
     iregion = domain->find_region(idsub[nregion]);
-    if (iregion == -1)
+    if (iregion == -1) 
       error->all(FLERR,"Region union region ID does not exist");
     list[nregion++] = iregion;
   }
@@ -55,6 +55,8 @@ RegUnion::RegUnion(LAMMPS *lmp, int narg, char **arg) : Region(lmp, narg, arg)
   for (int ilist = 0; ilist < nregion; ilist++) {
     if (regions[list[ilist]]->varshape) varshape = 1;
     if (regions[list[ilist]]->dynamic) dynamic = 1;
+    if (regions[list[ilist]]->moveflag) moveflag = 1;
+    if (regions[list[ilist]]->rotateflag) rotateflag = 1;
   }
 
   // extent of union of regions
@@ -80,11 +82,21 @@ RegUnion::RegUnion(LAMMPS *lmp, int narg, char **arg) : Region(lmp, narg, arg)
   }
 
   // possible contacts = sum of possible contacts in all sub-regions
+  // for near contacts and touching contacts
 
   cmax = 0;
-  for (int ilist = 0; ilist < nregion; ilist++)
+  size_restart = 0;
+  for (int ilist = 0; ilist < nregion; ilist++){
     cmax += regions[list[ilist]]->cmax;
+    size_restart += regions[list[ilist]]->size_restart;
+  }
   contact = new Contact[cmax];
+
+  tmax = 0;
+  for (int ilist = 0; ilist < nregion; ilist++) {
+    if (interior) tmax += regions[list[ilist]]->tmax;
+    else tmax++;
+  }
 }
 
 /* ---------------------------------------------------------------------- */
@@ -109,7 +121,7 @@ void RegUnion::init()
   int iregion;
   for (int ilist = 0; ilist < nregion; ilist++) {
     iregion = domain->find_region(idsub[ilist]);
-    if (iregion == -1)
+    if (iregion == -1) 
       error->all(FLERR,"Region union region ID does not exist");
     list[ilist] = iregion;
   }
@@ -151,6 +163,7 @@ int RegUnion::surface_interior(double *x, double cutoff)
   Region **regions = domain->regions;
   int n = 0;
 
+  int walloffset = 0 ;
   for (ilist = 0; ilist < nregion; ilist++) {
     iregion = list[ilist];
     ncontacts = regions[iregion]->surface(x[0],x[1],x[2],cutoff);
@@ -161,16 +174,23 @@ int RegUnion::surface_interior(double *x, double cutoff)
       for (jlist = 0; jlist < nregion; jlist++) {
         if (jlist == ilist) continue;
         jregion = list[jlist];
-        if (regions[jregion]->match(xs,ys,zs)) break;
+        if (regions[jregion]->match(xs,ys,zs) && 
+            !regions[jregion]->openflag) break;
       }
       if (jlist == nregion) {
         contact[n].r = regions[iregion]->contact[m].r;
+        contact[n].radius = regions[iregion]->contact[m].radius;
         contact[n].delx = regions[iregion]->contact[m].delx;
         contact[n].dely = regions[iregion]->contact[m].dely;
         contact[n].delz = regions[iregion]->contact[m].delz;
+        contact[n].iwall = regions[iregion]->contact[m].iwall + walloffset;
+	contact[n].varflag = regions[iregion]->contact[m].varflag;
         n++;
       }
     }
+    // increment by cmax instead of tmax to insure
+    // possible wall IDs for sub-regions are non overlapping
+    walloffset += regions[iregion]->cmax;
   }
 
   return n;
@@ -210,9 +230,12 @@ int RegUnion::surface_exterior(double *x, double cutoff)
       }
       if (jlist == nregion) {
         contact[n].r = regions[iregion]->contact[m].r;
+        contact[n].radius = regions[iregion]->contact[m].radius;
         contact[n].delx = regions[iregion]->contact[m].delx;
         contact[n].dely = regions[iregion]->contact[m].dely;
         contact[n].delz = regions[iregion]->contact[m].delz;
+        contact[n].iwall = ilist;
+        contact[n].r = regions[iregion]->contact[m].varflag;
         n++;
       }
     }
@@ -245,3 +268,46 @@ void RegUnion::pretransform()
   for (int ilist = 0; ilist < nregion; ilist++)
     regions[list[ilist]]->pretransform();
 }
+
+/* ----------------------------------------------------------------------
+   get translational/angular velocities of all subregions
+------------------------------------------------------------------------- */
+
+void RegUnion::set_velocity()
+{
+  Region **regions = domain->regions;
+  for (int ilist = 0; ilist < nregion; ilist++)
+    regions[list[ilist]]->set_velocity();
+}
+/* ----------------------------------------------------------------------
+   region writes its current position/angle
+   needed by fix/wall/gran/region to compute velocity by differencing scheme
+------------------------------------------------------------------------- */
+
+void RegUnion::write_restart(FILE *fp)
+{
+  for (int ilist = 0; ilist < nregion; ilist++)
+    domain->regions[list[ilist]]->write_restart(fp);
+}
+
+/* ----------------------------------------------------------------------
+   region reads its previous position/angle
+   needed by fix/wall/gran/region to compute velocity by differencing scheme
+------------------------------------------------------------------------- */
+
+int RegUnion::restart(char *buf, int n)
+{
+  for (int ilist = 0; ilist < nregion; ilist++)
+    n = domain->regions[list[ilist]]->restart(buf, n);
+  return n;
+}
+
+/* ----------------------------------------------------------------------
+   set prev vector to zero
+------------------------------------------------------------------------- */
+
+void RegUnion::reset_vel()
+{
+  for (int ilist = 0; ilist < nregion; ilist++)
+    domain->regions[list[ilist]]->reset_vel();
+}
diff --git a/src/region_union.h b/src/region_union.h
index 7cc32b3ed8c0019abeb444d6981b238236857ffc..091688d66e2910c47d2355d972ab1bec6380c95e 100644
--- a/src/region_union.h
+++ b/src/region_union.h
@@ -34,10 +34,12 @@ class RegUnion : public Region {
   int surface_exterior(double *, double);
   void shape_update();
   void pretransform();
+  void set_velocity();
+  void write_restart(FILE *);
+  int restart(char *, int);
+  void reset_vel();
 
  private:
-  int nregion;
-  int *list;
   char **idsub;
 };
 
diff --git a/src/special.cpp b/src/special.cpp
index ae566ec4f5a1f32236a38d52679ec5ff628acc57..c4de11e09c5f9232573444b90261bbb8995fd00c 100644
--- a/src/special.cpp
+++ b/src/special.cpp
@@ -23,6 +23,7 @@
 #include "accelerator_kokkos.h"
 #include "memory.h"
 #include "error.h"
+#include "atom_masks.h"
 
 using namespace LAMMPS_NS;
 
@@ -588,8 +589,12 @@ void Special::combine()
 
   if (lmp->kokkos) {
     AtomKokkos* atomKK = (AtomKokkos*) atom;
+    atomKK->modified(Host,SPECIAL_MASK);
+    atomKK->sync(Device,SPECIAL_MASK);
     memory->grow_kokkos(atomKK->k_special,atom->special,
                         atom->nmax,atom->maxspecial,"atom:special");
+    atomKK->modified(Device,SPECIAL_MASK);
+    atomKK->sync(Host,SPECIAL_MASK);
   } else {
     memory->destroy(atom->special);
     memory->create(atom->special,atom->nmax,atom->maxspecial,"atom:special");
diff --git a/src/version.h b/src/version.h
index 7f68648837af805b4804ca2f962a95aacb234e33..e24bd29bf3a3f2302c132e1d473e812ace765ba0 100644
--- a/src/version.h
+++ b/src/version.h
@@ -1 +1 @@
-#define LAMMPS_VERSION "5 Oct 2016"
+#define LAMMPS_VERSION "6 Oct 2016"