[lammps-users] computing distance r for atoms

Dear All!

I need to get the distance of every atom of BN ribbon in LAMMPS.
In fact, in the following code, I need to obtain the r coordinate instead of the x coordinate for the type 1 and type 2 atoms (1 and 2 are B and N respectively). which: r = (x^2+y^2+z^2 )^0.5
I would be grateful if you could help.

compute Coordinate1 1 property/atom x
compute Coordinate2 2 property/atom x

compute CSum1 1 reduce sum c_Coordinate1
compute CSum2 2 reduce sum c_Coordinate2

Regards;
Reza

Please see compute pair/local