CHEM 245

J. D. Cronk    Syllabus    Topics



Introducing PyMOL, an open-source molecular graphics program. Obtaining PyMOL. Getting started with PyMOL. PyMOL scripts. Other PyMOL resources.

PyMOL is an open-source molecular graphics program based on the Python programming language. It is the recommended molecular graphics application for this course due to its combination of a wide variety of powerful tools and capabilities, along with its relative ease of learning basic operations, as well as being freely available.

Obtaining PyMOL

A pre-built version is provided free to students and teachers ( by Schrödinger. See this YouTube video for a visual step-by-step guide, accompanied by some bad music. There is also a SourceForge PyMOL webpage where the source code is available for subsequent versions (including the latest version [as of Jan 2018],

Getting started with PyMOL

A great resource for all PyMOL users, including beginners, is the PyMOL Wiki. Among the tutorials available, the Practical PyMOL for Beginners and the Biochemistry student intro seem most useful for the purpose of getting started.

Once installed, it is easy to view a PDB file in PyMOL. If you have pdb files downloaded to your computer, PyMOL should be able to recognize this file type, and simply double-clicking the pdb file icon will open PyMOL and display the pdb file in the Viewer window. Alternatively, if PyMOL is already running, one can use the File menu in the Tk window to Open a pdb file. Another approach to displaying a pdb file is to have PyMOL "Fetch" the pdb file directly from the PDB data repository. For example, typing "fetch 1mbo" in the command line of the Tk window will obtain the pdb file of oxygenated sperm whale myoglobin which will also appear in the Display window. Of course, one must know the four-character code corresponding to the pdb file of interest. With a molecular structure displayed, a three-button mouse (or its equivalent) allows the rotation (press and hold the left mouse button while moving the cursor in the display), zooming in and out (press and hold the left mouse button while moving the cursor in the display). Right-clicking on the position of an atom results in the appearance of a pop-up window identifying the atom and presenting a menu of possible operations. A three-button mouse with a wheel is recommended; a wheel allows easy "slabbing" of the view (showing just a section of the structure in the z-direction, which is the direction perpendicular to the screen). There are various modes of mouse action available; the lower right corner of the display window helpfully shows the actions associated with the current mode and allows choosing of different modes.

After learning how to obtain and display pdb files in PyMOL, the next stage is to become familiar with the tools and methods for making selections to manipulate the representations. For example, to show a ribbon representation of the myoglobin polypeptide, click on the box labeled S (which stands for "show") and select "cartoon" (What PyMOL calls "ribbon" is actually a trace of Cα positions). By default, PyMOL shows the polypeptide chain and molecular cofactors in a "lines" format, and small "nonbonded" species (typical waters) as small crosses. One can "hide" waters by selecting waters under the menu that appears when the box labeled H is clicked. Portions of the structure can be highlighted as well as hidden. In this case, one can highlight the heme group by right clicking any atom within it and selecting residue → show → sticks using the pop-up menu. Right-click on the iron atom at the center of the heme group and show it as a sphere by atom → show → spheres using the pop-up menu. Center the view on the iron atom by right-clicking on it and selecting atom → center from the pop-up window.

PyMOL scripts

A PyMOL script is really just a simple text file (the extension .pml is used) containing a series of PyMOL commands, which the program executes. This feature is very convenient and multiplies the power of PyMOL by allowing easy generation of user-defined views and representations of structures. A number of scripts have been created for your enjoyment! (NOTE: Currently PyMOL scripts are posted on the Blackboard site for this course). Such scripts are of great help in visualizing the structures under discussion or to make certain textbook figures "come alive" in fully-manipulable graphics representations. As an example, the operations involving the oxymyoglobin molecule described above can be put into script form as follows:

# demo PyMOL script for oxymyoglobin
# copy and paste this text into a plain text file named
# "1mbo-demo.pml" (or whatever :)
# lines beginning with "#" are comments
# and not executed by the program
# Use either fetch (if the pdb file has not been downloaded -
# you must be connected to the internet),
# or load (if the pdb file is already present in the directory
# of the script file)

fetch 1mbo, asynch=0
#load 1mbo.pdb

# Setting asynch=0 causes PyMOL to wait for fetch to complete
# before executing any further commands
# Once "fetch 1mbo" is used, the pdb file is saved to the
# directory from which PyMOL is run,
# and subsequently the "load" command can and should be used

show cartoon
hide nonbonded
show sticks, resn hem
show spheres, name fe
center a/155/fe