From: John Stone (johns_at_ks.uiuc.edu)
Date: Tue Nov 09 2021 - 15:57:32 CST

Hi,
  I won't have time to do any custom script writing for this
until at least November 25th.

I suggest that one should be able to use the latest VMD 1.9.4 and
its built-in color scale submenu to achieve your goal.

You should be able to use one of the built-in color scale methods
to do this. You can use one of the linear sequential color maps
such as "plasma". After selecting the "plasma" color map, change
the "posterize" control from "off" to the number of distinct colors
you want to map into in your dataset, e.g., 3, or 4 let's say.

>From there, you'll see that the continuum color scale has now turned
into four discrete colors (look along the 0% ripple line at the bottom
of the test grating image, and that's what you're selecting from).

Once you've set the color scale to contain just the 3 or 4 colors,
you can then control how they are mapped to your density values
using the "color scale data range" controls in the VMD
graphical representations window, under the "trajectory" tab.
The starting value will correspond to the leftmost color in the
color scale test grating image. The ending (larger) value will
correspond to the rightmost color in your color scale.
The intermediate values will be mapped along the range linearly.
So, assuming your numeric values occur along the evenly spaced
color boundaries, you're finished.

If you want irregularly spaced mappings of data to colors, then
you'll have to write a routine to produce the necessary color scale
for yourself. The examples I previously provided are simple, and
I would expect one could easily adapt them to your purpose if necessary.

Best regards,
  John Stone
  vmd_at_ks.uiuc.edu

