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

Christopher Neale chris.neale at alum.utoronto.ca
Tue May 24 19:22:07 CEST 2016

Dear Teemu:

Thank you for the help. After a but of fiddling your suggestion did lead to the solution:

echo -e "\"group_&_1\"\n\"group_&_2\" | gmx ...

Is this really what you had in mind? If so, I think I'll still submit a feature request since I doubt we can expect all users to come up with that on their own. Also, interactive selection is not available with all tools (see e.g. gmx traj).

Thank you,

From: gromacs.org_gmx-users-bounces at maillist.sys.kth.se <gromacs.org_gmx-users-bounces at maillist.sys.kth.se> on behalf of Teemu Murtola <teemu.murtola at gmail.com>
Sent: 20 May 2016 23:33:36
To: gmx-users at gromacs.org
Subject: Re: [gmx-users] Invalid selection near '&' syntax error -- easy way to avoid?


On Sat, May 21, 2016 at 1:09 AM Christopher Neale <
chris.neale at alum.utoronto.ca> wrote:

> 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.

Three points:

   - If you need to select a group with non-alphanumeric names in gmx rdf
   or other selection-enabled tools, you simply need to put the group name in
   double quotes.
   - There is no need to pipe the selections to gmx rdf. You can simply
   write "gmx rdf -ref '<group 1>' -sel '<group 2>'", which at least to me is
   much more obvious.
   - There can be cases where writing an intermediate index file is
   justified, but for one-off groups, it is easier to just specify them
   directly to gmx rdf or other tools as a static selection like "name A B and
   resname 1 to 64", passed directly to the command-line options. Or if you
   need to reuse the same selection multiple times, you can put it in a file
   and pass it using -sf (like -ref -sf myselection.txt, or even -ref -sel -sf
   myselection.txt, which reads both selections from the same file).

Best regards,
Gromacs Users mailing list

* Please search the archive at http://www.gromacs.org/Support/Mailing_Lists/GMX-Users_List before posting!

* Can't post? Read http://www.gromacs.org/Support/Mailing_Lists

* For (un)subscribe requests visit
https://maillist.sys.kth.se/mailman/listinfo/gromacs.org_gmx-users or send a mail to gmx-users-request at gromacs.org.

More information about the gromacs.org_gmx-users mailing list