• ## Outreach

From: Tyler Westland (tylerofthewest_at_gmail.com)
Date: Tue Sep 20 2016 - 15:45:15 CDT

*Solved*

Solution:

Code created from suggestion:
# Change as nessecary
proc ::set_colors {} {
# add items to color categories
# The type is set to the color.
# B = Blue
# U = Blue
# Y = Yellow
# W = Yellow
# R = Red
# A = Gray
# O = Orange
# G = Green
# Water and Hexane project
# Water
set hexanewater [atomselect top "name H or name O or name M"]
\$hexanewater set name B
\$hexanewater set type B
# Hexane
set hexane [atomselect top "name CH2 or name CH3"]
\$hexane set name Y
\$hexane set type Y

# SDK project
# Water
set sdkwater [atomselect top "name W"]
\$sdkwater set name U
\$sdkwater set type U
# Surfactant S10E3
set OA [atomselect top "name OA"]
\$OA set name R
\$OA set type R
set EO [atomselect top "name EO"]
\$EO set name W
\$EO set type W
set CM [atomselect top "name CM"]
\$CM set name G
\$CM set type G
set CT [atomselect top "name CT"]
\$CT set name A
\$CT set type A
set EB [atomselect top "name EST1 or name CT2"]
\$EB set name O
\$EB set type O

# now we can define colors by color group!
if {[\$hexanewater num] > 0} {
color Name B blue
color Type B blue
}
if {[\$sdkwater num] > 0} {
color Name U blue
color Type U blue
}
if {[\$hexane num] > 0} {
color Name Y yellow
color Type Y yellow
}
if {[\$EO num] > 0} {
color Name W yellow
color Type W yellow
}
if {[\$OA num] > 0} {
color Name R red
color Type R red
}
if {[\$CM num] > 0} {
color Name G green
color Type G green
}
if {[\$CT num] > 0} {
color Name A gray
color Type A gray
}
if {[\$EB num] > 0} {
color Name O orange
color Type O orange
}
}

On Thu, Sep 8, 2016 at 10:17 AM, Tyler Westland <tylerofthewest_at_gmail.com>
wrote:

> Dear VMD users,
>
> VMD Version: 1.9.2
>
> Problem: Error in custom vmdrc script
>
> Problem script:
> # Our colors set by name.
> # The "after idle" command is because the .vmdrc is processed too early
> # for colors to be set; this makes it so that it occurs after other
> # stuff is properly set up.
> # The dummy molecule is created because we can't set colors if no
> # molecules exist.
> initialization-scripts
> after idle {
> # create dummy molecule with one atom
> set mol [mol new atoms 20]
> set sel [atomselect \$mol all]
> # add items to color categories
> # Water and Hexane project
> # Water
> \$sel set name H
> \$sel set type H
> color Name H blue
> color Type H blue
> \$sel set name O
> \$sel set type O
> color Name O blue
> color Type O blue
> \$sel set type M
> \$sel set name M
> color Name M blue
> color Type M blue
> # Hexane
> \$sel set name CH2
> \$sel set type CH2
> color Name CH2 yellow
> color Type CH2 yellow
> \$sel set name CH3
> \$sel set type CH3
> color Name CH3 yellow
> color Type CH3 yellow
>
> # SDK project
> # Water
> \$sel set name W
> \$sel set type W
> color Name W blue
> color Type W blue
> # Surfactant S10E3
> \$sel set name OA
> \$sel set type OA
> color Name OA red
> color Type OA red
> \$sel set type EO
> \$sel set name EO
> color Name EO yellow
> color Type EO yellow
> \$sel set name CM
> \$sel set type CM
> color Name CM green
> color Type CM green
> \$sel set name CT
> \$sel set type CT
> color Name CT gray
> color Type CT gray
> \$sel set name EST1
> \$sel set type EST1
> color Name EST1 orange
> color Type EST1 orange
> \$sel set name CT2
> \$sel set type CT2
> color Name CT2 orange
> color Type CT2 orange
>
> # clean up
> \$sel delete
> mol delete \$mol
> }
>
> Error:
> When VMD starts up it throws an application error with this message:
>
> Unable to change color name
> Unable to change color name
> while executing
> "color Name "CH2" yellow"
> ("after" script)
>
> Thank you very much,
> Tyler Westland
>