Dear lammps-users:

I have defined a dynamic group, which include few atoms (<6). I would like to calculate the distances between these atoms and a fixed point, so that when the distance is too far so I can stop the running with jump command. However, after searching in the mailing list, I still do not know how to define the calculation since I do not know how to get the atomic ID in this group. Could someone give me some suggestions? Thank you very much!

Shijun Zhao

Dear lammps-users:

I have defined a dynamic group, which include few atoms (<6). I would like

to calculate the distances between these atoms and a fixed point, so that

when the distance is too far so I can stop the running with jump command.

However, after searching in the mailing list, I still do not know how to

define the calculation since I do not know how to get the atomic ID in this

group. Could someone give me some suggestions? Thank you very much!

how about you create an atom style variable?

say, your reference point is: 4.0 -2.5 0.0

variable refdist atom gmask(mygroup)*(sqrt((x-4.0)^2+(y+2.5)^2+(z-0.0)^2)

now on this variable you can do a "compute reduce max" and find the largest

distance to your reference point and multiplying with gmask() will set the

result to 0 for all atoms outside the group. please note, that this example

assumes the reference point is sufficiently away from the box boundaries,

otherwise, you'll also have to unwrap the coordinates.

axel

excellent. I did not know the atomic style can circumvent the usage of atomic ID. Thank you very much!