Introducing PyMOL, a Python package for studying chemical structures.
I've looked at several open-source packages for computational chemistry inthe past, but in this article, I cover a package written inPython calledPyMOL.
PyMOL isa very powerful program, used for visualizing and analyzing chemicalstructures. Although the main project is an open-source one,a commercial version is available that provides support for those whoneed it.
There are several installation options, but Iactually suggest that you don't install it directly from theavailable downloads. You first will need to install a rather large numberof dependencies, which may lead you to dependency hell. So, ifthe package manager for your particular distribution includes a packagefor PyMOL, it probably will be much easier to use it, especially whenyou are just learning how to use PyMOL.
As I've mentioned and is obviousfrom the name, PyMOL is written in Python, and it also uses 3D libraries tohandle the actual image rendering. PyMOL also is written witha plugin architecture, which means you can expand PyMOL's feature setto handle new analysis workflows.
When you first start PyMOL, two windows will open (Figure 1).The first is a console window where you willbe able to interact with PyMOL programmatically. The second window isthe actual viewer for the results of the visualization and analysis ofyour chemistry problem.
Figure 1. When you first start up PyMOL, you get both a console window anda viewer window.
The most basic usage is as a regularviewer of chemical structures. In order to do that, click theFile→Open menu item to pop up a dialog window where you can selectthe file to open (Figure 2).

Figure 2. Opening a PDB file renders the molecule within the viewer window.
PyMOL can handle several dozen differentfile formats. If you don't have any input files of your own yet, youcan get PDB files from the RCSBProtein DataBank in order to explorePyMOL and see what you can do with it.
When it opens, you will get thedefault view of the molecule as a stick figure. Within the viewer window,there are three panes. The left-hand pane contains the actual renderedimage. On the right-hand side, there are two smaller panes. The bottomhalf has a description of mouse actions you can use to manipulatethe molecule in the viewer. You can rotate the image, zoom in and out,and control clipping and selection of the objects rendered within theviewing pane. The top half is the object control panel. It contains alist of all of the objects that are being worked with in the currentsession.
Each object in the list has a series of buttons that can applyfunctions to that object. There is one special entry at the top of thelist that affects all of the objects together. The first button, labeled"A", is a set of actions you can apply to selected objects. Theseactions include things like using presets for viewing options oreven initiating calculations (Figure 3).

Figure 3. A number of presets are available to make visualization easy.
You can alter several otherview options of the display through the action menu. The "S"and "H"buttons provide menus of which elements to show and which elements tohide. The "L" button lets you set what gets labeled withinthe viewer, and the "C" button lets you play with how colorsare used within the rendering.
You also have the option of changing theviewing elements directly within the viewing pane by right-clicking inthe viewer. When you do, you get a drop-down menu that allows you tochange the zoom, the orientation and what objects are visible, amongmany other options.
With so many settings to change, you mayfind yourself in a situation where you can't see the relevant objectsanymore, or you may not be able to undo the changes you havemade effectively. In those situations, you can right-click the viewer and selectthe Reset entry to start over from the beginning.
For more complex interactions, a number of wizards are available from the Wizards menu item to help you coordinate these types ofinteractions. For example, you could work with density maps by clickingthe Density option (Figure 4). This gives you a set of tools withinthe right-hand pane where you can change settings around the densitymappingfunctionality.

Figure 4. There are wizards to help you with more complex tasks, such asworking with density maps.
There is also a suite of plugins, which can addextra features to PyMOL. Go to Plugin→Plugin Managerfor a new window where you can work with those plugins (Figure 5).

Figure 5. The plugin manager allows you install, remove and configure yourPyMOL plugins.
Clicking the "Install New Plugin" tab provides a few options ofhow to install your new plugin. The first option allows you to installdirectly from a file stored on your local filesystem. The second optionis to install a plugin from the PyMOL Wiki, and you can enter a URL pointingto a plugin described on one of the Wiki pages. The third option isto select and install a plugin from one of the available repositoriesof plugins.
When you select one of the repositories from the list,the available plugin list will be populated, and you simply can selectthe plugin you need from that list.
Although you can write your ownfull-fledged plugins, you also can add your own customized functionalitymuch more easily by using scripts. PyMOL includes a command languageof its own that you can use directly within the console window. Theseinclude simple commands, like loading files or saving images, and morecomplex commands, such as doing fits between two molecules.
Along with thesebuilt-in commands, you also have access to a full Python interpreterunderneath the hood. This means you can write Python scripts thatwork with these commands and the objects within your PyMOL session to doeven more complex tasks.
Once you have your task figured out, you cansave your work within a script file that you can reload later andapply within a different session.
The PyMOL Wiki also hosts a scriptlibrary, and it's a good place to look before you start down theroad of creating your own script, as someone else may haverun into the same issue and may have founda solution you can use. If nothing else, you may be able to find ascript that could serve as a starting point for your own particular problem.
When you're are done working with PyMOL, there are many different ways toend the session. If there is work you are likely to pick upagain and continue with, click File→SaveSession to save all of the work you just did, including allof the transitions applied to the view. If the changes you made wereactually structural, rather than just superficial changes to the waythe molecule looked, you can save those structural changes by selectingFile→Save Molecule. This allows you to write outthe new molecule to a chemical file format, such as a PDB file.
Ifyou need output for publications or presentations, afew different options are available. Clicking File→SaveImage As allows you to select from saving a regular image file in PNGformat or writing out data in a POVRay or VRML 3D file format. If youare doing a fancier presentation, you even can export a movie of yourmolecule by clicking File→Save Movie As. This letsyou generate an MPEG movie file that can be used either on a web-basedjournal or within a slide deck for a presentation.






