https://pymolwiki.org/index.php?title=Symmetry_Axis&feed=atom&action=history
Symmetry Axis - Revision history
2024-03-29T08:45:51Z
Revision history for this page on the wiki
MediaWiki 1.35.7
https://pymolwiki.org/index.php?title=Symmetry_Axis&diff=6392&oldid=prev
Inchoate at 12:50, 30 April 2009
2009-04-30T12:50:53Z
<p></p>
<table class="diff diff-contentalign-left diff-editfont-monospace" data-mw="interface">
<col class="diff-marker" />
<col class="diff-content" />
<col class="diff-marker" />
<col class="diff-content" />
<tr class="diff-title" lang="en">
<td colspan="2" style="background-color: #fff; color: #202122; text-align: center;">← Older revision</td>
<td colspan="2" style="background-color: #fff; color: #202122; text-align: center;">Revision as of 12:50, 30 April 2009</td>
</tr><tr><td colspan="2" class="diff-lineno" id="mw-diff-left-l104" >Line 104:</td>
<td colspan="2" class="diff-lineno">Line 104:</td></tr>
<tr><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div></source></div></td><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div></source></div></td></tr>
<tr><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>[[Category:Script_Library|Symmetry Axis]]</div></td><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>[[Category:Script_Library|Symmetry Axis]]</div></td></tr>
<tr><td colspan="2"> </td><td class='diff-marker'>+</td><td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div><ins style="font-weight: bold; text-decoration: none;">[[Category:Math_Scripts]]</ins></div></td></tr>
</table>
Inchoate
https://pymolwiki.org/index.php?title=Symmetry_Axis&diff=4463&oldid=prev
Momeara: New page: <source lang="python"> ########################################################### # # Pymol script copyright Matthew O'Meara and Xavier Ambroggio 2007 # # Last updated Nov 29, 2007 # # Draw an axis ...
2007-11-30T15:13:28Z
<p>New page: <source lang="python"> ########################################################### # # Pymol script copyright Matthew O'Meara and Xavier Ambroggio 2007 # # Last updated Nov 29, 2007 # # Draw an axis ...</p>
<p><b>New page</b></p><div><source lang="python"><br />
###########################################################<br />
#<br />
# Pymol script copyright Matthew O'Meara and Xavier Ambroggio 2007<br />
#<br />
# Last updated Nov 29, 2007<br />
#<br />
# Draw an axis given a point and a direction. Optionally give color,<br />
# length and width.<br />
#<br />
# Usage: from the pymol menu click file->run... then find this file.<br />
# Then at the prompt, type<br />
#<br />
# draw_axis x,y,z, i,k,j<br />
#<br />
# where (x,y,z) is the point and (i,k,j) is the direction<br />
#<br />
#<br />
# Also one can run the script as follows<br />
#<br />
#<br />
# draw_axis x,y,z, i,k,j, length r,g,b, width,<br />
#<br />
# where (r,g,b) is the color for the line in red, green, colors,<br />
# width is the thickness of the line and length is the length of the<br />
# line.<br />
#<br />
#<br />
# For a fun example of the script run from the command line after the<br />
# script is loaded<br />
#<br />
# draw_axis_example<br />
#<br />
#<br />
<br />
from pymol.cgo import * # get constants<br />
from pymol import cmd<br />
<br />
import math<br />
<br />
class Counter:<br />
def __init__(self):<br />
self.state = 1<br />
counter = Counter()<br />
<br />
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 ):<br />
if x == None or y == None or z == None or i == None or j == None or k== None :<br />
print 'Usage: draw_axis x,y,z, i,k,j, length, r,g,b, width'<br />
print 'draw a line centered at (x,y,z) with the direction vector (i,j,k)'<br />
print 'length, color (r,g,b), and width arguments are optional'<br />
# print 'For a fun example of the command, run draw_axis_example'<br />
else :<br />
x,y,z = float(x), float(y), float(z)<br />
i,j,k = float(i), float(j), float(k)<br />
r,g,b = float(r), float(g), float(b)<br />
width = float(width)<br />
length = float(length) / 2.0<br />
<br />
x1,y1,z1 = (x+i*length,y+j*length,z+k*length)<br />
x2,y2,z2 = (x-i*length,y-j*length,z-k*length)<br />
<br />
obj = [<br />
LINEWIDTH, width,<br />
BEGIN, LINES,<br />
<br />
COLOR, r, g, b,<br />
VERTEX, x1, y1, z1,<br />
VERTEX, x2, y2, z2,<br />
<br />
END<br />
]<br />
<br />
cmd.load_cgo(obj,'axis'+str(counter.state))<br />
counter.state += 1<br />
<br />
cmd.extend("draw_axis", draw_axis)<br />
<br />
# a simple example<br />
#draw_line(x=18.232, y=17.150, z=9.488,<br />
# i=-.226639,j=0.708772,k=-.668039,<br />
# r=1, b=1, g=1,<br />
# width=1, length=1)<br />
<br />
<br />
<br />
<br />
# a more complex example<br />
<br />
#import random<br />
#def example1(n, f):<br />
# """draw a gradient field with n segments with the function f(x,y,z)=(i,j,k)"""<br />
# for i in range(n):<br />
# scale = 4<br />
# x,y,z = [random.random()*scale for i in range(3)]<br />
# i,j,k = f(x,y,z)<br />
<br />
# draw_axis(x,y,z,i,j,k,abs(i),abs(j),abs(k))<br />
<br />
<br />
#def f(x,y,z):<br />
# return (2*x,pow(z,2)+x,y-z)<br />
<br />
#cmd.extend("draw_axis_example", lambda :example1(1000,f))<br />
</source><br />
[[Category:Script_Library|Symmetry Axis]]</div>
Momeara