chr1shr / voro

Voro++: a three-dimensional Voronoi cell library in C++
Other
154 stars 44 forks source link

Non-orthogonal periodic domain #26

Closed SiyuChen closed 1 year ago

SiyuChen commented 1 year ago

The website says that Voro++ also supports computing the Voronoi diagram non-orthogonal periodic domains given by three periodicity vectors that define a parallelepiped. I can't find any example of this feature. Could someone provide more details or just a short code block demonstrating this? Thank you very much.

chr1shr commented 1 year ago

Yes—Voro++ supports computations in non-orthogonal triclinic domains. This functionality was originally developed for use with the sister software project Zeo++. If you look in the "zeo" directory, you'll find a small test code called cp_test.cc that demonstrates the functionality.

The cp_test.cc code puts particles into a parallelepiped at random, computes the Voronoi cells, and saves them in a format that can be read by Gnuplot. The unit vectors of the parallelepiped have the form (bx,0,0), (bxy,by,0), (bxz,byz,bz)—any parallelepiped can be rotated into this form. The underlying structure of this class is substantially different from the regular Voro++ container in order to deal with the complexities of the non-orthogonal periodic images.

You can look at the results by typing

splot 'cp_test_v.gnu' w l t 'Voronoi cells', 'cp_test_p.gnu' u 2:3:4 w p lt 4 t 'Particles', 'cp_test_d.gnu' w l t 'Domain'

It should look like this.

Over the past year my student Jiayin Lu and I have done a lot of work on the dev branch of the library, and part of this has been to overhaul the triclinic classes and make them more visible to users. This code should be merged into the main repository during the next few months.