if one wants to order the water molecules (each water molecule is 3 atoms) around an ion, one needs an index file with a group with the ion (e.i Na ion) and a separate group with water molecules.
Then the command will be
gmx trjorder -f traj.xtc -s topol.tpr -n index.ndx -o order.xtc -na 3 -da 1
If one want to order according to the center of mass of the water molecules
gmx trjorder -f traj.xtc -s topol.tpr -n index.ndx -o order.xtc -na 3 -da 0
If the group to order is composed by molecules made by more than 3 atoms (e.i methane) than ‘-da 5’
'-com ’ uses the distance to the center of mass of the reference group