x,y,z coordinates of a given atom

Dear Lammps users,

I am trying to locate the atom with the highest z coordinate. I would like to know its position (x,y,z)

So far i am able to get the z coordinate of this atom, via the commands

compute zmax all reduce max z
variable zmax equal c_zmax

Is there a way to get the other two components (x,y) of this particular atom? Is there an alternative approach?

I am running LAMMPS (25 Feb 2016-ICMS)

Regards,
Sebastián

You can use the “replace” option of compute reduce to do that.

Steve

Dear Lammps users,

I am trying to locate the atom with the highest z coordinate. I would like
to know its position (x,y,z)

So far i am able to get the z coordinate of this atom, via the commands

compute zmax all reduce max z
variable zmax equal c_zmax

Is there a way to get the other two components (x,y) of this particular
atom? Is there an alternative approach?

​compute reduce has a "replace" option, where you can pick array elements
from other per-atom data based on the reduction of another.
for example, the following input:

​compute c1 all property/atom id
compute c2 all reduce max x y z c_c1 replace 1 3 replace 2 3 replace 4
3
thermo_style custom step c_c2[1] c_c2[2] c_c2[3] c_c2[4]

​will output, x, y, and z coordinate as well as the atom id of the atom
with the largest z value.

axel.​

Great. That is exactly what i needed. Thanks