<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://wiki.pymol.org/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Pete0934</id>
	<title>PyMOL Wiki - User contributions [en]</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.pymol.org/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Pete0934"/>
	<link rel="alternate" type="text/html" href="https://wiki.pymol.org/index.php/Special:Contributions/Pete0934"/>
	<updated>2026-04-05T12:16:29Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.35.1</generator>
	<entry>
		<id>https://wiki.pymol.org/index.php?title=Python_Integration&amp;diff=8498</id>
		<title>Python Integration</title>
		<link rel="alternate" type="text/html" href="https://wiki.pymol.org/index.php?title=Python_Integration&amp;diff=8498"/>
		<updated>2010-05-05T12:19:39Z</updated>

		<summary type="html">&lt;p&gt;Pete0934: /* Launching PyMOL from Python programs */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Launching Python programs from PyMOL ==&lt;br /&gt;
Running a Python script from PyMOL, usually the command:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
run script.py&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
Is enough. Of course, the file script.py needs to be in the working directory.&lt;br /&gt;
You can also launch Python scripts when starting PyMOL. Asynchronous means, that a new Python thread is started:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
pymol example.py     # synchronous, in PyMOL module&lt;br /&gt;
pymol -r example.py  # synchronous in __main__ module&lt;br /&gt;
pymol -l example.py  # asychronous in a new module&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You can also launch python programs from within PyMOL with the commands:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
run example.py        # synchronous in pymol module&lt;br /&gt;
run example.py,main   # synchronous in __main__ module&lt;br /&gt;
&lt;br /&gt;
spawn example.py        # asychronous in a new module&lt;br /&gt;
spawn example.py,global # asychronous in the PyMOL module&lt;br /&gt;
spawn example.py,main   # asychronous in the __main__ module&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Launching PyMOL from Python programs==&lt;br /&gt;
Running PyMOL from a Python script requires two commands:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
import pymol&lt;br /&gt;
pymol.finish_launching()&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If using a single script to produce multiple figures, then the reinitialize() command is necessary between parts of the script. This can be made to run silently (without launching the PyMOL GUI) by using the __main__ commands. It is sometimes also necessary to put in a small delay (sleep) in order to allow PyMOL to finish processing the prior step. An example script might be:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
import __main__&lt;br /&gt;
__main__.pymol_argv = ['pymol','-qc'] # Pymol: quiet and no GUI&lt;br /&gt;
from time import sleep&lt;br /&gt;
import pymol&lt;br /&gt;
pymol.finish_launching()&lt;br /&gt;
&lt;br /&gt;
for index in [1,2,3]:&lt;br /&gt;
    pymol.cmd.reinitialize()&lt;br /&gt;
    # Desired pymol commands here to produce and save figures&lt;br /&gt;
    sleep(0.5) # (in seconds)&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Using the PyMOL commandline==&lt;br /&gt;
&lt;br /&gt;
Are you aware that the PyMOL command line is also a Python command line? You can just use PyMOL interactively in that fashion.&lt;br /&gt;
&amp;lt;source lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
PyMOL&amp;gt;print 1+1&lt;br /&gt;
2&lt;br /&gt;
PyMOL&amp;gt;from random import random&lt;br /&gt;
PyMOL&amp;gt;print random()&lt;br /&gt;
0.739460642143&lt;br /&gt;
&lt;br /&gt;
The only major difference is that the default namespace for PyMOL is &amp;quot;pymol&amp;quot; not &amp;quot;__main__&amp;quot;&lt;br /&gt;
&lt;br /&gt;
PyMOL&amp;gt;print __name__&lt;br /&gt;
pymol&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;/div&gt;</summary>
		<author><name>Pete0934</name></author>
	</entry>
	<entry>
		<id>https://wiki.pymol.org/index.php?title=Ray_shadows&amp;diff=10007</id>
		<title>Ray shadows</title>
		<link rel="alternate" type="text/html" href="https://wiki.pymol.org/index.php?title=Ray_shadows&amp;diff=10007"/>
		<updated>2010-05-05T12:06:23Z</updated>

		<summary type="html">&lt;p&gt;Pete0934: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=== OVERVIEW ===&lt;br /&gt;
