From: Ajasja Ljubetič (ajasja.ljubetic_at_gmail.com)
Date: Fri Mar 11 2011 - 14:12:52 CST

Well, you might like to close the file as well.

Regards,
Ajasja

2011/3/11 Goldsmith, Jacob <jgoldsmith_at_uky.edu>

> set out [open my_out_file.txt w]
> # instead of "puts "$i $distAB"
> #use:
> puts $out "$i $distAB"
>
> -Jacob
> ________________________________________
> From: owner-vmd-l_at_ks.uiuc.edu [owner-vmd-l_at_ks.uiuc.edu] On Behalf Of ban
> arn [ban.arn_at_gmail.com]
> Sent: Friday, March 11, 2011 12:15 PM
> To: Ajasja Ljubetič
> Cc: vmd-l_at_ks.uiuc.edu
> Subject: Re: vmd-l: tcl script
>
> Dear Ajasja
>
> Thanks it works.
> Could you please help me for writing the output as separate file
> instead of displaying in tk console.
>
> Many Thanks
> Balaji
>
> On Fri, Mar 11, 2011 at 4:17 PM, Ajasja Ljubetič
> <ajasja.ljubetic_at_gmail.com> wrote:
> > 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
> >
> >
>
>