Launching PyMOL

From PyMOLWiki
Revision as of 14:58, 18 February 2006 by Wgscott (talk | contribs) (Reading the pymolrc file)
Jump to: navigation, search

Launching PyMOL

Command Line Options

Launching From a Script

Invoking PyMOL and reading startup commands from a file


Assuming the executable is in your $PATH, simply issue


together with any Command Line Options and arguments (pdb files, pse files, map files and so forth) you require.

Whenever PyMol starts, a user-created '~/.pymolrc' file containing commands is run. All you need to do is create ".pymolrc" and place it in your home directory. Alternatively, you can instead create "" which contains actual Python code instead of just PyMOL commands.


On Windows, use 'pymolrc', '' or 'pymolrc.pym'. For global defaults (all users), you can place a .pymolrc file in C:\Program Files\DeLano Scientific\PyMOL

MacOS X:

Launching the Application

You can launch MacPyMOL by

  • Double-clicking the application's icon, or by
  • Issuing the unix command
open -a MacPyMOL

or by

  • Directly invoking the unix executable

The latter assumes the application has been placed in /Applications, so adjust the absolute path if you have it elsewhere. If you directly invoke the unix executable to launch pymol, it has the advantage that you can pass Command Line Options and arguments to it in the usual way. You might wish to make an alias

alias pymol=/Applications/Xtal/

(leave out the equal sign for tcsh) or symbolic link

sudo ln -s /Applications/Xtal/ /usr/local/bin/pymol

or use this shell script I wrote: pymol shell script (and zsh function) to invoke pymol on the command line. It uses OS X 10.4's mdfind to locate the executable.

  • If MacPyMOL is set as the default application to open pdb, pse and other such files, double-clicking any of those files (or issuing the unix open command) will start also pymol and load the file you clicked on.

Reading the pymolrc file

In each case, pymol will read the contents of the user's ~/.pymolrc file and/or ~/ file (as with Linux).

Here is one example of a MacOSX-specific .pymolrc file with a script enabling interaction via the PowerMate Dial

Launching PyMOL from an external application

If PYMOL_PATH, LD_LIBRARY_PATH, and TCL_LIBRARY are correctly defined, then you can launch PyMOL from an external Python program as shown in examples/devel/

NOTE: This approach is not recommended, since the PyMOL launching process is subject to change without warning. The recommended approach is to just use PyMOL as your python interpreter:

pymol -r <>
pymol -qcr <>

Running PyMOL in batch mode

To perform PyMOL commands from stdin (file, pipe) without opening an OpenGL window, try:

pymol -qc

Suppressing PyMOL output

To suppress most of PyMOL's normal chatter, just type on the Cmd line:

feedback disable,all,actions
feedback disable,all,results

or, from Python:"disable","all","actions")"disable","all","results")

Launching Python scripts

Running a Python script from PyMOL, usually the command:


Is enough. Of course, the file needs to be in the working directory. For more detailed examples, see the commands to launch Python scripts when starting PyMOL. Asynchronous means, that a new Python thread is started:

pymol     # synchronous, in PyMOL module
pymol -r  # synchronous in __main__ module
pymol -l  # asychronous in a new module

You can also launch python programs from within PyMOL with the commands:

run        # synchronous in pymol module
run,main   # synchronous in __main__ module

spawn        # asychronous in a new module
spawn,global # asychronous in the PyMOL module
spawn,main   # asychronous in the __main__ module

Overwriting Default Settings

If you don't like the cartoon default color and want to change default settings for it, from green to slate, you add the command line to do this in $HOME/.pymolrc. Here, 'set cartoon_color, slate'

Windows users can do this with a pymolrc file.