Crystallography‎ > ‎Molecular graphics‎ > ‎Pymol‎ > ‎

Color by B-factors

METHOD 1:

If "protein" is the name of the object:

color white, protein
color yellow, protein & b > 2.5
color orange, protein & b > 5.0
color red, protein & b > 7.5

METHOD 2:

See here for color_b.py script:
http://pldserver1.biochem.queensu.ca/~rlc/work/pymol/color_b.py

Once downloaded, from withinPyMOL run 

color_b.py

to load the function definition. Then, use for example:

color_b('(c;a or c;b)',ramp=1,rainbow=1,nbins=30)

to color chains A and B with the rainbow colors in 30 colors of equal numbers of atoms in each color.

Or in general, this can be used as follows:

color_b(selection='sel',ramp=0 or 1, rainbow=0 or 1, nbins=10)

This function allows coloring of a selection as a function of B-value, either in a range of hues from blue through magenta to red (rainbow=0, the default) or in the colors of the rainbow (rainbow=1). The division of B-value ranges can either be as a histogram (equal-sized B-value increments leading to unequal numbers of atoms in each bin: ramp=0) or as a ramp of B-value ranges with an equal number of atoms in each group (ramp=1). 

More examples:

color_b('all',ramp=1,rainbow=0,nbins=10)
color_b('resi 1:30',ramp=0,rainbow=0,nbins=30)