PyMOL_Mover Tutorial

The PyRosetta community uses PyMOL so much, we decided to streamline the visualization of output by creating a PyMOL_Mover. This Mover allows you to observe structural and score change instantaneously, which greatly aids the understanding of any protocol and the development of novel algorithms. This page accompanies the workshops found on the Tutorials page.


After loading PyMOL, click in the upper window command line (Tk Window Upper Command Line) and run the script to start the listener:

    cd /your/path/to/PyRosetta

The file is found in the main directory of PyRosetta. No further work is required to view PyMOL_Mover output from the same computer. We recommend adding this to your .pymolrc (and to make a .pymolrc if you don't have one), which should be located in your home directory on a Mac or Linux machine.

To change which IP address PyMOL is listening to, start the listener (as above); then enter:


The script connects at by default. Be sure that the connection is to an accessible IP address and that the PyMOL_Mover is outputting to that address.


In Rosetta and PyRosetta, a macromolecule (and information on a single conformation) is stored in a Pose object. To explore the PyMOL_Mover, you will want to start PyRosetta and create a Pose object from a PDB file.

    from rosetta import*
    pose = pose_from_pdb("your_favorite.pdb")

When the PyMOL_Mover> is applied to a Pose, the Pose coordinate data is sent to PyMOL, rendering an image of the structure.

    pymover = PyMOL_Mover()

The PyMOL_Mover method send_energy() commands PyMOL to color the loaded structure based on the relative residue energies. Make sure the pose has been scored before calling the method.

    scorefxn = get_fa_scorefxn() 

The default color spectrum spans from blue (low score/favorable energy) to red (high score/unfavorable energy). Rosetta scores are determined using a weighted sum of various score terms. The send_energy() method can accept the name of any score term and color residues based on this term. (If the input term had a zero weight in the last score function applied to the pose, i.e., is not used, no relevant coloring will occur.) The example here would color the residues based on the value of its (full-atom) Van der Waals attractive energy.

    pymover.send_energy(pose, fa_atr)

The PyMOL_Mover features an update_energy option that, when true, automatically colors residues by energy when you apply the PyMOL_Mover.


You can set the PyMOL_Mover to send a specific score term when it is applied (if update_energy is set to true) with the energy_type option. The example here would here would color the residues based on the value of its (full-atom) solvation energy every time you apply the PyMOL_Mover:


To send PyMOL_Mover output to a PyMOL instance on a different computer, change the PyMOL_Mover link options to the new computer's IP address and port: = "" = 65000

If the PyMOL_Mover's keep_history> option is set to true, PyMOL will load structures with the same name into successive states. You can then view the states intuitively by cycling through the PyMOL object states or creating a movie using PyMOL's frame features.


The color of a PyMOL molecular object is independent of its state, so if you view a series of structures sent from Rosetta — and their respective energy colorings — with the same name, the only accessible residue coloring will be the last one performed. An alternate method to accurately view intermediate changes of a Rosetta structure that avoids this complication is to change the Pose's name before sending structural data. This causes PyMOL to load these structures into different objects, thus allowing PyMOL to remember multiple colorings. This is particularly useful when you want to inspect energy changes during a protocol. The example here would change the Pose name — and thus the name of the structure in PyMOL — to "new_name".


So far, all the commands to PyMOL have been manual, relying on usage of PyMOL_Mover.apply. The PyMOL_Observer object automatically monitors Poses for conformational changes and, when triggered, applies its own PyMOL_Mover. Since a PyMOL_Observer has a PyMOL_Mover, all of the PyMOL_Mover options are available.

    pyobs = PyMOL_Observer()