Skip to content

Commit

Permalink
Get CPK colors from PeriodicTable (#182)
Browse files Browse the repository at this point in the history
* CPK colors from PeriodicTable
  • Loading branch information
eahenle authored Oct 19, 2022
1 parent f99aa60 commit 5f10e60
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 110 deletions.
4 changes: 3 additions & 1 deletion Project.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name = "Xtals"
uuid = "ede5f01d-793e-4c47-9885-c447d1f18d6d"
authors = ["SimonEnsemble <cory.simon@oregonstate.edu>"]
version = "0.4.11"
version = "0.4.12"

[deps]
AtomsBase = "a963bdd2-2df7-4f54-a1ee-49d51e6be12a"
Expand All @@ -13,6 +13,7 @@ Graphs = "86223c79-3864-5bf0-83f7-82e725a168b6"
JLD2 = "033835bb-8acc-5ee8-8aae-3f567f8a3819"
LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e"
MetaGraphs = "626554b9-1ddb-594c-aa3c-2596fe9399a5"
PeriodicTable = "7b2266bf-644c-5ea3-82d8-af4bbd25a884"
PrecompileSignatures = "91cefc8d-f054-46dc-8f8c-26e11d7c5411"
Printf = "de0858da-6303-5e67-8744-51eddeeeb8d7"
StaticArrays = "90137ffa-7385-5640-81b9-e52037218182"
Expand All @@ -28,6 +29,7 @@ FIGlet = "0.2"
Graphs = "1.4"
JLD2 = "0.4"
MetaGraphs = "0.7"
PeriodicTable = "1.1"
PrecompileSignatures = "3.0"
StaticArrays = "1.3"
Unitful = "1.11"
Expand Down
1 change: 1 addition & 0 deletions src/Xtals.jl
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ using AtomsBase,
Graphs,
LinearAlgebra,
MetaGraphs,
PeriodicTable,
Printf,
StaticArrays,
Unitful
Expand Down
113 changes: 4 additions & 109 deletions src/cpk_colors.jl
Original file line number Diff line number Diff line change
@@ -1,113 +1,8 @@
# global cpk color dictionary
# atom_symbol => (R, G, B)
# built from PeriodicTable cpk_hex entires
DEFAULT_CPK_COLORS = Dict(
:H => (255, 255, 255),
:He => (217, 255, 255),
:Li => (204, 128, 255),
:Be => (194, 255, 0),
:B => (255, 181, 181),
:C => (144, 144, 144),
:N => (48, 80, 248),
:O => (255, 13, 13),
:F => (144, 224, 80),
:Ne => (179, 227, 245),
:Na => (171, 92, 242),
:Mg => (138, 255, 0),
:Al => (191, 166, 166),
:Si => (240, 200, 160),
:P => (255, 128, 0),
:S => (255, 255, 48),
:Cl => (31, 240, 31),
:Ar => (128, 209, 227),
:K => (143, 64, 212),
:Ca => (61, 255, 0),
:Sc => (230, 230, 230),
:Ti => (191, 194, 199),
:V => (166, 166, 171),
:Cr => (138, 153, 199),
:Mn => (156, 122, 199),
:Fe => (224, 102, 51),
:Co => (240, 144, 160),
:Ni => (80, 208, 80),
:Cu => (200, 128, 51),
:Zn => (125, 128, 176),
:Ga => (194, 143, 143),
:Ge => (102, 143, 143),
:As => (189, 128, 227),
:Se => (255, 161, 0),
:Br => (166, 41, 41),
:Kr => (92, 184, 209),
:Rb => (112, 46, 176),
:Sr => (0, 255, 0),
:Y => (148, 255, 255),
:Zr => (148, 224, 224),
:Nb => (115, 194, 201),
:Mo => (84, 181, 181),
:Tc => (59, 158, 158),
:Ru => (36, 143, 143),
:Rh => (10, 125, 140),
:Pd => (0, 105, 133),
:Ag => (192, 192, 192),
:Cd => (255, 217, 143),
:In => (166, 117, 115),
:Sn => (102, 128, 128),
:Sb => (158, 99, 181),
:Te => (212, 122, 0),
:I => (148, 0, 148),
:Xe => (66, 158, 176),
:Cs => (87, 23, 143),
:Ba => (0, 201, 0),
:La => (112, 212, 255),
:Ce => (255, 255, 199),
:Pr => (217, 255, 199),
:Nd => (199, 255, 199),
:Pm => (163, 255, 199),
:Sm => (143, 255, 199),
:Eu => (97, 255, 199),
:Gd => (69, 255, 199),
:Tb => (48, 255, 199),
:Dy => (31, 255, 199),
:Ho => (0, 255, 156),
:Er => (0, 230, 117),
:Tm => (0, 212, 82),
:Yb => (0, 191, 56),
:Lu => (0, 171, 36),
:Hf => (77, 194, 255),
:Ta => (77, 166, 255),
:W => (33, 148, 214),
:Re => (38, 125, 171),
:Os => (38, 102, 150),
:Ir => (23, 84, 135),
:Pt => (208, 208, 224),
:Au => (255, 209, 35),
:Hg => (184, 184, 208),
:Tl => (166, 84, 77),
:Pb => (87, 89, 97),
:Bi => (158, 79, 181),
:Po => (171, 92, 0),
:At => (117, 79, 69),
:Rn => (66, 130, 150),
:Fr => (66, 0, 102),
:Ra => (0, 125, 0),
:Ac => (112, 171, 250),
:Th => (0, 186, 255),
:Pa => (0, 161, 255),
:U => (0, 143, 255),
:Np => (0, 128, 255),
:Pu => (0, 107, 255),
:Am => (84, 92, 242),
:Cm => (120, 92, 227),
:Bk => (138, 79, 227),
:Cf => (161, 54, 212),
:Es => (179, 31, 212),
:Fm => (179, 31, 186),
:Md => (179, 13, 166),
:No => (189, 13, 135),
:Lr => (199, 0, 102),
:Rf => (204, 0, 89),
:Db => (209, 0, 79),
:Sg => (217, 0, 69),
:Bh => (224, 0, 56),
:Hs => (230, 0, 46),
:Mt => (235, 0, 38)
Symbol(elements[i].symbol) => (
[parse(Int, elements[i].cpk_hex[x]; base=16) for x in [[2, 3], [4, 5], [6, 7]]]...,
) for i in eachindex(elements) if length(elements[i].cpk_hex) == 7
)

0 comments on commit 5f10e60

Please sign in to comment.