chemiscope
chemiscope copied to clipboard
Color atoms by property
Would be interesting to have the possibility of coloring atoms by an atomic property. The option could be active any time there are environment properties defined, and it could use same color schemes as for the map.
Yeah, very good idea. I had the same one and I just wanted to open an issue for this ;)
@jduerholt Want to help?
@Luthaf knows about my very limited java script capabilities ;) Perhaps he can give a bit advise how to actually implement it and then we can see what I can actually contribute ;)
This would require a bit of work to (1) get the color associated with the value of the property, through Plotly (we don't really want to re-implement color interpolation from the colormap); (2) use these colors with 3Dmol.js to set the color of atoms one by one and (3) link everything up properly so that the colors are updated whenever the user changes which point is being visualized, the color map or the color range.
I don't know if there is an API for (1) (maybe we can query the color of the point after plotting it?); for (2) we should be able to override the color of the atoms in 3Dmol with atom.color
.
This feature would touch quite a lot of different places in the code, I'm happy to guide you around but this might not be the best first point of entry 😃
Hi Guillaume,
sorry for my late response, I was travelling ;) This indeed sounds like not best entry point also with respect to my limited java script knowledge. Nevertheless, I am very interested in this feature as this could be really powerful in some scenarios.
Best,
Johannes
Implemented through #312 (and previous PRs)