How to exit selection in gmx distance (i.e. 'Ctrl-D') when using input file ('<')

GROMACS version: 2018
GROMACS modification: No

Dear all,

I’m trying to automatize analyses of MD simuations using a python script and for this I am feeding gmx distance and gmx angle with ‘<’. When doing this manually the gmx function request to hit ‘Ctrl-D’ to continue, so I am a bit confused about what to write in the last line of my file to exit the selection prompt. I suppose there an easy solution that I am missing.

Thank you in advance!


Use the -select flag and put in your selections for gmx distance. If there’s multiple groups, I think it should be semicolon separated? Not 100% sure, you might need to play around with it. The modern selection syntax description is here, and index groups can still be selected with something like -select "group 0; group 1; group 2"

I think gmx angle only takes in selections the old way. For scripting I usually echo it in,

# If I want to analyze groups 0, 1, 2
echo 0 1 2 | gmx angle <options>