From: Ana Celia Vila Verde (acavilaverde_at_gmail.com)
Date: Sat Sep 06 2014 - 03:39:38 CDT

Hi Eric,

I would do it in two steps:

First, rotate your VMD molecule so that the line coincides with one of
the axes. Use VMD's matrice routines.

Then, assuming that your line now coincides with the z axis, you can
select all atoms of type AAA within a certain distance R of that line at
frame $frm with:

set sel [atomselect top "(x**2 + y**2< R**2) and type AAA"]
$sel frame $frm
$sel update

By the way, if type AAA is, for example, the water oxygen or some other
atom type that's very abundant in your trajectory, it is more efficient
to write
set sel [atomselect top "(x**2 + y**2< R**2) and type AAA"]
instead of
set sel [atomselect top "type AAA and (x**2 + y**2< R**2) "]

I hope it helps.

Ana

On 06/09/14 08:40, Eric Smoll wrote:
> Hello VMD users,
>
> What is the best way to select all atoms a certain distance from a
> line defined between two points?
>
> Toying with selections using a symmetric representation of the line, I
> noticed that I cannot select atoms within a certain distance of a
> plane. Only inequalities seem to work (greater-than or less-than the
> plane). So, to achieve selection along a line, I have to resort to a
> cumbersome expression like
>
> (within X of EXP1 < 0) and
> (within X of EXP1 > 0) and
> (within X of EXP2 < 0) and
> (within X of EXP2 > 0)
>
> Is there a better way?
>
> Best,
> Eric