<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://wiki.pymol.org/index.php?action=history&amp;feed=atom&amp;title=Symmetry_Axis</id>
	<title>Symmetry Axis - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.pymol.org/index.php?action=history&amp;feed=atom&amp;title=Symmetry_Axis"/>
	<link rel="alternate" type="text/html" href="https://wiki.pymol.org/index.php?title=Symmetry_Axis&amp;action=history"/>
	<updated>2026-05-08T05:29:29Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.35.1</generator>
	<entry>
		<id>https://wiki.pymol.org/index.php?title=Symmetry_Axis&amp;diff=10541&amp;oldid=prev</id>
		<title>Bell: 2 revisions</title>
		<link rel="alternate" type="text/html" href="https://wiki.pymol.org/index.php?title=Symmetry_Axis&amp;diff=10541&amp;oldid=prev"/>
		<updated>2014-03-28T03:56:03Z</updated>

		<summary type="html">&lt;p&gt;2 revisions&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;&amp;lt;source lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
###########################################################&lt;br /&gt;
#&lt;br /&gt;
#  Pymol script copyright Matthew O'Meara and Xavier Ambroggio 2007&lt;br /&gt;
#&lt;br /&gt;
#  Last updated Nov 29, 2007&lt;br /&gt;
#&lt;br /&gt;
#  Draw an axis given a point and a direction.  Optionally give color,&lt;br /&gt;
#  length and width.&lt;br /&gt;
#&lt;br /&gt;
#  Usage: from the pymol menu click file-&amp;gt;run...  then find this file.&lt;br /&gt;
#  Then at the prompt, type&lt;br /&gt;
#&lt;br /&gt;
#           draw_axis x,y,z, i,k,j&lt;br /&gt;
#&lt;br /&gt;
#  where (x,y,z) is the point and (i,k,j) is the direction&lt;br /&gt;
#&lt;br /&gt;
#&lt;br /&gt;
#  Also one can run the script as follows&lt;br /&gt;
#&lt;br /&gt;
#&lt;br /&gt;
#           draw_axis x,y,z, i,k,j, length r,g,b, width,&lt;br /&gt;
#&lt;br /&gt;
#  where (r,g,b) is the color for the line in red, green, colors,&lt;br /&gt;
#  width is the thickness of the line and length is the length of the&lt;br /&gt;
#  line.&lt;br /&gt;
#&lt;br /&gt;
#&lt;br /&gt;
#  For a fun example of the script run from the command line after the&lt;br /&gt;
#  script is loaded&lt;br /&gt;
#&lt;br /&gt;
#           draw_axis_example&lt;br /&gt;
#&lt;br /&gt;
#&lt;br /&gt;
&lt;br /&gt;
from pymol.cgo import *    # get constants&lt;br /&gt;
from pymol import cmd&lt;br /&gt;
&lt;br /&gt;
import math&lt;br /&gt;
&lt;br /&gt;
class Counter:&lt;br /&gt;
   def __init__(self):&lt;br /&gt;
       self.state = 1&lt;br /&gt;
counter = Counter()&lt;br /&gt;
&lt;br /&gt;
def draw_axis(x=None, y=None, z=None, i=None, j=None, k=None, length=20.0, r=1.0, g=1.0, b=1.0, width=1.0 ):&lt;br /&gt;
   if x == None or y == None or z == None or i == None or j == None or k== None :&lt;br /&gt;
       print 'Usage: draw_axis x,y,z, i,k,j, length, r,g,b, width'&lt;br /&gt;
       print 'draw a line centered at (x,y,z) with the direction vector (i,j,k)'&lt;br /&gt;
       print 'length, color (r,g,b), and width arguments are optional'&lt;br /&gt;
#        print 'For a fun example of the command, run draw_axis_example'&lt;br /&gt;
   else :&lt;br /&gt;
       x,y,z = float(x), float(y), float(z)&lt;br /&gt;
       i,j,k = float(i), float(j), float(k)&lt;br /&gt;
       r,g,b = float(r), float(g), float(b)&lt;br /&gt;
       width = float(width)&lt;br /&gt;
       length = float(length) / 2.0&lt;br /&gt;
&lt;br /&gt;
       x1,y1,z1 = (x+i*length,y+j*length,z+k*length)&lt;br /&gt;
       x2,y2,z2 = (x-i*length,y-j*length,z-k*length)&lt;br /&gt;
