From: John Stone (johns_at_ks.uiuc.edu)
Date: Mon Feb 19 2007 - 17:30:16 CST

Hi Alexander,
  Yes, it closes the files, but due to the way some of the commands
are implemented, the closure doesn't necessarily occur immediately and
it may take one VMD event loop to occur. (The main event loop is blocked
while your script is running, so this can cause these to queue up...)

My initial thought is to force the VMD event loop to run after
deleting frames/molecules by adding this command:
  display update ui

This should force pending molecule/trajectory updates to work their
way to completion, which should allow various resources to be freed up.

Another thought I had is that rather than calling "animate delete all",
you might try deleting the molecules entirely and not just deleting
their frames and see what effect that has.

Try those two suggestions and let me know if you need more assistance.

  John

On Mon, Feb 19, 2007 at 03:03:54PM -0500, Alexander Balaeff wrote:
> 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
> =============================================================================
>
>
>
>
>

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