next up previous contents index
Next: Creating a set of Up: VMD Script Commands for Previous: VMD Script Commands for   Contents   Index


Changing the color scale definitions

Suppose that of the 1024 colors, the first 511 should be red, then 2 whites, and finally 511 blues. You can use the `color' command to modify the color scale values accordingly.

proc tricolor_scale {} {
  set color_start [colorinfo num]
  display update off
  for {set i 0} {$i < 1024} {incr i} {
    if {$i == 0} {
      set r 1;  set g 0;  set b 0
    }
    if {$i == 511} {
      set r 1;  set g 1;  set b 1
    }
    if {$i == 513} {
      set r 0;  set g 0;  set b 1
    }
    color change rgb [expr $i + $color_start     ] $r $g $b
  }
  display update on
}

tricolor_scale



vmd@ks.uiuc.edu