Support more complex fixed position selections
authorTeemu Murtola <teemu.murtola@gmail.com>
Wed, 28 Jan 2015 20:06:26 +0000 (22:06 +0200)
committerGerrit Code Review <gerrit@gerrit.gromacs.org>
Sat, 7 Feb 2015 00:37:21 +0000 (01:37 +0100)
commitbd72a865572045c119536365f221a0b44d1c145b
tree2590de5630e0b168e695e41075a152aa5aac4e0b
parent2755334da0b19be6d478eae8d6cceb81b0c0916c
Support more complex fixed position selections

Make it possible to create selections like
  [0,0,0] plus [0,1,0]
to specify a fixed set of positions.  This can be useful at least for
'gmx gangle' to calculate angles from a fixed reference vector.
Such selections were already understood properly by the parser, but
caused various crashes elsewhere in the code.  Fixed those crashes by
consistently managing the memory for the involved t_block structures
(always allocate one value in the index array, even if the block is
empty), and by not assuming that a plus-like keyword always has a child
element in the evaluation tree.

Fixes #1619.

Change-Id: I513cddbe882f269ad867c726a54583ee48b41b4d
src/gromacs/selection/evaluate.cpp
src/gromacs/selection/indexutil.cpp
src/gromacs/selection/poscalc.cpp
src/gromacs/selection/position.cpp
src/gromacs/selection/selection.cpp
src/gromacs/selection/sm_permute.cpp
src/gromacs/selection/tests/refdata/SelectionCollectionDataTest_HandlesConstantPositions.xml
src/gromacs/selection/tests/refdata/SelectionCollectionDataTest_HandlesConstantPositionsWithModifiers.xml [new file with mode: 0644]
src/gromacs/selection/tests/selectioncollection.cpp