Python Integration

General information about Python can be found on the home page and in the documentation. Information about integrating PyMOL with Python can be found below.

Design Philosophy

The basic idea behind PyMOL was to leverage Python for what it does well, while avoiding it for the things it does poorly. Generally this means using Python for command & control while leaving the heavy-lifting to C. In addition, there emerged a need to run PyMOL as pure C program without Python (CMol) to support integrated usage from Java (JyMOL), as well as ActiveX.

As of PyMOL 1.0, the application known as PyMOL relies heavily on the combination of C and Python.

Python is used:

C is used:

One important consequence and limitation of this approach is that the Python object model is barely used from within PyMOL. In other words, there is no Python “object” which corresponds to an actual atom or molecule from within PyMOL.

However, PyMOL can in some instances provide you with a pure Python copy of certain parts of the model (e.g. see cmd.get_model and cmd.load_model), and commands like iterate, alter, and label provide the ability to access and manipulate the C model using Python expressions and data structures.