diff --git a/modules/mol/base/src/impl/query_impl.cc b/modules/mol/base/src/impl/query_impl.cc index 463daac1c6284aa39b8e436510eab3601d62ebca..a7935dae11ba177991613d3329b950383840ed74 100644 --- a/modules/mol/base/src/impl/query_impl.cc +++ b/modules/mol/base/src/impl/query_impl.cc @@ -1037,7 +1037,7 @@ Node* QueryImpl::ParseWithinExpr(QueryLexer& lexer) { geom::Vec3 point; if (this->ParsePoint(lexer, point)) { ParamType pt(WithinParam(point, rv*rv)); - CompOP comp_op= COP_LE; + CompOP comp_op=COP_LE; if (inversion_stack_.back()) comp_op=COP_GE; SelNode* within_node=new SelNode(Prop(Prop::WITHIN, Prop::VEC_DIST, @@ -1077,8 +1077,11 @@ Node* QueryImpl::ParseWithinExpr(QueryLexer& lexer) { ParamType pt(WithinParam(bracketed_expr_.size()-1, rv*rv)); inversion_stack_.pop_back(); CompOP comp_op= COP_LE; - if (inversion_stack_.back()) + if (inversion_stack_.back()) { + std::cout << "INV" << std::endl; comp_op=COP_GE; + } + SelNode* within_node=new SelNode(Prop(Prop::WITHIN, Prop::VEC_DIST, Prop::ATOM), comp_op, pt); diff --git a/modules/mol/base/src/query_state.cc b/modules/mol/base/src/query_state.cc index 2f04aeecc9c9d02ef318e6b22cb20b5702a87e22..ad6ab0f126d5972517a27fa8a0b4f8fc02985e53 100644 --- a/modules/mol/base/src/query_state.cc +++ b/modules/mol/base/src/query_state.cc @@ -72,7 +72,7 @@ bool QueryState::do_within(const geom::Vec3& pos, const impl::WithinParam& p, if (geom::Dot(d, d) <= p.GetRadiusSquare()) { return true; } - } else if (geom::Dot(d, d) > p.GetRadiusSquare()) { + } else if (geom::Dot(d, d) < p.GetRadiusSquare()) { return false; } } diff --git a/modules/mol/base/tests/test_query.cc b/modules/mol/base/tests/test_query.cc index e8d56b6a1ee8873f168631cfd8056790e0112483..25d0284e64a3f7678a69b2c073bfb2a721010982 100644 --- a/modules/mol/base/tests/test_query.cc +++ b/modules/mol/base/tests/test_query.cc @@ -76,13 +76,13 @@ void ensure_counts(EntityHandle e, const String& qs, int cc, int rc, int ac) { BOOST_CHECK_NO_THROW(v=e.Select(qs)); BOOST_CHECK_MESSAGE(v.GetChainCount()==cc, "wrong chain count " << v.GetChainCount() - << " for query String " << qs); + << " for query string " << qs); BOOST_CHECK_MESSAGE(v.GetResidueCount()==rc, "wrong residue count " << v.GetResidueCount() << - " for query String " << qs); + " for query string " << qs); BOOST_CHECK_MESSAGE(v.GetAtomCount()==ac, "wrong atom count " << v.GetAtomCount() << - " for query String " << qs); + " for query string " << qs); } void ensure_counts_v(EntityView src, const String& qs, @@ -208,6 +208,9 @@ BOOST_AUTO_TEST_CASE(test_query_eval) ensure_counts(e, "rtype=C", 1, 3, 27); ensure_counts(e, "not (aname=CA and not aname=CA)", 1, 3, 27); ensure_counts(e, "3 <> {21.5,35,57.0}", 1, 2, 5); + ensure_counts(e, "not 3 <> {21.5,35,57.0}", 1, 3, 22); + ensure_counts(e, "3 <> {21.5,35,57} and not 0.5 <> {21.5,35,57} ", 1, 2, 4); + ensure_counts(e, "not 0.5 <> [rnum=3]", 1, 2, 19); ensure_counts(e, "1 <> {0,0,0}", 0, 0, 0); ensure_counts(e, "gatestpropa:0=1", 1, 1, 1); ensure_counts(e, "gatestpropa:1.0=1", 1, 3, 27);