* Tommy Wang <chern...@ima.org.sg> [2002-05-10 19:52] wrote:
> How do I view the direction vectors i.e. x,y,z in pymol?
> 

This is how I would do it.  Create a python script (I call it axes.py):

# axes.py
from pymol.cgo import *
from pymol import cmd
from pymol.vfont import plain

# create the axes object, draw axes with cylinders coloured red, green,
#blue for X, Y and Z

obj = [
   CYLINDER, 0., 0., 0., 10., 0., 0., 0.2, 1.0, 1.0, 1.0, 1.0, 0.0, 0.,
   CYLINDER, 0., 0., 0., 0., 10., 0., 0.2, 1.0, 1.0, 1.0, 0., 1.0, 0.,
   CYLINDER, 0., 0., 0., 0., 0., 10., 0.2, 1.0, 1.0, 1.0, 0., 0.0, 1.0,
   ]

# add labels to axes object (requires pymol version 0.8 or greater, I
# believe

cyl_text(obj,plain,[-5.,-5.,-1],'Origin',0.20,axes=[[3,0,0],[0,3,0],[0,0,3]])
cyl_text(obj,plain,[10.,0.,0.],'X',0.20,axes=[[3,0,0],[0,3,0],[0,0,3]])
cyl_text(obj,plain,[0.,10.,0.],'Y',0.20,axes=[[3,0,0],[0,3,0],[0,0,3]])
cyl_text(obj,plain,[0.,0.,10.],'Z',0.20,axes=[[3,0,0],[0,3,0],[0,0,3]])

# then we load it into PyMOL
cmd.load_cgo(obj,'axes')

################### end of script

Then you just need to do "run axes.py" from the pymol command line.

You can modify the "3" in the above description of the text labels to
change the size of the labels.  If you are running a version of pymol
older the 0.8, then you cannot add the text (that's why I included
colour coding of the axes).  You can also use just lines instead of
cylinders if you wish:

obj = [
   BEGIN, LINES,
   COLOR, 1.0, 0.0, 0.0,
   VERTEX, 0.0, 0.0, 0.0, VERTEX, 10.0, 0.0, 0.0,
   COLOR, 0.0, 1.0, 0.0,
   VERTEX, 0.0, 0.0, 0.0, VERTEX, 0.0, 10.0, 0.0,
   COLOR, 0.0, 0.0, 1.0,
   VERTEX, 0.0, 0.0, 0.0, VERTEX, 0.0, 0.0, 10.0,
   END,
   ]

would work as well to define the axes object.

Cheers,
Robert
-- 
Robert L. Campbell, Ph.D.               http://biophysics.med.jhmi.edu/rlc
r...@k2.med.jhmi.edu                                    phone: 410-614-6313
Research Specialist/X-ray Facility Manager
HHMI/Dept. of Biophysics & Biophysical Chem., The Johns Hopkins University
    PGP Fingerprint: 9B49 3D3F A489 05DC B35C  8E33 F238 A8F5 F635 C0E2

Reply via email to