output of compute voronoi/atom

Hi,all

When i used compute voronoi/atom command, the value of second vector (number of neighbor of centered atom) is found to to be the sum of previous trajectory. For example, 12 in the first trajectory and 24 in the second trajectory. Why is that and how to solve this problem? Thanks.

the command line is: compute 9 all voronoi/atom edge_threshold 0.1 face_threshold 0.65

--------------------------------BEST WISHES!

Daniel is the best person to answer this (CCd).

Steve

Hello Jacer,
thanks for spotting this. It is indeed a bug!
I forgot to zero the vector element in case the user specifies an
"area threshold". There is another missing zeroing of the next vector
element (surface area) if the user specifies a surface group.
The patch below fixes those two issues.
Daniel

diff --git a/src/VORONOI/compute_voronoi_atom.cpp
b/src/VORONOI/compute_voronoi_atom.cpp
index 264921f..1ab0058 100644
--- a/src/VORONOI/compute_voronoi_atom.cpp
+++ b/src/VORONOI/compute_voronoi_atom.cpp
@@ -295,6 +295,7 @@ void
ComputeVoronoi::processCell(voronoicell_neighbor &c, int i)
       // count only faces above area threshold
       c.face_areas(narea);
       have_narea = true;
+ voro[i][1] = 0.0;
       for (j=0; j<narea.size(); ++j)
         if (narea[j] > fthresh) voro[i][1] += 1.0;
     } else {
@@ -307,6 +308,7 @@ void
ComputeVoronoi::processCell(voronoicell_neighbor &c, int i)
       voro[i][2] = c.surface_area();
     } else if (surface == VOROSURF_GROUP) {
       if (!have_narea) c.face_areas(narea);
+ voro[i][2] = 0.0;
       // loop over all faces (neighbors) and check if they are in the
surface group
       for (j=0; j<voro[i][1]; ++j)
         if (mask[neigh[j]] & sgroupbit) voro[i][2] += narea[j];

Hello Jacer,
thanks for spotting this. It is indeed a bug!
I forgot to zero the vector element in case the user specifies an
"area threshold". There is another missing zeroing of the next vector
element (surface area) if the user specifies a surface group.
The patch below fixes those two issues.
Daniel

diff --git a/src/VORONOI/compute_voronoi_atom.cpp
b/src/VORONOI/compute_voronoi_atom.cpp
index 264921f..1ab0058 100644
--- a/src/VORONOI/compute_voronoi_atom.cpp
+++ b/src/VORONOI/compute_voronoi_atom.cpp
@@ -295,6 +295,7 @@ void
ComputeVoronoi::processCell(voronoicell_neighbor &c, int i)
       // count only faces above area threshold
       c.face_areas(narea);
       have_narea = true;
+ voro[i][1] = 0.0;
       for (j=0; j<narea.size(); ++j)
         if (narea[j] > fthresh) voro[i][1] += 1.0;
     } else {
@@ -307,6 +308,7 @@ void
ComputeVoronoi::processCell(voronoicell_neighbor &c, int i)
       voro[i][2] = c.surface_area();
     } else if (surface == VOROSURF_GROUP) {
       if (!have_narea) c.face_areas(narea);
+ voro[i][2] = 0.0;
       // loop over all faces (neighbors) and check if they are in the
surface group
       for (j=0; j<voro[i][1]; ++j)
         if (mask[neigh[j]] & sgroupbit) voro[i][2] += narea[j];

this will be in the next patch - thanks

Steve