<?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=RuneKidmose</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=RuneKidmose"/>
	<link rel="alternate" type="text/html" href="https://wiki.pymol.org/index.php/Special:Contributions/RuneKidmose"/>
	<updated>2026-07-10T12:29:56Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.35.1</generator>
	<entry>
		<id>https://wiki.pymol.org/index.php?title=Create&amp;diff=7671</id>
		<title>Create</title>
		<link rel="alternate" type="text/html" href="https://wiki.pymol.org/index.php?title=Create&amp;diff=7671"/>
		<updated>2013-02-11T23:42:50Z</updated>

		<summary type="html">&lt;p&gt;RuneKidmose: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;'''create''' creates a new molecule object from a selection.  It can also be used to create states in an existing object.&lt;br /&gt;
'''NOTE''': this command has not yet been throughly tested. &lt;br /&gt;
&lt;br /&gt;
===USAGE===&lt;br /&gt;
&amp;lt;source lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
create name, (selection) [,source_state [,target_state ] ]&lt;br /&gt;
create name = (selection) [,source_state [,target_state ] ]    # (DEPRECATED)&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* name = object to create (or modify)&lt;br /&gt;
* selection = atoms to include in the new object&lt;br /&gt;
* source_state (default: 0 - copy all states)&lt;br /&gt;
* target_state (default: 0)&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.create(string name, string selection, int state, int target_state,int discrete)&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===NOTES===&lt;br /&gt;
If the source and target states are zero (default), all states will be copied.  Otherwise, only the indicated states will be copied.&lt;br /&gt;
&lt;br /&gt;
===SEE ALSO===&lt;br /&gt;
[[Cmd load|load]], [[Cmd copy|copy]], [[Extract]]&lt;br /&gt;
&lt;br /&gt;
=== User Comments/Examples ===&lt;br /&gt;
&lt;br /&gt;
===EXAMPLES===&lt;br /&gt;
&amp;lt;source lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
# merging two multi-state objects with the create command&lt;br /&gt;
# obj1 has 25 states and obj2 has 40 states &lt;br /&gt;
&lt;br /&gt;
load multi_state_obj1, obj1&lt;br /&gt;
load multi_state_obj2, obj2&lt;br /&gt;
&lt;br /&gt;
# merge the two multi-state objects back to back into obj3&lt;br /&gt;
# 0 indicates every states from obj1 should be included&lt;br /&gt;
# 1 indicates that the first state of obj3 is the first state from obj1 etc.&lt;br /&gt;
&lt;br /&gt;
create obj3, obj1, 0, 1&lt;br /&gt;
&lt;br /&gt;
# as obj1 has 25 states, the first state of obj2 must be state 26 to create a multi-state object of obj1 and obj2 back-to-back &lt;br /&gt;
# 26 indicates that the 26th state of obj3 is state nr. 1 of obj2 etc. &lt;br /&gt;
&lt;br /&gt;
create obj3, obj2, 0, 26&lt;br /&gt;
&lt;br /&gt;
# Obj3 now has 65 states (25 from obj1 and 40 from obj2)&lt;br /&gt;
# save obj3 as a multi-state pdb file&lt;br /&gt;
# use state=0 to get all states into one pdb file&lt;br /&gt;
&lt;br /&gt;
save obj3.pdb, obj3, state=0&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[Category:Commands|Create]]&lt;br /&gt;
[[Category:States|Create]]&lt;br /&gt;
[[Category:Editing Module|Create]]&lt;/div&gt;</summary>
		<author><name>RuneKidmose</name></author>
	</entry>
	<entry>
		<id>https://wiki.pymol.org/index.php?title=Advanced_Coloring&amp;diff=699</id>
		<title>Advanced Coloring</title>
		<link rel="alternate" type="text/html" href="https://wiki.pymol.org/index.php?title=Advanced_Coloring&amp;diff=699"/>
		<updated>2011-12-18T19:17:31Z</updated>

		<summary type="html">&lt;p&gt;RuneKidmose: /* Coloring by atom type */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Coloring Molecules=&lt;br /&gt;
