atom IDs

Hello all!
How can I do something in lammps so that atom IDs increase in one direction. I mean for example atom with an ID of 1 has a lower z coordinate than atom with an ID of 1000 so that they are generated almost in z direction.

If you simply want to group atoms, so you can set their velocity
or some other attribute, then there are several other ways to
define a group besides using the atom ID. See the group command.
You can also sort dump file output by any attribute you wish,
e.g. the z coordinate. See the dump_modify sort doc page.