From: Benjamin Hall (benjamin.hall_at_bioch.ox.ac.uk)
Date: Thu Jun 02 2011 - 03:39:02 CDT

Hi

I've encountered an odd problem with for loops in tcl in VMD, whereby over the course of extended loops (>10000 iterations) in subroutines the individual loops seem to become slower as the loop progresses. The scripts are typically looping through frames in a trajectory in a manner similar to the below structure

for { set i 0 } { $i < [molinfo top get numframes] } { incr i } {
        some_other_function $i
        puts "."
}

As the loop progresses, the rate of printing "." visibly slows. I've not noticed any memory leaks (the some_other_function typically contains several atomselect commands), but I've seen this happen in a couple of unrelated scripts which do the same kind of looping through frames. If I rerun the loop, the initial speeds appear the same. I've not been able to sensibly benchmark the script, though I would if someone could suggest a benchmarking tool for tcl. Has anyone else observed this kind of behaviour, and could anyone suggest a likely cause/solution for the problem?

Thanks

Ben
************************************************************************
Benjamin A. Hall
Structural Bioinformatics & Computational Biochemistry Unit / OCISB
University of Oxford
http://sbcb.bioch.ox.ac.uk/hall.php
+44 (0)1865 613304
benjamin.hall_at_bioch.ox.ac.uk