compute coord/atom

Hi all,

I am trying to use ‘compute coord/atom’ command to compute the coordination number of each atom. The commands I used are :

compute neighbor_number all coord/atom cutoff 8.0
variable neighbors atom c_neighbor_number

dump dmp0 all custom 1 sio2_*.xyzc id type x y z v_neighbors c_neighbor_number
dump_modify dmp0 element Si O sort id format line "%d %d %20.15e %20.15e %20.15e %d %d”

The dump files looks like this :

ITEM: ATOMS id type x y z v_neighbors c_neighbor_number
1 2 4.715707572348302e+00 -2.593245600510897e+00 -5.108260252848745e+00 1 1
2 2 1.055506282063384e+00 -1.625283671634310e+00 -8.627919541483948e+00 1 1
3 1 -2.818252694544188e-01 -7.147681718471958e+00 -3.507238223752153e+00 1 1
4 2 -2.535007284351735e+00 -3.599426515465941e+00 -2.427090721641154e+00 1 1
5 1 2.001704951871128e+02 2.582002781450132e-01 9.673685765109312e+00 1 1

I don’t have the typeN keyword in the compute coord/atom. According to lammps compute coord/atom page, one coordination number should be computed for each atom and the compute calculates a per-atom vector. However, the coordination number is always 1 for all atoms no matter what the value of the cutoff distance is. Could anyone point out where I did wrong ?

Thank you,
Wenting

The problem is the format string for your dump. The data is computed correctly, but not output correctly.
The (scalar) result of a compute or atom style variable is always a floating point number, thus you would have to use a “%g” or “%f” format instead of “%d”.

axel.

Thank you Axel. It works with floating format.

Regards,
Wenting