Fix bug in selection subexpression handling.
authorTeemu Murtola <teemu.murtola@gmail.com>
Wed, 10 Apr 2013 18:17:36 +0000 (21:17 +0300)
committerTeemu Murtola <teemu.murtola@gmail.com>
Wed, 10 Apr 2013 18:17:36 +0000 (21:17 +0300)
commita301d73cd223281d2a58c282f962861be437ac7d
tree374f2675c2bc9a45919442a28dfde3b3d7e21f2e
parent90abdcf9a41e447da7f4e66baba23caf3e10d461
Fix bug in selection subexpression handling.

Did not work correctly if
1. a static expression was passed to a SPAR_ATOMVAL parameter,
2. other parameters to the same selection method were dynamic
   (so that the expression would not be completely eliminated during
   compilation), and
3. the evaluation group of the SEL_EXPRESSION element was dynamic
   (so that the SPAR_ATOMVAL expression could be evaluated for a
   different group during evaluation and compilation).
In this case, the static atom-valued parameter got evaluated during
compilation for the maximal evaluation group and replaced by a constant.
During evaluation, if the evaluation group was smaller, the values for
that expression were no longer correct.
See #1216 for what kinds of concrete selections this applies to.

Fixes #1216.

Backported from master with the same Change-Id.
Needed to also pull in part of the changes from
6e877567d9d3d08a3f6fb436f7bbfbaf35b95f8e.

Change-Id: Ic6b7f9b8df661a9c78d7862b981a07e65a7ebdbf
src/gmxlib/selection/compiler.c
src/gmxlib/selection/evaluate.c