From: Leonardo Trabuco (ltrabuco_at_ks.uiuc.edu)
Date: Tue Aug 29 2006 - 02:02:52 CDT

Hi,

On Tue, Aug 29, 2006 at 02:27:52PM +0800, wang wrote:
> Dear all ,
> I used VMD software to transform dcd file (from NAMD) into pdb format file .
> There are 30000 frames in dcd file . But I only tranfromed 4500 pdb files .
> Could you tell me how to fix the problem ?
> thx
> wang ^^

You have a memory leak in your script: at every frame you are creating a
new atom selection, and then the reference to the selection is lost, but
the memory is not freed. Besides, creating a new selection for every
frame is way slower than creating one selection and changing the frame
every time.

> my script
> _____________________________________________________
> mol load psf all.psf dcd 1.dcd
> set nf [molinfo top get numframes]
> for {set i 0 } {$i < $nf} {incr i}
> {
> set all [atomselect top all frame $i ]
> $all writepdb $i.pdb
> }

You want something like this:

mol load psf all.psf dcd 1.dcd
set nf [molinfo top get numframes]
set all [atomselect top all]
for { set i 0 } { $i < $nf } { incr i } {
  $all frame $i
  $all writepdb $i.pdb
}
$all delete

Let us know if this solves your problem.

Best,
Leo

-- 
Leonardo Trabuco, Ph.D. candidate
Theoretical and Computational Biophysics Group
University of Illinois at Urbana-Champaign