diff --git a/doc/Makefile b/doc/Makefile
index 198fffda22066621865155b468156cf84bfda9a1..8ee8379c58bc22ee7d0ef801be39a165abaae3bd 100644
--- a/doc/Makefile
+++ b/doc/Makefile
@@ -1,5 +1,5 @@
 # Makefile for LAMMPS documentation
-SHA1          = $(shell echo $USER-$PWD | sha1sum | cut -f1 -d" ")
+SHA1          = $(shell echo $USER-$PWD | python utils/sha1sum.py)
 BUILDDIR      = /tmp/lammps-docs-$(SHA1)
 RSTDIR        = $(BUILDDIR)/rst
 VENV          = $(BUILDDIR)/docenv
diff --git a/doc/README.md b/doc/README.md
index fb130b35b91c254c4bf0792c4f658dc6962c6d05..26a51c13ab8410cd70a7be4f388f4c2f13dfc7e2 100644
--- a/doc/README.md
+++ b/doc/README.md
@@ -15,18 +15,28 @@ make clean-all    # remove entire build folder and any cached data
 ## Installing prerequisites
 
 To run the documention build toolchain Python 3 and virtualenv have to be
-installed. The following are instructions for common Linux distributions:
+installed. Here are instructions for common setups:
 
-### virtualenv
-
-#### Ubuntu
+### Ubuntu
 
 ```bash
 sudo apt-get install python-virtualenv
 ```
 
-#### Fedora
+### Fedora
 
 ```
 sudo yum install python-virtualenv
 ```
+
+### MacOS X
+
+## Python 3
+
+Download the latest Python 3 MacOS X package from https://www.python.org and install it.
+This will install both Python 3 and pip3.
+
+## virtualenv
+
+Once Python 3 is installed, open a Terminal and type `pip3 install virtualenv`. This will
+install virtualenv from the Python Package Index.
diff --git a/doc/html/fix_nve_manifold_rattle.html b/doc/html/fix_nve_manifold_rattle.html
index 3f7633ded41aaed60e1d5aa27ed508c6acb28a3f..dbcf0a2488f497e88e58d8ab5792bd2a007c888f 100644
--- a/doc/html/fix_nve_manifold_rattle.html
+++ b/doc/html/fix_nve_manifold_rattle.html
@@ -158,7 +158,7 @@ keyword = <em>every</em>
 <p>Perform constant NVE integration to update position and velocity for
 atoms constrained to a curved surface (manifold) in the group each timestep. The constraint
 is handled by RATTLE <a class="reference internal" href="fix_shake.html#andersen"><span class="std std-ref">(Andersen)</span></a> written out for the special case of
-single-particle constraints as explained in <a class="reference internal" href="fix_nvt_manifold_rattle.html#paquay"><span class="std std-ref">(Paquay)</span></a>.
+single-particle constraints as explained in <a class="reference internal" href="manifolds.html#paquay"><span class="std std-ref">(Paquay)</span></a>.
 V is volume; E is energy. This way, the dynamics of particles constrained to
 curved surfaces can be studied. If combined with <a class="reference internal" href="fix_langevin.html"><span class="doc">fix langevin</span></a>, this generates
 Brownian motion of particles constrained to a curved surface. For a list of currently supported
@@ -191,6 +191,9 @@ This fix is not invoked during <a class="reference internal" href="minimize.html
 <p>This fix is part of the USER-MANIFOLD package. It is only enabled if LAMMPS
 was built with that package. See the <a class="reference internal" href="Section_start.html#start-3"><span class="std std-ref">Making LAMMPS</span></a>
 section for more info.</p>
+<p>Only use this with <em>min_style hftn</em> or <em>min_style quickmin</em>. If not, the constraints
+will not be satisfied very well at all. A warning is generated if the <em>min_style</em> is
+incompatible but no error.</p>
 </div>
 <hr class="docutils" />
 <div class="section" id="related-commands">
@@ -199,7 +202,7 @@ section for more info.</p>
 <p><strong>Default:</strong> every = 0, tchain = 3</p>
 <hr class="docutils" />
 <p id="andersen"><strong>(Andersen)</strong> Andersen, J. Comp. Phys. 52, 24, (1983).</p>
-<p id="paquay"><strong>(Paquay)</strong> Paquay and Kusters, Biophys. J., 110, 6, (2016).
+<p id="paquay"><strong>(Paquay)</strong> Paquay and Kusters, Biophys. J., 110, ???, (2016), to be published,
 preprint available at <a class="reference external" href="http://arxiv.org/abs/1411.3019/">arXiv:1411.3019</a>.</p>
 </div>
 </div>
diff --git a/doc/html/fix_nvt_manifold_rattle.html b/doc/html/fix_nvt_manifold_rattle.html
index 35e6ea6135f9aef00e8fa8a88a462bef8daf4af5..98dd612247e8fb35d4829bd16da9d170996ea5a7 100644
--- a/doc/html/fix_nvt_manifold_rattle.html
+++ b/doc/html/fix_nvt_manifold_rattle.html
@@ -157,7 +157,7 @@ keyword = <em>temp</em> or <em>tchain</em> or <em>every</em>
 </div>
 <div class="section" id="description">
 <h2>Description</h2>
-<p>This fix combines the RATTLE-based <a class="reference internal" href="fix_shake.html#andersen"><span class="std std-ref">(Andersen)</span></a> time integrator of <a class="reference internal" href="fix_nve_manifold_rattle.html"><span class="doc">fix nve/manifold/rattle</span></a> <a class="reference internal" href="#paquay"><span class="std std-ref">(Paquay)</span></a> with a Nose-Hoover-chain thermostat to sample the
+<p>This fix combines the RATTLE-based <a class="reference internal" href="fix_shake.html#andersen"><span class="std std-ref">(Andersen)</span></a> time integrator of <a class="reference internal" href="fix_nve_manifold_rattle.html"><span class="doc">fix nve/manifold/rattle</span></a> <a class="reference internal" href="manifolds.html#paquay"><span class="std std-ref">(Paquay)</span></a> with a Nose-Hoover-chain thermostat to sample the
 canonical ensemble of particles constrained to a curved surface (manifold). This sampling does suffer from discretization bias of O(dt).
 For a list of currently supported manifolds and their parameters, see <a class="reference internal" href="manifolds.html"><span class="doc">manifolds</span></a></p>
 </div>
@@ -176,6 +176,9 @@ This fix is not invoked during <a class="reference internal" href="minimize.html
 <p>This fix is part of the USER-MANIFOLD package. It is only enabled if LAMMPS
 was built with that package. See the <a class="reference internal" href="Section_start.html#start-3"><span class="std std-ref">Making LAMMPS</span></a>
 section for more info.</p>
+<p>Only use this with <em>min_style hftn</em> or <em>min_style quickmin</em>. If not, the constraints
+will not be satisfied very well at all. A warning is generated if the <em>min_style</em> is
+incompatible but no error.</p>
 </div>
 <hr class="docutils" />
 <div class="section" id="related-commands">
@@ -184,7 +187,7 @@ section for more info.</p>
 <strong>Default:</strong> every = 0</p>
 <hr class="docutils" />
 <p id="andersen"><strong>(Andersen)</strong> Andersen, J. Comp. Phys. 52, 24, (1983).</p>
-<p id="paquay"><strong>(Paquay)</strong> Paquay and Kusters, Biophys. J., 110, 6, (2016).
+<p id="paquay"><strong>(Paquay)</strong> Paquay and Kusters, Biophys. J., 110, ???, (2016), to be published,
 preprint available at <a class="reference external" href="http://arxiv.org/abs/1411.3019/">arXiv:1411.3019</a>.</p>
 </div>
 </div>
diff --git a/doc/src/fix_nve_manifold_rattle.txt b/doc/src/fix_nve_manifold_rattle.txt
index a35c234e636e1595be0f71c97f32dada9dd3d241..8d0eb8e57c8d03803c29d5465188eb3b3a52b1ee 100644
--- a/doc/src/fix_nve_manifold_rattle.txt
+++ b/doc/src/fix_nve_manifold_rattle.txt
@@ -76,6 +76,10 @@ This fix is part of the USER-MANIFOLD 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.
 
