From: ban arn (
Date: Fri Mar 11 2011 - 09:06:00 CST

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