The '''ray_shadows''' setting determines whether or not PyMOL will ray trace shadows.  This is also related to the '''ray_shadow''' setting.&lt;br /&gt;
&lt;br /&gt;
=== SYNTAX ===&lt;br /&gt;
&amp;lt;source lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
# turn on ray traced shadows&lt;br /&gt;
set ray_shadows, on&lt;br /&gt;
set ray_shadows, 1&lt;br /&gt;
&lt;br /&gt;
# turn off ray traced shadows&lt;br /&gt;
set ray_shadows, off&lt;br /&gt;
set ray_shadows, 0&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===PYMOL API===&lt;br /&gt;
&amp;lt;source lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
cmd.set('ray_shadows','on')&lt;br /&gt;
cmd.set('ray_shadows','off')&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== EXAMPLES ===&lt;br /&gt;
To illustrate the difference, look at the two following images:&lt;br /&gt;
&amp;lt;gallery&amp;gt;&lt;br /&gt;
Image:Ray_shadow_off.png|Ray_shadow turned off.  Click on the image to see the full detail.&lt;br /&gt;
Image:Ray_shadow_on.png|Ray_shadow turned on.  Click on the image to see the full detail.&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[Category:Settings|Ray shadows]]&lt;/div&gt;</summary>
		<author><name>Pete0934</name></author>
	</entry>
	<entry>
		<id>https://wiki.pymol.org/index.php?title=Rotate&amp;diff=9578</id>
		<title>Rotate</title>
		<link rel="alternate" type="text/html" href="https://wiki.pymol.org/index.php?title=Rotate&amp;diff=9578"/>
		<updated>2008-05-13T21:47:06Z</updated>

		<summary type="html">&lt;p&gt;Pete0934: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;===DESCRIPTION===&lt;br /&gt;
'''rotate''' can be used to rotate the atomic coordinates of a molecular object.  Behavior differs depending on whether or not the '''object''' parameter is specified.&lt;br /&gt;
 &lt;br /&gt;
If object is '''None''', then rotate rotates the atomic coordinates according to the axes and angle for the selection and state provided.  All presentation geometries will need to be regenerated to reflect the new atomic coordinates.&lt;br /&gt;
&lt;br /&gt;
If object is set to an object name, then selection and state are ignored and instead of translating the atomic coordinates, the object's representation display matrix is modified.  This option is for use in animations only.&lt;br /&gt;
&lt;br /&gt;
===USAGE===&lt;br /&gt;
 rotate axis, angle [,selection [,state [,camera [,object [,origin]]]]]&lt;br /&gt;
&lt;br /&gt;
===PYMOL API===&lt;br /&gt;
&amp;lt;source lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
cmd.rotate(list-or-string axis, angle=0, string selection = &amp;quot;all&amp;quot;, int state = 0,&lt;br /&gt;
           int camera = 1, string object = None)&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===EXAMPLES===&lt;br /&gt;
 rotate x, 45, pept&lt;br /&gt;
&lt;br /&gt;
===NOTES===&lt;br /&gt;
   if state = 0, then only visible state(s) are affected.&lt;br /&gt;
   if state = -1, then all states are affected. &lt;br /&gt;
&lt;br /&gt;
=====Electrostatic Map Caveat=====&lt;br /&gt;
If you have an electrostatic map and it's not rotating with the molecule as you expect it to, see the [[Cmd turn|Turn]] command.  [[Cmd turn|Turn]] moves the camera and thus the protein and map will be changed.&lt;br /&gt;
&lt;br /&gt;
===SEE ALSO===&lt;br /&gt;
[[Translate]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:Commands|rotate]]&lt;/div&gt;</summary>
		<author><name>Pete0934</name></author>
	</entry>
	<entry>
		<id>https://wiki.pymol.org/index.php?title=Rotate&amp;diff=9577</id>
		<title>Rotate</title>
		<link rel="alternate" type="text/html" href="https://wiki.pymol.org/index.php?title=Rotate&amp;diff=9577"/>
		<updated>2008-05-13T21:46:01Z</updated>

		<summary type="html">&lt;p&gt;Pete0934: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;===DESCRIPTION===&lt;br /&gt;
'''rotate''' can be used to rotate the atomic coordinates of a molecular object.  Behavior differs depending on whether or not the '''object''' parameter is specified.&lt;br /&gt;
 &lt;br /&gt;
If object is '''None''', then rotate rotates the atomic coordinates according to the axes and angle for the selection and state provided.  All presentation geometries will need to be regenerated to reflect the new atomic coordinates.&lt;br /&gt;
&lt;br /&gt;
If object is set to an object name, then selection and state are ignored and instead of translating the atomic coordinates, the object's representation display matrix is modified.  This option is for use in animations only.&lt;br /&gt;
&lt;br /&gt;
===USAGE===&lt;br /&gt;
 rotate axis, angle [,selection [,state [,camera [,object [,origin]]]]]&lt;br /&gt;
&lt;br /&gt;
===PYMOL API===&lt;br /&gt;
&amp;lt;source lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
cmd.rotate(list-or-string axis, angle=0, string selection = &amp;quot;all&amp;quot;, int state = 0,&lt;br /&gt;
           int camera = 1, string object = None)&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===EXAMPES===&lt;br /&gt;
 rotate x, 45, pept&lt;br /&gt;
&lt;br /&gt;
===NOTES===&lt;br /&gt;
   if state = 0, then only visible state(s) are affected.&lt;br /&gt;
   if state = -1, then all states are affected. &lt;br /&gt;
