How can I get the positions of all neighboring particles in a container with Voro++ Library?

Viewed 140

I try to implement a 3D Voronoi application with Voro++ Library in C++. I have a container containing particles. After putting all the particles in the container and using the periodic boundary condition case, it has a function to get the neighboring particle ID of each particle of all Voronoi cells computed by Voro++, but I can't distinguish between the real particle and periodic image particle just by ID since it shows the same particle ID. Therefore, I want to get the positions of those neighboring particles for sure.

  • How can I get the positions of those neighboring particles?

*The attached image is how the output looks like after using voro++. And as you can see in the neighbor list (list of neighboring particle ID), there are 2 same IDs, 20 and 13, but I don't know which one is real or periodic image neighbor. enter image description here

#include "voro++.hh"
#include <stdio.h>
using namespace voro;

int main() {
   int id;
   double x,y,z;
   int nx=5,ny=5,nz=5;
   const double xmin=0,xmax=10;
   const double ymin=0,ymax=10;
   const double zmin=0,zmax=10;
   
   voronoicell_neighbor c;
   container con(xmin,xmax,ymin,ymax,zmin,zmax,nx,ny,nz,true,true,true,8);

   con.import("position.txt");
   c_loop_all cl(con);

   if(cl.start()){
       do{
          if(con.compute_cell(c,cl)) {
              cl.pos(x,y,z);
              id=cl.pid();
              con.print_custom("\n%i %q %n");
            //c.output_neighbors();
          }
       } while (cl.inc());
    }
}
0 Answers
Related