&lt;br /&gt;
       obj = [&lt;br /&gt;
           LINEWIDTH, width,&lt;br /&gt;
           BEGIN, LINES,&lt;br /&gt;
&lt;br /&gt;
           COLOR,   r,  g,  b,&lt;br /&gt;
           VERTEX, x1, y1, z1,&lt;br /&gt;
           VERTEX, x2, y2, z2,&lt;br /&gt;
&lt;br /&gt;
           END&lt;br /&gt;
           ]&lt;br /&gt;
&lt;br /&gt;
       cmd.load_cgo(obj,'axis'+str(counter.state))&lt;br /&gt;
       counter.state += 1&lt;br /&gt;
&lt;br /&gt;
cmd.extend(&amp;quot;draw_axis&amp;quot;, draw_axis)&lt;br /&gt;
&lt;br /&gt;
# a simple example&lt;br /&gt;
#draw_line(x=18.232,  y=17.150,  z=9.488,&lt;br /&gt;
#          i=-.226639,j=0.708772,k=-.668039,&lt;br /&gt;
#          r=1,       b=1,       g=1,&lt;br /&gt;
#          width=1,   length=1)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
# a more complex example&lt;br /&gt;
&lt;br /&gt;
#import random&lt;br /&gt;
#def example1(n, f):&lt;br /&gt;
#    &amp;quot;&amp;quot;&amp;quot;draw a gradient field with n segments with the function f(x,y,z)=(i,j,k)&amp;quot;&amp;quot;&amp;quot;&lt;br /&gt;
#    for i in range(n):&lt;br /&gt;
#        scale = 4&lt;br /&gt;
#        x,y,z = [random.random()*scale for i in range(3)]&lt;br /&gt;
#        i,j,k = f(x,y,z)&lt;br /&gt;
&lt;br /&gt;
#        draw_axis(x,y,z,i,j,k,abs(i),abs(j),abs(k))&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
#def f(x,y,z):&lt;br /&gt;
#    return (2*x,pow(z,2)+x,y-z)&lt;br /&gt;
&lt;br /&gt;
#cmd.extend(&amp;quot;draw_axis_example&amp;quot;, lambda :example1(1000,f))&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
[[Category:Script_Library|Symmetry Axis]]&lt;br /&gt;
[[Category:Math_Scripts]]&lt;/div&gt;</summary>
		<author><name>Bell</name></author>
	</entry>
	<entry>
		<id>https://wiki.pymol.org/index.php?title=Symmetry_Axis&amp;diff=10539&amp;oldid=prev</id>
		<title>Momeara: New page: &lt;source lang=&quot;python&quot;&gt; ########################################################### # #  Pymol script copyright Matthew O'Meara and Xavier Ambroggio 2007 # #  Last updated Nov 29, 2007 # #  Draw an axis ...</title>
		<link rel="alternate" type="text/html" href="https://wiki.pymol.org/index.php?title=Symmetry_Axis&amp;diff=10539&amp;oldid=prev"/>
		<updated>2007-11-30T15:13:28Z</updated>

		<summary type="html">&lt;p&gt;New page: &amp;lt;source lang=&amp;quot;python&amp;quot;&amp;gt; ########################################################### # #  Pymol script copyright Matthew O&amp;#039;Meara and Xavier Ambroggio 2007 # #  Last updated Nov 29, 2007 # #  Draw an axis ...&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;&amp;lt;source lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
###########################################################&lt;br /&gt;
#&lt;br /&gt;
#  Pymol script copyright Matthew O'Meara and Xavier Ambroggio 2007&lt;br /&gt;
#&lt;br /&gt;
#  Last updated Nov 29, 2007&lt;br /&gt;
#&lt;br /&gt;
#  Draw an axis given a point and a direction.  Optionally give color,&lt;br /&gt;
#  length and width.&lt;br /&gt;
#&lt;br /&gt;
#  Usage: from the pymol menu click file-&amp;gt;run...  then find this file.&lt;br /&gt;
#  Then at the prompt, type&lt;br /&gt;
#&lt;br /&gt;
#           draw_axis x,y,z, i,k,j&lt;br /&gt;
#&lt;br /&gt;
#  where (x,y,z) is the point and (i,k,j) is the direction&lt;br /&gt;
#&lt;br /&gt;
#&lt;br /&gt;
#  Also one can run the script as follows&lt;br /&gt;
#&lt;br /&gt;
#&lt;br /&gt;
#           draw_axis x,y,z, i,k,j, length r,g,b, width,&lt;br /&gt;
#&lt;br /&gt;
#  where (r,g,b) is the color for the line in red, green, colors,&lt;br /&gt;
#  width is the thickness of the line and length is the length of the&lt;br /&gt;
#  line.&lt;br /&gt;
#&lt;br /&gt;
#&lt;br /&gt;
#  For a fun example of the script run from the command line after the&lt;br /&gt;
#  script is loaded&lt;br /&gt;
#&lt;br /&gt;
#           draw_axis_example&lt;br /&gt;
#&lt;br /&gt;
#&lt;br /&gt;
&lt;br /&gt;
from pymol.cgo import *    # get constants&lt;br /&gt;
from pymol import cmd&lt;br /&gt;
&lt;br /&gt;
import math&lt;br /&gt;
&lt;br /&gt;
class Counter:&lt;br /&gt;
   def __init__(self):&lt;br /&gt;
       self.state = 1&lt;br /&gt;
