From: Alexander Balaeff (abalaeff_at_duke.edu)
Date: Mon Feb 19 2007 - 14:03:54 CST

Dear all:

Could anyone advise me on whether VMD closes PDB files after reading
the data from them? The reason I am asking is that a simple TcL script
(attached below) results in a steady growth of memory taken by VMD,
eventually slowing my workstation to a crawl. The script is relatively
simple, and the only unusual thing it is doing is constantly reading
and re-reading PDB files from the disk (for exactly the reason of
avoiding overloading the memory with too much data). The only thing I
can currently think could be going wrong is not closing the PDB files
after reading them (eventually resulting in 4,5 mln open files) -- or
another cleanup problem. Any comment or suggestion would be grealy
appreciated.

Thank you,

Alexander.

========================================================
               Dr. Alexander Balaeff
 Department of Chemistry Phone: (919) 660-1634
 Duke University, Box 90349 FAX: (919) 684-4212
 Durham, NC 27707-0349 E-mail: abalaeff_at_duke.edu
========================================================

=============================================================================
The VMD version:

Info) VMD for LINUX, version 1.8.5 (August 25, 2006)
Info) http://www.ks.uiuc.edu/Research/vmd/
Info) Email questions and bug reports to vmd_at_ks.uiuc.edu
Info) Please include this reference in published work using VMD:
Info) Humphrey, W., Dalke, A. and Schulten, K., `VMD - Visual
Info) Molecular Dynamics', J. Molec. Graphics 1996, 14.1, 33-38.
Info) -------------------------------------------------------------
Info) Multithreading available, 2 CPUs detected.
Info) OpenGL renderer: Mesa GLX Indirect
Info) Features: STENCIL MDE MTX PP PS
Info) GLSL rendering mode is NOT available.
Info) Textures: 2-D (2048x2048), Multitexture (8)

=============================================================================
The system:

Red Hat Linux, Dell Optiplex GX620 workstation

=============================================================================

The command:
  vmd -dispdev text < RMSD_map_Axis.tcl >& log &

=============================================================================
The script:

#
# The molecules:

mol new PDB_Axis/1.pdb type pdb waitfor all
set ref_id [molinfo top get id]
mol new PDB_Axis/1.pdb type pdb waitfor all

#
# RMSD data file to write:

set rmsd_file [open "rmsd_map_Axis.dat" "w"]

#
# Atom selections to be used:

set all [atomselect top "all"]
set comp [atomselect $ref_id "all"]

#
# The main loop

for { set i 1} { $i<=3000} { incr i } {

    animate delete all $ref_id
    mol addfile PDB_Axis/$i.pdb type pdb waitfor all $ref_id
    puts "======= COMPARISON FRAME $i ======="

    puts $rmsd_file "$i $i 0"
    for { set j [expr $i+1] } { $j <= 3000 } { incr j } {
        animate delete all top
        mol addfile PDB_Axis/$j.pdb type pdb waitfor all top

        set transformation_matrix [measure fit $all $comp]
        $all move $transformation_matrix
        set rmsd [measure rmsd $all $comp]
        puts $rmsd_file "$i $j $rmsd"
        puts $rmsd_file "$j $i $rmsd"
    }

}

close $rmsd_file
=============================================================================