From: Ashar Malik (asharjm_at_gmail.com)
Date: Sun Feb 24 2019 - 22:24:08 CST

Test for these 2 things. It might help.

1) Are you sure 1000 frames are loaded -- you can check this looking at the
frame count in the VMD main window or by displaying the value of
$numframes.

2) you have opened a file for writing -- but I see that you unset the
variable - but you do NOT close the file. Not sure if these operations are
equivalent. Trying closing the file using

close $output

before you unset the variable. I suspect that if the trajectory is fully
loaded (all 1000 frames) then your last 85 or so values might be hanging
around without getting a chance to get written out.

Hopefully this should fix. Otherwise write back.

On Mon, Feb 25, 2019 at 12:12 PM McGuire, Kelly <mcg05004_at_byui.edu> wrote:

> I have this script that calculates the distance between two groups of
> atoms for each frame. For some reason, the script
> doesn't got through all of the frames. In this case, I have 1000 frames,
> and the script stops calculating distance at frame 915. Here is my script:
>
>
> #This calculates the distance between the center-of-mass of two groups of
> atoms
>
> #Selection for the two atoms of choice
> set A [atomselect top "resname ASN and resid 31"]
> set B [atomselect top "resname DEG"]
>
> #Get number of frames loaded into top molecule
> set numframes [molinfo top get numframes]
>
> #Open file for writing output
> set output [open "Distance.dat" w]
>
> #Write a short header to the file
> puts $output "Frame\tDistance"
>
> #Loop over all frames
> for {set i 0} {$i < $numframes} {incr i} {
>
> #Advance to frame i
> animate goto $i
>
> #Get the positions, find the vector from B to A, calculate the length of
> vector
> set distance [veclength [vecsub [measure center $A weight mass] [measure
> center $B weight mass] ] ]
>
> #Write the frame number and distance to file, separated by a tabulator
> puts $output "$i\t$distance"
> }
>
> #Close and clean up everything
> $A delete
> $B delete
> unset numframes
> unset output
>
>
>
> *Kelly L. McGuire*
>
> *PhD Candidate*
>
> *Biophysics*
>
> *Department of Physiology and Developmental Biology*
>
> *Brigham Young University*
>
> *LSB 3050*
>
> *Provo, UT 84602*
>
>
>

-- 
Best,
/A