[gmx-users] select waters in CNT
teemu.murtola at cbr.su.se
Wed Oct 13 11:36:54 CEST 2010
ngjin <zhongjin1000 at yahoo.com.cn> wrote:
> I want to select waters in CNT using g_select.
> g_select -f md.xtc -s md.tpr -sf selection.dat -os -oc -oi -om -selrpos whole_mol_com -seltype whole_mol_com
> selection.dat contains:resname SOL and ((x-1)^2+(y-1)^2<= 1) and (z >=-0.7037 and z <= 0.6833 ). and an error occure,
Thanks for the report, I must have overlooked this when testing. The
reason for the failure is technical (if you are interested, see
explanation in the end), and not trivial to fix properly without
disabling some functionality or adding more complexity. I will have
to think what's the best solution. For now, you can get the selection
working by writing ((x)-1)^2 instead of (x-1)^2, and the same for y.
(x+-1)^2 should also work, but I found a small bug in 4.5.1 that
causes this to segfault (this is now fixed).
PS. The promised explanation: the parser processes the input token by
token, and when it has seen only "(x -", it has to decide what to do
with the x. However, it can't decide at this point whether the input
continues as an arithmetic expression or as something like "x -1 to
1", which is also supported (there are some bugs in parsing negative
numbers in this context, so right now, it doesn't work). So it
assumes the latter. Changing this assumption will break things like
"charge -1", but might still be the easiest thing to do.
More information about the gromacs.org_gmx-users