// Voronoi calculation example code // // Author : Chris H. Rycroft (LBL / UC Berkeley) // Email : chr@alum.mit.edu // Date : April 14th 2013 #include "voro++.hh" using namespace voro; // Set up constants for the container geometry const double x_min=-1,x_max=1; const double y_min=-1,y_max=1; const double z_min=-1,z_max=1; const double cvol=(x_max-x_min)*(y_max-y_min)*(x_max-x_min); // Set up the number of blocks that the container is divided into const int n_x=6,n_y=6,n_z=6; // Set the number of particles that are going to be randomly introduced const int particles=40; // This function returns a random double between 0 and 1 double rnd() {return double(rand())/RAND_MAX;} int main() { int i; double x,y,z; voronoicell_neighbor c; std::vector neigh; // Create a container with the geometry given above, and make it // non-periodic in each of the three coordinates. Allocate space for // eight particles within each computational block container con(x_min,x_max,y_min,y_max,z_min,z_max,n_x,n_y,n_z, true,true,true,8); // Randomly add particles into the container for(i=0;i