Help with TCl script

From: Ilya Chorny (
Date: Thu Oct 25 2007 - 23:44:49 CDT

Hi I am writing a tcl script that, for each segment of my trimer protein,
prints out the RMSD for each residue as a function of time. My protein is
falling apart in my simulation and I want to track the progression by single
residue RMSDs.

So first I align all the trajectories by segment. For example I first align
segment #1. Then I figure out the number of residues in segment #1 and
compute each rmsd as a function of time. I then repeat for the other
segments. I could also do this for the whole protein but for some reason
going by segment makes more sense to me.

My problem is that I do not know how to impliment some simple things using
TCL. My script is below. The parts in front of the question marks is where I
do not know how to do something. Any help would be greatly appreciated.


Ilya Chorny Ph.D.
proc rmsd{{mol top}} {
# use frame 0 for the reference
set reference [atomselect $mol "protein" frame 0]
proc rmsd{{mol top}} {
# use frame 0 for the reference
for {set segment 1} {$segment < $4} {incr segment} {
    # the frame being compared
        set reference [atomselect $mol "protein and segname P$segment and
backbone" frame 0]
    set compare [atomselect $mol "protein and segname P$segment and
    set num_steps [molinfo $mol get numframes]
    for {set frame 0} {$frame < $num_steps} {incr frame} {
        # get the correct frame
        $compare frame $frame
        # compute the transformation
        set trans_mat [measure fit $compare $reference]
        # do the alignment
        $compare move $trans_mat
    set resid [atomselect $mol "protein and segname P$segment and name CA"]
    ?? set min_resid_val
    ?? set max_rmsd_val
    ?? for {set num $min_resid_val } {$num < $max_rmsd_val + 1} {incr
max_rmsd_val} {
        ?? print to file $num
        set $reference [atomslect $mol "resid $num" frame 0]
        set $compare [atomslect $mol "resid $num"]
        for {set frame 0} {$frame < $num_steps} {incr frame} {
            $compare frame $frame
            set rmsd [measure rmsd $compare $reference]
            ?? print to file $rmsd
        ?? print to file \n (space)
Ilya Chorny Ph.D.

This archive was generated by hypermail 2.1.6 : Wed Feb 29 2012 - 15:45:25 CST