3dmol / 3Dmol.js

WebGL accelerated JavaScript molecular graphics library
https://3dmol.org/
Other
803 stars 194 forks source link

Problem with atom color options #485

Closed knc6 closed 3 years ago

knc6 commented 3 years ago

Description Hi,

I have been trying to use 3Dmol.js in JARVIS-DFT.

Is there a documentation for selecting different color options in 3Dmol?

For example, in this Bi2Se3 example, both Bi and Se atomic colors are similar.( https://www.ctcms.nist.gov/~knc6/static/JARVIS-DFT/JVASP-1067)

Your help is greatly appreciated.

Relevant Context image

I am using the following code:

dkoes commented 3 years ago

There are a number of built-in color schemes: http://3dmol.csb.pitt.edu/doc/types.html#ColorschemeSpec

Jmol has the most distinct colors, including different colors for Se and Bi. You can also specify your own mapping from elements to colors. The easiest way to do this is to extend a pre-existing color scheme.

var mycolors = $3Dmol.extend({},$3Dmol.elementColors.defaultColors);
mycolors.Bi = 0xffff00;
mycolors.Se = 'silver';
viewer.setStyle({sphere:{colorscheme:{'prop': 'elem', map:mycolors}}});

https://3dmol.org/tests/auto/generate_test.cgi?test=testcolormap