From 2a30b76277778e4140c394e6c76c1597cbe5371b Mon Sep 17 00:00:00 2001
From: sjplimp <sjplimp@f3b2605a-c512-4ea7-a41b-209d697bcdaa>
Date: Fri, 23 Sep 2016 16:49:40 +0000
Subject: [PATCH] git-svn-id: svn://svn.icms.temple.edu/lammps-ro/trunk@15633
 f3b2605a-c512-4ea7-a41b-209d697bcdaa

---
 src/fix_store.cpp | 16 ++++++++++++++++
 src/fix_store.h   |  1 +
 2 files changed, 17 insertions(+)

diff --git a/src/fix_store.cpp b/src/fix_store.cpp
index abfceda264..19d2c72f9d 100644
--- a/src/fix_store.cpp
+++ b/src/fix_store.cpp
@@ -40,6 +40,7 @@ vstore(NULL), astore(NULL), rbuf(NULL)
   //   0/1 flag = not-store or store peratom values in restart file
   //   nvalues = # of peratom values, N = 1 is vector, N > 1 is array
 
+  disable = 0;
   nvalues = vecflag = 0;
   flavor = UNKNOWN; 
 
@@ -230,6 +231,8 @@ void FixStore::grow_arrays(int nmax)
 
 void FixStore::copy_arrays(int i, int j, int delflag)
 {
+  if (disable) return;
+
   if (vecflag) vstore[j] = vstore[i];
   else
     for (int m = 0; m < nvalues; m++)
@@ -242,6 +245,8 @@ void FixStore::copy_arrays(int i, int j, int delflag)
 
 int FixStore::pack_exchange(int i, double *buf)
 {
+  if (disable) return 0;
+
   if (vecflag) buf[0] = vstore[i];
   else
     for (int m = 0; m < nvalues; m++)
@@ -255,6 +260,8 @@ int FixStore::pack_exchange(int i, double *buf)
 
 int FixStore::unpack_exchange(int nlocal, double *buf)
 {
+  if (disable) return 0;
+
   if (vecflag) vstore[nlocal] = buf[0];
   else
     for (int m = 0; m < nvalues; m++)
@@ -268,6 +275,11 @@ int FixStore::unpack_exchange(int nlocal, double *buf)
 
 int FixStore::pack_restart(int i, double *buf)
 {
+  if (disable) {
+    buf[0] = 0;
+    return 1;
+  }
+
   buf[0] = nvalues+1;
   if (vecflag) buf[1] = vstore[i];
   else
@@ -282,6 +294,8 @@ int FixStore::pack_restart(int i, double *buf)
 
 void FixStore::unpack_restart(int nlocal, int nth)
 {
+  if (disable) return;
+
   double **extra = atom->extra;
 
   // skip to Nth set of extra values
@@ -302,6 +316,7 @@ void FixStore::unpack_restart(int nlocal, int nth)
 
 int FixStore::maxsize_restart()
 {
+  if (disable) return 1;
   return nvalues+1;
 }
 
@@ -311,6 +326,7 @@ int FixStore::maxsize_restart()
 
 int FixStore::size_restart(int nlocal)
 {
+  if (disable) return 1;
   return nvalues+1;
 }
 
diff --git a/src/fix_store.h b/src/fix_store.h
index 9bdfc7d308..1aad563232 100644
--- a/src/fix_store.h
+++ b/src/fix_store.h
@@ -31,6 +31,7 @@ class FixStore : public Fix {
   int nvalues;           // number of per-atom values
   double *vstore;        // vector storage for GLOBAL or PERATOM
   double **astore;       // array storage for GLOBAL or PERATOM
+  int disable;        // 1 if operations (except grow) are currently disabled
 
   FixStore(class LAMMPS *, int, char **);
   ~FixStore();
-- 
GitLab