Changing the members of a group dynamically

Please post to the list, not to me.

What you have will not work. The dump command
will use the currently defined group (at the start of the
run) for the duration of the run. Doing a dump does
not “reevaluate” the group.

You could try using the run every M command and set

M to the same frequency as your dump. Then list 2 commands

with run every, to be invoked every M steps. The first

to group delete your group (clearing it), the 2nd to redefine
it with your group variable command, which should then
use the current nearby atoms.

That may not work, b/c the ptr to the group stored
by the dump command may become invalid with
a delete/re-create. But if we added a group clear

command to remove atoms w/out deleting the group,

it would probably work. Give it a try and see.

Steve

Please post to the list, not to me.

What you have will not work. The dump command
will use the currently defined group (at the start of the
run) for the duration of the run. Doing a dump does
not "reevaluate" the group.

how about using the "dump_modify thresh" feature?

axel.

p.s.: steve, how about grouping the commands in dump_modify that are
not related to dump image at the top of the documentation summary? it
is quite easy to overlook an option currently.

Hi Steve,
Thank you for your reply. Yes you are right deleting a group and redefining it within run every M c1 c2 command is not working because the dump command defined earlier is using that group and the error msg is “Can not delete group currently used by dump” and that makes perfect sense. I think there is no command currently like "group ID style(clear) " instead of deleting it. Do you think it can be done? Because I am damn sure so many other LAMMPS user have this kind of problem too.

Thanks,
Mir Karim
Graduate Research Assistant
Chemical Engineering
Texas Tech University

Hi Axel,
“how about using the “dump_modify thresh” feature” - it is probably a good idea for dumping info dynamically which satisfy particular conditions. Let me think about it and write the part of the script. I will get back to you.

Thanks,
Mir Karim
ChE, Texas Tech

Hi,
dump modify thresh worked for me. The part of the script is like -

"…

fix 1 all nvt temp 1.0 1.0 100.0
fix 2 nano_beads addforce 10.0 0.0 0.0
compute 1 nano_beads com
fix 3 nano_beads ave/time 1 1 1 c_1[1] c_1[2] c_1[3] file COM

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)
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)

dump 4 all custom 100 COORD_VEL.* id mol type x y z vx vy vz
dump_modify 4 sort id thresh v_distance <= 7.07106 thresh type != 2 # crucial things

run 1000000 "

I got exactly what I wanted. I was always thinking in terms of using group command. But scripting in this way is much easier to write and to understand. Thanks a lot.

Mir Karim
ChE, Texas Tech