What is the difference between gmx distance, gmx mindist and gmx pairdist?

Hi,
I am trying to compute distance between four residues of a protein involved in active site. I am getting confused in mindist, pairdist and gmx distance. What are the limits and differences in three?
Which analysis can be helpful in plotting distance between A-B, B-C, C-D and D-A residues over time, where ABCD are 4 residues forming bottleneck for ligand entry.

Hi,

gmx distance calculates distances between (fix) pairs of positions as a function of time. For example to calculate the distance between atom 1 and atom 2 , you should provide an index file with the following group
[ distance ]
1 2

gmx mindist computes the minimum distance or contact between one group and a number of other groups. A feature is that with option -pi the minimum distance of a group to its periodic image can be calculated

gmx pair-dist also calculates the minimum distances between one reference selection and one or more other selections. But it can also provide the max distance and has more advance options to define the selections.

I hope this is useful
Alessandra

hi alevilla
thankyou for your time and response.

If i have to compute time dependent distance change among four residues, should i keep a separate index for each amino acid*?*

Hi,
Yes, you could create an index file with a group for each the residues or you could use the selection option
Kind regards
Alessandra

Hi alevilla and Yogesh,
Suppose I have index of 128 Phosphorus atoms as ‘ref’ and index of 5 oxygen atoms as ‘sel’ , then does pairdist calculate (at each frame) the minimum distances out of 128*5 possible combinations?
Can you please clarify?
Thanks and regards.
Anirban

Hi,
This extract from the help of gmx pairdist (gmx pairdist — GROMACS 2021 documentation) may answer to your question:
“Computed distances are written to the file specified with -o . If there are N groups in -ref and M groups in the first selection in -sel , then the output contains N*M columns for the first selection. The columns contain distances like this: r1-s1, r2-s1, …, r1-s2, r2-s2, …, where rn is the n’th group in -ref and sn is the n’th group in the other selection.”
Best regards
Alessandra

Thank you Alessandra to point this out . I will check it.
I am very sorry for my late response.
Regards
Anirban

Hi @Anirban12,

It looks like you want to find all the NxM distances, is that correct?

I think the answer is in using the -regrouping and -selgrouping arguments. I believe what that does is deaggregate the group so that you get your NxM array instead of a 1x1 array.

example - I believe this is finding all C-N distances:

gmx pairdist -s simulation.tpr -f simulation.xtc -ref 'type C' -sel 'type N' -refgrouping none -selgrouping none

Now, the $64K question is: which numbers belong to which atom pairings. :). I believe @alevilla might have answered that above; the bit she quotes would seem to give the mapping algorithm.

It also seems convenient to use a pre-engineered index (.ndx) file if you know the groups you are looking for. For example, I created an ndx file where the group Protein-Heavy-Atoms is group #1. I added this to the pairdist command using -n (to include the ndx file) and the -ref and -sel arguments to select group #1.

gmx pairdist -s simulation.tpr -f simulation.xtc -refgrouping none -selgrouping none -n protein.ndx -ref 1 -sel 1

-denny-

p.s. let me know if you aren’t comfortable writing the ndx files. I believe there are ways to do it from gmx, but I just created them manually from python.

Hi @denny
Thanks for your comment.
I have two groups a) 5 O2 atom and b) 128 P atoms. Now pairdist and mindist both are giving same result when I chose ref as group a and sel as group b ,which is I am guessing, minimum of all possible 128*5 distances (at each frame).
In my case they are giving same result but probably their way of functionality is different. Can you shed some light on this? It would be great.
Regards
Anirban

Again, I am no expert, but that is what I would suggest because you are 1) using them all as a single group and 2) probably using the default ‘min’ distance.

try using the type argument to control min/max
try using the refgroupiong and selgrouping to control whether they are all treated as a single group. See my example above for those.

Sure. Thank you.
Anirban :)