[lammps-users] group command

Dear LAMMPS Users
I was wondering if there is an option in LAMMPS by which we can define atoms as a group based on the region in which they are positioned in the current timestep. i.e, during the simulation when an atom enters a particular region it will belong to say group A and when it leaves the region it is assigned to another group…looking forward for your valuable suggestions…

Yes, You can. first please define a region which is your aim, then use group command with region style.


But my doubt is when a new atom comes into the region during the simulation will that also be included in the group…when i did the simulation i observed that once we specify the region and group only the atoms present in the region at that time instant is assigned to the specified group…

Thanking you in advance…

With Warm Regards

Yes, You can. first please define a region which is your aim, then use group
command with region style.

no! this does not work the way as it was asked for. group assingnments
are fixed.

from the documentation:

The region style puts all atoms in the region volume into the group.
Note that this is a static one-time assignment. The atoms remain
assigned (or not assigned) to the group even in they later move out of
the region volume.


please explain what you would need those group assignments to change.
most of the time, there is an alternate solution.


thank you Farrokh and Axel…
actually i needed to get the density profile in a particular region in a fluid flow problem. in the fix ave/spatial command i was not able to assign the group-id since the constituent atoms were changing…looking forward for your suggestions…

I think you would be better off doing this post-process.

No - groups are static. You can assign them initially based
on atoms in a region, but they won't update automagically when
atoms enter/leave the region.

However several commands have "region" options to operate
on atoms in a region, which is checked dynamically. E.g.
compute temp/region. What is it you want to do with atoms
in a region?