From: John Stone (johns_at_ks.uiuc.edu)
Date: Fri Mar 10 2006 - 13:47:47 CST

Hi Lily,
  Yes, there are various little scripts that can do things like this.
Take one of these and cut out the stuff you don't need, as all of these
probably do more than you're looking for.

Here's one that loads a numerically named sequence of PDB files:
  http://www.ks.uiuc.edu/Research/vmd/script_library/scripts/animatepdbs/

Here's another that loads all of the PDB files in a particular
directory using filename globbing (wildcards), which I've used to
load the entire PDB into VMD at once, for example:

##
## Example:
## load_all_pdb "/Scr/pdb/data/structures/all/pdb/*.Z" 32000
##

proc load_all_pdb { pdbfilespec maxcount } {
  puts "Gathering candidate files."
  set filelist [glob -types f -- $pdbfilespec]
  set numfiles [llength $filelist]
  set count 0

  if { $numfiles > 0 } {
    puts "Searching $numfiles PDB files..."
    foreach {file} $filelist {
      incr count
      if {$count > $maxcount} {
        break;
      }

# puts "$count/$numfiles, loading $file ..."

      # detect compressed PDB entry by filename, uncompress, and load
      if { [string match "*.ent.Z" $file] } {
        file delete /tmp/loadpdb.pdb
        exec zcat $file > /tmp/loadpdb.pdb
        mol new /tmp/loadpdb.pdb waitfor all
# mol rename top $file
      } elseif { [string match "*.ent" $file] } {
        mol new $file type pdb waitfor all
      } elseif { [string match "*.pdb" $file] } {
        mol new $file waitfor all
      } else {
        # Skip unrecognized structure file formats and PDB files without coords
        continue;
      }
    }
    puts "Completed loading $numfiles PDB files..."
  } else {
    puts "No PDB files found"
  }
}

On Fri, Mar 10, 2006 at 11:41:03AM -0800, lily jin wrote:
> In the .VMD file, I have :
> mol addfile 1.pdb type pdb type pdb waitfor all
> mol addfile 2.pdb type pdb type pdb waitfor all
> mol addfile 3.pdb type pdb type pdb waitfor all
> mol addfile 4.pdb type pdb type pdb waitfor all
> mol addfile 5.pdb type pdb type pdb waitfor all
> mol addfile 6.pdb type pdb type pdb waitfor all
> mol addfile 7.pdb type pdb type pdb waitfor all
> mol addfile 8.pdb type pdb type pdb waitfor all
> mol addfile 9.pdb type pdb type pdb waitfor all
> mol addfile 10.pdb type pdb type pdb waitfor all
> Is there a way to do the same in a loop? Thanks!
>
>
> Lily
>
> ---------------------------------
> Yahoo! Mail
> Bring photos to life! New PhotoMail makes sharing a breeze.

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