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

Hi,
  I see a few things in your script that need tweaking.
First, don't re-create the atom selection each time through the
loop, create it once, and then update the active frame with
$sel frame.

Try this instead:

mol load xyz trajectory.xyz
set a {}
set sel [atomselect top "name CA"]
for { set i 0 } { $i <=100 } {incr i} {
  $sel frame $i
  lappend a [measure rgyr $sel]
}
$sel delete

On Tue, May 10, 2005 at 02:47:59PM +0000, Cetin Baloglu wrote:
> Hi ,
>
> I want to calculate radius of gyration of a xyz trajectory for each
> frame, measure rgyr command seems to do it alone for the active frame .
>
> when I change the frame one by one with animate next command, measure
> rgyr [atomselect top "name CA"] command works , but when I try to give
> these in a for loop
>
> mol load xyz trajectory.xyz
> set a {}
> for { set i 0 } { $i <=100 } {incr i} {
> animate next # or animate goto $i
> lappend a [measure rgyr [atomselect top "name CA"]]
> }
>
> Here I want to see 100 different rgyr value but the list a contains 100
> same value.
>
> I am new in tcl and vmd scripting and I don't know the hints yet.
>
> thanks,
>
> Cetin Baloglu

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