From: Nicholas Musolino (
Date: Sun Apr 18 2010 - 12:13:12 CDT

On Apr 18, 2010, at 12:18 PM, vmd-l digest wrote:
> I want to load 2000 pdb files at once with these format: SNAP1.pdb,
> SNAP2.pdb, ...., SNAP2000.pdb with coloring format of ResName. I tried the
> available scripts but I could not get that done. I would be appreciated if
> somebody can help me!
> Many thanks,
> Fatima

Dear Fatima,

I will suggest three options, depending on what you mean when you say you want to load them at once. Do you mean you want all 2000 files loaded in VMD at the same time? Or that you don't want to type something 2000 times?

Write a BASH script to run VMD 2000 times, and each time process a file.
for (( i=1; i<=2000; i++))
        vmd -dispdev text -eofexit -pdb SNAP${i}.pdb <<EOF > output${i}.txt
        # INSERT VMD text commands here.
        set allsel [ atomselect top "all" ]
        etc. etc.

List all those files at the VMD command line. You should look at

$ vmd -f SNAP*.pdb # will load all PDBs into one molecule
$ vmd -m SNAP*.pdb # will load all PDBs into separate molecules
This will launch vmd in interactive mode; you could also use a script with the "-e" command-line option. Make sure you understand the meaning of "molecule" in the context of VMD, i.e. as a "system," not a chemical molecule. Also, if bash complains about the number of arguments, see this page:

Process each file in VMD in a loop through the TCL interface. In VMD you could use the following text commands:
mol new -psf my_system.psf
for { set i 1} { $i < 2000 } { incr i} {
        set filename [ concat SNAP $i .pdb ]
        mol addfile -pdb $filename autobonds off
Here you should look at I think these will load into subsequent frames.

IMPORTANT NOTE: I just typed all the above into my mail message and didn't test any of the above. They might require some tweaking/syntax correction.

Finally, sorry if anyone else replied to this message while I was composing. I get the VMD-L in digest form and might have missed a message.

Best regards,
Nicholas Musolno

Nicholas Musolino
Ph.D. candidate, Department of Chemical Engineering, MIT | 617-253-6675 | Room E19-528