From e9bcfbbaea5513bdc74a9b1abe9f9d67e8710a74 Mon Sep 17 00:00:00 2001
From: sjplimp <sjplimp@f3b2605a-c512-4ea7-a41b-209d697bcdaa>
Date: Tue, 10 Jun 2014 15:45:27 +0000
Subject: [PATCH] git-svn-id: svn://svn.icms.temple.edu/lammps-ro/trunk@12108
 f3b2605a-c512-4ea7-a41b-209d697bcdaa

---
 src/fix_ave_spatial.cpp | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/src/fix_ave_spatial.cpp b/src/fix_ave_spatial.cpp
index c55ffd0e7f..c6606d9252 100644
--- a/src/fix_ave_spatial.cpp
+++ b/src/fix_ave_spatial.cpp
@@ -42,7 +42,6 @@ enum{BOX,LATTICE,REDUCED};
 enum{ONE,RUNNING,WINDOW};
 
 #define INVOKED_PERATOM 8
-#define BIG 1000000000
 
 /* ---------------------------------------------------------------------- */
 
@@ -329,9 +328,9 @@ FixAveSpatial::FixAveSpatial(LAMMPS *lmp, int narg, char **arg) :
   delete [] title3;
 
   // this fix produces a global array
+  // size_array_rows set by setup_bins()
 
   array_flag = 1;
-  size_array_rows = BIG;
   size_array_cols = 1 + ndim + nvalues;
   extarray = 0;
 
@@ -362,6 +361,8 @@ FixAveSpatial::FixAveSpatial(LAMMPS *lmp, int narg, char **arg) :
   }
 
   // initializations
+  // invoke setup_bins() now to set size_array_rows
+  // will be reset in setup(), but needed now so Thermo custom can access it
 
   irepeat = 0;
   iwindow = window_limit = 0;
@@ -380,6 +381,8 @@ FixAveSpatial::FixAveSpatial(LAMMPS *lmp, int narg, char **arg) :
   values_one = values_many = values_sum = values_total = NULL;
   values_list = NULL;
 
+  setup_bins();
+
   // nvalid = next step on which end_of_step does something
   // add nvalid to all computes that store invocation times
   // since don't know a priori which are invoked by this fix
@@ -897,6 +900,8 @@ void FixAveSpatial::setup_bins()
     bin_volume *= delta[m]/prd[dim[m]];
   }
 
+  size_array_rows = nbins;
+
   // reallocate bin arrays if needed
 
   if (nbins > maxbin) {
-- 
GitLab