Changing the members of a group dynamically

Hi,
Actually, in the mail list archive this issue came for few times but still I don’t have proper solution for this. The problem is how to change the members of a group dynamically during the simulation. Here is some part my script where I want to keep track the moving polymer beads surrounding a probe particle (nano_beads and is being moved by a force) and I did it by the following way. Basically I am keeping track of those polymer beads within a certain distance (7, see below) and moving with the nano_beads group.

"



fix 1 all nvt temp 1.0 1.0 100.0

fix 2 nano_beads addforce 10.0 0.0 0.0


label looping
variable xcom equal xcm(nano_beads,x)

variable ycom equal xcm(nano_beads,y)
variable zcom equal xcm(nano_beads,z)

variable xdis atom x-v_xcom
variable ydis atom y-v_ycom
variable zdis atom z-v_zcom

variable xdiss atom v_xdis-lxfloor(v_xdis/lx+0.5) # Nearest distances
variable ydiss atom v_ydis-ly
floor(v_ydis/ly+0.5)
variable zdiss atom v_zdis-lz*floor(v_zdis/lz+0.5)

variable distance atom sqrt(v_xdiss^2+v_ydiss^2+v_zdiss^2)

variable eatom atom v_distance<=7.0 # choosing criteria
group tempo variable eatom
group poly_beads_around_probe subtract tempo nano_beads

dump 4 poly_beads_around_probe custom 1 COORD_VEL.* id mol type x y z vx vy vz
dump_modify 4 sort id
run 1
undump 4

jump in.lj_with_NP looping"

If I don’t use jump and run for a time let’s say 10000 timesteps then “group tempo variable eatom” command mentioned above does not update the group dynamically.
One problem of this approach (jumping) is for every time step, the neighbor list is being rebuilt (and other things happen what usually happen before starting a run) and it take much longer time than continuous “run 10000” situation. Since my system size is really high, I really don’t want proceed in this way.

Please remember anything using “region” will not work because though they can be movable with nano_beads but will not be wrapped up across the periodic boundary.

Any help or other suggestions will be highly appreciated

Thanks,
Mir Karim
Chemical Engineering
Texas Tech University

The first thing to realize is that groups do not “update dynamically”.

You will simply be adding atoms continuously, never deleting,
which is probably not what you want. The group doc page
explains this.

I suggest you debug your script by dumping the values of

the per-atom variables to a dump file. If you verify that
eatom has 0s and 1s for the correct atoms, then you
can focus on the group command that uses it. Also, how
do you know that the group command is not working?

Steve