From: Ajasja Ljubetič (ajasja.ljubetic_at_gmail.com)
Date: Fri Mar 11 2011 - 10:17:15 CST

Hi,

you have to move the set A and set B calls inside the loop

 set mol [molinfo top]
 set sel1 [atomselect $mol "resname UNK"]
 set sel2 [atomselect $mol "resid 200"]
 set frames [molinfo $mol get numframes]
 for {set i 0} {$i < $frames} {incr i} {
  $sel1 frame $i
  $sel2 frame $i
        $sel1 update
        $sel2 update
        set A [lindex [$sel1 get { x y z }] 0]
        set B [lindex [$sel2 get { x y z }] 0]
        set distAB [vecdist $A $B]
        puts "$i $distAB"
 }

regards,
Ajasja
On Fri, Mar 11, 2011 at 16:06, ban arn <ban.arn_at_gmail.com> wrote:

> Dear VMD users
>
> I'm new to tcl scripting and i'm thankful to help or suggestion.
>
> In tcl script for calculating the distance between center of mass of
> ligand and residues along the trajectory, I'm trying to loop over the
> trajectory, but I couldn't able to update the frames along the time.
>
> Kindly find the script here:
>
> set mol [molinfo top]
> set sel1 [atomselect $mol "resname UNK"]
> set sel2 [atomselect $mol "resid 200"]
> set A [lindex [$sel1 get { x y z }] 0]
> set B [lindex [$sel2 get { x y z }] 0]
> set distAB [vecdist $A $B]
> set frames [molinfo $mol get numframes]
> for {set i 0} {$i < $frames} {incr i} {
> $sel1 frame $i
> $sel2 frame $i
> $sel1 update
> $sel2 update
> set n [vecdist $A $B]
> puts "$i $n"
> }
>
> Kindly advice
>
> Many Thanks
> Balaji
>