[gmx-users] Invalid selection near '&' syntax error -- easy way to avoid?

Christopher Neale chris.neale at alum.utoronto.ca
Sat May 21 00:08:58 CEST 2016

Dear Users:

I find that gmx make_ndx will create groups with names that have ampersands in them and that this complicates piping the group name back into an analysis tool. I have included an example below. There is an obvious solution with sed to rename the group in the .ndx file after creation (this is what I am doing now). However, I'm thinking about posting a redmine feature request since ideally I think the tool will not require an external step for name-based selection and I wanted to ask here first just in case I am missing something.

### commands

  echo "aC316 C216"
  echo "aC316 C216 & r1-64" 
  echo "aC316 C216 & r65-128" 
  echo q
} | gmx make_ndx -f start.gro -o rdf.ndx
echo -e 'C316_C216_&_r_65-128\nC316_C216_&_r_65-128\n' | gmx rdf -f MD.xtc -n rdf.ndx -s MD.tpr

### output from gmx rdf:

                    :-) GROMACS - gmx rdf, VERSION 5.1.2 (-:

                            GROMACS is written by:
     Emile Apol      Rossen Apostolov  Herman J.C. Berendsen    Par Bjelkmar   
 Aldert van Buuren   Rudi van Drunen     Anton Feenstra   Sebastian Fritsch 
  Gerrit Groenhof   Christoph Junghans   Anca Hamuraru    Vincent Hindriksen
 Dimitrios Karkoulis    Peter Kasson        Jiri Kraus      Carsten Kutzner  
    Per Larsson      Justin A. Lemkul   Magnus Lundborg   Pieter Meulenhoff 
   Erik Marklund      Teemu Murtola       Szilard Pall       Sander Pronk   
   Roland Schulz     Alexey Shvetsov     Michael Shirts     Alfons Sijbers  
   Peter Tieleman    Teemu Virolainen  Christian Wennberg    Maarten Wolf   
                           and the project leaders:
        Mark Abraham, Berk Hess, Erik Lindahl, and David van der Spoel

Copyright (c) 1991-2000, University of Groningen, The Netherlands.
Copyright (c) 2001-2015, The GROMACS development team at
Uppsala University, Stockholm University and
the Royal Institute of Technology, Sweden.
check out http://www.gromacs.org for more information.

GROMACS is free software; you can redistribute it and/or modify it
under the terms of the GNU Lesser General Public License
as published by the Free Software Foundation; either version 2.1
of the License, or (at your option) any later version.

GROMACS:      gmx rdf, VERSION 5.1.2
Executable:   /home/cneale/exec/GROMACS/exec/gromacs-5.1.2/serial/bin/gmx
Data prefix:  /home/cneale/exec/GROMACS/exec/gromacs-5.1.2/serial
Command line:
  gmx rdf -f MD.xtc -n rdf.ndx -s MD.tpr

Program:     gmx rdf, VERSION 5.1.2

Error in user input:
Invalid selection 'C316_C216_&_r_65-128 '
  Near '&'
    syntax error

For more information and tips for troubleshooting, please check the GROMACS
website at http://www.gromacs.org/Documentation/Errors

More information about the gromacs.org_gmx-users mailing list