1 // Parallelepiped calculation example code
3 // Author : Chris H. Rycroft (LBL / UC Berkeley)
4 // Email : chr@alum.mit.edu
5 // Date : August 30th 2011
12 const double bxy
=0,by
=2;
13 const double bxz
=1,byz
=0,bz
=3;
15 // Set up the number of blocks that the container is divided into
16 const int nx
=5,ny
=5,nz
=5;
18 // Set the number of particles that are going to be randomly introduced
19 const int particles
=20;
21 // This function returns a random double between 0 and 1
22 double rnd() {return double(rand())/RAND_MAX
;}
28 // Create a parallelepiped with
29 container_periodic
con(bx
,bxy
,by
,bxz
,byz
,bz
,nx
,ny
,nz
,8);
31 // Randomly add particles into the container
32 for(i
=0;i
<particles
;i
++) {
39 // Output the particle positions in gnuplot format
40 con
.draw_particles("cp_test_p.gnu");
42 // Output the Voronoi cells in gnuplot format
43 con
.draw_cells_gnuplot("cp_test_v.gnu");
45 // Output the domain outline
46 con
.draw_domain_gnuplot("cp_test_d.gnu");