From: Ignacio Fernández Galván (
Date: Wed Jul 23 2008 - 02:39:23 CDT

--- On Tue, 22/7/08, Eduardo Cruz-Chu <> wrote:

> you can use equations in your selection. For instance, to
> select a cylindrical region of radius R around a point
> (Xcenter,Ycenter) in the frame F
> set sel [ atomselect top "(x-$Xcenter)*(x-$Xcenter) +
> (y-$Ycenter)*(y-$Ycenter) < $R*$R" frame $F ]
> you can limit the region of the cylinder adding extra
> equations in the Z direction.

Yes, that's what I tried as the "hard way", but somehow the variables are not evaluated inside the selection. The problem may be that I'm writing the selection formula in the GUI for representations (or in the "mol selection" line in a state file previously saved). So:

set xA 2
mol selection {x < $xA}
mol addrep top

but the selection comes out as if I had written "x < 0" instead of "x < 2". Of course, if I write "x < 2" directly, it works as it should, so at the end I could "hard code" the values in the state file, but I'd prefer to avoid that.

> If your benzene ring is moving, you should play with the
> equations (find the center of the ring, can use the middle
> point between 2 carbons, and the normal to the ring plane,
> can use three carbons).

Ok, in my case it is actually not moving, because I'm centering it at every frame. But if it were, how would I do it so that the selection would be updated at each frame? For doing analysis and calculations, I can use a foreach loop and get the coordinates each frame, but what can be done for a representation? The "update selection every frame" is not enough, because I'd need a way to define the xA variable every frame...

Not happy with your email address?.
Get the one you really want - millions of new email addresses available now at Yahoo!