[Chimera-users] Change atom size and color depending on atomic charge

Elaine Meng meng at cgl.ucsf.edu
Thu Jan 27 09:44:46 PST 2022

Hi Henrique!
First I'll describe how to use color and size to show values, but not iteratively.

If you can format the charge values into a Chimera "attribute assignment file," then you can read it in to assign the values to atoms and use Render by Attribute to map the values to atom size and color.

First you would need to open the atomic structure file and figure out how to specify the atoms in the command line, e.g. by residue name and atom name:     :HEM at N5

These specifications go into the attribute assignment file.  The format is fairly simple as explained here:

After you make this file containing your values,  when the structure is still open, read the attribute file with Define Attribute (in menu under Tools... Structure Analysis) or "defattr" command:

This will automatically assign the values to the atoms and show the Render by Attribute dialog for showing the values with color and/or size.  You can also open Render by Attribute from the menu (under Tools... Structure Analysis).  Another way to color by attribute is with the "rangecolor" command.

Now if by iteratively you mean that the values are changing and you want to keep changing color and size, that is more difficult.  You could make multiple attribute assignment files and then read the first one with "defattr" and color with "rangecolor," then open the next one with "defattr" and color with "rangecolor" again, etc.  Or instead of files and "defattr" you can assign or reassign values one by one with the "setattr" command.

I believe you would have to explicitly use "rangecolor" or Render by Attribute for each new coloring.  For anything fancier or more automatic, some kind of programming (e.g. python script) would be required, but that is beyond my expertise.

I hope this helps,
Elaine C. Meng, Ph.D.                       
UCSF Chimera(X) team
Department of Pharmaceutical Chemistry
University of California, San Francisco

> On Jan 27, 2022, at 5:55 AM, henriquecsj--- via Chimera-users <chimera-users at cgl.ucsf.edu> wrote:
> Hi!
> I was wondering if it is possible to iteratively change each atom's size and color relative to, let's say, the atomic charge computed by a quantum chemistry package. This is to help the reader understand changes happening between the ground and excited states of the molecules.
> Cheers!
> _______________________________________________
> Chimera-users mailing list: Chimera-users at cgl.ucsf.edu
> Manage subscription: https://plato.cgl.ucsf.edu/mailman/listinfo/chimera-users

More information about the Chimera-users mailing list