Tony,
In order to enter multi-line Python code on the command line, you
need to use explicit end-of-line continuations. Otherwise, PyMOL won't know
where your Python code stops and PyMOL commands again begin.
from pymol.cgo import *
from pymol import cmd
set cgo_sphere_quality, 3
def cgo_sphere(x,y,z,r,name="cgo_sphere"): \
# Create a CGO object \
obj = [ \
SPHERE, float(x), float(y), float(z), float(r) \
] \
# Load it into PyMOL \
cmd.load_cgo(obj,name)
# Add to PyMOL command language
cmd.extend("cgo_sphere",cgo_sphere)
# end Python, begin PYMOL commands
cgo_sphere 0,0,0,500,test
--
For example, I can paste the above directly into the PyMOL command line (on
win32), in order to get a sphere on the screen.
A better alternative it to simply put all of that Python code into a ".py"
file and "run" it from within PyMOL.
NOTE: PyMOL doesn't currently render large and small objects together very
efficiently, and there's precious little that you can do about it at the
present time. Increasing hash_max won't help, though decreasing it can give
a modest gain in performance. Sticking exclusively to CPK can also help.
Cheers,
Warren
--
mailto:[email protected]
Warren L. DeLano, Ph.D.
Principal Scientist
DeLano Scientific LLC
Voice (650)-346-1154
Fax (650)-593-4020
> -----Original Message-----
> From: [email protected]
> [mailto:[email protected]] On Behalf Of
> Tony Giannetti
> Sent: Monday, May 10, 2004 12:25 PM
> To: [email protected]
> Subject: [PyMOL] Creating cell surface
>
> Hey Fellow PyMolers,
> I should be able to figure this out but I simply haven't
> after much fiddling and googling. I'm trying to create a
> cell surface for a cover figure and in Molscript I usually
> did this by making a PDF file with a single atom, rendering
> it in CPK, and then blowing its atom_radius way up to several
> thousand angstroms to create a slightly curved surface on
> which molecules could be positioned.
>
> I'm trying this in PyMol and can't figure out the command sequence.
> Basically, how do I alter the radius for a single atom,
> especially because I don't want all atoms I draw as a surface
> to have the same radius?
>
> Alternatively I've been trying to do this with the CGO
> utility using one of Gareth's scripts I found on the web:
>
> from pymol.cgo import *
> from pymol import cmd
>
> def cgo_sphere(x,y,z,r,name="cgo_sphere"):
>
> # Create a CGO object
> obj = [
> SPHERE, float(x), float(y), float(z), float(r)
> ]
>
> # Load it into PyMOL
> cmd.load_cgo(obj,name)
>
> # Add to PyMOL API
> cmd.extend("cgo_sphere",cgo_sphere)
>
>
> But in adding these lines sequentially to the PyMol command
> line, or running it as a script, it fails at:
>
> def cgo_sphere(x,y,z,r,name="cgo_sphere"):
>
> and I get the following error message
>
> def cgo_sphere(x,y,z,r,name="cgo_sphere"):
> Traceback (most recent call last):
> File
> "/Users/delwarl/pymol/products/MacPyMOL.app/pymol/modules/pymo
> l/parser.py",
> line 144, in parse
> exec(com2[nest]+"\n",pymol_names,pymol_names)
> File "<string>", line 1
> def cgo_sphere(x,y,z,r,name="cgo_sphere"):
> ^
> SyntaxError: unexpected EOF while parsing
>
>
> Is there some other way the script is supposed to be used. .
> .I'm using
> MacPyMol 0.95.
>
> Thanks for any tips/help.
> Tony
>
>
>
>
> -------------------------------------------------------
> This SF.Net email is sponsored by Sleepycat Software
> Learn developer strategies Cisco, Motorola, Ericsson & Lucent
> use to deliver
> higher performing products faster, at low TCO.
> http://www.sleepycat.com/telcomwpreg.php?From=osdnemail3
> _______________________________________________
> PyMOL-users mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/pymol-users
>