From: McGuire, Kelly (
Date: Thu Apr 26 2018 - 23:27:47 CDT

My script for measuring the distance between two residues at three different points

on the protein for every frame in the trajectory works great, except for one thing. I have

1,667 frames in the trajectory, but the three files with those distances stop at 1,545,

1,535, and 1,530 frames. Any idea why all 1,667 aren't being written to my files? Here

is the code:

set A [atomselect top "resname HSP and segname XP3"]
set B [atomselect top "resname HSE and segname XP4"]

set C [atomselect top "resname ASP and segname XP3"]
set D [atomselect top "resname ASP and segname XP4"]

set E [atomselect top "resname VAL and segname XP3"]
set F [atomselect top "resname VAL and segname XP4"]

set numframes [molinfo top get numframes]

set output [open "HSPtoHSE.dat" w]
set output2 [open "ASPtoASP.dat" w]
set output3 [open "VALtoVAL.dat" w]

puts $output "Frame\tDistance"
puts $output2 "Frame\tDistance"
puts $output3 "Frame\tDistance"

for {set i 0} {$i < $numframes} {incr i} {

     set distance [veclength [vecsub [lindex [$A get {x y z}] 0] [lindex [$B get {x y z}] 0] ] ]

set distance2 [veclength [vecsub [lindex [$C get {x y z}] 0] [lindex [$D get {x y z}] 0] ] ]

set distance3 [veclength [vecsub [lindex [$E get {x y z}] 0] [lindex [$F get {x y z}] 0] ] ]

     puts $output "$i\t$distance"

puts $output2 "$i\t$distance2"

puts $output3 "$i\t$distance3"

     animate goto $i


$output close
$output2 close
$output3 close
$A delete
$B delete
$C delete
$D delete
$E delete
$F delete
unset numframes
unset output

Kelly L. McGuire