coordination number

Hello LAMMPS users,

I have a question about the coordination number. Would you please
answer it and help me?
The command "compute coord/atom" consider all the atoms in the
simulation box for calculating the coordination number of each atom in
a specific group. Suppose that I have two groups named "A1" and "A2".
I want to calculate the coordination number of each atom in group A1
with the surrounding atoms just in that group (A1) not all the atoms
in simulation box (A1 and A2). Is there any way to do this?

Thanks a lot for your helps in advance,


This is a valid request, but not currently supported. The fix is
simple. Add the following extra line of code to
compute_coord_atom.cpp. I suppose we could put in a flag to support

      for (jj = 0; jj < jnum; jj++) {
        j = jlist[jj];
        j &= NEIGHMASK;

---> // ignore atoms not in group
---> if (!(mask[j] & groupbit)) continue;

        delx = xtmp - x[j][0];
        dely = ytmp - x[j][1];
        delz = ztmp - x[j][2];
        rsq = delx*delx + dely*dely + delz*delz;
        if (rsq < cutsq) n++;

See if the new atom-type extensions to the compute coord/atom
command will do what you want. So long as your groups are
defined based on atom types, it should work.

See the Aug 11 patch.