# Gmx select - selection of residues within distance

**URL:** <https://gromacs.bioexcel.eu/t/gmx-select-selection-of-residues-within-distance/7127>\
**Category:** User discussions\
**Created:** [September 4, 2023, 8:53am UTC](https://gromacs.bioexcel.eu/t/gmx-select-selection-of-residues-within-distance/7127 "2023-09-04T08:53:27Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![arijit93](https://avatars.discourse-cdn.com/v4/letter/a/c0e974/32.png) [@arijit93](https://gromacs.bioexcel.eu/u/arijit93)\
**Post date:** [September 4, 2023, 8:53am UTC](https://gromacs.bioexcel.eu/t/gmx-select-selection-of-residues-within-distance/7127/1 "2023-09-04T08:53:27Z")

</div>

GROMACS version: 2022.4  
Hi,  
I am working with a GPCR system embedded in lipid bilayer and water. I want to select every water (group 31 in index file) that is situated below 4A from a particular residue of the protein (group 43), so the command has been used as I have seen being used in earlier queries:  
gmx select -f input.xtc -s input.tpr -n input.ndx -select ‘group 31 and within 0.4 of group 43’ -on output.ndx

But I get multiple syntax errors:  
Error in user input:  
Invalid command-line options  
In command-line option -select  
Invalid selection ‘and’  
Near ‘and’  
syntax error  
In command-line option -select  
Invalid selection ‘within’  
While parsing ‘within’  
‘within’ should be followed by a value/expression  
‘of’ is missing  
In command-line option -select  
Invalid selection ‘0.4’  
Near ‘0.4’  
syntax error  
In command-line option -select  
Invalid selection ‘group’  
Near ‘group’  
syntax error  
In command-line option -select  
Near ‘�’  
syntax error  
Where am I going wrong? I have tried few other combinations too, but those were also followed up similar syntax errors? Thanks in advance
