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.