From: Axel Kohlmeyer (akohlmey_at_gmail.com)
Date: Mon Oct 05 2009 - 01:41:49 CDT

On Sun, 2009-10-04 at 22:06 -0500, Schreiner Eduard wrote:
> Hi Patrick,
>
> something like the following should work (I did not test it)
>
> mol new yourtraj.xyz waitfor all
> set nr_frames [molinfo 0 get numframes ]
> set a [atomselect top "all" frame 0]
>
> for {set fr 0} {$fr < $nr_frames} {incr fr } {
> $a frame $fr
> $a update

$a update is not needed for an "all" selection.
the number of atoms in the selection will not change.

> $a writepdb frame-$a.pdb

this cannot work ($a is the selection and $fr the loop variable)
to get _exactly_ what was asked for try:
    $a writepdb [format "frame-%03d.pdb" $fr]

> }
> $a delete
>
>
> keep in mind, the size (storage space) requirements will increase
> if you go from xyz to pdb format.

not that much. the .pdb format drops a lot
of precision on the coordinates. this is different
if you start from a binary format.

cheers,
    axel.

>
>
> eddi
>
>
> On Oct 4, 2009, at 9:48 PM, Patrick Redmill wrote:
>
> > Hi all,
> > I think this is an easy question, hope I'm right. I have an xyz
> > trajectory, and I wish to loop through each frame and save each
> > frame as an individual .pdb file (numbered 000.pdb, 001.pdb,
> > 002.pdb, ... etc.). I don't need any of the extra connectivity data
> > that comes with the pdb, just the format change. This is easily done
> > in the GUI with File > Save coordinates, but given that I may be
> > dealing with a few hundred frames, I'd like to automate it if
> > possible. Thanks in advance!
> >
> > Patrick
> >
> >
>
>
> =====================================================
> Eduard Schreiner
> Theoretical and Computational Biophysics Group
> NIH Resource for Macromolecular Modeling and Bioinformatics
> Beckman Institute for Advanced Science and Technology
> University of Illinois, 405 N. Mathews Ave., Urbana, IL 61801
> Phone: 217-244-4361
> Fax: 217-244-6078
> http://www.ks.uiuc.edu/~eschrein/
> =============================================
>

-- 
Dr. Axel Kohlmeyer  akohlmey_at_gmail.com 
Institute for Computational Molecular Science
College of Science and Technology
Temple University, Philadelphia PA, USA.