&lt;br /&gt;
==Basic Coloring==&lt;br /&gt;
Any molecule in PyMOL can be assigned a color using the small rightmost buttons in the object list (in the upper right part of the main GUI window. The [[Color]] command will do the same.&lt;br /&gt;
&lt;br /&gt;
PyMOL has a predefined set of colors that can be edited in the ''Settings-&amp;gt;Colors'' menu. &lt;br /&gt;
Alternatively, you can use the [[Set_Color]] command. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Coloring secondary structures==&lt;br /&gt;
To assign helices, sheets and loops individual colors, do:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
color red, ss h&lt;br /&gt;
color yellow, ss s&lt;br /&gt;
color green, ss l+''&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
When the colour bleeds from the ends of helices and sheets into loops, do:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
set cartoon_discrete_colors, 1&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
Or activate ''Cartoon -&amp;gt; Discrete Colors'' in the GUI menu.&lt;br /&gt;
&lt;br /&gt;
==Coloring by atom type==&lt;br /&gt;
The util.cba* (&amp;quot;Color By Atom&amp;quot;) commands color atoms according to type: oxygen in red, nitrogen in blue, hydrogen in white. Carbon will get a different colors, depending on the command:&lt;br /&gt;
{|&lt;br /&gt;
! command&lt;br /&gt;
! carbon color&lt;br /&gt;
|-&lt;br /&gt;
| util.cba'''g'''&lt;br /&gt;
| green&lt;br /&gt;
|-&lt;br /&gt;
| util.cba'''c'''&lt;br /&gt;
| cyan&lt;br /&gt;
|-&lt;br /&gt;
| util.cba'''m'''&lt;br /&gt;
| light magenta&lt;br /&gt;
|-&lt;br /&gt;
| util.cba'''y'''&lt;br /&gt;
| yellow&lt;br /&gt;
|-&lt;br /&gt;
| util.cba'''s'''&lt;br /&gt;
| salmon&lt;br /&gt;
|-&lt;br /&gt;
| util.cba'''w'''&lt;br /&gt;
| white/grey&lt;br /&gt;
|-&lt;br /&gt;
| util.cba'''b'''&lt;br /&gt;
| slate&lt;br /&gt;
|-&lt;br /&gt;
| util.cba'''o'''&lt;br /&gt;
| bright orange&lt;br /&gt;
|-&lt;br /&gt;
| util.cba'''p'''&lt;br /&gt;
| purple&lt;br /&gt;
|-&lt;br /&gt;
| util.cba'''k'''&lt;br /&gt;
| pink&lt;br /&gt;
|}&lt;br /&gt;
For instance:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
  util.cbay three&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
will color the object ''three'' by atom type, with the carbon atoms in yellow.&lt;br /&gt;
&lt;br /&gt;
The util.cnc command will color all the atoms according to type, as in the util.cba* commands stated above, except for the C-atoms.&lt;br /&gt;
&lt;br /&gt;
For instance:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
  util.cnc three&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
will color the object ''three'' by atom type, but leave the color of the C-atom unaltered.&lt;br /&gt;
&lt;br /&gt;
==CMYK-safe Colors==&lt;br /&gt;
There are two distinct color spaces on computers: RGB (red-green-blue), which is for screens, and CMYK (cyan-magenta-yellow-black), which is for printing.&lt;br /&gt;
Some RGB triplets do not have equivalents in CMYK space. As a result, a figure that looks great on a screen can come out with unpredictable colors when printed.&lt;br /&gt;
&lt;br /&gt;
Most applications do a good job with RGB-to-CMYK conversions for photos, but do not do such a good job with graphics that use pure primary colors. For example, reds are generally OK, but pure blues and greens do not translate very well.&lt;br /&gt;
&lt;br /&gt;
Here are some RGB values that are within the CMYK gamut (i.e. are &amp;quot;CMYK-safe&amp;quot;):&lt;br /&gt;
&amp;lt;source lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
#optimized rgb values for cmyk output:&lt;br /&gt;
set_color dblue= [0.05 , 0.19 , 0.57]&lt;br /&gt;
set_color blue=  [0.02 , 0.50 , 0.72]&lt;br /&gt;
set_color mblue= [0.5  , 0.7  , 0.9 ]&lt;br /&gt;
set_color lblue= [0.86 , 1.00 , 1.00]&lt;br /&gt;
&lt;br /&gt;
set_color green= [0.00 , 0.53 , 0.22]&lt;br /&gt;
set_color lgreen=[0.50 , 0.78 , 0.50]&lt;br /&gt;
set_color yellow=[0.95 , 0.78 , 0.00]&lt;br /&gt;
set_color orange=[1.00 , 0.40 , 0.0 ]&lt;br /&gt;
&lt;br /&gt;
# these are trivial&lt;br /&gt;
set_color red=   [1.00 , 0.00 , 0.00]&lt;br /&gt;
set_color mred=  [1.00 , 0.40 , 0.40]&lt;br /&gt;
set_color lred=  [1.00 , 0.80 , 0.80]&lt;br /&gt;
set_color vlred= [1.00 , 0.90 , 0.90]&lt;br /&gt;
set_color white= [1.00 , 1.00 , 1.00]&lt;br /&gt;
set_color vlgray=[0.95 , 0.95 , 0.95]&lt;br /&gt;
set_color lgray= [0.90 , 0.90 , 0.90]&lt;br /&gt;
set_color gray=  [0.70 , 0.70 , 0.70]&lt;br /&gt;
set_color dgray= [0.50 , 0.50 , 0.50]&lt;br /&gt;
set_color vdgray=[0.30 , 0.30 , 0.30]&lt;br /&gt;
set_color black= [0.00 , 0.00 , 0.00]&lt;br /&gt;
##&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note that there are default atom colors such as &amp;quot;carbon&amp;quot;, &amp;quot;nitrogen&amp;quot;, &amp;quot;oxygen&amp;quot;, &amp;quot;hydrogen&amp;quot;, &amp;quot;sulfur&amp;quot;, etc. which should also be redefined:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
set_color carbon= [0.00 , 0.53 , 0.22]&lt;br /&gt;
etc.&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Coloring with 'chainbows' from a script==&lt;br /&gt;
The chainbow function can be invoked by:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
util.chainbow(&amp;quot;object-name&amp;quot;)&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Assign color by B-factor==&lt;br /&gt;
B-factor coloring can be done with the [[spectrum]] command. Example:&lt;br /&gt;
&lt;br /&gt;
 spectrum b, blue_white_red, minimum=20, maximum=50&lt;br /&gt;
 as cartoon&lt;br /&gt;
 cartoon putty&lt;br /&gt;
&lt;br /&gt;
= See Also =&lt;br /&gt;
[[Color]], [[Spectrum]]&lt;br /&gt;
&lt;br /&gt;
==Creating a Color bar==&lt;br /&gt;
To show a vertical/horizontal color bar indiacting the b-factor variation, use the script pseudobar.pml on the structure pseudobar.pdb, or do the following:&lt;br /&gt;
# Create a pdb-file which contains CA positions only, whereas the numbers correspond to your wanted increments of colors. Be sure that CA's are separated by a contant value, say 5 Angstroem.&lt;br /&gt;
# Load this new pseudobar-pdb file into PyMOL, make bonds between increment 1 and increment 2 [increment 2 and increment 3 and so on...], define/assign a smooth color for each increment (copy colors definition from automatically created colors made by b-factor script) and show the b-factor bar as lines (or sticks).&lt;br /&gt;
&lt;br /&gt;
Also, see the newly created [[spectrumbar]] script!&lt;br /&gt;
&lt;br /&gt;
==Coloring insides and outsides of helices differently==&lt;br /&gt;
The inside of helices can be adressed with:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
set cartoon_highlight_color, red&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 &lt;br /&gt;
==Coloring all objects differently==&lt;br /&gt;
Is there a simple way to colour each object currently loaded, with a different colour?&lt;br /&gt;
There is a script [[Color_Objects |color_obj.py]] that does the job.&lt;br /&gt;
&lt;br /&gt;
USAGE&lt;br /&gt;
&lt;br /&gt;
        color_obj(rainbow=0)&lt;br /&gt;
&lt;br /&gt;
	This function colours each object currently in the PyMOL heirarchy&lt;br /&gt;
	with a different colour.  Colours used are either the 22 named&lt;br /&gt;
	colours used by PyMOL (in which case the 23rd object, if it exists,&lt;br /&gt;
	gets the same colour as the first), or are the colours of the rainbow&lt;br /&gt;
&lt;br /&gt;
==List the color of atoms==&lt;br /&gt;
To retrieve the color for all residues in a selection, you can iterate over it from the PyMOL command line&lt;br /&gt;
&amp;lt;source lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
iterate all, print color&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
In Python, it looks like this:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
import pymol&lt;br /&gt;
pymol.color_list = []&lt;br /&gt;
cmd.iterate('all', 'pymol.color_list.append(color)')&lt;br /&gt;
print pymol.color_list&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[Category:Publication_Quality|Advanced Coloring]]&lt;br /&gt;
[[Category:Coloring|Advanced Coloring]]&lt;/div&gt;</summary>
		<author><name>RuneKidmose</name></author>
	</entry>
</feed>