Radical Voronoi Tesselation - feature request

In the compute voronoi, it would be nice if there is an option that
considers the sizes of the beads and calculate radical voronoi
tesselation.

Yes, that can be done (that functionality is implemented in LAMMPS). How should the bead size be defined? Size per type unless the atom style contains a radius? I could allow use of an atom style variable as well.

Yes, that can be done (that functionality is implemented in LAMMPS).

I meant voro++ of course

whoa - sounds radical man … (I don’t even know
what a RVT is …)

Daniel can comment on whether the Voro++ lib
has an option for this.

Steve

One can just simply input the size similar to "diameter" or "adiam"
option in dump_image.

I'd prefer to have the user pass an atom style variable to the compute
for maximum flexibility.
Below is a small patch that should make radius (and charge) atom
vectors to available in lammps atom style variables.

So for granular simulations (uh oh, please don't ask for elliptical
particle support...) you will be able to do

variable r atom radius
compute 1 all voronoi/atom radical v_r

And for other atom styles you could construct a radius based on type
or magnitude of charge etc.
The following would give atom type 1 a radius of 1.75 units and type 2
a radius of 2.5 units

variable r atom "(type==1)*1.75 + (type==2)*2.5"
compute 1 all voronoi/atom radical v_r

How does that sound?
Daniel

diff --git a/src/variable.cpp b/src/variable.cpp
index f625668..a0badb6 100644
--- a/src/variable.cpp
+++ b/src/variable.cpp
@@ -3278,6 +3278,8 @@ void Variable::peratom2global(int flag, char *word,
       else if (strcmp(word,"fx") == 0) mine = atom->f[index][0];
       else if (strcmp(word,"fy") == 0) mine = atom->f[index][1];
       else if (strcmp(word,"fz") == 0) mine = atom->f[index][2];
+ else if (strcmp(word,"q") == 0 && atom->q_flag) mine = atom->q[index];
+ else if (strcmp(word,"radius") == 0 && atom->radius_flag) mine
= atom->radius[index];

       else error->one(FLERR,"Invalid atom vector in variable formula");

@@ -3317,6 +3319,8 @@ int Variable::is_atom_vector(char *word)
   if (strcmp(word,"fx") == 0) return 1;
   if (strcmp(word,"fy") == 0) return 1;
   if (strcmp(word,"fz") == 0) return 1;
+ if (strcmp(word,"q") == 0 && atom->q_flag) return 1;
+ if (strcmp(word,"radius") == 0 && atom->radius_flag) return 1;
   return 0;
}

@@ -3362,6 +3366,8 @@ void Variable::atom_vector(char *word, Tree **tree,
   else if (strcmp(word,"fx") == 0) newtree->array = &atom->f[0][0];
   else if (strcmp(word,"fy") == 0) newtree->array = &atom->f[0][1];
   else if (strcmp(word,"fz") == 0) newtree->array = &atom->f[0][2];
+ else if (strcmp(word,"q") == 0) newtree->array = atom->q;
+ else if (strcmp(word,"radius") == 0) newtree->array = atom->radius;
}

/* ----------------------------------------------------------------------

Ok, here it is (lightly tested, so I'd appreciate feedback).
I decided to call the keyword "radius" (sounds less radical).
Syntax:

variable r atom 0.01
#or
variable r atom x%2.0

compute 1 all voronoi/atom radius v_r

Have good weekend,
Daniel

P.S.: unfortunately there is no common base class to voro::container
and voro::container_poly that has a complete interface to perform the
tesselation, so I had to refactor the code a bit to avoid too much
code duplication.

compute_voronoi_atom.h (1.73 KB)

compute_voronoi_atom.cpp (9.61 KB)

Ok, here it is (lightly tested, so I'd appreciate feedback).
I decided to call the keyword "radius" (sounds less radical).
Syntax:

variable r atom 0.01
#or
variable r atom x%2.0

compute 1 all voronoi/atom radius v_r

Have good weekend,
Daniel

P.S.: unfortunately there is no common base class to voro::container
and voro::container_poly that has a complete interface to perform the
tessellation, so I had to refactor the code a bit to avoid too much
code duplication.

P.P.S.: i accidentally keep posting with my non-ML email (tablet).
Please just discard those messages in the queue

compute_voronoi_atom.h (1.73 KB)

compute_voronoi_atom.cpp (9.61 KB)

Ok, here it is (lightly tested, so I'd appreciate feedback).
I decided to call the keyword "radius" (sounds less radical).
Syntax:

variable r atom 0.01
#or
variable r atom x%2.0

compute 1 all voronoi/atom radius v_r

Have good weekend,
Daniel

P.S.: unfortunately there is no common base class to voro::container
and voro::container_poly that has a complete interface to perform the
tessellation, so I had to refactor the code a bit to avoid too much
code duplication.

P.P.S.: i accidentally keep posting with my non-ML email (tablet).
Please just discard those messages in the queue (again!!!!)

compute_voronoi_atom.h (1.73 KB)

compute_voronoi_atom.cpp (9.61 KB)