On Fri, Oct 29, 2021 at 04:39:19PM +0100, anas forum wrote:
> Dear Professor Stone,
> I am writing to request your assistance concerning my issue about
> coloration in vmd,¬ because I failed to get the desired results like in
> the attached image "Diazomethane_Isosurface.jpg".
> I attached the necessary cube files and the process of visualizing it
> "Visualization_Process.jpg".¬
> [1]https://www.mediafire.com/file/tpj0gbhcj4te6c0/diazomethane_elf.cube/file
> [2]https://www.mediafire.com/file/xfqdm9ar5jzhvp5/diazomethane_esyn.cube/file
> I would greatly appreciate any help that you could offer.
> Sincere appreciation,
> Le¬ mer. 27 oct. 2021 √ ¬ 15:24, anas forum <[3]anasforum05_at_gmail.com> a
> écrit :
>
> Dear Professors Josh Vermaas and John Stone,
> Thank you very much, finally i found someone who understands¬ my issue,
> but unfortunately I'm still a beginner in tcl scripting language, so I
> still can't write a script to do this kind of job.
> The kind of coloration that i'm looking for is like what is in the
> attached image
> Le¬ jeu. 28 oct. 2021 √ ¬ 15:22, John Stone <[4]johns_at_ks.uiuc.edu> a
> écrit :
>
> Hi,
> ¬ I'll provide the old Tcl code for some of the Matlab color scales
> as an example here.¬ I should also mention that the VMD 1.9.4 builds
> provided over the past year include many new high-quality color scales
> that are suitable for viewing by colorblind people etc, such as the
> popular "viridis" scale, and others.
>
> That being said, you can make any color scale you want with a bit of
> code,
> as you'll see in the attached example.
>
> Best,
> ¬ John Stone
> ¬ [5]vmd_at_ks.uiuc.edu
>
> On Thu, Oct 28, 2021 at 10:12:57AM -0400, Josh Vermaas wrote:
> >¬ ¬ Anything is possible with enough scripting. :D It seems like
> you want 4
> >¬ ¬ isosurfaces at different contour levels. What is probably the
> least amount
> >¬ ¬ of scripting is to make 4 isosurface representations, and color
> them
> >¬ ¬ differently based on colorID. If you turn the TkConsole logging
> feature on
> >¬ ¬ (File->log to console from the main VMD window), it'll spit
> back the
> >¬ ¬ commands you need to change the representations to what you
> want.
> >
> >¬ ¬ -Josh
> >
> >¬ ¬ On 10/27/21 7:55 AM, anas forum wrote:
> >
> >¬ ¬ ¬ Dear Colleagues,
> >¬ ¬ ¬ Is it possible to create a ramp of 4 colors in VMD, like in
> Pymol
> >¬ ¬ ¬ software (ramp_new ramp, isosurface, [1, 2, 3, 4], [orange,
> blue,
> >¬ ¬ ¬ aquamarine, magenta]).
> >¬ ¬ ¬ Many thanks in advance
> >
> >¬ --
> >¬ Josh Vermaas
> >
> >¬ [1][6]vermaasj_at_msu.edu
> >¬ Assistant Professor, Plant Research Laboratory and Biochemistry
> and Molecular Biology
> >¬ Michigan State University
> >¬ [2][7]https://prl.natsci.msu.edu/people/faculty/josh-vermaas/
> >
> > References
> >
> >¬ ¬ Visible links
> >¬ ¬ 1. mailto:[8]vermaasj_at_msu.edu
> >¬ ¬ 2.
> [9]https://urldefense.com/v3/__https://prl.natsci.msu.edu/people/faculty/josh-vermaas/__;!!DZ3fjg!r4vI8xa123CqHhx1EkChii7in8baIhV1oEbLocijedloJreHt9iQAh_rIMI_2Zlg7A$
>
> --
> NIH Center for Macromolecular Modeling and Bioinformatics
> Beckman Institute for Advanced Science and Technology
> University of Illinois, 405 N. Mathews Ave, Urbana, IL 61801
> [10]http://www.ks.uiuc.edu/~johns/¬ ¬ ¬ ¬ ¬ ¬ Phone: 217-244-3349
> [11]http://www.ks.uiuc.edu/Research/vmd/¬ ¬ ¬
>
> References
>
> Visible links
> 1. https://urldefense.com/v3/__https://www.mediafire.com/file/tpj0gbhcj4te6c0/diazomethane_elf.cube/file__;!!DZ3fjg!tWjgGRQkDtJXFnQ5ra_Hmp1PFps6FltrRbmWpJ3ApHwMGk289XwkP7k35Co3EH7J$
> 2. https://urldefense.com/v3/__https://www.mediafire.com/file/xfqdm9ar5jzhvp5/diazomethane_esyn.cube/file__;!!DZ3fjg!tWjgGRQkDtJXFnQ5ra_Hmp1PFps6FltrRbmWpJ3ApHwMGk289XwkP7k35NsAUNz0$
> 3. mailto:anasforum05_at_gmail.com
> 4. mailto:johns_at_ks.uiuc.edu
> 5. mailto:vmd_at_ks.uiuc.edu
> 6. mailto:vermaasj_at_msu.edu
> 7. https://urldefense.com/v3/__https://prl.natsci.msu.edu/people/faculty/josh-vermaas/__;!!DZ3fjg!tWjgGRQkDtJXFnQ5ra_Hmp1PFps6FltrRbmWpJ3ApHwMGk289XwkP7k35LTT7K8U$
> 8. mailto:vermaasj_at_msu.edu
> 9. https://urldefense.com/v3/__https://prl.natsci.msu.edu/people/faculty/josh-vermaas/__;!!DZ3fjg!r4vI8xa123CqHhx1EkChii7in8baIhV1oEbLocijedloJreHt9iQAh_rIMI_2Zlg7A$
> 10. http://www.ks.uiuc.edu/~johns/
> 11. http://www.ks.uiuc.edu/Research/vmd/

-- 
NIH Center for Macromolecular Modeling and Bioinformatics
Beckman Institute for Advanced Science and Technology
University of Illinois, 405 N. Mathews Ave, Urbana, IL 61801
http://www.ks.uiuc.edu/~johns/           Phone: 217-244-3349
http://www.ks.uiuc.edu/Research/vmd/