# Compute RDF between COMs of two selections (or groups) using GROMACS

I have been using gromacs since years but I am always confused when I want to perform the following task: compute the RDF (radial distribution function) between the COMs (center of masses) of two selections or groups.

I am assuming I can define selections within the command line via -sel and -ref- options, however I am always confused if to include com there or in the -selrpos option.

Example: I have several residues and I want to compute the RDF between the COMs of the selection made by atoms C1 C2 C3 (in all residues). Possible syntax:

1$$gmx rdf -f ftraj.xtc -s ftraj.tpr -ref "com of name C1 C2 C3" -sel "com of name C1 C2 C3" -selrpos res_com 2$$ gmx rdf -f ftraj.xtc -s ftraj.tpr -ref "com of name C1 C2 C3" -sel "com of name C1 C2 C3"
3$$gmx rdf -f ftraj.xtc -s ftraj.tpr -ref "name C1 C2 C3" -sel "name C1 C2 C3" -selrpos res_com 4$$ gmx rdf -f ftraj.xtc -s ftraj.tpr -ref "name C1 C2 C3" -sel "name C1 C2 C3" -selrpos res_com -seltype res_com
5$gmx rdf -f ftraj.xtc -s ftraj.tpr -ref "name C1 C2 C3" -sel "name C1 C2 C3" -selrpos whole_res_com -seltype whole_res_com  1$ and 2$ return zero everywhere, while 3$ peaks at atomic positions (not COMs). It seems only last commands (4$ or 5$) are doing somehow what I am looking for but I am not sure what is the difference (and there is difference). So, further confusion is due to the option listed for selrpos: what would be the difference between res_com, whole_res_com, part_res_com and dyn_res_com? Also, the option seltype is only documented in last versions of gmx rdf.

Besides, I am assuming I could pre-define "C1 C2 C3" as a group via gmx make_ndx

Any clarification is welcome :)

• Did you figure this out? I can offer a bounty to help get it solved. Jan 15 at 7:23
• I have found a solution, yes. I'll post it asap! Jan 15 at 10:58

\$gmx rdf -f ftraj.xtc -s ftraj.tpr -ref "name C1 C2 C3" -sel "name C1 C2 C3" -selrpos part_res_com -seltype part_res_com

My thoughts were partially clarified after consulting the useful command gmx help selections positions where it is described that POSTYPE can be atom, res_com, res_cog, mol_com or mol_cog, with an optional prefix whole_ part_ or dyn_:
• whole_ calculates the centers for the whole residue/molecule, even if only part of it is selected
• part_ prefix calculates the centers for the selected atoms, but uses always the same atoms for the same residue/molecule
• dyn_ calculates the centers strictly only for the selected atoms.
However, I still want to test the default behaviour (which should be part_ when selections are provided, and whole_ otherwise).