User Tools

Site Tools


Script Composition

This section explains what each line of the example script does so that you can change it.


The first two lines of the script simply load the molecule:

#load the PDB file
load c:\2CM8.pdb


The next few lines of the script change the background lighting:

#adjust background lighting
#set the ambient lighting
set ambient=0.14 
#set the direct lighting
set direct=0.3  


The next two lines erase all the representations to give you a clean screen.

#hide the default representation
hide all

Fun Stuff

Now the next section is the fun stuff. This is what you are going to want to play around with. You may have realized by now that you can comment your script by prepacing the line with the “#” symbol, like this:

#set up variables for representations


The next series of commands involves manipulating the cartoon representation.

The helices can be adjusted:

#fancy helices
set cartoon_fancy_helices=1 

The sheets can be adjusted:

#flat beta sheets
set cartoon_flat_sheets = 0 

The loops can be adjusted:

#smooth loops
set cartoon_smooth_loops = 0 

Then you can make these cartoon variables visible:

#cartoon representation of the protein
show cartoon, /2CM8//A  

You may want to change the cartoon_transparency of the cartoon.

#transparency of the cartoon representation of the protein
set cartoon_transparency=0.0, /2CM8//A 


In this example, we represented the water molecules as small spheres. These are the lines that made that possible:

#sphere representation of the waters
show sphere, /2CM8//Z 
#set size of the sphere for the water at 0.2
set sphere_scale=0.2, /2CM8//Z


In this example, the Mg was represented with the dot representation:

#dot representation of the Mg ion
show dot, /2CM8//A/1300  
#set density of the dots for the water at 5
set dot_density=5, /2CM8//Z


In this example, the ligand was represented with the stick representation:

#stick representation of the ligand
show sticks, /2CM8//A/1299 
#set the radius of the sticks to 0.4
set stick_radius=.4


In this example, the protein was also represented with the surface representation:

#surface representation of the protein
show surface, /2CM8//A  
#transparency of the surface representation of the protein
set transparency=0.4, /2CM8//A  

Custom Colors

You can make lots of custom colors using this command:

#make a custom color


You can color the individual parts of your molecule. It is worthwhile to introduce this idea with a description of selection.

#color the structures
#color the protein salmon
color salmon, /2CM8//A  
#color the waters the custom color cyan
color cyan, /2CM8//Z
#color the Mg ion red
color red, /2CM8//A/1300 
#color the ligand the blue
color blue, /2CM8//A/1299 


You can add labels after the fact in a program like PowerPoint, or you can add basic labels directly in Pymol, as we did in this example.

#set label variables
#label color
set label_color=dash
#label font
set label_font_id=4
#set label position
set label_position=[3,3,2]
#add labels
label /2CM8//A/1299/C12, "ligand"
label /2CM8//A/1300, "Mg ion"

Really Useful stuff

There are some lines in the example script that show some really time saving stuff. These follow.


You can change the position and rotation of the molecule and you can save this position in your script.

# set the view
set_view (\
     0.454857916,   -0.874098599,   -0.170457616,\
    -0.826678693,   -0.485608459,    0.284229279,\
    -0.331220239,    0.011628916,   -0.943481266,\
     0.000000000,    0.000000000, -275.660125732,\
    43.778598785,   16.942298889,   15.083831787,\
   236.467651367,  314.852630615,    1.000000000 )

# move to the right place
#translate [-40,-30,0]

More fun stuff

#set up the variables for the background representation
#color the background yellow
bg_color black  
#set the depth
set depth_cue=0  
#add some fog
set ray_trace_fog=10

#prepare variables for ray tracing 
#set the orthoscopy
set orthoscopic=0.3  
#improve the resolution
set antialias=1.0  
#crank up the glossiness
set spec_power = 200  
set spec_refl=1.5 

#specify a large ray-traced image type,
#ray 600,600

#save the scene
#png c:\filename.png

See Also

tutorial/figures/script_breakdown.txt · Last modified: 2013/08/19 21:01 (external edit)