set a variable for atoms in a group

Submitted by JoshuaP on Fri, 11/06/2015 - 11:51

Hey,
is it possible to set a variable to atoms in a group? So that for example all atoms in group 1 have have a atom variable that is 1 and for group 2 the same variable has the value 2 for each atom?
What I'm trying to do is subdivide the simulation region in many groups and calculate the density in these groups. But now for post process i want to set an atom variable which defines the density of each groups and all atoms in one group shall have the same density value.
Is this possible?
kind regards
joshua

Daniel Queteschiner | Fri, 11/06/2015 - 12:29

Maybe a combination of fix property/atom and set property/atom will work for you? It should be possible to restrict the set command to a specified group, e.g.
set group mygroup property/atom myproperty 1000

JoshuaP | Fri, 11/06/2015 - 12:44

hey,
I tried this already, the problem is that i can not use a variable value for set like
set group ring11 property/atom voidfrac v_voidratio11

Daniel Queteschiner | Fri, 11/06/2015 - 13:00

From a quick look at the set command code that should be supported as long as voidratio11 is a scalar or 3-vector. What's the error message you get (if any)?

JoshuaP | Fri, 11/06/2015 - 13:19

ERROR: Variable for set command is invalid style (../set.cpp:1155)
this works:
variable test equal $b*$a
set group ring$b$a property/atom voidfrac ${test}
this not
variable test equal $b*$a
set group ring$b$a property/atom voidfrac v_test

Daniel Queteschiner | Fri, 11/06/2015 - 13:37

It looks like the v_ reference just works for variables of style 'atom' here.

JoshuaP | Fri, 11/06/2015 - 14:05

maybe you could help me to somehow get the values as output:
compute vorovol$b$a ring$b$a reduce sum c_voro[1]
compute partvol$b$a ring$b$a reduce sum v_partvolume[1]
variable voidratio$b$a equal (c_vorovol$b$a-c_partvol$b$a)/c_vorovol$b$a

b and a are loop variables. a,b defines a region or group. what i want to have is the voidratio$b$a for the different regions. But how can I write them out to use them in paraview? What I tried before was to set this value to all particles in the region, but this doesnt work. Another problem: do I have to print all computes that Im using in variable voidratio before I want to evaluate voidratio? The c_voro is the voronoi volume. Maybe you have a smart idea.

Thanks
Joshua