From e3e687f7b35e0caaacd42aabd678225ed86c41f0 Mon Sep 17 00:00:00 2001
From: athomps <athomps@f3b2605a-c512-4ea7-a41b-209d697bcdaa>
Date: Fri, 22 Jan 2016 22:30:40 +0000
Subject: [PATCH] Added peratom keyword

git-svn-id: svn://svn.icms.temple.edu/lammps-ro/trunk@14470 f3b2605a-c512-4ea7-a41b-209d697bcdaa
---
 src/VORONOI/compute_voronoi_atom.cpp | 17 ++++++++++++++++-
 src/VORONOI/compute_voronoi_atom.h   |  1 +
 2 files changed, 17 insertions(+), 1 deletion(-)

diff --git a/src/VORONOI/compute_voronoi_atom.cpp b/src/VORONOI/compute_voronoi_atom.cpp
index 305a98716d..2a4d65de1f 100644
--- a/src/VORONOI/compute_voronoi_atom.cpp
+++ b/src/VORONOI/compute_voronoi_atom.cpp
@@ -113,6 +113,12 @@ ComputeVoronoi::ComputeVoronoi(LAMMPS *lmp, int narg, char **arg) :
       else if (strcmp(arg[iarg+1],"no") == 0) faces_flag = 0;
       else error->all(FLERR,"Illegal compute voronoi/atom command");
       iarg += 2;
+    } else if (strcmp(arg[iarg], "peratom") == 0) {
+      if (iarg + 2 > narg) error->all(FLERR,"Illegal compute voronoi/atom command");
+      if (strcmp(arg[iarg+1],"yes") == 0) peratom_flag = 1;
+      else if (strcmp(arg[iarg+1],"no") == 0) peratom_flag = 0;
+      else error->all(FLERR,"Illegal compute voronoi/atom command");
+      iarg += 2;
     }
     else error->all(FLERR,"Illegal compute voronoi/atom command");
   }
@@ -137,6 +143,7 @@ ComputeVoronoi::ComputeVoronoi(LAMMPS *lmp, int narg, char **arg) :
   if (faces_flag) {
     local_flag = 1;
     size_local_cols = 3;
+    size_local_rows = 0;
     nfacesmax = 0;
   }
 }
@@ -298,7 +305,7 @@ void ComputeVoronoi::buildCells()
   }
 
   // clear edge statistics
-  for (i = 0; i < maxedge; ++i) edge[i]=0;
+  for (i = 0; i <= maxedge; ++i) edge[i]=0;
 
   // initialize voro++ container
   // preallocates 8 atoms per cell
@@ -606,6 +613,14 @@ void ComputeVoronoi::compute_vector()
 
 /* ---------------------------------------------------------------------- */
 
+void ComputeVoronoi::compute_local()
+{
+  invoked_local = update->ntimestep;
+  if( invoked_peratom < invoked_local ) compute_peratom();
+}
+
+/* ---------------------------------------------------------------------- */
+
 int ComputeVoronoi::pack_forward_comm(int n, int *list, double *buf,
                                   int pbc_flag, int *pbc)
 {
diff --git a/src/VORONOI/compute_voronoi_atom.h b/src/VORONOI/compute_voronoi_atom.h
index 086b0e2936..7d23a611bd 100644
--- a/src/VORONOI/compute_voronoi_atom.h
+++ b/src/VORONOI/compute_voronoi_atom.h
@@ -32,6 +32,7 @@ class ComputeVoronoi : public Compute {
   void init();
   void compute_peratom();
   void compute_vector();
+  void compute_local();
   double memory_usage();
 
   int pack_forward_comm(int, int *, double *, int, int *);
-- 
GitLab