Custom Color/Radius on Selection?

Hi Konstantin,

A question came up when I was showing off the new 1.1 features. Is it possible to set a custom color or atom radius on all atoms in a selection? It seems like this should be possible, but I could only bring up the menu for one atom or bond at a time.

Thanks,
-Geoff

26.05.2011, 00:12, “Geoffrey Hutchison” geoff.hutchison@gmail.com:

Hi Konstantin,

A question came up when I was showing off the new 1.1 features. Is it possible to set a custom color or atom radius on all atoms in a selection? It seems like this should be possible, but I could only bring up the menu for one atom or bond at a time.

It needs to be implemented but I don’t see any difficulties. Will look on it when I have some free time.

However there may be some troubles with supporting this feature for both atoms and bonds (what should be done for “mixed” selection?)


Regards,
Konstantin

It needs to be implemented but I don’t see any difficulties. Will look on it when I have some free time.

Great, thanks!

However there may be some troubles with supporting this feature for both atoms and bonds (what should be done for “mixed” selection?)

I think for most people, they care about the atoms rather than bonds in a “mixed” selection. I guess the best solution would be a dialog with tabs for atoms or bonds, but that’s probably better left as a ToDo for now.

-Geoff

26.05.2011, 21:02, “Geoffrey Hutchison” geoff.hutchison@gmail.com:

It needs to be implemented but I don’t see any difficulties. Will look on it when I have some free time.

Great, thanks!

However there may be some troubles with supporting this feature for both atoms and bonds (what should be done for “mixed” selection?)

I think for most people, they care about the atoms rather than bonds in a “mixed” selection. I guess the best solution would be a dialog with tabs for atoms or bonds, but that’s probably better left as a ToDo for now.

Probably it should be further polished to reduce code duplication

Also, maybe it’s a good time to fix custom property manipulations.

  • We discussed use of QProperties to reduce memory overhead
  • I don’t like how access to colors is implemented - first I need to check custom color, than color map, but it would be much more pleasant to have something like Atom::color() returning actual property value.


Regards,
Konstantin

On May 30, 2011, at 11:28 AM, Konstantin Tokarev wrote:

Support etting of custom properties for multi-atomic selections · annulen/avogadro@a69c045 · GitHub

Probably it should be further polished to reduce code duplication

So I assume when you’ve done the polish, you’ll submit to Gerrit?

Also, maybe it’s a good time to fix custom property manipulations.

  • We discussed use of QProperties to reduce memory overhead
  • I don’t like how access to colors is implemented - first I need to check custom color, than color map, but it would be much more pleasant to have something like Atom::color() returning actual property value.

I talked with Marcus a while ago about caching colors in the engines, which would also reduce the overhead from custom colors. The idea is that the engine class would get a signal when the molecule changed, check the colors (both custom and normal) and save them in a QList.

I’m not sure about your second point – Atom::color() only knows a color if it’s custom. Otherwise, I could set one color scheme for the Sticks engine (e.g., to reflect partial charge or somesuch) and another for Spheres.

BTW, I think it’s probably a good idea for v1.1 to revamp the standard ElementColor class to use its own text file for colors. I think there are a lot of savvy users who might want to use green for carbon or something like this.

What do you think?
-Geoff

30.05.2011, 19:54, “Geoffrey Hutchison” geoff.hutchison@gmail.com:

On May 30, 2011, at 11:28 AM, Konstantin Tokarev wrote:

Support etting of custom properties for multi-atomic selections · annulen/avogadro@a69c045 · GitHub

Probably it should be further polished to reduce code duplication

So I assume when you’ve done the polish, you’ll submit to Gerrit?

You can check right now if everything work as it should do.

Also, maybe it’s a good time to fix custom property manipulations.

  • We discussed use of QProperties to reduce memory overhead
  • I don’t like how access to colors is implemented - first I need to check custom color, than color map, but it would be much more pleasant to have something like Atom::color() returning actual property value.

I talked with Marcus a while ago about caching colors in the engines, which would also reduce the overhead from custom colors. The idea is that the engine class would get a signal when the molecule changed, check the colors (both custom and normal) and save them in a QList.

I’m not sure about your second point – Atom::color() only knows a color if it’s custom. Otherwise, I could set one color scheme for the Sticks engine (e.g., to reflect partial charge or somesuch) and another for Spheres.

I was thinking about some method which would incapsulate these actions:

  1. check if custom color is set;
  2. if not, figure out what engine paints this atom (if many - which of them is “main”, e.g. we should disregard force engine here)
  3. get color of atom from that engine

BTW, I think it’s probably a good idea for v1.1 to revamp the standard ElementColor class to use its own text file for colors. I think there are a lot of savvy users who might want to use green for carbon or something like this.

I.e. edit global color map - I think that would be useful (also it would be useful to have custom global map in each CML file)


Regards,
Konstantin