From: Axel Kohlmeyer (akohlmey_at_vitae.cmm.upenn.edu)
Date: Tue Mar 14 2006 - 08:20:53 CST

On Tue, 14 Mar 2006, andrea spitaleri wrote:

AS> Hi Axel,

ciao andrea,

AS> thanks for your reply. So if I undestood well *everytime* I add a script
AS> in /usr/local/lib/vmd/scripts/vmd I need to add the lines done by
AS> auto_mkindex in tclIndex file, is it right?

correct. this is why i prefer to have them in a directory different
from the vmd installation (i.e. $HOME/vmd/scripts/tcl). come to
think of it, you can probably tweak your .vmdrc to update this file
every time on startup before you expand your auto_path variable...

regards,
   axel.

AS>
AS> Thanks
AS> Reagards
AS>
AS> andrea
AS>
AS> Axel Kohlmeyer wrote:
AS>
AS> >On Mon, 13 Mar 2006, andrea spitaleri wrote:
AS> >
AS> >AS> Hi Johns,
AS> >AS> the only way to run a own script is first to source it and then use it?
AS> >AS> May vmd load it at start up the script without put it in the $vmddir/script?
AS> >AS> I couldn't find it any answer ......
AS> >
AS> >andrea,
AS> >you also can use standard TCL techniques to have scripts autoloaded.
AS> >
AS> >please have a look at:
AS> >http://www.theochem.ruhr-uni-bochum.de/~axel.kohlmeyer/cpmd-vmd/part1.html#chap3_sect3
AS> >
AS> >to make a directory autoloadable, you only need to generate an index
AS> >file i use the following trivial script for it:
AS> >
AS> >#!/usr/bin/tclsh
AS> >
AS> >auto_mkindex . *.tcl
AS> >
AS> >
AS> >note, that the draw extensions (and similar functions) _have_
AS> >to be sourced before they are recognized. but the URL from above
AS> >shows how to do this in a generic way.
AS> >
AS> >regards,
AS> > axel.
AS> >
AS> >AS>
AS> >AS> Reagards,
AS> >AS>
AS> >AS> andrea
AS> >AS>
AS> >AS>
AS> >AS>
AS> >AS> John Stone wrote:
AS> >AS>
AS> >AS> >Hi Lily,
AS> >AS> > Yes, there are various little scripts that can do things like this.
AS> >AS> >Take one of these and cut out the stuff you don't need, as all of these
AS> >AS> >probably do more than you're looking for.
AS> >AS> >
AS> >AS> >Here's one that loads a numerically named sequence of PDB files:
AS> >AS> > http://www.ks.uiuc.edu/Research/vmd/script_library/scripts/animatepdbs/
AS> >AS> >
AS> >AS> >Here's another that loads all of the PDB files in a particular
AS> >AS> >directory using filename globbing (wildcards), which I've used to
AS> >AS> >load the entire PDB into VMD at once, for example:
AS> >AS> >
AS> >AS> >##
AS> >AS> >## Example:
AS> >AS> >## load_all_pdb "/Scr/pdb/data/structures/all/pdb/*.Z" 32000
AS> >AS> >##
AS> >AS> >
AS> >AS> >proc load_all_pdb { pdbfilespec maxcount } {
AS> >AS> > puts "Gathering candidate files."
AS> >AS> > set filelist [glob -types f -- $pdbfilespec]
AS> >AS> > set numfiles [llength $filelist]
AS> >AS> > set count 0
AS> >AS> >
AS> >AS> > if { $numfiles > 0 } {
AS> >AS> > puts "Searching $numfiles PDB files..."
AS> >AS> > foreach {file} $filelist {
AS> >AS> > incr count
AS> >AS> > if {$count > $maxcount} {
AS> >AS> > break;
AS> >AS> > }
AS> >AS> >
AS> >AS> ># puts "$count/$numfiles, loading $file ..."
AS> >AS> >
AS> >AS> > # detect compressed PDB entry by filename, uncompress, and load
AS> >AS> > if { [string match "*.ent.Z" $file] } {
AS> >AS> > file delete /tmp/loadpdb.pdb
AS> >AS> > exec zcat $file > /tmp/loadpdb.pdb
AS> >AS> > mol new /tmp/loadpdb.pdb waitfor all
AS> >AS> ># mol rename top $file
AS> >AS> > } elseif { [string match "*.ent" $file] } {
AS> >AS> > mol new $file type pdb waitfor all
AS> >AS> > } elseif { [string match "*.pdb" $file] } {
AS> >AS> > mol new $file waitfor all
AS> >AS> > } else {
AS> >AS> > # Skip unrecognized structure file formats and PDB files without coords
AS> >AS> > continue;
AS> >AS> > }
AS> >AS> > }
AS> >AS> > puts "Completed loading $numfiles PDB files..."
AS> >AS> > } else {
AS> >AS> > puts "No PDB files found"
AS> >AS> > }
AS> >AS> >}
AS> >AS> >
AS> >AS> >
AS> >AS> >
AS> >AS> >
AS> >AS> >On Fri, Mar 10, 2006 at 11:41:03AM -0800, lily jin wrote:
AS> >AS> >
AS> >AS> >
AS> >AS> >>In the .VMD file, I have :
AS> >AS> >> mol addfile 1.pdb type pdb type pdb waitfor all
AS> >AS> >> mol addfile 2.pdb type pdb type pdb waitfor all
AS> >AS> >> mol addfile 3.pdb type pdb type pdb waitfor all
AS> >AS> >> mol addfile 4.pdb type pdb type pdb waitfor all
AS> >AS> >> mol addfile 5.pdb type pdb type pdb waitfor all
AS> >AS> >> mol addfile 6.pdb type pdb type pdb waitfor all
AS> >AS> >> mol addfile 7.pdb type pdb type pdb waitfor all
AS> >AS> >> mol addfile 8.pdb type pdb type pdb waitfor all
AS> >AS> >> mol addfile 9.pdb type pdb type pdb waitfor all
AS> >AS> >> mol addfile 10.pdb type pdb type pdb waitfor all
AS> >AS> >> Is there a way to do the same in a loop? Thanks!
AS> >AS> >>
AS> >AS> >>
AS> >AS> >>Lily
AS> >AS> >>
AS> >AS> >>---------------------------------
AS> >AS> >>Yahoo! Mail
AS> >AS> >>Bring photos to life! New PhotoMail makes sharing a breeze.
AS> >AS> >>
AS> >AS> >>
AS> >AS>
AS> >AS>
AS> >
AS> >
AS> >
AS>
AS>

-- 
=======================================================================
Axel Kohlmeyer   akohlmey_at_cmm.chem.upenn.edu   http://www.cmm.upenn.edu
   Center for Molecular Modeling   --   University of Pennsylvania
Department of Chemistry, 231 S.34th Street, Philadelphia, PA 19104-6323
tel: 1-215-898-1582,  fax: 1-215-573-6233,  office-tel: 1-215-898-5425
=======================================================================
If you make something idiot-proof, the universe creates a better idiot.