From: John Stone (johns_at_ks.uiuc.edu)
Date: Tue May 10 2005 - 13:18:13 CDT

Hi Yolanda,
  $sel update is indeed the correct method to cause VMD to
re-evaluate atom selections based on the current frame.
When you are displaying the selection visually in VMD, you need to
enable the "update selection every frame" button in the Trajectory
tab in the Graphical Representations window. I'm also assuming here
that you don't have multiple instances of 'resid 30' in your structure
right? (if so, you may wish to use the 'residue' keyword instead, with
the appropriately adjusted index value)
In your original script, you'd need to have used the selection:
  "resname HOH and within 4 of resid 30"

If you're still having trouble, I'd suggest sending a less
abbreviated version of your script so we can see what's really
going on here.

Thanks,
  John Stone
  vmd_at_ks.uiuc.edu

On Tue, May 10, 2005 at 01:44:12PM -0400, YOLANDA SMALL wrote:
> Hello John,
>
> Yes, this is a subset of a larger script. The problem is that the "within"
> command isn't being updated for every frame as I would expect. For example, in
> VMD under the Graphical Representation > selected atoms box, if I put the
> following command
>
> resid 30 or solvent within 4 of resid 30
>
> When I run the animation through 400 frames, I expect to see some solvent
> molecules appear and disappear based on whether they fall within or outside of
> the 4 Ang range. This doesn't happen. Instead, I keep observing the same
> number of solvent molecules in all frames but the distances will change and
> some distances are much longer than the 4 Ang that I specified.
>
> I thought that the following lines update the selection for each frame, but they
> do not.
> $sel1 frame $frame
> $sel1 update
>
> What is the command to update the selection for each frame?
>
> Thanks,
> Yolanda
>
>
> On Tue, 10 May 2005 10:36:24 +0000, John Stone wrote:
>
> >
> > Yolanda,
> > Is this a piece of a larger script? I noticed a few inconsistencies
> > that indicate that either you're leaving out parts of your script or you
> > have a couple of obvious typos to fix in this one. There's no $sel1 being
> > set in the script you included below, yet you reference it inside your
> > loop. I assume you intended for that to be $nearby?
> >
> > John
> >
> > On Mon, May 09, 2005 at 05:23:24PM -0400, YOLANDA SMALL wrote:
> > > Hello,
> > >
> > > I would like to calculate the number of hydrogen bonds within a certain
> region
> > > of the protein.
> > > What is the syntax to select water molecules within 3.1 Ang of a residue?
> > >
> > > I tried the following but it didn't work:
> > >
> > > set distance 3.1
> > > set nearby [atomselect top "(resname HOH within $distance of resid 189)"]
> > > set cutoff 3.0
> > > set angle 30.0
> > > set chan [open test_output.log a]
> > > for {set frame 0} {$frame < $nf} {incr frame 1} {
> > > $sel1 frame $frame
> > > $sel1 update
> > > set sel2 [measure hbonds $cutoff $angle $sel1]
> > > puts $chan "h-bonds for frame $frame is $sel2"
> > > }
> > > close $chan
> >
> > --
> > NIH Resource for Macromolecular Modeling and Bioinformatics
> > Beckman Institute for Advanced Science and Technology
> > University of Illinois, 405 N. Mathews Ave, Urbana, IL 61801
> > Email: johns_at_ks.uiuc.edu Phone: 217-244-3349
> > WWW: http://www.ks.uiuc.edu/~johns/ Fax: 217-244-6078
> >
> >

-- 
NIH Resource for Macromolecular Modeling and Bioinformatics
Beckman Institute for Advanced Science and Technology
University of Illinois, 405 N. Mathews Ave, Urbana, IL 61801
Email: johns_at_ks.uiuc.edu                 Phone: 217-244-3349
  WWW: http://www.ks.uiuc.edu/~johns/      Fax: 217-244-6078