+Only use this with {min_style hftn} or {min_style quickmin}. If not, the constraints
+will not be satisfied very well at all. A warning is generated if the {min_style} is
+incompatible but no error.
+
 :line
 
 [Related commands:]
@@ -90,7 +94,7 @@ section for more info.
 [(Andersen)] Andersen, J. Comp. Phys. 52, 24, (1983).
 
 :link(Paquay)
-[(Paquay)] Paquay and Kusters, Biophys. J., 110, 6, (2016).
+[(Paquay)] Paquay and Kusters, Biophys. J., 110, ???, (2016), to be published,
 preprint available at "arXiv:1411.3019"_http://arxiv.org/abs/1411.3019/.
 
 
diff --git a/doc/src/fix_nvt_manifold_rattle.txt b/doc/src/fix_nvt_manifold_rattle.txt
index 42a06d4ed779c84e5468584b4764b0d97f5fbf39..f117d10eb962ed1fdaf2d4c4445b9f8ae84dea29 100644
--- a/doc/src/fix_nvt_manifold_rattle.txt
+++ b/doc/src/fix_nvt_manifold_rattle.txt
@@ -62,6 +62,10 @@ This fix is part of the USER-MANIFOLD 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.
 
+Only use this with {min_style hftn} or {min_style quickmin}. If not, the constraints
+will not be satisfied very well at all. A warning is generated if the {min_style} is
+incompatible but no error.
+
 :line
 
 
@@ -76,6 +80,6 @@ section for more info.
 [(Andersen)] Andersen, J. Comp. Phys. 52, 24, (1983).
 
 :link(Paquay)
-[(Paquay)] Paquay and Kusters, Biophys. J., 110, 6, (2016).
+[(Paquay)] Paquay and Kusters, Biophys. J., 110, ???, (2016), to be published,
 preprint available at "arXiv:1411.3019"_http://arxiv.org/abs/1411.3019/.
 
diff --git a/doc/utils/sha1sum.py b/doc/utils/sha1sum.py
new file mode 100755
index 0000000000000000000000000000000000000000..d4842ecf1a70b4ebe31deff8c00696ea9a94d101
--- /dev/null
+++ b/doc/utils/sha1sum.py
@@ -0,0 +1,7 @@
+#!/bin/env python
+# simple utility which reimplements sha1sum using Python
+import hashlib
+import sys
+s = hashlib.sha1()
+s.update(sys.stdin.read().encode())
+print(s.hexdigest())
diff --git a/src/COMPRESS/Install.sh b/src/COMPRESS/Install.sh
index 49bc09f709a5da51d4f8c49efbc028e9b67dfa0e..ef1c8920c8686f3a4737cd6114b445c7aedc83ec 100644
--- a/src/COMPRESS/Install.sh
+++ b/src/COMPRESS/Install.sh
@@ -3,6 +3,10 @@
 
 mode=$1
 