counter = Counter()&lt;br /&gt;
&lt;br /&gt;
def draw_axis(x=None, y=None, z=None, i=None, j=None, k=None, length=20.0, r=1.0, g=1.0, b=1.0, width=1.0 ):&lt;br /&gt;
   if x == None or y == None or z == None or i == None or j == None or k== None :&lt;br /&gt;
       print 'Usage: draw_axis x,y,z, i,k,j, length, r,g,b, width'&lt;br /&gt;
       print 'draw a line centered at (x,y,z) with the direction vector (i,j,k)'&lt;br /&gt;
       print 'length, color (r,g,b), and width arguments are optional'&lt;br /&gt;
#        print 'For a fun example of the command, run draw_axis_example'&lt;br /&gt;
   else :&lt;br /&gt;
       x,y,z = float(x), float(y), float(z)&lt;br /&gt;
       i,j,k = float(i), float(j), float(k)&lt;br /&gt;
       r,g,b = float(r), float(g), float(b)&lt;br /&gt;
       width = float(width)&lt;br /&gt;
       length = float(length) / 2.0&lt;br /&gt;
&lt;br /&gt;
       x1,y1,z1 = (x+i*length,y+j*length,z+k*length)&lt;br /&gt;
       x2,y2,z2 = (x-i*length,y-j*length,z-k*length)&lt;br /&gt;
&lt;br /&gt;
       obj = [&lt;br /&gt;
           LINEWIDTH, width,&lt;br /&gt;
           BEGIN, LINES,&lt;br /&gt;
&lt;br /&gt;
           COLOR,   r,  g,  b,&lt;br /&gt;
           VERTEX, x1, y1, z1,&lt;br /&gt;
           VERTEX, x2, y2, z2,&lt;br /&gt;
&lt;br /&gt;
           END&lt;br /&gt;
           ]&lt;br /&gt;
&lt;br /&gt;
       cmd.load_cgo(obj,'axis'+str(counter.state))&lt;br /&gt;
       counter.state += 1&lt;br /&gt;
&lt;br /&gt;
cmd.extend(&amp;quot;draw_axis&amp;quot;, draw_axis)&lt;br /&gt;
&lt;br /&gt;
# a simple example&lt;br /&gt;
#draw_line(x=18.232,  y=17.150,  z=9.488,&lt;br /&gt;
#          i=-.226639,j=0.708772,k=-.668039,&lt;br /&gt;
#          r=1,       b=1,       g=1,&lt;br /&gt;
#          width=1,   length=1)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
# a more complex example&lt;br /&gt;
&lt;br /&gt;
#import random&lt;br /&gt;
#def example1(n, f):&lt;br /&gt;
#    &amp;quot;&amp;quot;&amp;quot;draw a gradient field with n segments with the function f(x,y,z)=(i,j,k)&amp;quot;&amp;quot;&amp;quot;&lt;br /&gt;
#    for i in range(n):&lt;br /&gt;
#        scale = 4&lt;br /&gt;
#        x,y,z = [random.random()*scale for i in range(3)]&lt;br /&gt;
#        i,j,k = f(x,y,z)&lt;br /&gt;
&lt;br /&gt;
#        draw_axis(x,y,z,i,j,k,abs(i),abs(j),abs(k))&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
#def f(x,y,z):&lt;br /&gt;
#    return (2*x,pow(z,2)+x,y-z)&lt;br /&gt;
&lt;br /&gt;
#cmd.extend(&amp;quot;draw_axis_example&amp;quot;, lambda :example1(1000,f))&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
[[Category:Script_Library|Symmetry Axis]]&lt;/div&gt;</summary>
		<author><name>Momeara</name></author>
	</entry>
</feed>