Skip to content

Commit

Permalink
Merge pull request #17 from crstnbr/elconfig
Browse files Browse the repository at this point in the history
Added electron configurations
  • Loading branch information
rahulkp220 authored Sep 8, 2018
2 parents 3cfa3f6 + 5a065b3 commit de17381
Show file tree
Hide file tree
Showing 4 changed files with 128 additions and 4 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ Oxygen (O), number 8:
boiling point: 90.188 K
phase: Gas
shells: [2, 6]
e⁻-configuration: 122p⁴
summary: Oxygen is a chemical element with symbol O and atomic number 8. It is a member of the chalcogen group on the periodic table and is a highly reactive nonmetal and oxidizing agent that readily forms compounds (notably oxides) with most elements. By mass, oxygen is the third-most abundant element in the universe, after hydrogen and helium.
discovered by: Carl Wilhelm Scheele
named by: Antoine Lavoisier
Expand Down
6 changes: 5 additions & 1 deletion src/PeriodicTable.jl
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ mutable struct Element
color::String
density::Float64
discovered_by::String
el_config::String
melt::Float64
molar_heat::Float64
named_by::String
Expand All @@ -48,6 +49,7 @@ Element(; name::AbstractString="",
color::AbstractString="",
density::Real=NaN,
discovered_by::AbstractString="",
el_config::AbstractString="",
melt::Real=NaN,
molar_heat::Real=NaN,
named_by::AbstractString="",
Expand All @@ -62,7 +64,7 @@ Element(; name::AbstractString="",
ypos::Integer=-1,
shells::AbstractVector{<:Integer}=Int[]) =
Element(name, appearance, atomic_mass, boil, category, color, density,
discovered_by, melt, molar_heat, named_by, number, period, phase,
discovered_by, el_config, melt, molar_heat, named_by, number, period, phase,
source, spectral_img, summary, symbol, xpos, ypos, shells)

Base.show(io::IO, el::Element) = print(io, "Element(", el.name, ')')
Expand All @@ -86,6 +88,7 @@ function Base.show(io::IO, ::MIME"text/plain", el::Element)
printpresent(io, "boiling point", el.boil, " K")
printpresent(io, "phase", el.phase)
printpresent(io, "shells", el.shells)
printpresent(io, "e⁻-configuration", el.el_config)
printpresent(io, "appearance", el.appearance)
printpresent(io, "color", el.color)
printpresent(io, "summary", el.summary)
Expand Down Expand Up @@ -115,6 +118,7 @@ function Base.show(io::IO, ::MIME"text/html", el::Element)
printpresenthtml(io, "boiling point", el.boil, " K")
printpresenthtml(io, "phase", el.phase)
printpresenthtml(io, "shells", el.shells)
printpresenthtml(io, "electron configuration", el.el_config)
printpresenthtml(io, "appearance", el.appearance)
printpresenthtml(io, "color", el.color)
printpresenthtml(io, "summary", el.summary)
Expand Down
Loading

0 comments on commit de17381

Please sign in to comment.