Improve diagnostics with empty selections.
authorTeemu Murtola <teemu.murtola@gmail.com>
Wed, 25 Sep 2013 18:33:24 +0000 (21:33 +0300)
committerGerrit Code Review <gerrit@gerrit.gromacs.org>
Thu, 3 Oct 2013 19:04:18 +0000 (21:04 +0200)
commit2e29337ad43698ad1074012373365e9fb64e588c
treea5681ae88ccdf554b5472fa73f97801e4866a84a
parent031d6d80e6365bb9a25bd6f951c3a338c5b15ed2
Improve diagnostics with empty selections.

Two independent fixes to make empty selections work better:
 - Some empty selections could assert or give internal errors, because
   evaluation of some types of expressions for zero atoms was not
   working.  Fixed by removing the asserts/checks.  The check for empty
   selections should now produce useful diagnostics for these cases.
 - Fix the check for empty selections to work for all types of selection
   option input.  Previously, it only worked if the selection was
   provided on the command line, but not if it was provided from a file
   or through interactive input.

Fixes a problem reported on the gmx-users list.  Only fixed in master
since the problem is only with selections that are nearly always
incorrect.  Also, the empty selections check makes the fix much more
useful there.

Change-Id: Ic3e086e637493fc5fefe4594d4407c5a6c53bc8b
src/gromacs/selection/compiler.cpp
src/gromacs/selection/selectionoption.cpp
src/gromacs/selection/sm_compare.cpp
src/gromacs/selection/tests/refdata/SelectionCollectionDataTest_HandlesEmptySelectionWithUnevaluatedExpressions.xml [new file with mode: 0644]
src/gromacs/selection/tests/selectioncollection.cpp
src/gromacs/selection/tests/selectionoption.cpp