From 1dd7a13d823356cc5c1f8a040951fa00c90a9562 Mon Sep 17 00:00:00 2001
From: sjplimp <sjplimp@f3b2605a-c512-4ea7-a41b-209d697bcdaa>
Date: Thu, 8 Sep 2016 20:37:31 +0000
Subject: [PATCH] sync with GH

git-svn-id: svn://svn.icms.temple.edu/lammps-ro/trunk@15562 f3b2605a-c512-4ea7-a41b-209d697bcdaa
---
 src/SHOCK/fix_append_atoms.h  |  3 +--
 src/USER-MISC/fix_ttm_mod.cpp |  1 -
 src/fix_shear_history.cpp     | 17 +++++++++++++----
 3 files changed, 14 insertions(+), 7 deletions(-)

diff --git a/src/SHOCK/fix_append_atoms.h b/src/SHOCK/fix_append_atoms.h
index 1368d164b6..d9885998be 100644
--- a/src/SHOCK/fix_append_atoms.h
+++ b/src/SHOCK/fix_append_atoms.h
@@ -79,8 +79,7 @@ must be of type m (shrink/minimum).
 
 E: Bad fix ID in fix append/atoms command
 
-The value of the fix_id for keyword spatial must start with the suffix
-f_.
+The value of the fix_id for keyword spatial must start with 'f_'.
 
 E: Invalid basis setting in fix append/atoms command
 
diff --git a/src/USER-MISC/fix_ttm_mod.cpp b/src/USER-MISC/fix_ttm_mod.cpp
index f7b81c7206..4bf90fdca3 100644
--- a/src/USER-MISC/fix_ttm_mod.cpp
+++ b/src/USER-MISC/fix_ttm_mod.cpp
@@ -282,7 +282,6 @@ FixTTMMod::FixTTMMod(LAMMPS *lmp, int narg, char **arg) :
   if (me == 0) read_initial_electron_temperatures(fpr);
   MPI_Bcast(&T_electron[0][0][0],total_nnodes,MPI_DOUBLE,0,world);
   fclose(fpr);
-  fclose(fpr_2);
 }
 
 /* ---------------------------------------------------------------------- */
diff --git a/src/fix_shear_history.cpp b/src/fix_shear_history.cpp
index 2577c16be8..8e8c1bb53b 100644
--- a/src/fix_shear_history.cpp
+++ b/src/fix_shear_history.cpp
@@ -29,13 +29,13 @@
 using namespace LAMMPS_NS;
 using namespace FixConst;
 
-enum{NPARTNER,PERPARTNER};
+enum{DEFAULT,NPARTNER,PERPARTNER};
 
 /* ---------------------------------------------------------------------- */
 
 FixShearHistory::FixShearHistory(LAMMPS *lmp, int narg, char **arg) :
   Fix(lmp, narg, arg),
-  npartner(NULL), partner(NULL), shearpartner(NULL), ipage(NULL), dpage(NULL)
+  npartner(NULL), partner(NULL), shearpartner(NULL), pair(NULL), ipage(NULL), dpage(NULL)
 {
   if (narg != 4) error->all(FLERR,"Illegal fix SHEAR_HISTORY commmand");
 
@@ -71,6 +71,7 @@ FixShearHistory::FixShearHistory(LAMMPS *lmp, int narg, char **arg) :
   maxtouch = 0;
 
   nlocal_neigh = nall_neigh = 0;
+  commflag = DEFAULT;
 }
 
 /* ---------------------------------------------------------------------- */
@@ -87,6 +88,14 @@ FixShearHistory::~FixShearHistory()
   memory->destroy(npartner);
   memory->sfree(partner);
   memory->sfree(shearpartner);
+
+  // to better detect use-after-delete errors
+
+  pair = NULL;
+  npartner = NULL;
+  partner = NULL;
+  shearpartner = NULL;
+
   delete [] ipage;
   delete [] dpage;
 }
@@ -609,7 +618,7 @@ int FixShearHistory::pack_reverse_comm(int n, int first, double *buf)
         m += dnum;
       }
     }
-  }
+  } else error->all(FLERR,"Unsupported comm mode in shear history");
 
   return m;
 }
@@ -640,7 +649,7 @@ void FixShearHistory::unpack_reverse_comm(int n, int *list, double *buf)
         m += dnum;
       }
     }
-  }
+  } else error->all(FLERR,"Unsupported comm mode in shear history");
 }
 
 /* ----------------------------------------------------------------------
-- 
GitLab