Following up myself on this. I did some more digging on Google, and putting together bits and pieces this is what I have currently.
It works, but does not (yet) allow me to scale the colors according to eg. the max and min values of my density (which I do not know how to access).

I guess that means I have a new question about accessing details about the density-object.


load density.dx, d

bg_color white

from pmg_tk.skins.normal.ColorRampModel import ColorRamp
r = ColorRamp(nColors=256)
ramp_colors = r.getRamp()

21 nov 2012 kl. 17:30 skrev Per Larsson:

Hi pymol-users

I have previously been able to make quite nice visualizations of my volume object, containing the time-averaged density of atoms from a MD-simulation.
For making even more improvement, I'd like to be able to use a script (either python or pml) to control which regions of density gets which color. 

I've found this thread

that suggests it to be possible, but understanding how to use that for my case is unfortunately (yet) a bit beyond my current pymol-skills.
Ideally I would want to have a solution that allows me to load in my volume-file (in .dx format), assign colors to different regions of density systematically (the Volume-GUI is great, but somewhat tricky to make quick changes with), and display the result on screen.

Is such a thing possible?

Monitor your physical, virtual and cloud infrastructure from a single
web console. Get in-depth insight into apps, servers, databases, vmware,
SAP, cloud infrastructure, etc. Download 30-day Free Trial.
Pricing starts from $795 for 25 servers or applications!
PyMOL-users mailing list (
Info Page: