From: Nicholas Musolino (musolino_at_mit.edu)
Date: Sun Apr 18 2010 - 20:14:36 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?

OPTION 1:
Write a BASH script to run VMD 2000 times, and each time process a file.
#!/bin/bash
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.
EOF
}

OPTION 2:
List all those files at the VMD command line. You should look at http://www.ks.uiuc.edu/Research/vmd/current/ug/node204.html

$ 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: http://www.mail-archive.com/uug-list@uug.byu.edu/msg19010.html.

OPTION 3:
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 http://www.ks.uiuc.edu/Research/vmd/current/ug/node135.html. 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. I also tried sending it to vmd-l-digest at first, so if there was somehow a double-post, I doubly apologize.

Best regards,
Nicholas Musolno

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