# Selections for gmx distance/ gmx mindist / gmx pairdist

GROMACS version: 2021.4, 2021.3 and 2019.2 (depending on machine)
GROMACS modification: Not

I am studying the adsorption of pollutants onto amorphous carbon surfaces using MD and would like to use the gmx distance analysis tools to analyse my trajectories:

1. I would like to calculate the distance between pollutant and surface across my equilibration runs - I believe this can be done using gmx mindist

2. I would like to calculate the avg. distance between pollutant and surface across my production runs (after simulation is converged) - I believe this can be done with gmx distance / gmx pairdist

I have created an index for each of my simulations - groups include system, solvent, ions, pollutant, pollutant FGs (e.g. aromatic groups or acidic groups), the amorphous carbon, and the surface atoms of the amorphous carbon (calculated using pytim).

What I am confused about is how the selections in gmx mindist, gmx distance and gmx pairdist are treated and whether the results are averaged. I have looked through the manual pages for all three but still feel a bit confused as to how these work.

1. gmx mindist: does a selection of pollutant and surface atoms calculate the minimum distance between any pollutant atom and any surface atom at any time in my trajectory or is it somehow averaged across all residues? (i.e. in my case, if one pollutant is adsorbed but all the rest are in still solution how will this look in mindist?)

2. gmx distance: I am confused by this part of the manual

Note that `gmx distance` calculates distances between fixed pairs (1-2, 3-4, etc.) within a single selection. To calculate distances between two selections, including minimum, maximum, and pairwise distances, use gmx pairdist.

1. (cont) how does this translate into the selections? Does it infact imply that my index group should include both surface atoms and pollutants in order to calculate distances between these?

2. gmx pairdist: should I instead be using this to calculate the distance between groups as in above quote? What are fixed vs non-fixed pairs?

3. I also see for both gmx distance and gmx pairdist there are options for -selrpos and -seltype . What do these mean and how should I be using these in my calculations (e.g. what is the difference between res_com and whole_res_com?)?

Hi,

gmx mindist : does a selection of pollutant and surface atoms calculate the minimum distance between any pollutant atom and any surface atom at any time in my trajectory or is it somehow averaged across all residues? (i.e. in my case, if one pollutant is adsorbed but all the rest are in still solution how will this look in mindist?)

gmx mindist calculates the minimum distance between the two groups at any times in the trajectory file. One group is the polluntants atoms and the other group is the surface atoms.

gmx distance …(cont) how does this translate into the selections? Does it infact imply that my index group should include both surface atoms and pollutants in order to calculate distances between these?

gmx distance calculate the distance between two pairs of positions as a function of time. The positions can correspond to one atoms position or to a selection position, like for example the center of mass.

gmx pairdist : should I instead be using this to calculate the distance between groups as in above quote? What are fixed vs non-fixed pairs?

I am not use what you mean with non-fixed pairs.
gmx pairdist can calculated pairwise distances between one reference selection and one or more other selections. and those selection can also be dynamics.

I also see for both gmx distance and gmx pairdist there are options for -selrpos and -seltype . What do these mean and how should I be using these in my calculations (e.g. what is the difference between res_com and whole_res_com?)?

`whole_` calculates the centers for the whole residue/molecule, even if only part of it is selected. See more on selection syntax here https://manual.gromacs.org/current/onlinehelp/selections.html?highlight=selection

I have no experience how looks like a pollutant, but (for example) your pollutant is formed by several independent molecules I think gmx pairdist is doing what you want.

I hope it helps
Alessandra