From: John Stone (
Date: Wed Oct 09 2013 - 09:50:22 CDT

  Yes, that's right, 'exwithin' can be thought of as being
equivalent to '(within 5 of X) and not X)'. The point of having
exwithin is that it provides a massive performance benefit
if the 'X' part of the selection is complex. So ultimately, 'exwithin'
is really just a performance optimization for a particularly common
type of selection expression. In the case where 'X' has several
selection terms, or involves macros other other complex evaluations,
the use of 'exwithin' can double performance, in addition to being
easier to type.

It's a bad idea to make changes to the semantics of any of the existing
selection keywords except to fix bugs. Any changes to the semantics of
existing selection keywords will break scripts people have already written.

It is a much better idea to add a new keyword. I'm not sure what would
be a good name for such a keyword. Maybe "pairdist" or "pairwithin" or
something along those lines. We could provide multiple keywords depending
on whether one wants to count particles that are bonded, part of the same
residue, segment/chain, etc. Which semantics would be the most useful to

  John Stone

On Wed, Oct 09, 2013 at 09:37:07AM +0200, Olaf Lenz wrote:
> Hash: SHA1
> Hi again!
> Thanks to all that suggested a solution. Apparently, there is no
> solution using selections, but only what I would probably call
> "workarounds" using Dynamic Bonds or "measure contacts".
> However, I now wonder what the keyword "exwithin" is actually good for.
> As it works now, I believe that you can always replace a selection of
> exwithin <d> of <sel>
> by the equivalent selection of
> not <sel> and within <d> of <sel>
> isn't that true?
> Therefore, I would suggest to modify the semantics of the keyword
> "exwithin" such that it selects an atom if it is within <d> of *another*
> particle of the given selection. Or would it make sense to introduce
> another keyword?
> Olaf
> - --
> Dr. rer. nat. Olaf Lenz
> Institut für Computerphysik, Allmandring 3, D-70569 Stuttgart
> Phone: +49-711-685-63607
> Version: GnuPG v2.0.19 (GNU/Linux)
> Comment: Using GnuPG with Thunderbird -
> iEYEARECAAYFAlJVB6MACgkQtQ3riQ3oo/oP0ACfavPTAJ+n4jQ2jfyu2iY1Fs5Z
> uKEAnj4z7VbG1E11VZR4lkaIq6P6wWFM
> =VErC

NIH Center for Macromolecular Modeling and Bioinformatics
Beckman Institute for Advanced Science and Technology
University of Illinois, 405 N. Mathews Ave, Urbana, IL 61801           Phone: 217-244-3349