+# enforce using portable C locale
+LC_ALL=C
+export LC_ALL
+
 # arg1 = file, arg2 = file it depends on
 
 action () {
diff --git a/src/CORESHELL/Install.sh b/src/CORESHELL/Install.sh
index 871a78ca88745ef6a073b968ced605cd35a0c362..f5ea54ac863b1e27c72ee6c9c6603b69c23312a8 100644
--- a/src/CORESHELL/Install.sh
+++ b/src/CORESHELL/Install.sh
@@ -3,6 +3,10 @@
 
 mode=$1
 
+# enforce using portable C locale
+LC_ALL=C
+export LC_ALL
+
 # arg1 = file, arg2 = file it depends on
 
 action () {
diff --git a/src/Depend.sh b/src/Depend.sh
index 698c1652331d6199b010a7795c66e4d661100424..7eb485cb1dc5db1d2db97458993a05f1c37085d7 100644
--- a/src/Depend.sh
+++ b/src/Depend.sh
@@ -1,6 +1,10 @@
 # Depend.sh = Install/unInstall files due to package dependencies
 # this script is invoked after any package is installed/uninstalled
 
+# enforce using portable C locale
+LC_ALL=C
+export LC_ALL
+
 # all parent/child package dependencies should be listed below
 # parent package = has files that files in another package derive from
 # child package = has files that derive from files in another package
diff --git a/src/GPU/Install.sh b/src/GPU/Install.sh
index 0ff436e95d97e6d26681eee888857b1c2066b752..ca73adbf82c37dbe2ce2da55f3aa8c81d4163bd9 100644
--- a/src/GPU/Install.sh
+++ b/src/GPU/Install.sh
@@ -3,6 +3,10 @@
 
 mode=$1
 
+# enforce using portable C locale
+LC_ALL=C
+export LC_ALL
+
 # arg1 = file, arg2 = file it depends on
 
 action () {
diff --git a/src/Install.sh b/src/Install.sh
index 322631fce9acd30c7eedd0926bd36e43b791eb75..307188a09f7e4b2453be98a9c60dd2342584a14b 100644
--- a/src/Install.sh
+++ b/src/Install.sh
@@ -7,6 +7,10 @@
 
 mode=$1
 
+# enforce using portable C locale
+LC_ALL=C
+export LC_ALL
+
 # arg1 = file, arg2 = file it depends on
 
 action () {
diff --git a/src/KIM/Install.sh b/src/KIM/Install.sh
index 128cf1585a88f5bb800ca565e770ccbb75ad7935..bac9d97cc62cc620d618c77a880cf608b6ffdd06 100644
--- a/src/KIM/Install.sh
+++ b/src/KIM/Install.sh
@@ -3,6 +3,10 @@
 
 mode=$1
 
+# enforce using portable C locale
+LC_ALL=C
+export LC_ALL
+
 # arg1 = file, arg2 = file it depends on
 
 action () {
diff --git a/src/KOKKOS/Install.sh b/src/KOKKOS/Install.sh
index 80a1bb8df0e726cf1ad623aa8c6b32e2de188a02..c269de41d33085737e88d758192314cac50d2bec 100644
--- a/src/KOKKOS/Install.sh
+++ b/src/KOKKOS/Install.sh
@@ -3,6 +3,10 @@
 
 mode=$1
 
+# enforce using portable C locale
+LC_ALL=C
+export LC_ALL
+
 # arg1 = file, arg2 = file it depends on
 
 action () {
diff --git a/src/MEAM/Install.sh b/src/MEAM/Install.sh
index acf4c90910cd2208bb688a3370cfd744c2455669..1825d4327f461af90310f5a7aa646793b302e291 100644
--- a/src/MEAM/Install.sh
+++ b/src/MEAM/Install.sh
@@ -3,6 +3,10 @@
 
 mode=$1
 
+# enforce using portable C locale
+LC_ALL=C
+export LC_ALL
+
 # arg1 = file, arg2 = file it depends on
 
 action () {
diff --git a/src/MPIIO/Install.sh b/src/MPIIO/Install.sh
index 08d284dd2ec8b4c912c1f7c1fbb7e7a20f66100b..3834aea5c5c7498f31dbd8edb5dce3aed9e734ee 100644
--- a/src/MPIIO/Install.sh
+++ b/src/MPIIO/Install.sh
@@ -3,6 +3,10 @@
 
 mode=$1
 
+# enforce using portable C locale
+LC_ALL=C
+export LC_ALL
+
 # arg1 = file, arg2 = file it depends on
 
 action () {
diff --git a/src/Make.py b/src/Make.py
index 81f3060c2109376d8c6ee60ca2fa7392a257f516..0fb298082375f5c388cf935cc7bfb0612e18dcac 100755
--- a/src/Make.py
+++ b/src/Make.py
@@ -3,9 +3,10 @@
 # Make.py tool for managing packages and their auxiliary libs,
 #   auto-editing machine Makefiles, and building LAMMPS
 # Syntax: Make.py -h (for help)
-# Notes: needs python 2.7 (not Python 3)
+# Notes: should be compatible with python 2.7 and 3.x thanks to 'futurize'
 
-import sys,os,commands,re,copy,subprocess,platform
+from __future__ import print_function
+import sys,os,re,copy,subprocess,platform
 
 # switch abbrevs
 # switch classes = created class for each switch
@@ -34,15 +35,15 @@ gpubuildflag = 0
 # functions
 # ----------------------------------------------------------------
 
-# if flag = 1, print str and exit
-# if flag = 0, print str as warning and do not exit
+# if flag = 1, print txt and exit
+# if flag = 0, print txt as warning and do not exit
 
-def error(str,flag=1):
+def error(txt,flag=1):
   if flag:
-    print "ERROR:",str
+    print("ERROR:",txt)
     sys.exit()
   else:
-    print "WARNING:",str
+    print("WARNING:",txt)
 
 # store command-line args as sw = dict of key/value
 # key = switch word, value = list of following args
@@ -83,15 +84,15 @@ def switch2str(switches,switch_order):
 
 def compile_check(compiler,ccflags,warn):
   open("tmpauto.cpp",'w').write("int main(int, char **) {}\n")
-  str = "%s %s -c tmpauto.cpp" % (compiler,ccflags)
-  txt = commands.getoutput(str)
+  tmp = "%s %s -c tmpauto.cpp" % (compiler,ccflags)
+  txt = subprocess.check_output(tmp,stderr=subprocess.STDOUT,shell=True).decode()
   flag = 1
   if txt or not os.path.isfile("tmpauto.o"):
     flag = 0
     if warn:
-      print str
-      if txt: print txt
-      else: print "compile produced no output"
+      print(tmp)
+      if txt: print(txt)
+      else: print("compile produced no output")
   os.remove("tmpauto.cpp")
   if os.path.isfile("tmpauto.o"): os.remove("tmpauto.o")
   return flag
@@ -102,15 +103,15 @@ def compile_check(compiler,ccflags,warn):
 
 def link_check(linker,linkflags,libs,warn):
   open("tmpauto.cpp",'w').write("int main(int, char **) {}\n")
-  str = "%s %s -o tmpauto tmpauto.cpp %s" % (linker,linkflags,libs)
-  txt = commands.getoutput(str)
+  tmp = "%s %s -o tmpauto tmpauto.cpp %s" % (linker,linkflags,libs)
+  txt = subprocess.check_output(tmp,stderr=subprocess.STDOUT,shell=True).decode()
   flag = 1
   if txt or not os.path.isfile("tmpauto"):
     flag = 0
     if warn:
-      print str
-      if txt: print txt
-      else: print "link produced no output"
+      print(tmp)
+      if txt: print(txt)
+      else: print("link produced no output")
   os.remove("tmpauto.cpp")
   if os.path.isfile("tmpauto"): os.remove("tmpauto")
   return flag
@@ -121,7 +122,7 @@ def link_check(linker,linkflags,libs,warn):
 
 # actions
 
-class Actions:
+class Actions(object):
   def __init__(self,list):
     self.inlist = copy.copy(list)
     
@@ -229,18 +230,18 @@ class Actions:
   
   def lib(self,suffix):
     if suffix != "all":
-      print "building",suffix,"library ..."
-      str = "%s.build()" % suffix
-      exec(str)
+      print("building",suffix,"library ...")
+      txt = "%s.build()" % suffix
+      exec(txt)
     else:
       final = packages.final
       for one in packages.lib:
         if final[one]:
           if "user" in one: pkg = one[5:]
           else: pkg = one
-          print "building",pkg,"library ..."
-          str = "%s.build()" % pkg
-          exec(str)
+          print("building",pkg,"library ...")
+          txt = "%s.build()" % pkg
+          exec(txt)
 
   # read Makefile.machine
   # if caller = "file", edit via switches
@@ -526,8 +527,10 @@ class Actions:
     # unless caller = "exe" and "file" action already invoked
     
     if caller == "file" or "file" not in self.alist:
+      # make certain that 'MAKE/MINE' folder exists.
+      subprocess.check_output("mkdir -p %s/MAKE/MINE" % dir.src,stderr=subprocess.STDOUT,shell=True)
       make.write("%s/MAKE/MINE/Makefile.auto" % dir.src,1)
-      print "Created src/MAKE/MINE/Makefile.auto"
+      print("Created src/MAKE/MINE/Makefile.auto")
       
     # test full compile and link
     # unless caller = "file" and "exe" action will be invoked later
@@ -545,9 +548,9 @@ class Actions:
   # invoke "make clean-auto" to force clean before build
     
   def clean(self):
-    str = "cd %s; make clean-auto" % dir.src
-    commands.getoutput(str)
-    print "Performed make clean-auto"
+    txt = "cd %s; make clean-auto" % dir.src
+    subprocess.check_output(txt,stderr=subprocess.STDOUT,shell=True)
+    print("Performed make clean-auto")
 
   # build LAMMPS using Makefile.auto and -j setting
   # invoke self.file() first, to test makefile compile/link
@@ -556,15 +559,15 @@ class Actions:
     
   def exe(self):
     self.file("exe")
-    commands.getoutput("cd %s; rm -f lmp_auto" % dir.src)
+    subprocess.check_output("cd %s; rm -f lmp_auto" % dir.src,stderr=subprocess.STDOUT,shell=True)
     if self.stubs and not os.path.isfile("%s/STUBS/libmpi_stubs.a" % dir.src):
-      print "building serial STUBS library ..."
-      str = "cd %s/STUBS; make clean; make" % dir.src
-      txt = commands.getoutput(str)
+      print("building serial STUBS library ...")
+      tmp = "cd %s/STUBS; make clean; make" % dir.src
+      txt = subprocess.check_output(tmp,stderr=subprocess.STDOUT,shell=True).decode()
       if not os.path.isfile("%s/STUBS/libmpi_stubs.a" % dir.src):
-        print txt
+        print(txt)
         error('Unsuccessful "make stubs"')
-      print "Created src/STUBS/libmpi_stubs.a"
+      print("Created src/STUBS/libmpi_stubs.a")
 
     # special hack for shannon GPU cluster
     # must use "srun make" if on it and building w/ GPU package, else just make
@@ -574,24 +577,24 @@ class Actions:
     if "shannon" == platform.node() and packages.final["gpu"]:
       make = "srun make"
       
-    if jmake: str = "cd %s; %s -j %d auto" % (dir.src,make,jmake.n)
-    else: str = "cd %s; %s auto" % (dir.src,make)
+    if jmake: tmp = "cd %s; %s -j %d auto" % (dir.src,make,jmake.n)
+    else: tmp = "cd %s; %s auto" % (dir.src,make)
     
     # if verbose, print output as build proceeds, else only print if fails
 
-    if verbose: subprocess.call(str,shell=True)
+    if verbose: subprocess.call(tmp,shell=True)
     else:
-      print str
-      try: subprocess.check_output(str,stderr=subprocess.STDOUT,shell=True)
-      except Exception as e: print e.output
+      print(tmp)
+      try: subprocess.check_output(tmp,stderr=subprocess.STDOUT,shell=True)
+      except Exception as e: print(e.output)
 
     if not os.path.isfile("%s/lmp_auto" % dir.src):
       error('Unsuccessful "make auto"')
-    elif not output: print "Created src/lmp_auto"
+    elif not output: print("Created src/lmp_auto")
     
 # dir switch
 
-class Dir:
+class Dir(object):
   def __init__(self,list):
     self.inlist = copy.copy(list)
       
@@ -625,7 +628,7 @@ class Dir:
 
 # help switch
 
-class Help:
+class Help(object):
   def __init__(self,list): pass
 
   def help(self):
@@ -650,7 +653,7 @@ Syntax: Make.py switch args ...
 
 # jmake switch
   
-class Jmake:
+class Jmake(object):
   def __init__(self,list):
     self.inlist = copy.copy(list)
   
@@ -671,7 +674,7 @@ class Jmake:
         
 # makefile switch
 
-class Makefile:
+class Makefile(object):
   def __init__(self,list):
     self.inlist = copy.copy(list)
   
@@ -690,7 +693,7 @@ class Makefile:
     
 # output switch
 
-class Output:
+class Output(object):
   def __init__(self,list):
     self.inlist = copy.copy(list)
 
@@ -707,7 +710,7 @@ class Output:
 
 # packages switch
   
-class Packages:
+class Packages(object):
   def __init__(self,list):
     self.inlist = copy.copy(list)
 
@@ -805,14 +808,14 @@ class Packages:
     # key = package name, value = 1 if currently installed, else 0
 
     original = {}
-    str = "cd %s; make ps" % dir.src
-    output = commands.getoutput(str).split('\n')
+    tmp = "cd %s; make ps" % dir.src
+    output = subprocess.check_output(tmp,stderr=subprocess.STDOUT,shell=True).decode()
     pattern = "Installed\s+(\w+): package (\S+)"
     for line in output:
       m = re.search(pattern,line)
       if not m: continue
       pkg = m.group(2).lower()
-      if pkg not in all: error('Package list does not math "make ps" results')
+      if pkg not in all: error('Package list does not match "make ps" results')
       if m.group(1) == "NO": original[pkg] = 0      
       elif m.group(1) == "YES": original[pkg] = 1
 
@@ -849,33 +852,33 @@ class Packages:
   # install packages in plist
     
   def install(self):
-    if self.plist: print "Installing packages ..."
+    if self.plist: print("Installing packages ...")
     for one in self.plist:
       if one == "orig": continue
-      commands.getoutput("cd %s; make %s" % (dir.src,one))
+      subprocess.check_output("cd %s; make %s" % (dir.src,one),stderr=subprocess.STDOUT,shell=True)
     if self.plist and verbose:
-      txt = commands.getoutput("cd %s; make ps" % dir.src)
-      print "Package status after installation:"
-      print txt
+      txt = subprocess.check_output("cd %s; make ps" % dir.src,stderr=subprocess.STDOUT,shell=True).decode()
+      print("Package status after installation:")
+      print(txt)
       
   # restore packages to original list if requested
   # order of re-install should not matter matter b/c of Depend.sh
   
   def uninstall(self):
     if not self.plist or self.plist[-1] != "orig": return
-    print "Restoring packages to original state ..."
-    commands.getoutput("cd %s; make no-all" % dir.src)
+    print("Restoring packages to original state ...")
+    subprocess.check_output("cd %s; make no-all" % dir.src,stderr=subprocess.STDOUT,shell=True)
     for one in self.all:
       if self.original[one]:
-        commands.getoutput("cd %s; make yes-%s" % (dir.src,one))
+        subprocess.check_output("cd %s; make yes-%s" % (dir.src,one),stderr=subprocess.STDOUT,shell=True)
     if verbose:
-      txt = commands.getoutput("cd %s; make ps" % dir.src)
-      print "Restored package status:"
-      print txt
+      txt = subprocess.check_output("cd %s; make ps" % dir.src,stderr=subprocess.STDOUT,shell=True).decode()
+      print("Restored package status:")
+      print(txt)
       
 # redo switch
     
-class Redo:
+class Redo(object):
   def __init__(self,list):
     self.inlist = copy.copy(list)
   
@@ -940,8 +943,8 @@ class Redo:
       if words[0][-1] == ':': label = words[0][:-1]
       else: label = None
       if not self.labels:
-        if label: commands.append(' '.join(words[1:]))
-        else: commands.append(line)
+        if label: subprocess.append(' '.join(words[1:]))
+        else: subprocess.append(line)
       else:
         if not label: continue
         dict[label] = ' '.join(words[1:])
@@ -950,13 +953,13 @@ class Redo:
         
     for label in self.labels:
       if label not in dict: error("Redo label not in redo file")
-      commands.append(dict[label])
+      subprocess.append(dict[label])
 
     self.commands = commands
 
 # settings switch
 
-class Settings:
+class Settings(object):
   def __init__(self,list):
     self.inlist = copy.copy(list)
   
@@ -979,7 +982,7 @@ class Settings:
   
 # verbose switch
 
-class Verbose:
+class Verbose(object):
   def __init__(self,list):
     self.inlist = copy.copy(list)
   
@@ -995,7 +998,7 @@ class Verbose:
 
 # zoutput switch for making copy of final Makefile.auto
 
-class Zoutput:
+class Zoutput(object):
   def __init__(self,list):
     self.inlist = copy.copy(list)
 
@@ -1018,7 +1021,7 @@ class Zoutput:
 
 # ATC lib
 
-class ATC:
+class ATC(object):
   def __init__(self,list):
     self.inlist = copy.copy(list)
     self.make = "g++"
@@ -1051,25 +1054,25 @@ class ATC:
       make.setvar("EXTRAMAKE","Makefile.lammps.%s" % self.lammps)
     make.write("%s/Makefile.auto" % libdir)
     
-    commands.getoutput("cd %s; make -f Makefile.auto clean" % libdir)
-    if jmake: str = "cd %s; make -j %d -f Makefile.auto" % (libdir,jmake.n)
-    else: str = "cd %s; make -f Makefile.auto" % libdir
+    subprocess.check_output("cd %s; make -f Makefile.auto clean" % libdir,stderr=subprocess.STDOUT,shell=True)
+    if jmake: txt = "cd %s; make -j %d -f Makefile.auto" % (libdir,jmake.n)
+    else: txt = "cd %s; make -f Makefile.auto" % libdir
     
     # if verbose, print output as build proceeds, else only print if fails
 
-    if verbose: subprocess.call(str,shell=True)
+    if verbose: subprocess.call(txt,shell=True)
     else:
-      try: subprocess.check_output(str,stderr=subprocess.STDOUT,shell=True)
-      except Exception as e: print e.output
+      try: subprocess.check_output(txt,stderr=subprocess.STDOUT,shell=True)
+      except Exception as e: print(e.output)
 
     if not os.path.isfile("%s/libatc.a" % libdir) or \
           not os.path.isfile("%s/Makefile.lammps" % libdir):
       error("Unsuccessful build of lib/atc library")
-    else: print "Created lib/atc library"
+    else: print("Created lib/atc library")
     
 # AWPMD lib
 
-class AWPMD:
+class AWPMD(object):
   def __init__(self,list):
     self.inlist = copy.copy(list)
     self.make = "mpicc"
@@ -1102,25 +1105,25 @@ class AWPMD:
       make.setvar("EXTRAMAKE","Makefile.lammps.%s" % self.lammps)
     make.write("%s/Makefile.auto" % libdir)
 
-    commands.getoutput("cd %s; make -f Makefile.auto clean" % libdir)
-    if jmake: str = "cd %s; make -j %d -f Makefile.auto" % (libdir,jmake.n)
-    else: str = "cd %s; make -f Makefile.auto" % libdir
+    subprocess.check_output("cd %s; make -f Makefile.auto clean" % libdir,stderr=subprocess.STDOUT,shell=True)
+    if jmake: txt = "cd %s; make -j %d -f Makefile.auto" % (libdir,jmake.n)
+    else: txt = "cd %s; make -f Makefile.auto" % libdir
 
     # if verbose, print output as build proceeds, else only print if fails
 
-    if verbose: subprocess.call(str,shell=True)
+    if verbose: subprocess.call(txt,shell=True)
     else:
-      try: subprocess.check_output(str,stderr=subprocess.STDOUT,shell=True)
-      except Exception as e: print e.output
+      try: subprocess.check_output(txt,stderr=subprocess.STDOUT,shell=True)
+      except Exception as e: print(e.output)
    
     if not os.path.isfile("%s/libawpmd.a" % libdir) or \
           not os.path.isfile("%s/Makefile.lammps" % libdir):
       error("Unsuccessful build of lib/awpmd library")
-    else: print "Created lib/awpmd library"
+    else: print("Created lib/awpmd library")
 
 # COLVARS lib
 
-class COLVARS:
+class COLVARS(object):
   def __init__(self,list):
     self.inlist = copy.copy(list)
     self.make = "g++"
@@ -1153,25 +1156,25 @@ class COLVARS:
       make.setvar("EXTRAMAKE","Makefile.lammps.%s" % self.lammps)
     make.write("%s/Makefile.auto" % libdir)
 
-    commands.getoutput("cd %s; make -f Makefile.auto clean" % libdir)
-    if jmake: str = "cd %s; make -j %d -f Makefile.auto" % (libdir,jmake.n)
-    else: str = "cd %s; make -f Makefile.auto" % libdir
+    subprocess.check_output("cd %s; make -f Makefile.auto clean" % libdir,stderr=subprocess.STDOUT,shell=True)
+    if jmake: txt = "cd %s; make -j %d -f Makefile.auto" % (libdir,jmake.n)
+    else: txt = "cd %s; make -f Makefile.auto" % libdir
 
     # if verbose, print output as build proceeds, else only print if fails
 
-    if verbose: subprocess.call(str,shell=True)
+    if verbose: subprocess.call(txt,shell=True)
     else:
-      try: subprocess.check_output(str,stderr=subprocess.STDOUT,shell=True)
-      except Exception as e: print e.output
+      try: subprocess.check_output(txt,stderr=subprocess.STDOUT,shell=True)
+      except Exception as e: print(e.output)
 
     if not os.path.isfile("%s/libcolvars.a" % libdir) or \
           not os.path.isfile("%s/Makefile.lammps" % libdir):
       error("Unsuccessful build of lib/colvars library")
-    else: print "Created lib/colvars library"
+    else: print("Created lib/colvars library")
 
 # CUDA lib
 
-class CUDA:
+class CUDA(object):
   def __init__(self,list):
     self.inlist = copy.copy(list)
     self.mode = "double"
@@ -1205,30 +1208,30 @@ class CUDA:
           
   def build(self): 
     libdir = dir.lib + "/cuda"
-    commands.getoutput("cd %s; make clean" % libdir)
+    subprocess.check_output("cd %s; make clean" % libdir,stderr=subprocess.STDOUT,shell=True)
     if self.mode == "double": n = 2
     elif self.mode == "mixed": n = 3
     elif self.mode == "single": n = 1
-    if jmake: str = "cd %s; make -j %d precision=%d arch=%s" % \
+    if jmake: txt = "cd %s; make -j %d precision=%d arch=%s" % \
           (libdir,jmake.n,n,self.arch)
-    else: str = str = "cd %s; make precision=%d arch=%s" % \
+    else: txt = "cd %s; make precision=%d arch=%s" % \
           (libdir,n,self.arch)
 
     # if verbose, print output as build proceeds, else only print if fails
 
-    if verbose: subprocess.call(str,shell=True)
+    if verbose: subprocess.call(txt,shell=True)
     else:
-      try: subprocess.check_output(str,stderr=subprocess.STDOUT,shell=True)
-      except Exception as e: print e.output
+      try: subprocess.check_output(txt,stderr=subprocess.STDOUT,shell=True)
+      except Exception as e: print(e.output)
 
     if not os.path.isfile("%s/liblammpscuda.a" % libdir) or \
           not os.path.isfile("%s/Makefile.lammps" % libdir):
       error("Unsuccessful build of lib/cuda library")
-    else: print "Created lib/cuda library"
+    else: print("Created lib/cuda library")
 
 # GPU lib
 
-class GPU:
+class GPU(object):
   def __init__(self,list):
     self.inlist = copy.copy(list)
     self.make = "linux.double"
@@ -1300,25 +1303,25 @@ class GPU:
     make = "make"
     if "shannon" == platform.node(): make = "srun make"
 
-    commands.getoutput("cd %s; %s -f Makefile.auto clean" % (libdir,make))
-    if jmake: str = "cd %s; %s -j %d -f Makefile.auto" % (libdir,make,jmake.n)
-    else: str = "cd %s; %s -f Makefile.auto" % (libdir,make)
+    subprocess.check_output("cd %s; %s -f Makefile.auto clean" % (libdir,make),stderr=subprocess.STDOUT,shell=True)
+    if jmake: txt = "cd %s; %s -j %d -f Makefile.auto" % (libdir,make,jmake.n)
+    else: txt = "cd %s; %s -f Makefile.auto" % (libdir,make)
 
     # if verbose, print output as build proceeds, else only print if fails
 
-    if verbose: subprocess.call(str,shell=True)
+    if verbose: subprocess.call(txt,shell=True)
     else:
-      try: subprocess.check_output(str,stderr=subprocess.STDOUT,shell=True)
-      except Exception as e: print e.output
+      try: subprocess.check_output(txt,stderr=subprocess.STDOUT,shell=True)
+      except Exception as e: print(e.output)
 
     if not os.path.isfile("%s/libgpu.a" % libdir) or \
           not os.path.isfile("%s/Makefile.lammps" % libdir):
       error("Unsuccessful build of lib/gpu library")
-    else: print "Created lib/gpu library"
+    else: print("Created lib/gpu library")
 
 # H5MD lib
 
-class H5MD:
+class H5MD(object):
   def __init__(self,list):
     self.inlist = copy.copy(list)
     self.make = "h5cc"
@@ -1351,24 +1354,24 @@ class H5MD:
       make.setvar("EXTRAMAKE","Makefile.lammps.%s" % self.lammps)
     make.write("%s/Makefile.auto" % libdir)
 
-    commands.getoutput("cd %s; make clean" % libdir)
-    str = "cd %s; make" % libdir
+    subprocess.check_output("cd %s; make clean" % libdir,stderr=subprocess.STDOUT,shell=True)
+    txt = "cd %s; make" % libdir
 
     # if verbose, print output as build proceeds, else only print if fails
 
-    if verbose: subprocess.call(str,shell=True)
+    if verbose: subprocess.call(txt,shell=True)
     else:
-      try: subprocess.check_output(str,stderr=subprocess.STDOUT,shell=True)
-      except Exception as e: print e.output
+      try: subprocess.check_output(txt,stderr=subprocess.STDOUT,shell=True)
+      except Exception as e: print(e.output)
 
     if not os.path.isfile("%s/libch5md.a" % libdir) or \
           not os.path.isfile("%s/Makefile.lammps" % libdir):
       error("Unsuccessful build of lib/h5md library")
-    else: print "Created lib/h5md library"
+    else: print("Created lib/h5md library")
 
 # MEAM lib
 
-class MEAM:
+class MEAM(object):
   def __init__(self,list):
     self.inlist = copy.copy(list)
     self.make = "gfortran"
@@ -1401,25 +1404,25 @@ class MEAM:
       make.setvar("EXTRAMAKE","Makefile.lammps.%s" % self.lammps)
     make.write("%s/Makefile.auto" % libdir)
 
-    commands.getoutput("cd %s; make -f Makefile.auto clean" % libdir)
+    subprocess.check_output("cd %s; make -f Makefile.auto clean" % libdir,stderr=subprocess.STDOUT,shell=True)
     # do not use -j for MEAM build, parallel build does not work
-    str = "cd %s; make -f Makefile.auto" % libdir
+    txt = "cd %s; make -f Makefile.auto" % libdir
 
     # if verbose, print output as build proceeds, else only print if fails
 
-    if verbose: subprocess.call(str,shell=True)
+    if verbose: subprocess.call(txt,shell=True)
     else:
-      try: subprocess.check_output(str,stderr=subprocess.STDOUT,shell=True)
-      except Exception as e: print e.output
+      try: subprocess.check_output(txt,stderr=subprocess.STDOUT,shell=True)
+      except Exception as e: print(e.output)
 
     if not os.path.isfile("%s/libmeam.a" % libdir) or \
           not os.path.isfile("%s/Makefile.lammps" % libdir):
       error("Unsuccessful build of lib/meam library")
-    else: print "Created lib/meam library"
+    else: print("Created lib/meam library")
 
 # POEMS lib
 
-class POEMS:
+class POEMS(object):
   def __init__(self,list):
     self.inlist = copy.copy(list)
     self.make = "g++"
@@ -1452,25 +1455,25 @@ class POEMS:
       make.setvar("EXTRAMAKE","Makefile.lammps.%s" % self.lammps)
     make.write("%s/Makefile.auto" % libdir)
 
-    commands.getoutput("cd %s; make -f Makefile.auto clean" % libdir)
-    if jmake: str = "cd %s; make -j %d -f Makefile.auto" % (libdir,jmake.n)
-    else: str = "cd %s; make -f Makefile.auto" % libdir
+    subprocess.check_output("cd %s; make -f Makefile.auto clean" % libdir,stderr=subprocess.STDOUT,shell=True)
+    if jmake: txt = "cd %s; make -j %d -f Makefile.auto" % (libdir,jmake.n)
+    else: txt = "cd %s; make -f Makefile.auto" % libdir
 
     # if verbose, print output as build proceeds, else only print if fails
 
-    if verbose: subprocess.call(str,shell=True)
+    if verbose: subprocess.call(txt,shell=True)
     else:
-      try: subprocess.check_output(str,stderr=subprocess.STDOUT,shell=True)
-      except Exception as e: print e.output
+      try: subprocess.check_output(txt,stderr=subprocess.STDOUT,shell=True)
+      except Exception as e: print(e.output)
 
     if not os.path.isfile("%s/libpoems.a" % libdir) or \
           not os.path.isfile("%s/Makefile.lammps" % libdir):
       error("Unsuccessful build of lib/poems library")
-    else: print "Created lib/poems library"
+    else: print("Created lib/poems library")
 
 # PYTHON lib
 
-class PYTHON:
+class PYTHON(object):
   def __init__(self,list):
     self.inlist = copy.copy(list)
     self.make = "g++"
@@ -1497,15 +1500,15 @@ class PYTHON:
   def build(self):
     libdir = dir.lib + "/python"
     if self.lammpsflag:
-      commands.getoutput("cd %s; cp Makefile.lammps.%s Makefile.lammps" %
+      subprocess.check_output("cd %s; cp Makefile.lammps.%s Makefile.lammps" %
                          (libdir,self.lammps))
     if not os.path.isfile("%s/Makefile.lammps.%s" % (libdir,self.lammps)):
       error("Unsuccessful creation of lib/python/Makefile.lammps.%s file" % self.lammps)
-    else: print "Created lib/python/Makefile.lammps file"
+    else: print("Created lib/python/Makefile.lammps file")
 
 # QMMM lib
 
-class QMMM:
+class QMMM(object):
   def __init__(self,list):
     self.inlist = copy.copy(list)
     self.make = "gfortran"
@@ -1538,25 +1541,25 @@ class QMMM:
       make.setvar("EXTRAMAKE","Makefile.lammps.%s" % self.lammps)
     make.write("%s/Makefile.auto" % libdir)
 
-    commands.getoutput("cd %s; make -f Makefile.auto clean" % libdir)
-    if jmake: str = "cd %s; make -j %d -f Makefile.auto" % (libdir,jmake.n)
-    else: str = "cd %s; make -f Makefile.auto" % libdir
+    subprocess.check_output("cd %s; make -f Makefile.auto clean" % libdir,stderr=subprocess.STDOUT,shell=True)
+    if jmake: txt = "cd %s; make -j %d -f Makefile.auto" % (libdir,jmake.n)
+    else: txt = "cd %s; make -f Makefile.auto" % libdir
 
     # if verbose, print output as build proceeds, else only print if fails
 
-    if verbose: subprocess.call(str,shell=True)
+    if verbose: subprocess.call(txt,shell=True)
     else:
-      try: subprocess.check_output(str,stderr=subprocess.STDOUT,shell=True)
-      except Exception as e: print e.output
+      try: subprocess.check_output(txt,stderr=subprocess.STDOUT,shell=True)
+      except Exception as e: print(e.output)
    
     if not os.path.isfile("%s/libqmmm.a" % libdir) or \
           not os.path.isfile("%s/Makefile.lammps" % libdir):
       error("Unsuccessful build of lib/qmmm library")
-    else: print "Created lib/qmmm library"
+    else: print("Created lib/qmmm library")
 
 # REAX lib
 
-class REAX:
+class REAX(object):
   def __init__(self,list):
     self.inlist = copy.copy(list)
     self.make = "gfortran"
@@ -1590,24 +1593,24 @@ class REAX:
     make.write("%s/Makefile.auto" % libdir)
 
     commands.getoutput("cd %s; make -f Makefile.auto clean" % libdir)
-    if jmake: str = "cd %s; make -j %d -f Makefile.auto" % (libdir,jmake.n)
-    else: str = "cd %s; make -f Makefile.auto" % libdir
+    if jmake: txt = "cd %s; make -j %d -f Makefile.auto" % (libdir,jmake.n)
+    else: txt = "cd %s; make -f Makefile.auto" % libdir
     
     # if verbose, print output as build proceeds, else only print if fails
 
-    if verbose: subprocess.call(str,shell=True)
+    if verbose: subprocess.call(txt,shell=True)
     else:
-      try: subprocess.check_output(str,stderr=subprocess.STDOUT,shell=True)
-      except Exception as e: print e.output
+      try: subprocess.check_output(txt,stderr=subprocess.STDOUT,shell=True)
+      except Exception as e: print(e.output)
 
     if not os.path.isfile("%s/libreax.a" % libdir) or \
           not os.path.isfile("%s/Makefile.lammps" % libdir):
       error("Unsuccessful build of lib/reax library")
-    else: print "Created lib/reax library"
+    else: print("Created lib/reax library")
 
 # VORONOI lib
 
-class VORONOI:
+class VORONOI(object):
   def __init__(self,list):
     self.inlist = copy.copy(list)
     self.install = ""
@@ -1635,9 +1638,9 @@ class VORONOI:
     if not self.install: return
     libdir = dir.lib + "/voronoi"
     cmd = "cd %s; python install.py %s" % (libdir,self.install)
-    txt = commands.getoutput(cmd)
-    if verbose: print txt
-    print "Created lib/voronoi library"
+    txt = subprocess.check_output(cmd,stderr=subprocess.STDOUT,shell=True).decode()
+    if verbose: print(txt)
+    print("Created lib/voronoi library")
 
 # ----------------------------------------------------------------
 # build classes for intel, kokkos build options
@@ -1645,7 +1648,7 @@ class VORONOI:
 
 # Intel class
 
-class Intel:
+class Intel(object):
   def __init__(self,list):
     self.inlist = copy.copy(list)
     self.mode = "cpu"
@@ -1666,7 +1669,7 @@ class Intel:
 
 # Kokkos class
 
-class Kokkos:
+class Kokkos(object):
   def __init__(self,list):
     self.inlist = copy.copy(list)
     self.mode = ""
@@ -1688,7 +1691,7 @@ class Kokkos:
 """
 
   def check(self):
-    print self.inlist
+    print(self.inlist)
     if self.inlist != None and len(self.inlist) == 0:
       error("-kokkos args are invalid")
       
@@ -1710,7 +1713,7 @@ class Kokkos:
 
 # Cc class
 
-class Cc:
+class Cc(object):
   def __init__(self,list):
     self.inlist = copy.copy(list)
     self.compiler = self.abbrev = ""
@@ -1762,7 +1765,7 @@ class Cc:
 
 # Flags class
 
-class Flags:
+class Flags(object):
   def __init__(self,list):
     self.inlist = copy.copy(list)
     self.flags = []
@@ -1803,7 +1806,7 @@ class Flags:
       
 # Mpi class
 
-class Mpi:
+class Mpi(object):
   def __init__(self,list):
     self.inlist = copy.copy(list)
     self.style = self.dir = ""
@@ -1837,7 +1840,7 @@ class Mpi:
 
 # Fft class
 
-class Fft:
+class Fft(object):
   def __init__(self,list):
     self.inlist = copy.copy(list)
     self.dir = self.incdir = self.libdir = ""
@@ -1877,7 +1880,7 @@ class Fft:
 
 # Jpg class
 
-class Jpg:
+class Jpg(object):
   def __init__(self,list):
     self.inlist = copy.copy(list)
     self.on = 1
@@ -1916,7 +1919,7 @@ class Jpg:
 
 # Png class
 
-class Png:
+class Png(object):
   def __init__(self,list):
     self.inlist = copy.copy(list)
     self.on = 1
@@ -1958,7 +1961,7 @@ class Png:
 
 # read, tweak, and write a Makefile
 
-class MakeReader:
+class MakeReader(object):
 
   # read a makefile
   # flag = 0 if file is full path name
@@ -2127,14 +2130,14 @@ class MakeReader:
       if not line.isdigit():
         if flag and i == 0:
           line = "# auto = makefile auto-generated by Make.py"
-        print >>fp,line
+        print(line, file=fp)
       else:
         index = int(line)
         name = self.varinfo[index][0]
         txt = self.varinfo[index][1]
         if name not in self.var: continue
         values = self.var[name]
-        print >>fp,"%s%s" % (txt,' '.join(values))
+        print("%s%s" % (txt,' '.join(values)), file=fp)
   
 # ----------------------------------------------------------------
 # main program
@@ -2203,7 +2206,7 @@ while 1:
       switches[switch] = cmd_switches[switch]
 
     argstr = switch2str(switches,switch_order)
-    print "Redo command: Make.py",argstr
+    print("Redo command: Make.py",argstr)
   else:
     switches = cmd_switches
     switch_order = cmd_switch_order
@@ -2246,10 +2249,10 @@ while 1:
 
   if help or (actions and "-h" in actions.inlist) or not switches:
     if not help: help = Help(None)
-    print help.help()
+    print(help.help())
     for switch in switch_order:
       if switch == "h": continue
-      print classes[switch].help()[1:]
+      print(classes[switch].help()[1:])
     sys.exit()
 
   # create needed default classes if not specified with switch
@@ -2298,7 +2301,7 @@ while 1:
 
   if actions:
     for action in actions.alist:
-      print "Action %s ..." % action
+      print("Action %s ..." % action)
       if action.startswith("lib-"): actions.lib(action[4:])
       elif action == "file": actions.file("file")
       elif action == "clean": actions.clean()
@@ -2310,35 +2313,35 @@ while 1:
 
   if output and actions and "exe" in actions.alist:
     txt = "cp %s/lmp_auto %s/lmp_%s" % (dir.src,dir.cwd,output.machine)
-    commands.getoutput(txt)
-    print "Created lmp_%s in %s" % (output.machine,dir.cwd)
+    subprocess.check_output(txt,stderr=subprocess.STDOUT,shell=True)
+    print("Created lmp_%s in %s" % (output.machine,dir.cwd))
 
   # create copy of Makefile.auto if requested, and file or exe action performed
   # ditto for library Makefile.auto and Makefile.lammps files
-    
+
   if zoutput and actions and \
         ("file" in actions.alist or "exe" in actions.alist):
     txt = "cp %s/MAKE/MINE/Makefile.auto %s/MAKE/MINE/Makefile.%s" % \
         (dir.src,dir.src,zoutput.machine)
-    commands.getoutput(txt)
-    print "Created Makefile.%s in %s/MAKE/MINE" % (zoutput.machine,dir.src)
+    subprocess.check_output(txt,stderr=subprocess.STDOUT,shell=True)
+    print("Created Makefile.%s in %s/MAKE/MINE" % (zoutput.machine,dir.src))
     if gpubuildflag:
       txt = "cp %s/gpu/Makefile.auto %s/MAKE/MINE/Makefile_gpu.%s" % \
           (dir.lib,dir.src,zoutput.machine)
-      commands.getoutput(txt)
-      print "Created Makefile_gpu.%s in %s/MAKE/MINE" % \
-          (zoutput.machine,dir.src)
+      subprocess.check_output(txt,stderr=subprocess.STDOUT,shell=True)
+      print("Created Makefile_gpu.%s in %s/MAKE/MINE" % \
+          (zoutput.machine,dir.src))
       txt = "cp %s/gpu/Makefile.lammps %s/MAKE/MINE/Makefile_gpu_lammps.%s" % \
           (dir.lib,dir.src,zoutput.machine)
-      commands.getoutput(txt)
-      print "Created Makefile_gpu_lammps.%s in %s/MAKE/MINE" % \
-          (zoutput.machine,dir.src)
+      subprocess.check_output(txt,stderr=subprocess.STDOUT,shell=True)
+      print("Created Makefile_gpu_lammps.%s in %s/MAKE/MINE" % \
+          (zoutput.machine,dir.src))
       
   # write current Make.py command to src/Make.py.last
 
   fp = open("%s/Make.py.last" % dir.src,'w')
-  print >>fp,"# last invoked Make.py command"
-  print >>fp,switch2str(switches,switch_order)
+  print("# last invoked Make.py command", file=fp)
+  print(switch2str(switches,switch_order), file=fp)
   fp.close()
   
   # if not redoflag, done
diff --git a/src/Make.sh b/src/Make.sh
index 3332be92c4ec784f485826305849dbd04d298dc5..fbed1a8bcd598251a1f9f24d7167b5e4b467d7c7 100644
--- a/src/Make.sh
+++ b/src/Make.sh
@@ -5,6 +5,12 @@
 #         sh Make.sh Makefile.shlib
 #         sh Make.sh Makefile.list
 
+# turn off enforced customizations
+GREP_OPTIONS=
+# enforce using portable C locale
+LC_ALL=C
+export LC_ALL GREP_OPTIONS
+
 # function to create one style_*.h file
 # must whack *.d files that depend on style_*.h file,
 # else Make will not recreate them
diff --git a/src/OPT/Install.sh b/src/OPT/Install.sh
index 2374072a69760ae10868b37e9a5f691d3dfcb077..ca1231c615c40a95164b90a6e79fbc5335461744 100644
--- a/src/OPT/Install.sh
+++ b/src/OPT/Install.sh
@@ -5,6 +5,10 @@ mode=$1
 
 # arg1 = file, arg2 = file it depends on
 
+# enforce using portable C locale
+LC_ALL=C
+export LC_ALL
+
 action () {
   if (test $mode = 0) then
     rm -f ../$1
diff --git a/src/POEMS/Install.sh b/src/POEMS/Install.sh
index b03792e4f181d670746338d1b9785c9824347146..7996f542be37dc8e8a4d5f358329067d9e8e0afe 100644
--- a/src/POEMS/Install.sh
+++ b/src/POEMS/Install.sh
@@ -5,6 +5,10 @@ mode=$1
 
 # arg1 = file, arg2 = file it depends on
 
+# enforce using portable C locale
+LC_ALL=C
+export LC_ALL
+
 action () {
   if (test $mode = 0) then
     rm -f ../$1
diff --git a/src/PYTHON/Install.sh b/src/PYTHON/Install.sh
index 02c7acc81276126ad59c79fc7afe5499e5b69729..3d6f71958a7f9caf30ad8365a71eb67622e453f7 100755
--- a/src/PYTHON/Install.sh
+++ b/src/PYTHON/Install.sh
@@ -5,6 +5,10 @@ mode=$1
 
 # arg1 = file, arg2 = file it depends on
 
+# enforce using portable C locale
+LC_ALL=C
+export LC_ALL
+
 action () {
   if (test $mode = 0) then
     rm -f ../$1
diff --git a/src/Package.sh b/src/Package.sh
index 80677665eb923e54afd391869c64b5178c0311cc..ce3819b590e3a439652931e14c358b537b79f4f0 100644
--- a/src/Package.sh
+++ b/src/Package.sh
@@ -1,6 +1,10 @@
 # Package.sh = package management, called from Makefile
 # Syntax: sh Package.sh DIR status/update/overwrite/diff
 
+# enforce using portable C locale
+LC_ALL=C
+export LC_ALL
+
 # package is already installed if any package *.cpp or *.h file is in src
 # else not installed
 
diff --git a/src/REAX/Install.sh b/src/REAX/Install.sh
index af0f1e2436aa0fe0d37e1253daf6f1fc45061ea4..f0083810e9b403acc48710010531d217c90621c9 100644
--- a/src/REAX/Install.sh
+++ b/src/REAX/Install.sh
@@ -5,6 +5,10 @@ mode=$1
 
 # arg1 = file, arg2 = file it depends on
 
+# enforce using portable C locale
+LC_ALL=C
+export LC_ALL
+
 action () {
   if (test $mode = 0) then
     rm -f ../$1
diff --git a/src/USER-ATC/Install.sh b/src/USER-ATC/Install.sh
index 03ec562a6a6787628f0af18779f0cc8608774742..113738901843421f6d5d3e9a6f4fef6372203f3a 100755
--- a/src/USER-ATC/Install.sh
+++ b/src/USER-ATC/Install.sh
@@ -5,6 +5,10 @@ mode=$1
 
 # arg1 = file, arg2 = file it depends on
 
+# enforce using portable C locale
+LC_ALL=C
+export LC_ALL
+
 action () {
   if (test $mode = 0) then
     rm -f ../$1
diff --git a/src/USER-AWPMD/Install.sh b/src/USER-AWPMD/Install.sh
index 6fd0718b71374d34e26bf0331f854e5c61bd0102..7922c53395e986a62699b24a61a4f6b48faa59e3 100644
--- a/src/USER-AWPMD/Install.sh
+++ b/src/USER-AWPMD/Install.sh
@@ -5,6 +5,10 @@ mode=$1
 
 # arg1 = file, arg2 = file it depends on
 
+# enforce using portable C locale
+LC_ALL=C
+export LC_ALL
+
 action () {
   if (test $mode = 0) then
     rm -f ../$1
diff --git a/src/USER-CG-CMM/Install.sh b/src/USER-CG-CMM/Install.sh
index 8e4376e9619ef922b81a07fe479a49a73f5430cd..00f515b794bee82336ac36597bbbafe8a1c17de6 100644
--- a/src/USER-CG-CMM/Install.sh
+++ b/src/USER-CG-CMM/Install.sh
@@ -5,6 +5,10 @@ mode=$1
 
 # arg1 = file, arg2 = file it depends on
 
+# enforce using portable C locale
+LC_ALL=C
+export LC_ALL
+
 action () {
   if (test $mode = 0) then
     rm -f ../$1
diff --git a/src/USER-COLVARS/Install.sh b/src/USER-COLVARS/Install.sh
index d4e252c223a93ba651ddb723f77246b14bc5366b..c01719e76630a4a170c4a3f7b715cfbf3bb1dc08 100755
--- a/src/USER-COLVARS/Install.sh
+++ b/src/USER-COLVARS/Install.sh
@@ -5,6 +5,10 @@ mode=$1
 
 # arg1 = file, arg2 = file it depends on
 
+# enforce using portable C locale
+LC_ALL=C
+export LC_ALL
+
 action () {
   if (test $mode = 0) then
     rm -f ../$1
diff --git a/src/USER-FEP/Install.sh b/src/USER-FEP/Install.sh
index 695d2baf69c056172a18d82e269d261247a6e4eb..09c2024ad20038652d9a55399f46ffaac6c04aa1 100644
--- a/src/USER-FEP/Install.sh
+++ b/src/USER-FEP/Install.sh
@@ -1,12 +1,12 @@
 # Install/unInstall package files in LAMMPS
 # mode = 0/1/2 for uninstall/install/update
 
-# this is default Install.sh for all packages
-# if package has an auxiliary library or a file with a dependency,
-# then package dir has its own customized Install.sh
-
 mode=$1
 
+# enforce using portable C locale
+LC_ALL=C
+export LC_ALL
+
 # arg1 = file, arg2 = file it depends on
 
 action () {
diff --git a/src/USER-H5MD/Install.sh b/src/USER-H5MD/Install.sh
index 32bd9d1931a4c1c590364c086ed8f245574bb829..bdda732807b033c6631a26ae74c124e9d98734d1 100644
--- a/src/USER-H5MD/Install.sh
+++ b/src/USER-H5MD/Install.sh
@@ -3,6 +3,10 @@
 
 mode=$1
 
+# enforce using portable C locale
+LC_ALL=C
+export LC_ALL
+
 # arg1 = file, arg2 = file it depends on
 
 action () {
diff --git a/src/USER-INTEL/Install.sh b/src/USER-INTEL/Install.sh
index 5b7e9e40b3f0cdde8771695b58cea4bacf3f8318..79cc1158e9ffca0a6b91561671ccccf9961c662f 100644
--- a/src/USER-INTEL/Install.sh
+++ b/src/USER-INTEL/Install.sh
@@ -3,6 +3,10 @@
 
 mode=$1
 
+# enforce using portable C locale
+LC_ALL=C
+export LC_ALL
+
 # arg1 = file, arg2 = file it depends on
 
 action () {
diff --git a/src/USER-MISC/Install.sh b/src/USER-MISC/Install.sh
index 8b2e864787da599513418c534332fc3de406b80c..203d9231641ee7fe7013e2b06c456c691808fa7b 100644
--- a/src/USER-MISC/Install.sh
+++ b/src/USER-MISC/Install.sh
@@ -3,6 +3,10 @@
 
 mode=$1
 
+# enforce using portable C locale
+LC_ALL=C
+export LC_ALL
+
 # arg1 = file, arg2 = file it depends on
 
 action () {
diff --git a/src/USER-MOLFILE/Install.sh b/src/USER-MOLFILE/Install.sh
index df193a6f44a0bdbf31314fae368c457284ea2dbc..19fd3bd361fab307063d032ec346e0ea8224572d 100644
--- a/src/USER-MOLFILE/Install.sh
+++ b/src/USER-MOLFILE/Install.sh
@@ -3,6 +3,10 @@
 
 mode=$1
 
+# enforce using portable C locale
+LC_ALL=C
+export LC_ALL
+
 # arg1 = file, arg2 = file it depends on
 
 action () {
diff --git a/src/USER-OMP/Install.sh b/src/USER-OMP/Install.sh
index 85b44f1bee1d0a103504759af56108430447b355..bb4ef6c3aa29ef3b4382dd64bd18299139ac862e 100644
--- a/src/USER-OMP/Install.sh
+++ b/src/USER-OMP/Install.sh
@@ -3,6 +3,10 @@
 
 mode=$1
 
+# enforce using portable C locale
+LC_ALL=C
+export LC_ALL
+
 # arg1 = file, arg2 = file it depends on
 
 action () {
diff --git a/src/USER-PHONON/Install.sh b/src/USER-PHONON/Install.sh
index 36cd17daaeda6cbc8453e86f54df0b13669d8db0..cfa369bb055ee2679b873535221244839cce9094 100644
--- a/src/USER-PHONON/Install.sh
+++ b/src/USER-PHONON/Install.sh
@@ -3,6 +3,10 @@
 
 mode=$1
 
+# enforce using portable C locale
+LC_ALL=C
+export LC_ALL
+
 # arg1 = file, arg2 = file it depends on
 
 action () {
diff --git a/src/USER-QMMM/Install.sh b/src/USER-QMMM/Install.sh
index 02efdf2d7e7422874aff618d36521a0124f91105..089b880a777f8c236f203866eccd5c1f820edb23 100755
--- a/src/USER-QMMM/Install.sh
+++ b/src/USER-QMMM/Install.sh
@@ -3,6 +3,10 @@
 
 mode=$1
 
+# enforce using portable C locale
+LC_ALL=C
+export LC_ALL
+
 # arg1 = file, arg2 = file it depends on
 
 action () {
diff --git a/src/USER-QUIP/Install.sh b/src/USER-QUIP/Install.sh
index 9cc672aefa255397a8ea2560311a9160b2fd9fb9..ee7faaf62aad7697b3f1f2e64eeb28d1522ea312 100644
--- a/src/USER-QUIP/Install.sh
+++ b/src/USER-QUIP/Install.sh
@@ -3,6 +3,10 @@
 
 mode=$1
 
+# enforce using portable C locale
+LC_ALL=C
+export LC_ALL
+
 # arg1 = file, arg2 = file it depends on
 
 action () {
diff --git a/src/USER-SMD/Install.sh b/src/USER-SMD/Install.sh
index 4cc736e96d39d6bb8e52984efcc2d8450c136d21..c0f48c54603b2ce0140e83d04cb65ac5f20443f2 100644
--- a/src/USER-SMD/Install.sh
+++ b/src/USER-SMD/Install.sh
@@ -3,6 +3,10 @@
 
 mode=$1
 
+# enforce using portable C locale
+LC_ALL=C
+export LC_ALL
+
 # arg1 = file, arg2 = file it depends on
 
 action () {
diff --git a/src/USER-VTK/Install.sh b/src/USER-VTK/Install.sh
index d61e0640f9feebd26b35529cdceb9c7ca5554bc1..d02dc8777269b9bd37d9ef03b99acb836584b121 100644
--- a/src/USER-VTK/Install.sh
+++ b/src/USER-VTK/Install.sh
@@ -3,6 +3,10 @@
 
 mode=$1
 
+# enforce using portable C locale
+LC_ALL=C
+export LC_ALL
+
 # arg1 = file, arg2 = file it depends on
 
 action () {
diff --git a/src/VORONOI/Install.sh b/src/VORONOI/Install.sh
index a93b2cab7e2bc3abbd7a26efe32fe29d77475400..f21e9404ebee3408d20b1880c29dd7129d334491 100755
--- a/src/VORONOI/Install.sh
+++ b/src/VORONOI/Install.sh
@@ -3,6 +3,10 @@
 
 mode=$1
 
+# enforce using portable C locale
+LC_ALL=C
+export LC_ALL
+
 # arg1 = file, arg2 = file it depends on
 
 action () {