VMD-L Mailing List
From: Warren L. DeLano (warren_at_delanoscientific.com)
Date: Tue Sep 30 2003 - 20:38:19 CDT
- Next message: John Stone: "Re: nvidia driver"
- Previous message: Justin Gullingsrud: "Re: python support and pipes in vmd"
- In reply to: Andrew Dalke: "Re: Python's future in VMD"
- Next in thread: Alan Wilter Sousa da Silva: "Re: Python's future in VMD"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ] [ attachment ]
> > The forseeable plan is retain the services of both languages.
> > Tcl and Python are very different languages. Tcl serves well as an
> > interactive command language, has a mature package system, and has
> > clean bindings for Tk. Python is a nicer language, faster in many
> > cases, and is becoming very popular in this field
>
> There is another option that I first saw in PyMol. Write
> a macro language on top of Python. If the text is Python
> (there's a C API call for that) then it is evaluated as
> Python. Otherwise the line is parsed as a shell line, so
>
> do this or that
>
> gets converted to the Python code
>
> cmd.do("this", "or", "that")
Close, but not quite. Commas still delimit PyMOL arguments. So,
do this, or that, or something else
becomes
cmd.do("this","or that","or something else")
if "do" is a known PyMOL keyword. If not, then the code gets handed off
to Python proper. Thus, PyMOL command scripts can also mix-in embedded
Python, such as:
load test.pdb
color red, 10-40/
print "hi bob"
os.system("/bin/rm tmp.pdb")
for a in range(1,100): \
cmd.load("mov_%04d.pdb","mov")
etc.
By the way, Python named argument support should also be considered:
load ligand.pdb
load bigdensity.map, format=xplor
isomesh mesh1, bigdensity, 1.0, ligand, carve=2.1
Of course, you can also script PyMOL directly using "pure" Python in .py
files run straight out of the system Python interpreter:
# import and wait on initialization of the PyMOL thread
import pymol
pymol.finish_launching()
# now convert a directory of PDB files to a directory of PNG images
from pymol import cmd
cmd.do("movie.load traj*.pdb,mov")
cmd.smooth("mov")
cmd.mpng("img")
These are all things it would be nice to see in VMD too, since PyMOL
lacks VMD's awesome MD trajectory file handling, analysis features,
documentation, or an extensive GUI. PyMOL may occasionally be useful
for some limited quick-and-dirty MD visualization, but clearly that's
not its strong suit.
Cheers,
Warren
- Next message: John Stone: "Re: nvidia driver"
- Previous message: Justin Gullingsrud: "Re: python support and pipes in vmd"
- In reply to: Andrew Dalke: "Re: Python's future in VMD"
- Next in thread: Alan Wilter Sousa da Silva: "Re: Python's future in VMD"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ] [ attachment ]