CGOCylinder

From PyMOLWiki
Revision as of 08:18, 9 July 2009 by Inchoate (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Overview

CGO cylinders are compiled graphics cylinder objects. If you set the cylinder height to something very small, you can mimic a circle (see examples).

Examples

# Cylinder #1 on left.
x1,y1,z1 = 10, 0, 0 # start point
r1,g1,b1 = 1,0,0 # color (red)
x2,y2,z2 = 0.1, 0, 0 # end point
r2,g2,b2 = 1,1,0 # color (yellow)
radius = 10
cmd.load_cgo( [ 9.0, x1, y1, z1, x2, y2, z2, radius, r1, g1, b1, r2, g2, b2 ], "cylinder1" )

# Cylinder #2 (the circle)
x1,y1,z1 = -0.1, 0, 0 # start point
r1,g1,b1 = 1,0,0 # color (red)
x2,y2,z2 = 0.1, 0, 0 # end point
r2,g2,b2 = 1,1,0 # color (yellow)
radius = 10
cmd.load_cgo( [ 9.0, x1, y1, z1, x2, y2, z2, radius, r1, g1, b1, r2, g2, b2 ], "cylinder2" )

# to make the cylinder transparent, use
cmd.load_cgo( [ 25.0, 0.25, 9.0, x1, y1, z1, x2, y2, z2, radius, r1, g1, b1, r2, g2, b2 ], "cylinder1" )

Usage

cmd.load_cgo( [ a1, a2, cylSpec, x1, y1, z1, x2, y2, z2, radius, r1, g1, b1, r2, g2, b2 ], objName )

The parameters are:

a1, a2

a1=25 means 'ALPHA' (if you do from pymol.cgo import * you can then use CGO keywords, like ALPHA, CYLINDER, etc. So, if a1="25.0" then set a2 to some value in the range 0-1.

cylSpec

Cylinder specification: set this to 9.0 or if you did from pymol.cgo import * you can then use "CYLINDER", here.

x1, y1, z1

coordinates for one end of the cylinder

x2, y2, z2

coordinates for one end of the cylinder

radius

radius of the cylinder

r1, b1, g1

color one, (a triplet of values in the range 0-1

r2, b2, g2

color two, (a triplet of values in the range 0-1; this allows a gradient

objName

Name of cylinder object in PyMOL

References

PyMOL list. Thanks to Tsjerk.