From: Chang, Christopher (Christopher_Chang_at_nrel.gov)
Date: Wed Nov 16 2005 - 17:05:41 CST

Hi John,

   Thanks for the reply. For the archives, the following script template
seems handy for limiting memory usage during DCD coordinate extraction.
The example is for a 2000-frame DCD file to be sectioned into 10 pieces,
extracting the atoms of interest for each 200-frame section, then the
sections concatenated after extraction using Justin's catdcd script.

mol new hydferr42ahsd_xplor.psf
for {set i 0} {$i < 10} {incr i} {
   set a [expr $i * 200]
   set b [expr $a + 199]
   animate read dcd dyn_1.0ns_out.dcd beg $a end $b waitfor all top
   set temp [atomselect top "segname HYDR HYDH FERR FRC1"]
   animate write dcd temp_$i.dcd beg 0 end 199 sel $temp waitfor all top
   animate delete all
}
for {set i 0} {$i < 9} {incr i} {
   set a [expr $i + 1]
   exec catdcd -o new.dcd temp_$i.dcd temp_$a.dcd
   exec mv new.dcd temp_$a.dcd
   exec rm temp_$i.dcd
}
exec mv temp_9.dcd final_extracted.dcd

Cheers,

Chris

> -----Original Message-----
> From: John Stone [mailto:johns_at_ks.uiuc.edu]
> Sent: Wednesday, November 16, 2005 2:01 PM
> To: Chang, Christopher
> Cc: Nuno R. L. Ferreira; vmd-l_at_ks.uiuc.edu
> Subject: Re: vmd-l: Appending to DCD file with "animate write"
>
> Hi,
> DCD files cannot be concatenated with simple shell commands
> because they contain a file header at the the beginning. You
> could conceivably truncate the front end of the file using
> 'dd' or something, and then concatenate them, but using
> 'catdcd' is the right way to do this.
> At present VMD doesn't provide a means to append frames to
> existing trajectory files, it can only create new files from
> scratch from the trajectory timesteps that are resident in
> memory, so for your purposes 'catdcd' is the right tool for the job.
>
> John Stone
> vmd_at_ks.uiuc.edu
>
> On Wed, Nov 16, 2005 at 12:42:36PM -0700, Chang, Christopher wrote:
> > Nuno,
> >
> > Do you know if cat'ing DCD files will work like this? If not, I
> > could call Justin Gullingsrud's catdcd utility just as
> well, I guess.
> > Thanks for the suggestion!
> >
> > Best,
> >
> > Chris
> >
> >
> > _____
> >
> > From: Nuno R. L. Ferreira [mailto:nunolf_at_ci.uc.pt]
> > Sent: Wednesday, November 16, 2005 12:36 PM
> > To: Chang, Christopher
> > Subject: Re: vmd-l: Appending to DCD file with "animate write"
> >
> >
> > What about
> >
> > animate write dcd tmp.dcd beg $a end $a waitfor all sel
> $selection
> > top
> > cat tmp.dcd >> outname.dcd
> >
> > inside a loop?
> >
> > N.
> >
> >
> > ----- Original Message -----
> > From: Chang, Christopher
> > <mailto:Christopher_Chang_at_nrel.gov>
> > To: vmd-l_at_ks.uiuc.edu
> > Sent: Wednesday, November 16, 2005 7:11 PM
> > Subject: vmd-l: Appending to DCD file with
> "animate write"
> >
> >
> > Hi,
> >
> > I am extracting an atom selection from very
> large DCD files, and
> > would like to script something that will use a loop to read
> a frame,
> > then append the atomselection to a new DCD file to lower memory
> > demands. Can "animate write" do this? Right now the command
> >
> > animate write dcd outname.dcd beg $a end $a
> waitfor all sel
> > $selection top
> >
> > in the loop with counter "a" and atomselection
> "$selection"
> > overwrites each (a-1)th structure with the (a)th one.
> >
> > Thanks,
> >
> > Chris
> >
> >
> >
> > _____
> >
> > avast! Antivirus <http://www.avast.com> : Inbound message clean.
> >
> > Virus Database (VPS): 0546-3, 16-11-2005 Tested on: 16-11-2005
> > 19:29:28 avast! - copyright (c) 1988-2005 ALWIL Software.
> >
> >
> >
> >
> > _____
> >
> > avast! Antivirus <http://www.avast.com> : Outbound message clean.
> >
> > Virus Database (VPS): 0546-3, 16-11-2005 Tested on: 16-11-2005
> > 19:36:32 avast! - copyright (c) 1988-2005 ALWIL Software.
> >
> >
>
> --
> 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
>