> From: Scott Dixon [mailto:[email protected]]
> > By the way, it is important to understand the disntinction
> between PyMOL's
> > scripts and Python programs you run your PyMOL -- PyMOL scripts are
> > basically just a linear series of PyMOL commands. For anything more
> > sophisticated, use straight Python.
> Understood. BTW, one way to get part of the benefit of arguments to
> PyMOL scripts is to use named selections and to load molecules into
> specific object names (like say, "ligand"). Then your
> scripts can work
> on the standard names and be more widely reusable. But I take your
> point about Python being much more versatile.
Yes, you can certainly use program state as a means of conveying
information, and you can even use global python variables in this manner
even when operating inside of PyMOL command scripts:
/obj1="hi"
@ex1.pml
# where ex1.pml contains...
reset
/cmd.zoom(obj1)
/cmd.show("spheres",obj1)
NOTE: a forward slash can be used to explicitly include a line of Python
in a PyMOL script. Normally it isn't required (since PyMOL commands
fall back on Python "eval"), but it is more efficient because is
bypasses normal parsing.
Again, I view these approaches as best for limited -- real Python
scripts gives you so much more, with very little added burden.
Cheers,
Warren