Dear users,
In my lammps script, I have define one “atom-style” variable and the variable like –
" variable myvariable atom vx-gmask(mygroup)*vcm(mygroup,x) "
So as per I understand it will calculate X-comp of velocity after subtracting off the c-o-m velocity of each atom of “mygroup”. Now I need to sum all the values within “mygroup”, suppose for ke of a group sum(0.5mv_myvariable^2); how can I do this sum operation for “mygroup” ? I am searching variable doc page, but getting puzzled as it is “atom-style” variable. Please make your suggestion.
Thank you for your invaluable time.
Rgds,
Ravi Rajom
I have found one option,
" compute 1 mygroup reduce sum v_myvariable "
Would it be correct conceptually ? I’m trying to examine it.
Thank you
Just try it and you will see. Axel.
the first paragraph of the compute reduce doc page is
Define a calculation that “reduces” one or more vector inputs into scalar values, one per listed input. The inputs can be per-atom or local quantities; they cannot be global quantities. Atom attributes are per-atom quantities, computes and fixes may generate any of the three kinds of quantities, and atom-style variables generate per-atom quantities.
so yes, it does what you want
Steve