My software notes

September 11, 2012

[PyMOL] customize spectrum colors

Filed under: pymol/ molmol — kpwu @ 12:29 am
Tags: ,

Saw a post at recent Pymol mailing list and found the nice example of “spectrumany” at PymolWiki.

Here is the example I created using “spectrumany” to show customized spectral colors of the example protein TBEV envelope protein “PDBV entry: 1SVB”.

By using the built-in command “spectrum”, one can color the envelope protein in 2 or 3 gradient colors or use the “rainbow” to colorful gradient.

The figure below was drew using command “spectrum count, red_white_blue, all“. (more pymol built-in color schemes are listed at my older post: [pymol] example– coloring surface by b-factor).

After downloding “” and run “”, one can customize gradient colors on his/her target. The example shown at here using command: “spectrumany count, red green blue yellow white, resi 1-395“.

In this pymol script, colors are separated by “space”. For example: red blue cyan white yellow

Note: In a lot of crystal protein structure PDB files, there are a lot of water molecules as well as some heavy metal ions. I found that using “spectrumany count, red green blue yellow white, all” will result in the image below.

All water molecules are colored in white not not shown in the image. The reasons are 1) water are numbered after 400 (421-800) and 2). water H2O is not shown in cartoon mode. When water molecules are presented in “sphere” mode, you can see the water molecules are colored from yellow to white.  In order to make right color gradient schemes (in cartoon mode) either using pymol-provided “spectrum” or the “” script, it better to define the residue ranges (resi xxx-yyy) not use “all”.

Create a free website or blog at