From: John Stone (johns_at_ks.uiuc.edu)
Date: Thu Dec 07 2000 - 09:51:36 CST

Hi,

On Thu, Dec 07, 2000 at 01:51:07PM +0100, Aitor Gonzalez wrote:
> I have a serie of pdb models between a start and an end pdb file. Does
> someone have a script to make it.

  I just wrote up a script which should do the trick for you, you will
just need to use the right format string to make it work for your file
naming conventions, two examples are included. Its a very simple script,
but should work fine for your application. Let us know if you need
more help with this.

Enjoy,
  John Stone
  vmd_at_ks.uiuc.edu

##
## "animatepdbs" - A Tcl script to load a consecutively numbered
## sequence of PDB files.
##
## Parameters:
## start - "frame number" of first PDB file in sequence
## end - "frame number" of last PDB file in sqeuence
## format - a Tcl format string which describes the filename/numbering
## used.
##
## To load a sequence of PDB files named 0.pdb 1.pdb 2.pdb 3.pdb one
## would call this proc with: animatepdbs 0 3 "%d.pdb"
##
## To load a sequence of PDB files named as foo0000.pdb foo0001.pdb foo0002.pdb
## one would call this proc with: animatepdbs 0 2 "foo%04d.pdb"
##

proc animatepdbs {start end fileformat} {
  set filename [format $fileformat [expr $start]]
  incr start
  puts "Reading initial frame in PDB sequence $filename"
  mol load pdb $filename

  puts "Reading PDB files as an animation..."
  for {set i $start} {$i <= $end} {incr i 1} {
    set filename [format $fileformat [expr $i]]
    animate read pdb $filename
  }
}

-- 
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