From: Ajasja Ljubetič (ajasja.ljubetic_at_gmail.com)
Date: Thu Jan 13 2011 - 15:46:48 CST

Doesn't work is not exactly the best description, but I think one problem
is:
" for {set myid 1} {$myid < $mynum} {incr $myid} {"
the incr takes the name of the variable not the value, so try
" for {set myid 1} {$myid < $mynum} {incr myid} {"

Regards,
Ajasja
On Thu, Jan 13, 2011 at 20:08, dhacademic <dhacademic_at_gmail.com> wrote:

> Many thanks for the reply. It does work now.
>
> I have another question about using variable in TCL. There are 34 subunits
> (resid 1~34) in my system. I want to print out all of the intra-subunit
> vectors of two atoms (atom name C3 and C17) in each frame. Results in the
> outfile are printed out in a matrix, in which the ith column is the vector
> of ith subunit and the jth line is the vector of jth frame. Following is the
> loop part of my script, but it does not work. Can anyone help me to figure
> out this problem?
>
> Thanks in advance!
>
> Best,
> Hao
>
>
> for {set frame 0} {$frame < $num_steps} {incr frame} {
> set mynum 34
> for {set myid 1} {$myid < $mynum} {incr $myid} {
> set s$myid [[atomselect $mol "resname CLT and name
> C3 and resid $myid" frame $frame] get {x y z}]
> set t$myid [[atomselect $mol "resname CLT and name
> C17 and resid $myid" frame $frame] get {x y z}]
> set vec$myid [vecsub ${s$myid} ${t$myid}]
> }
> puts $outfile "$vec1, $vec2, ...."
>
>
> }
>
>
>
>
> On Thu, Jan 13, 2011 at 10:53 AM, John Stone <johns_at_ks.uiuc.edu> wrote:
>
>>
>> Hi,
>> When you run a script like that, you need to make sure you add "waitfor
>> all"
>> to the end of the "mol new" and "mol addfile" commands, otherwise VMD
>> continues running the next commands in your script while it is still
>> in the process of loading the trajectory file in the background...
>> So, this is why only 8 frames are loaded when you run it without the
>> "waitfor all" option.
>>
>> Cheers,
>> John Stone
>> vmd_at_ks.uiuc.edu
>>
>> On Thu, Jan 13, 2011 at 10:45:16AM -0500, dhacademic wrote:
>> > Hi VMD user,
>> >
>> > I meet the problem in extracting the number of frames from amber
>> > trajectory.
>> >
>> > Following is my script "myframe.tcl". When I run "vmd -e
>> myframe.tcl", the
>> > calculated frame number is 8. But when I use the first two lines of
>> the
>> > script to load the trajectory, and then type in the last four lines
>> in TCL
>> > Console, the frame number is 1000. In reality, 1000 is the correct
>> number.
>> >
>> > I want to know is there anything wrong?
>> >
>> > Best,
>> > Hao
>> >
>> >
>> > mol new out.top type parm7
>> > mol addfile out.mdcrd type crdbox
>> >
>> > proc myframe {{mol top}} {
>> > set num_steps [molinfo $mol get numframes]
>> > }
>> > myframe
>> >
>> >
>> > 2011-01-13
>> >
>> >
>> ----------------------------------------------------------------------
>> >
>> > dhacademic
>>
>>
>> --
>> 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/ <http://www.ks.uiuc.edu/%7Ejohns/>
>> Fax: 217-244-6078
>>
>
>