How to add a viscous force only to atoms with kinetic energy larger than a certain value?

Dear all,

I want to add a viscous force in my simulation about ionization collisions, and I wish it only affect fast atoms with kinetic energy larger than 10eV. I only know I can assign these fast atoms in a group and then add a viscous force to this group, by something like:

compute keg all ke/atom

compute 2 all reduce sum c_keg

thermo 1

thermo_style custom step temp c_pkaTemp lx ly lz ke c_2

Run 0

variable Cufast atom “c_keg >= 10.0”

group fastCu variable Cufast

fix 4 fastCu viscous 0.3

However, this assignment is needed to be done after every steps, since the members of the fast atoms is varying in dynamic process. A loop “ group defined — fix viscous – run 1 — unfix viscous — group delete — “ can achieve this, but it cause a redundant and discontinuous thermo outputs. Maybe there is a more convenient way to achieve this via lammps command? Please inform me about it.

There certainly is. If you define a dynamic group according to the variable it will update the atoms in the group every time it is used.

Thank you, Paquay. I tried group dynamic, but it can’t work. A error message occurred: Fix 4 does not allow use of dynamic group. It seems “fix viscous” is not compatible with dynamic group.

It is in my version of lammps. Try updating to the latest version of lammps.