From: Schreiner Eduard (
Date: Sun Oct 04 2009 - 22:06:21 CDT

Hi Patrick,

something like the following should work (I did not test it)

mol new 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 writepdb frame-$a.pdb
$a delete

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


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