&lt;br /&gt;
===SEE ALSO===&lt;br /&gt;
[[Translate]]&lt;br /&gt;
&lt;br /&gt;
=====Electrostatic Map Caveat=====&lt;br /&gt;
If you have an electrostatic map and it's not rotating with the molecule as you expect it to, see the [[Cmd turn|Turn]] command.  [[Cmd turn|Turn]] moves the camera and thus the protein and map will be changed.&lt;br /&gt;
&lt;br /&gt;
[[Category:Commands|rotate]]&lt;/div&gt;</summary>
		<author><name>Pete0934</name></author>
	</entry>
	<entry>
		<id>https://wiki.pymol.org/index.php?title=Translate&amp;diff=5718</id>
		<title>Translate</title>
		<link rel="alternate" type="text/html" href="https://wiki.pymol.org/index.php?title=Translate&amp;diff=5718"/>
		<updated>2008-05-13T21:45:18Z</updated>

		<summary type="html">&lt;p&gt;Pete0934: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;===DESCRIPTION===&lt;br /&gt;
'''translate''' can be used to translate the atomic coordinates of a molecular object (move an object).  Behavior differs depending on whether or not the &amp;quot;object&amp;quot; parameter is specified.&lt;br /&gt;
&lt;br /&gt;
If object is None, then translate translates atomic coordinates according to the vector provided for the selection and in the state provided.  All representation geometries will need to be regenerated to reflect the new atomic coordinates.&lt;br /&gt;
 &lt;br /&gt;
If object is set to an object name, then selection and state are ignored and instead of translating the atomic coordinates, the object's overall representation display matrix is modified.  This option is for use in animations only.&lt;br /&gt;
 &lt;br /&gt;
The &amp;quot;camera&amp;quot; option controls whether the camera or the model's axes are used to interpret the translation vector.&lt;br /&gt;
&lt;br /&gt;
===USAGE===&lt;br /&gt;
&lt;br /&gt;
 translate vector [,selection [,state [,camera [,object ]]]]&lt;br /&gt;
&lt;br /&gt;
===PYMOL API===&lt;br /&gt;
&amp;lt;source lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
cmd.translate(list vector, string selection = &amp;quot;all&amp;quot;, int state = 0,&lt;br /&gt;
              int camera = 1, string object = None)&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===EXAMPLES===&lt;br /&gt;
A simple example; just move the alpha-carbons one Ang. along the X-axis.&lt;br /&gt;
====Example====&lt;br /&gt;
&amp;lt;source lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
# move the alpha carbons one Ang. on the X-axis&lt;br /&gt;
translate [1,0,0], name ca&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====Example====&lt;br /&gt;
A slightly more complicated example.  Load two proteins, align them, and then move one away from the other to see their similarities separately.&lt;br /&gt;
&amp;lt;source lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
# load 1cll and 1ggz&lt;br /&gt;
fetch 1cll 1ggz, async=0&lt;br /&gt;
&lt;br /&gt;
# align the two proteins&lt;br /&gt;
cealign 1cll, 1ggz&lt;br /&gt;
&lt;br /&gt;
# orient the proteins&lt;br /&gt;
orient&lt;br /&gt;
&lt;br /&gt;
# move 1cll above 1ggz so we can &lt;br /&gt;
# see both proteins separately&lt;br /&gt;
translate [0, 40, 0], 1cll&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===NOTES===&lt;br /&gt;
# if state = 0, then only visible state(s) are affected.&lt;br /&gt;
# if state = -1, then all states are affected. &lt;br /&gt;
&lt;br /&gt;
===SEE ALSO===&lt;br /&gt;
[[Rotate]], [[Move]]&lt;br /&gt;
&lt;br /&gt;
[[Category:Commands|translate]]&lt;/div&gt;</summary>
		<author><name>Pete0934</name></author>
	</entry>
	<entry>
		<id>https://wiki.pymol.org/index.php?title=Move&amp;diff=6995</id>
		<title>Move</title>
		<link rel="alternate" type="text/html" href="https://wiki.pymol.org/index.php?title=Move&amp;diff=6995"/>
		<updated>2008-05-13T21:44:18Z</updated>

		<summary type="html">&lt;p&gt;Pete0934: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;===DESCRIPTION===&lt;br /&gt;
'''move''' translates the camera about one of the three primary axes.&lt;br /&gt;
&lt;br /&gt;
===USAGE===&lt;br /&gt;
 move axis,distance&lt;br /&gt;
&lt;br /&gt;
====EXAMPLES====&lt;br /&gt;
 move x,3&lt;br /&gt;
 move y,-1&lt;br /&gt;
&lt;br /&gt;
===PYMOL API===&lt;br /&gt;
&amp;lt;source lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
cmd.move( string axis, float distance )&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===SEE ALSO===&lt;br /&gt;
[[Cmd turn]], [[Cmd rotate]], [[Cmd translate]], [[Cmd zoom]], [[Cmd center]], [[Cmd clip]], [[Translate]]&lt;br /&gt;
&lt;br /&gt;
[[Category:Commands|move]]&lt;/div&gt;</summary>
		<author><name>Pete0934</name></author>
	</entry>
</feed>