From: Axel Kohlmeyer (akohlmey_at_gmail.com)
Date: Thu Oct 14 2010 - 11:58:09 CDT

brooke,

On Thu, Oct 14, 2010 at 12:37 PM, Brooke Dallas <bdallas_at_ucdavis.edu> wrote:
> Dear Axel,
> Is it possible to set the current color using an RGB 3-tuple in Tcl?

as far as i know, you can reset only the predefined 33 colors to 3-tuples,
but for the rest of the colors you have to use a color scale.

here is a code snipped from the 3d ramachandran plot code i wrote
a long time ago:

    # setup color scaling
    color scale method BGR

    # get min/max colorid
    set mincolor [colorinfo num]
    set maxcolor [colorinfo max]
    set ncolorid [expr $maxcolor - $mincolor]

can use the color indices from $mincolor
to $maxcolor to select colors on the color gradient map.

the colors with smaller index are the freely predefined colors.
mind you, the color definitions are global.

cheers,
     axel.

> For example,
>
> "graphics top color red"
> "graphics top sphere {1 1 1}
> or
> "graphics top color 2"
> "graphics top sphere {1 1 1}"
> draws red and gray spheres, but can I say something like
> "graphics top color  {0.5 0.0  0.5}" ?
> If I am reading the manual right it looks like this is possible in Python,
> but not Tcl,
> can that be right?
> thanks
>
> Brooke
>
> On Wed, Oct 13, 2010 at 6:38 PM, Axel Kohlmeyer <akohlmey_at_gmail.com> wrote:
>>
>> On Wed, Oct 13, 2010 at 12:31 PM, Brooke Dallas <bdallas_at_ucdavis.edu>
>> wrote:
>> > Thanks Axel,
>> >
>> > The molecule has 38 atoms and it only needs to be a static image.
>>
>> ok. then the kind of approaches i have in mind, should work for you.
>> it will need a little tcl scripting, but not too much.
>>
>> option 1:
>>
>> re-draw all bonds manually using the cylinder primitive.
>> you need to get a list of all bonds, match them with the
>> value that you want to attach to them, identify the coordinates
>> of the atoms and then draw the bond after setting the color
>> to a proper value.
>>
>> option 2:
>>
>> create 4 representations that use coloring by user, user2, user3, user4
>> then identify the bonds and set the user field for both atoms to the
>> rmsf value. if user is != 0 for any of the two atoms use user2 instead,
>> if that is set then use user3 and so on. if you use a "Bonds"
>> representation
>> you can overlay it with a CPK or scaled down VDW representation to
>> show the atoms in their "normal" colors.
>>
>> perhaps you can try with a couple of bonds manually, which of
>> the two options would be more convenient and let us know if
>> you run into problems with the implementation.
>>
>> cheers,
>>    axel.
>>
>>
>> >
>> > Brooke
>> >
>> > On Wed, Oct 13, 2010 at 3:41 PM, Axel Kohlmeyer <akohlmey_at_gmail.com>
>> > wrote:
>> >>
>> >> On Wed, 2010-10-13 at 14:46 +0100, Brooke Dallas wrote:
>> >> > Dear Vmd List,
>> >>
>> >> dear brooke,
>> >>
>> >> > I need to draw a molecule with bond colors indicating the RMS bond
>> >> > length fluctuation for each bond, e.g. blue for small RMS
>> >> > fluctuations
>> >> > continuous to red for large RMS fluctuations. Does anybody have any
>> >> > suggestions for how to do that?
>> >>
>> >> how large a molecule?
>> >> does it have to be dynamics or only a static image?
>> >>
>> >> VMD doesn't have any internal provisions for things like this,
>> >> so you would either have to do some kind of hack with multiple
>> >> representations, or draw the bonds manually from a script.
>> >>
>> >> if you can give some more details about what you want to
>> >> achieve and for what purpose you need this, somebody may
>> >> be able to come up with some suggestions for doing this.
>> >>
>> >> cheers,
>> >>    axel.
>> >>
>> >> > Thanks in advance,
>> >> >
>> >> > Brooke Dallas
>> >>
>> >> --
>> >> Dr. Axel Kohlmeyer  akohlmey_at_gmail.com
>> >> http://sites.google.com/site/akohlmey/
>> >>
>> >> Institute for Computational Molecular Science
>> >> Temple University, Philadelphia PA, USA.
>> >>
>> >
>> >
>>
>>
>>
>> --
>> Dr. Axel Kohlmeyer    akohlmey_at_gmail.com
>> http://sites.google.com/site/akohlmey/
>>
>> Institute for Computational Molecular Science
>> Temple University, Philadelphia PA, USA.
>
>

-- 
Dr. Axel Kohlmeyer    akohlmey_at_gmail.com
http://sites.google.com/site/akohlmey/
Institute for Computational Molecular Science
Temple University, Philadelphia PA, USA.