VMD-L Mailing List
From: McGuire, Kelly (mcg05004_at_byui.edu)
Date: Sun Feb 24 2019 - 22:25:03 CST
- Next message: Axel Kohlmeyer: "Re: TCL For Loop Problem"
- Previous message: McGuire, Kelly: "TCL For Loop Problem"
- In reply to: Axel Kohlmeyer: "Re: TCL For Loop Problem"
- Next in thread: Ashar Malik: "Re: TCL For Loop Problem"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ] [ attachment ]
That was definitely it. I had $output close instead of close $output in a previous version of the script. The file was not being closed. Thanks!
Kelly L. McGuire
PhD Candidate
Biophysics
Department of Physiology and Developmental Biology
Brigham Young University
LSB 3050
Provo, UT 84602
________________________________
From: Axel Kohlmeyer <akohlmey_at_gmail.com>
Sent: Sunday, February 24, 2019 9:18 PM
To: McGuire, Kelly
Cc: VMD Mailing LIst
Subject: Re: vmd-l: TCL For Loop Problem
On Sun, Feb 24, 2019 at 11: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:
are you sure the script is not completing all calculations?
couldn't it be, that you are simply not getting the desired entire
output due to i/o buffering and the fact, that you don't close the
file you are writing to? and thus your output gets truncated?
axel.
>
>
> #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
>
>
-- Dr. Axel Kohlmeyer akohlmey_at_gmail.com http://goo.gl/1wk0 College of Science & Technology, Temple University, Philadelphia PA, USA International Centre for Theoretical Physics, Trieste. Italy.
- Next message: Axel Kohlmeyer: "Re: TCL For Loop Problem"
- Previous message: McGuire, Kelly: "TCL For Loop Problem"
- In reply to: Axel Kohlmeyer: "Re: TCL For Loop Problem"
- Next in thread: Ashar Malik: "Re: TCL For Loop Problem"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ] [ attachment ]