Launching PyMOL: Difference between revisions

From PyMOLWiki
Jump to navigation Jump to search
Line 16: Line 16:
You can launch MacPyMOL by  
You can launch MacPyMOL by  


* double-clicking the application's icon, or by  
* Double-clicking the application's icon, or by  


* issuing the unix command
* Issuing the unix command


  open -a MacPyMOL
  open -a MacPyMOL
Line 24: Line 24:
or by  
or by  


*directly invoking the unix executable
* Directly invoking the unix executable


  /Applications/MacPyMOL.app/Contents/MacOS/MacPyMOL
  /Applications/MacPyMOL.app/Contents/MacOS/MacPyMOL
Line 37: Line 37:


In each case, pymol will read the contents of the user's ~/.pymolrc file and/or ~/.pymolrc.py file (as with Linux).
In each case, pymol will read the contents of the user's ~/.pymolrc file and/or ~/.pymolrc.py file (as with Linux).
* 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.


==Launching PyMOL from an external application==
==Launching PyMOL from an external application==

Revision as of 12:52, 18 February 2006

Launching PyMOL

Command Line Options

Launching From a Script

File for startup commands

Linux: Whenever PyMol starts, a '.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 ".pymolrc.py" which contains actual Python code instead of just PyMOL commands.

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

MacOS X: 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
/Applications/MacPyMOL.app/Contents/MacOS/MacPyMOL

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/MacPyMOL.app/Contents/MacOS/MacPyMOL

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

sudo ln -s /Applications/Xtal/MacPyMOL.app/Contents/MacOS/MacPyMOL /usr/local/bin/pymol

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

  • 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.

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/start_pymol.py.

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 <script.py>
pymol -qcr <script.py>


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:

cmd.feedback("disable","all","actions")
cmd.feedback("disable","all","results")


Launching Python scripts

Running a Python script from PyMOL, usually the command:

run script.py

Is enough. Of course, the file script.py 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 example.py     # synchronous, in PyMOL module
pymol -r example.py  # synchronous in __main__ module
pymol -l example.py  # asychronous in a new module

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

run example.py        # synchronous in pymol module
run example.py,main   # synchronous in __main__ module

spawn example.py        # asychronous in a new module
spawn example.py,global # asychronous in the PyMOL module
spawn example.py,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.