[lammps-users] get atom number of region or group

Hi, Steve,

Is there any command to get the atom numbers in a “region” or “group”? as I want to use this as a variable in my input file before the simulation.

Any suggestions.

Regards

Yu

See the doc page for the variable command - an equal variable
can ask for the # of atoms in a group. Can't think of a simple
way to do this for a region. Could be added to the variable
syntax, I suppose.

Steve

2009/3/20 Chen Yu <[email protected]>:

Thought of something - you could define a new group
as the region, then get it thru the variable syntax for
a group - i.e. the "count" keyword.

Steve

Yeah, to get the numbers of atoms in a group is much more easy. But in my problem, I want to sum some per-atom property in a certain geometric region, and divide it by the atom number, getting the average one. Can LAMMPS record the atom number of a region every step and then output with a variable?

Yu

Not currently. You'd have to add this capability, e.g. in a variable
or compute. You'd have to loop over all the atoms to find which
are currently in the region anyway, to compute the quantity you
want.

Steve

2009/3/20 chenyu <[email protected]>: