From: Mustafa Tekpinar (tekpinar_at_buffalo.edu)
Date: Tue Jan 31 2012 - 13:48:40 CST

Hi,
I am trying to calculate rmsd of a pdb file vs each frame of a trajectory
and write results to a file. However, it doesn't work with arguments
properly. The error and the script is below:

can't read "pdb_name": no such variable
can't read "target_pdb": no such variable
Cannot find molecule 0 in atomselect's 'molId'
can't read "pdb_name": no such variable
can't read "data_file_name": no such variable
can't read "traj_psf": no such variable
can't read "traj_dcd": no such variable
Cannot find molecule 1 in atomselect's 'molId'
molinfo: get: no molecule exists with id 1
can't read "num_steps": no such variable
can't read "file": no such variable
can't read "compare": no such variable
can't read "reference": no such variable
ERROR) No molecules loaded.
Info) VMD for LINUXAMD64, version 1.8.6 (April 6, 2007)
Info) Exiting normally.

//===========================================================================================================
if { $argc != 3 }
        puts "Usage: vmd -dispdev text -e rmsd_traj.tcl -args
pdb_name(W/out extension) trj.psf trj.dcd"
} else {
    set pdb_name [lindex $argv 0]
    puts "[lindex $argv 0]"
    set traj_psf [lindex $argv 1]
    puts "[lindex $argv 1]"
    set traj_dcd [lindex $argv 2]
    puts "[lindex $argv 2]"
}

#set pdb_name
1yzi

set target_pdb ${pdb_name}.pdb

mol new ${target_pdb}
set reference [atomselect 0 "name CA"]

set data_file_name rmsd_${pdb_name}_to_trj_test.dat
set file [open "$data_file_name" w]

mol new ${traj_psf} waitfor all
mol addfile ${traj_dcd} waitfor all

# the frame being
compared

set compare [atomselect 1 "name CA"]

set num_steps [molinfo 1 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

    # compute the
RMSD

    set rmsd [measure rmsd $compare $reference]

    # print the
RMSD

    puts $file "$frame \t$rmsd"
}
close $file
$compare delete
$reference delete
mol delete all
exit
//===========================================================================================================
Mustafa Tekpinar

Department of Physics
SUNY at Buffalo,
Buffalo, NY