From: John Stone (johns_at_ks.uiuc.edu)
Date: Wed Mar 14 2007 - 16:56:18 CDT

Hi,
  You forgot to update the active frame referenced by your
atom selections, this is done by adding a command such as:
  $sel frame $i
to each selection for which you want the referenced coordinates
to be updated.

If youwant the selectected atoms to be reevaluated at the
new frame (e.g. 'within' selections), you would also need to add
  $sel update

Cheers,
  John Stone
  vmd_at_ks.uiuc.edu

On Wed, Mar 14, 2007 at 05:06:30PM -0400, Patrick Wintrode wrote:
> Dear all,
>
> I've been having difficulty measuring the distance between two
> selections during a trajectory. The script I tried was
>
> -------------------------------------------------------------------------------------
> set n [molinfo top get numframes]
> for {set i 0} {$i < $n} {incr i} {
> set sel1 [atomselect top "index 401"]
>
> set crds1 [$sel1 get {x y z}]
>
> set sel2 [atomselect top "index 3361"]
>
> set crds2 [$sel2 get {x y z}]
>
> set dists {}
> foreach a $crds1 b $crds2 {
> set diff [veclength [vecsub $a $b]]
> lappend dists $diff
> }
> puts "dists: $dists"
>
> }
> -------------------------------------------------------------------------------
>
> The result is that it prints out the same value for all frames, even
> though I've confirmed that it changes.
>
> Any suggestions?
>
> Thanks.
>
> Patrick L. Wintrode, Assistant Professor
> Department of Physiology & Biophysics
> School of Medicine, Case Western Reserve University
> 10900 Euclid Avenue
> Cleveland, OH 44106-4970
> Phone: 216-368-3178
> Fax: 216-368-3952
> E-mail: patrick.wintrode_at_case.edu

-- 
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