From: Axel Kohlmeyer (akohlmey_at_cmm.chem.upenn.edu)
Date: Fri Dec 07 2007 - 14:19:47 CST

On Dec 7, 2007 2:15 PM, Manali Mehendale <manali_at_adrik.bchs.uh.edu> wrote:
> Hi,
>
> I am trying to calculate the length of multiple (thousands) small
> molecules (upto 100 atom length).
> My script works perfect for few molecules but when i try to process
> thousands it takes up too much memory and freezes up the system.
> Any help will be greatly appreciated.

manali,

please check out the tips and hints at:
http://biocore.ks.uiuc.edu/biocore/biofs/VMD%20(Public)/tips/tclscripts.html

your script is creating many atom selections and not deleting them
=> memory leak
=> freeze due to excessive swapping

axel.

>
> Thanks,
> Manali
>
>
> The script is as follows:
>
> set outfile1 [open length.dat w];
> set m 0
> foreach filename [lsort -dictionary [glob *.mol2]] {
> puts $filename
> mol new $filename type mol2 waitfor all
> molinfo top set drawn 0
> incr m 1
> }
>
> for {set k 0 } {$k < 4000 } { incr k} {
>
> set distAB 0
> set sel [atomselect $k all]
> set s [$sel get index]
> set length [llength $s]
>
> for {set i 0 } {$i < $length } { incr i} {
> for { set j 0 } { $j < $length} {incr j} {
>
> set sel1 [atomselect $k "index $i"]
> set sel2 [atomselect $k "index $j"]
> set A [lindex [$sel1 get { x y z}] 0]
> set B [lindex [$sel2 get { x y z}] 0]
>
> lappend distAB [vecdist $A $B]
> }
> }
> set result [lindex [lsort -decreasing $distAB] 0]
> puts $outfile1 $result
> }
> close $outfile1
>
>

-- 
=======================================================================
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.