<?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=Editing_atoms</id>
	<title>Editing atoms - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.pymol.org/index.php?action=history&amp;feed=atom&amp;title=Editing_atoms"/>
	<link rel="alternate" type="text/html" href="https://wiki.pymol.org/index.php?title=Editing_atoms&amp;action=history"/>
	<updated>2026-05-25T07:42:38Z</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=Editing_atoms&amp;diff=7937&amp;oldid=prev</id>
		<title>Pyadmin: 1 revision</title>
		<link rel="alternate" type="text/html" href="https://wiki.pymol.org/index.php?title=Editing_atoms&amp;diff=7937&amp;oldid=prev"/>
		<updated>2014-03-28T02:16:23Z</updated>

		<summary type="html">&lt;p&gt;1 revision&lt;/p&gt;
&lt;table class=&quot;diff diff-contentalign-left diff-editfont-monospace&quot; data-mw=&quot;interface&quot;&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;en&quot;&gt;
				&lt;td colspan=&quot;1&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan=&quot;1&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;Revision as of 02:16, 28 March 2014&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-notice&quot; lang=&quot;en&quot;&gt;&lt;div class=&quot;mw-diff-empty&quot;&gt;(No difference)&lt;/div&gt;
&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;</summary>
		<author><name>Pyadmin</name></author>
	</entry>
	<entry>
		<id>https://wiki.pymol.org/index.php?title=Editing_atoms&amp;diff=7936&amp;oldid=prev</id>
		<title>Sbliven: /* Get coordinates from Python */ Fixed list numbering</title>
		<link rel="alternate" type="text/html" href="https://wiki.pymol.org/index.php?title=Editing_atoms&amp;diff=7936&amp;oldid=prev"/>
		<updated>2012-07-23T20:49:54Z</updated>

		<summary type="html">&lt;p&gt;&lt;span dir=&quot;auto&quot;&gt;&lt;span class=&quot;autocomment&quot;&gt;Get coordinates from Python: &lt;/span&gt; Fixed list numbering&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;==Altering atom types/elements==&lt;br /&gt;
Example:&lt;br /&gt;
&lt;br /&gt;
To transform a carbon into an oxygen,&lt;br /&gt;
pick an atom by a ''select'' command or CTRL+middle.&lt;br /&gt;
&amp;lt;source lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
alter pk1,elem='O'&lt;br /&gt;
alter pk1,name='O2'&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
Note that the ''name'' field should contain something more descriptive than just the element symbol.&lt;br /&gt;
For reasons unknown (?), util.cbag() and similar methods will not recognize the new element.&lt;br /&gt;
&lt;br /&gt;
==Altering atom coordinates==&lt;br /&gt;
Example:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
alter_state 1,(pdb1cse),x=x-10.0 &lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
The latter section can contain formulae involving at least the xyz coordinates, lots of constants and the (+-*/) operators.&lt;br /&gt;
&lt;br /&gt;
 &lt;br /&gt;
==Translate or rotate individual objects==&lt;br /&gt;
There is a &amp;quot;translate&amp;quot; function similar to &amp;quot;rotate&amp;quot;, the docs for these don't exist yet, because the implementation isn't finished. However, feel free to use them in the following forms:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
translate vector,object-name,state&lt;br /&gt;
   vector needs to be something like [x,y,z]&lt;br /&gt;
&lt;br /&gt;
   translate [1,0,0],pept&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
rotate axis,angle,object-name,state&lt;br /&gt;
   axis can be either the letter x,y,z or a 3D vector [x,y,z]&lt;br /&gt;
&lt;br /&gt;
   rotate x,90,pept&lt;br /&gt;
   rotate [1,1,1],10,pept&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Get coordinates from Python==&lt;br /&gt;
&lt;br /&gt;
# The actual C-langauge arrays aren't exposed, but there are at least three different ways you can modify coordinates from within Python: You can get a python object which contains the molecular information, modify the coordinates in that object, load the modified molecule into PyMOL, update the modified coordinates to the original model, and then delete the modified object. (link to example)&lt;br /&gt;
# Another approach is the &amp;quot;alter_state&amp;quot; function, which can perform the same transformation in a single PyMOL command statement:&amp;lt;source lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
alter_state 1,pept,(x,y)=(-y,x)&lt;br /&gt;
&amp;lt;/source&amp;gt;Likewise sub-selections can be transformed as well:&amp;lt;source lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
alter_state 1,(pept and name ca),(x,y,z)=(x+5,y,z)&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
# A third approach is to use alter_state with the global &amp;quot;stored&amp;quot; object: Example in a Python script)&lt;br /&gt;
Approaches 2 gives the best [[:Category:Performance|performance]], approach 3 gives more flexibility, and approach 1 gives you a reusable and fully modifiable Python object.&lt;br /&gt;
&lt;br /&gt;
[[Category:Modeling_and_Editing_Structures|Editing Atoms]]&lt;br /&gt;
[[Category:Performance]]&lt;br /&gt;
[[Category:States]]&lt;/div&gt;</summary>
		<author><name>Sbliven</name></author>
	</entry>
</feed>