Use this extension along with gmx distance

Continuing the discussion from Using gmx distance for system with odd number of atoms:

use this option with gmx distance- "-select ‘com of group “A” plus com of group “B”’. Where A and B are the residue name or selected group.