From: Johannes Müllegger (hannes_at_zymeworks.com)
Date: Mon Feb 18 2008 - 21:45:42 CST

Dear VMD users/developers,

        I've modified the original ca-dist.tcl script (http://
www.ks.uiuc.edu/Research/vmd/script_library/scripts/ca-dist-v2.0/) so
I can use it on a trajectory and average the CA distances over all
frames. The new tcl function that I have does not exit clean but
leaves a huge memory behind. This is to the best of my knowledge not
due to an undeleted atomselection but has to do with the array of
distances that is used. I was able to narrow the problem down to
second for loop in the script below. The array, as expected is
deleted after the procedure exits, additional, just to confirm, I've
added a unset line, which does however not change anything.
My system has ~ 200 amino acids in two separate chains, depending on
how many frames I run the script on I see different percentages of
the memory used up. Rerunning the script increases the memory use but
only marginally.
Any suggestion of what's going wrong here is appreciated.

Our system:
Linux node004 2.6.17-gentoo-r4 #5 SMP Thu Jun 21 14:15:34 PDT 2007
x86_64 Dual Core AMD Opteron(tm) Processor 275 AuthenticAMD GNU/Linux

VMD:
>Main< (feb08.data.1) 61 % vmdinfo versionmsg
VMD for LINUX, version 1.8.6 (July 18, 2007)

Thanks,
-hannes-

proc ca_average {main_sel start_frame end_frame} {

set sel [atomselect top "$main_sel and name CA"]
set list1 [$sel list]
set list2 $list1
for {set i $start_frame} {$i < $end_frame} {incr i 1} {
                 $sel frame $i
                 set coords($i) [$sel get {x y z}]
                 }
$sel delete

for {set i $start_frame} {$i < $end_frame} {incr i 1} {
           set list2 $list1
           foreach atom1 $coords($i) id1 $list1 {
                foreach atom2 $coords($i) id2 $list2 {
                        set dist($i,$id1,$id2) [veclength [vecsub
$atom2 $atom1]]
                        }
                lvarpop list2
                lvarpop coords($i)
                }
           }
puts "Array before deletion: [array size dist]"
unset dist
puts "Array after deletion: [array size dist]"
}

Tk Console output:
loading history file ... 48 events added
Main console display active (Tcl8.4.9 / Tk8.4.9)
(feb08.data.1) 49 % source ~/Tcl_scripts/test.tcl
>Main< (feb08.data.1) 50 % ca_average protein 0 200
Array before deletion: 5130200
Array after deletion: 0
>Main< (feb08.data.1) 51 %

top output for VMD before I run the script:
  4680 hannes 15 0 223m 39m 7620 S 0 2.0 0:02.77 vmd_LINUX

and after:
4680 hannes 15 0 1165m 982m 7912 S 0 48.8 0:21.61 vmd_LINUX

_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/

Dr. Johannes Müllegger
Zymeworks Inc.
201 - 1401 West Broadway
Vancouver, BC, Canada
V6H 1H6
Phone: 604 678 1388 -124
Fax: 604 737 7077
www.zymeworks.com

_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/

Notice of Confidentiality: The information transmitted is intended only for the
person or entity to which it is addressed and may contain confidential and/or
privileged material. Any review, re-transmission, dissemination or other use of
or taking of any action in reliance upon this information by persons or entities
other than the intended recipient is prohibited. If you received this in error
please contact the sender immediately by return electronic transmission and then
immediately delete this transmission including all attachments without copying,
distributing or disclosing the same.