From: John Stone (johns_at_ks.uiuc.edu)
Date: Tue Mar 16 2004 - 18:49:27 CST

Hi Ekta,
  You're not calling '$sel delete' anywhere inside your loops, so
most likely you're causing VMD to use a tremendous amount of memory
for those atom selections (they won't be freed otherwise until the proc
is finished, assuming its even implemented as a proc....)
If you're leaking atom selections like that, you might be causing your
machine to start paging, which would absolutely kill your performance.
Try adding $sel delete at the end of each iteration through your 'res' loop,
and see if your memory usage goes _way down_ and your performance also
ought to be much better as a result. Other than that, the rest would just
be normal Tcl optimizations I suppose, unless you can do things to simplify
your atom selection. These are the first things that come to mind.

  John Stone
  vmd_at_ks.uiuc.edu

On Tue, Mar 16, 2004 at 03:57:36PM -0500, Ekta Khurana wrote:
>
> Hi,
> My system consists of two surfactant monolayers at vacuum/water
> interface.I want to create a density profile of various residues from the
> dcd files.I have 954 water residues.I am using a TCL script to do that but
> it is taking too long to get the information for water residues(more than
> a day!)I just load the dcd file and source the script in the vmd TkCon
> window.The script as shown below reads the coordinates of oxygen atoms of
> TIP3 residues and assigns them to 36 different bins depending on their z
> coordinate.Can anyone suggest how I can make it faster?
> .........................................................
>
> set fa [open out.dat w]
> for {set j 1} { $j < 37} {incr j} {
> set bin($j) 0
> }
> for {set res 128} { $res < 10181 } {incr res} {
> set sel [atomselect top "resname TIP3 and name OH2 and residue $res"]
> set nf [molinfo top get numframes]
> for {set i 0 } { $i < $nf } {incr i } {
> $sel frame $i
> $sel update
> set dz 1.25
> set z [$sel get z]
> set z1 [expr {$z/$dz}]
> set n 1
> for { set c 8} {$c < 45 } {incr c} {
> if {$z1>$c && $z1<=($c+1)} {
> incr bin($n)
> }
> incr n
> }
> }
> }
> set md 10.625
> for { set n 1} { $n < 37} {incr n} {
> puts $fa "$md $bin($n)"
> set new [expr {$md+1.25} ]
> set md $new
> }
>
> close $fa
> .............................................................
>
> Thanks
> Ekta
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>

-- 
NIH Resource for Macromolecular Modeling and Bioinformatics
Beckman Institute for Advanced Science and Technology
University of Illinois, 405 N. Mathews Ave, Urbana, IL 61801
Email: johns_at_ks.uiuc.edu                 Phone: 217-244-3349              
  WWW: http://www.ks.uiuc.edu/~johns/      Fax: 217-244-6078