From: Axel Kohlmeyer (akohlmey_at_cmm.chem.upenn.edu)
Date: Tue Feb 19 2008 - 07:35:20 CST

On Mon, 18 Feb 2008, Johannes Müllegger wrote:

JM> Dear VMD users/developers,
JM>
JM> I've modified the original ca-dist.tcl script
JM> (http://www.ks.uiuc.edu/Research/vmd/script_library/scripts/ca-dist-v2.0/)

JM> so I can use it on a trajectory and average the CA distances over all
JM> frames. The new tcl function that I have does not exit clean but leaves a
JM> huge memory behind. This is to the best of my knowledge not due to an
JM> undeleted atomselection but has to do with the array of distances that is
JM> used. I was able to narrow the problem down to second for loop in the script
JM> below. The array, as expected is deleted after the procedure exits,
JM> additional, just to confirm, I've added a unset line, which does however not
JM> change anything.

johannes,
can you try using:

array dist unset

instead. perhaps there is a bug in tcl with the reference
counting of the array elements?

cheers,
   axel.

JM> My system has ~ 200 amino acids in two separate chains, depending on how
JM> many frames I run the script on I see different percentages of the memory
JM> used up. Rerunning the script increases the memory use but only marginally.
JM> Any suggestion of what's going wrong here is appreciated.
JM>
JM> Our system:
JM> Linux node004 2.6.17-gentoo-r4 #5 SMP Thu Jun 21 14:15:34 PDT 2007 x86_64
JM> Dual Core AMD Opteron(tm) Processor 275 AuthenticAMD GNU/Linux
JM>
JM> VMD:
JM> >Main< (feb08.data.1) 61 % vmdinfo versionmsg
JM> VMD for LINUX, version 1.8.6 (July 18, 2007)
JM>
JM> Thanks,
JM> -hannes-
JM>
JM>
JM> proc ca_average {main_sel start_frame end_frame} {
JM>
JM> set sel [atomselect top "$main_sel and name CA"]
JM> set list1 [$sel list]
JM> set list2 $list1
JM> for {set i $start_frame} {$i < $end_frame} {incr i 1} {
JM> $sel frame $i
JM> set coords($i) [$sel get {x y z}]
JM> }
JM> $sel delete
JM>
JM> for {set i $start_frame} {$i < $end_frame} {incr i 1} {
JM> set list2 $list1
JM> foreach atom1 $coords($i) id1 $list1 {
JM> foreach atom2 $coords($i) id2 $list2 {
JM> set dist($i,$id1,$id2) [veclength [vecsub $atom2
JM> $atom1]]
JM> }
JM> lvarpop list2
JM> lvarpop coords($i)
JM> }
JM> }
JM> puts "Array before deletion: [array size dist]"
JM> unset dist
JM> puts "Array after deletion: [array size dist]"
JM> }
JM>
JM>
JM> Tk Console output:
JM> loading history file ... 48 events added
JM> Main console display active (Tcl8.4.9 / Tk8.4.9)
JM> (feb08.data.1) 49 % source ~/Tcl_scripts/test.tcl
JM> >Main< (feb08.data.1) 50 % ca_average protein 0 200
JM> Array before deletion: 5130200
JM> Array after deletion: 0
JM> >Main< (feb08.data.1) 51 %
JM>
JM> top output for VMD before I run the script:
JM> 4680 hannes 15 0 223m 39m 7620 S 0 2.0 0:02.77 vmd_LINUX
JM>
JM> and after:
JM> 4680 hannes 15 0 1165m 982m 7912 S 0 48.8 0:21.61 vmd_LINUX
JM>
JM>
JM> _/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
JM>
JM> Dr. Johannes Müllegger
JM> Zymeworks Inc.
JM> 201 - 1401 West Broadway
JM> Vancouver, BC, Canada
JM> V6H 1H6
JM> Phone: 604 678 1388 -124
JM> Fax: 604 737 7077
JM> www.zymeworks.com
JM>
JM> _/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
JM>
JM>
JM>
JM>
JM>
JM>
JM>
JM>
JM>
JM> Notice of Confidentiality: The information transmitted is intended only for
JM> the
JM> person or entity to which it is addressed and may contain confidential
JM> and/or
JM> privileged material. Any review, re-transmission, dissemination or other use
JM> of
JM> or taking of any action in reliance upon this information by persons or
JM> entities
JM> other than the intended recipient is prohibited. If you received this in
JM> error
JM> please contact the sender immediately by return electronic transmission and
JM> then
JM> immediately delete this transmission including all attachments without
JM> copying,
JM> distributing or disclosing the same.
JM>
JM>
JM>

-- 
=======================================================================
Axel Kohlmeyer   akohlmey_at_cmm.chem.upenn.edu   http://www.cmm.upenn.edu
   Center for Molecular Modeling   --   University of Pennsylvania
Department of Chemistry, 231 S.34th Street, Philadelphia, PA 19104-6323
tel: 1-215-898-1582,  fax: 1-215-573-6233,  office-tel: 1-215-898-5425
=======================================================================
If you make something idiot-proof, the universe creates a better idiot.