Difference between revisions of "Pymolrc"

From PyMOLWiki
Jump to navigation Jump to search
(technical details)
Line 1: Line 1:
When Pymol [[Launching PyMOL|launches]], it will read custom settings and functions from a .pymolrc (windows: pymolrc.pym) file.
+
When Pymol [[Launching PyMOL|launches]], it will read custom settings and functions from a pymolrc file, if it exists. This is simply a script in PyMOL command syntax or in python syntax, depending on the suffix.
  
In windows put file under "C:\Users\YOU\pymolrc.pym". <br>
+
The typical location on Windows would be:
On a Unix/Linux-type system (including Mac OS X), this file will be located in /path/to/home/.pymolrc.
 
  
An example of a .pymolrc file is:
+
C:\Users\YOU\pymolrc.pml
 +
 
 +
and on a Unix/Linux-type system (including Mac OS X):
 +
 
 +
/home/YOU/.pymolrc
 +
 
 +
== Technical Details ==
 +
 
 +
* The leading dot is optional, so everything that starts with '''.pymolrc''' or '''pymolrc''' will be found by PyMOL. Files with dot take precedence over files without dot.
 +
* Files ending on '''.py''' (or .pym) will be parsed as python scripts, files ending on '''.pml''' or without suffix will be parsed as PyMOL command syntax.
 +
* Several directories are searched, in order:
 +
** $HOME
 +
** $HOMEPATH + $HOMEDRIVE (on Windows)
 +
** $PYMOL_PATH
 +
* PyMOL will even load multiple pymolrc files, however only either with dot or without dot, and only from the same directory. But you could for example have two scripts ''.pymolrc-settings.py'' and ''.pymolrc-misc.py'' in your home directory.
 +
 
 +
== Example ==
  
 
<source lang="python">
 
<source lang="python">
Line 20: Line 35:
 
# for images:
 
# for images:
 
#  antialias =1 smooths jagged edges, 0 turns it off
 
#  antialias =1 smooths jagged edges, 0 turns it off
set antialias = 1
+
set antialias, 1
  
 
#  stick_radius -adjust thickness of atomic bonds
 
#  stick_radius -adjust thickness of atomic bonds
set stick_radius = 0.3
+
set stick_radius, 0.3
  
 
# set fetch_path
 
# set fetch_path
 
set fetch_path, /your/fetch/path
 
set fetch_path, /your/fetch/path
 +
</source>
  
</source>
+
To reload a pymolrc file (e.g. after editing .pymolrc, or after running [[reinitialize]]), [[Running Scripts|run it]] like any other script:
  
 +
@~/.pymolrc
  
To reload .pymolrc file (e.g. after editing .pymolrc, or after running [[reinitialize|reinitialize]]), use:
+
or
  
<source lang="python">
+
run ~/.pymolrc.py
@~/.pymolrc
 
</source>
 
  
 
== See Also ==
 
== See Also ==
[[Launching PyMOL]]
+
* [[save_settings]]
 +
* [[Launching PyMOL]]
  
 
[[Category:Launching]]
 
[[Category:Launching]]

Revision as of 17:41, 30 January 2013

When Pymol launches, it will read custom settings and functions from a pymolrc file, if it exists. This is simply a script in PyMOL command syntax or in python syntax, depending on the suffix.

The typical location on Windows would be:

C:\Users\YOU\pymolrc.pml

and on a Unix/Linux-type system (including Mac OS X):

/home/YOU/.pymolrc

Technical Details

  • The leading dot is optional, so everything that starts with .pymolrc or pymolrc will be found by PyMOL. Files with dot take precedence over files without dot.
  • Files ending on .py (or .pym) will be parsed as python scripts, files ending on .pml or without suffix will be parsed as PyMOL command syntax.
  • Several directories are searched, in order:
    • $HOME
    • $HOMEPATH + $HOMEDRIVE (on Windows)
    • $PYMOL_PATH
  • PyMOL will even load multiple pymolrc files, however only either with dot or without dot, and only from the same directory. But you could for example have two scripts .pymolrc-settings.py and .pymolrc-misc.py in your home directory.

Example

# this will run the script in the specified location
run /path/to/home/pymol/load_sep.py

set movie_loop, 0
set two_sided_lighting, 1

set label_size, 60
set label_outline_color, 1
set label_color, 0
set label_position, [0, 0, 10]

# for images:
#   antialias =1 smooths jagged edges, 0 turns it off
set antialias, 1

#   stick_radius -adjust thickness of atomic bonds
set stick_radius, 0.3

# set fetch_path
set fetch_path, /your/fetch/path

To reload a pymolrc file (e.g. after editing .pymolrc, or after running reinitialize), run it like any other script:

@~/.pymolrc

or

run ~/.pymolrc.py

See Also