From: Justin Gullingsrud (justin_at_ks.uiuc.edu)
Date: Fri Mar 21 2003 - 17:53:51 CST

Hi,

Since the vmd-l email, we've fixed problems with atom selection deletions.
You can simply type
  $compare delete
to delete the atom selection named compare. This should free all the
memory.

However, it's hardly ever necessary now to put the atomselect command inside
your loop. You can define the atom selection once, then update the frame of
the atom selection, like so:
  set ref [atomselect top "name CA" frame 0]
  set cmp [atomselect top "name CA"]
  for { set i 0 } { $i < [molinfo top get numframes] } { incr i } {
    $cmp frame $i
    lappend rms [measure rmsd $cmp $ref]
  }

If you have distance based atom selections, i.e. something with "within" in
it, you can update it every frame with
  $sel frame $i
  $sel update

You might also want to try writing out your analysis results as you go
instead of accumulating them in Tcl variables and saving the result all
at once.

Rewriting your script using these two methods to move all atomselect
commands out of the main loop should take care of the memory pressure
you're experiencing.

Cheers,
Justin

On Fri, Mar 21, 2003 at 04:36:02PM -0600, John Stone wrote:
>
> Joe,
> Depending on how you're performing your atom selections, you
> may be causing Tcl to leak atom selection memory. If you're making
> many atom selections inside of a loop, make sure you call '$sel delete'
> so that the selection is destroyed when you're finished with it.
> Without seeing your code I'm not positive this is the cause, but that's
> probably 90% likelihood... If you need more help, send us a copy of
> your script so we can see what you're actually doing.
>
> Thanks,
> John Stone
> vmd_at_ks.uiuc.edu
>
> On Thu, Mar 20, 2003 at 01:02:48PM -0600, Joe Huang wrote:
> > Dear VMD users,
> > I am running a kind of RMSD comparisons (segment by segment on Protein
> > or RNA) with TCL script under VMD1.8.
> > The system is huge and the calculations can be ~ (1500 X 1500) RMSD
> > calculations (i.e., 2.25 E6 or more than 2 million RMSD calculations).
> > In the beginning, my calculations would crash due to the consumptions
> > of virtual SWAP memory in the system after ~ 4 rounds of RMSD
> > calculations (i.e., ~[4x1500] out of more than 2 million calculations);
> > later, I checked the VMD-L archive and found out that I need to unset
> > the atom selections after each RMSD comparison to solve this problem.
> > Therefore, I unset the atomselections (e.g., "unset
> > upproc_var_$compare" and "unset upproc_var_$reference") and also unset
> > all the variables (e.g., "unset trans_mat", "unset rmsd", ...etc.)
> > after their usages on each cycle; in this case, the calculations could
> > go on more than (400x1500) comparisons, but the virtual SWAP memory was
> > still decreasing in a much slower slower degree and eventually the
> > calculations would still crash in the middle to the finish line!
> > Although I could rerun VMD and recontinue the job several times to
> > finish the whole calculations, I prefer to finish it just by one session
> > of VMD calculations with TCL script. So, does anyone know what causes
> > the calculations to slowly consume the SWAP memory and also know the
> > solution to it?
> > Your help will be much appreciated!!
> >
> >
> > Joe
> >
> > --
> > *****************************************
> > Hung-Chung Huang, M. T., M. Sc., Ph. D.
> > Department of Biology and Biochemistry
> > University of Houston, Houston, TX 77204
> > Tel: (713) 743-8365, Fax: (713) 743-8351
> > e-mail: HCHuang_at_uh.edu
> > http://prion.bchs.uh.edu/~jhuang
> > *****************************************
> >
>
> --
> 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

-- 
  Justin Gullingsrud        3111 Beckman Institute        217-244-8946
  I been dropping the new science, and I be kicking the new knowledge,
  and I'm seeing to a degree that you can't get in college.  -- b.boys