From: Norman Geist (norman.geist_at_uni-greifswald.de)
Date: Fri Apr 27 2018 - 02:07:09 CDT

Well, I don't know the notation you used for closing the output files.
Therefore if they are not properly closed, it would explain why the end of
the file is truncated.

Try:

 

close $output

close $output2

close $output3

 

instead of:

 

$output close

$output2 close

$output3 close

 

Best wishes

Norman Geist

 

Von: owner-vmd-l_at_ks.uiuc.edu [mailto:owner-vmd-l_at_ks.uiuc.edu] Im Auftrag von
McGuire, Kelly
Gesendet: Freitag, 27. April 2018 06:28
An: VMD Mailing LIst <vmd-l_at_ks.uiuc.edu>
Betreff: vmd-l: Measure Distance Script Question

 

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