[lammps-users] Changing group enrollment during simulation

Dear all,

I have written a script to define static regions in a simulation volume, and then looped in an attempt to assign atoms into groups based on their current positions every n*2500 timesteps. The atoms are assigned correctly on the first iteration, but then all atoms get assigned to the first group on subsequent iterations. Everything else seems to be working correctly. I can’t figure out how to redefine the regions each iteration to see if that would fix the problem, and beyond that I have no good ideas for troubleshooting. Any help would be greatly appreciated. The important parts of the script are reproduced below.



<< begin script >>

region 1 plane 0.0 0.0 -5.0 0.0 0.0 1.0 units box

region 1 plane 0.0 0.0 5.0 0.0 0.0 -1.0 units box

label loopi

variable i loop 200

group gplus1 region cplus1

group gminus1 region cminus1

group grp1 intersect gplus1 gminus1

if $i > 1 then “jump in.PS skip”

label skip

run 2500

next i

jump in.PS loopi

<< end script >>

I don't really know what you're trying to do or how you want
to use these groups. But when you use a group command
more than once, the subsequent uses simply add atoms
to the group.

From the group doc page:

If the group ID already exists, the group command adds the specified
atoms to the group.