Skip to content

Commit

Permalink
Merge pull request #45 from Eben60/master
Browse files Browse the repository at this point in the history
correct densities of gases
  • Loading branch information
carstenbauer authored Jun 24, 2022
2 parents 69d2d2c + 6597570 commit f6ce585
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 14 deletions.
24 changes: 12 additions & 12 deletions src/elements.jl
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ const _elements_data = [
boil=20.271K,
category="diatomic nonmetal",
cpk_hex="#ffffff",
density=0.08988g/cm^3,
density=0.08988e-3g/cm^3,
discovered_by="Henry Cavendish",
el_config="1s¹",
melt=13.99K,
Expand All @@ -53,7 +53,7 @@ const _elements_data = [
boil=4.222K,
category="noble gas",
cpk_hex="#d9ffff",
density=0.1786g/cm^3,
density=0.1786e-3g/cm^3,
discovered_by="Pierre Janssen",
el_config="1s²",
melt=0.95K,
Expand Down Expand Up @@ -151,7 +151,7 @@ const _elements_data = [
boil=77.355K,
category="diatomic nonmetal",
cpk_hex="#3050f8",
density=1.251g/cm^3,
density=1.251e-3g/cm^3,
discovered_by="Daniel Rutherford",
el_config="1s² 2s² 2p³",
melt=63.15K,
Expand All @@ -171,7 +171,7 @@ const _elements_data = [
boil=90.188K,
category="diatomic nonmetal",
cpk_hex="#ff0d0d",
density=1.429g/cm^3,
density=1.429e-3g/cm^3,
discovered_by="Carl Wilhelm Scheele",
el_config="1s² 2s² 2p⁴",
melt=54.36K,
Expand All @@ -191,7 +191,7 @@ const _elements_data = [
boil=85.03K,
category="diatomic nonmetal",
cpk_hex="#90e050",
density=1.696g/cm^3,
density=1.696e-3g/cm^3,
discovered_by="André-Marie Ampère",
el_config="1s² 2s² 2p⁵",
melt=53.48K,
Expand All @@ -211,7 +211,7 @@ const _elements_data = [
boil=27.104K,
category="noble gas",
cpk_hex="#b3e3f5",
density=0.9002g/cm^3,
density=0.9002e-3g/cm^3,
discovered_by="Morris Travers",
el_config="1s² 2s² 2p⁶",
melt=24.56K,
Expand Down Expand Up @@ -354,7 +354,7 @@ const _elements_data = [
boil=239.11K,
category="diatomic nonmetal",
cpk_hex="#1ff01f",
density=3.2g/cm^3,
density=3.2e-3g/cm^3,
discovered_by="Carl Wilhelm Scheele",
el_config="1s² 2s² 2p⁶ 3s² 3p⁵",
melt=171.6K,
Expand All @@ -374,7 +374,7 @@ const _elements_data = [
boil=87.302K,
category="noble gas",
cpk_hex="#80d1e3",
density=1.784g/cm^3,
density=1.784e-3g/cm^3,
discovered_by="Lord Rayleigh",
el_config="1s² 2s² 2p⁶ 3s² 3p⁶",
melt=83.81K,
Expand Down Expand Up @@ -735,7 +735,7 @@ const _elements_data = [
boil=119.93K,
category="noble gas",
cpk_hex="#5cb8d1",
density=3.749g/cm^3,
density=3.749e-3g/cm^3,
discovered_by="William Ramsay",
el_config="1s² 2s² 2p⁶ 3s² 3p⁶ 4s² 3d¹⁰ 4p⁶",
melt=115.78K,
Expand Down Expand Up @@ -1093,7 +1093,7 @@ const _elements_data = [
boil=165.051K,
category="noble gas",
cpk_hex="#429eb0",
density=5.894g/cm^3,
density=5.894e-3g/cm^3,
discovered_by="William Ramsay",
el_config="1s² 2s² 2p⁶ 3s² 3p⁶ 4s² 3d¹⁰ 4p⁶ 5s² 4d¹⁰ 5p⁶",
melt=161.4K,
Expand Down Expand Up @@ -1732,7 +1732,7 @@ const _elements_data = [
boil=211.5K,
category="noble gas",
cpk_hex="#428296",
density=9.73g/cm^3,
density=9.73e-3g/cm^3,
discovered_by="Friedrich Ernst Dorn",
el_config="1s² 2s² 2p⁶ 3s² 3p⁶ 4s² 3d¹⁰ 4p⁶ 5s² 4d¹⁰ 5p⁶ 6s² 4f¹⁴ 5d¹⁰ 6p⁶",
melt=202.0K,
Expand Down Expand Up @@ -2195,7 +2195,7 @@ const _elements_data = [
atomic_mass=285.0u,
boil=3570.0K,
category="transition metal",
density=23.7g/cm^3,
density=23.7e-3g/cm^3, # estimation for gas phase
discovered_by="Gesellschaft für Schwerionenforschung",
el_config="1s² 2s² 2p⁶ 3s² 3p⁶ 4s² 3d¹⁰ 4p⁶ 5s² 4d¹⁰ 5p⁶ 6s² 4f¹⁴ 5d¹⁰ 6p⁶ 7s² 5f¹⁴ 6d¹⁰",
number=112,
Expand Down
9 changes: 7 additions & 2 deletions test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,8 @@ else
end

@test stringmime("text/plain", elements) == "Elements(…119 elements…):\nH He \nLi Be B C N O F Ne \nNa Mg Al Si P S Cl Ar \nK Ca Sc Ti V Cr Mn Fe Co Ni Cu Zn Ga Ge As Se Br Kr \nRb Sr Y Zr Nb Mo Tc Ru Rh Pd Ag Cd In Sn Sb Te I Xe \nCs Ba Hf Ta W Re Os Ir Pt Au Hg Tl Pb Bi Po At Rn \nFr Ra Rf Db Sg Bh Hs Mt Ds Rg Cn Nh Fl Mc Lv Ts Og \nUue \n La Ce Pr Nd Pm Sm Eu Gd Tb Dy Ho Er Tm Yb Lu \n Ac Th Pa U Np Pu Am Cm Bk Cf Es Fm Md No Lr \n"
@test stringmime("text/plain", O) == "Oxygen (O), number 8:\n category: diatomic nonmetal\n atomic mass: 15.999 u\n density: 1.429 g/cm³\n melting point: 54.36 K\n boiling point: 90.188 K\n phase: Gas\n shells: [2, 6]\ne⁻-configuration: 1s² 2s² 2p⁴\n 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.\n discovered by: Carl Wilhelm Scheele\n named by: Antoine Lavoisier\n source: https://en.wikipedia.org/wiki/Oxygen\n spectral image: https://en.wikipedia.org/wiki/File:Oxygen_spectre.jpg\n"
@test stringmime("text/html", O) == "<style>\nth{text-align:right; padding:5px;}td{text-align:left; padding:5px}\n</style>\nOxygen (O), number 8:\n<table>\n<tr><th>category</th><td>diatomic nonmetal</td></tr>\n<tr><th>atomic mass</th><td>15.999 u</td></tr>\n<tr><th>density</th><td>1.429 g/cm³</td></tr>\n<tr><th>melting point</th><td>54.36 K</td></tr>\n<tr><th>boiling point</th><td>90.188 K</td></tr>\n<tr><th>phase</th><td>Gas</td></tr>\n<tr><th>shells</th><td>[2, 6]</td></tr>\n<tr><th>electron configuration</th><td>1s² 2s² 2p⁴</td></tr>\n<tr><th>summary</th><td>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.</td></tr>\n<tr><th>discovered by</th><td>Carl Wilhelm Scheele</td></tr>\n<tr><th>named by</th><td>Antoine Lavoisier</td></tr>\n<tr><th>source</th><td><a href=\"https://en.wikipedia.org/wiki/Oxygen\">https://en.wikipedia.org/wiki/Oxygen</a></td></tr>\n</table>\n<img src=\"https://commons.wikimedia.org/w/index.php?title=Special:Redirect/file/Oxygen_spectre.jpg&width=500\" alt=\"Oxygen_spectre.jpg\">\n"
@test stringmime("text/plain", O) == "Oxygen (O), number 8:\n category: diatomic nonmetal\n atomic mass: 15.999 u\n density: 0.001429 g/cm³\n melting point: 54.36 K\n boiling point: 90.188 K\n phase: Gas\n shells: [2, 6]\ne⁻-configuration: 1s² 2s² 2p⁴\n 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.\n discovered by: Carl Wilhelm Scheele\n named by: Antoine Lavoisier\n source: https://en.wikipedia.org/wiki/Oxygen\n spectral image: https://en.wikipedia.org/wiki/File:Oxygen_spectre.jpg\n"
@test stringmime("text/html", O) == "<style>\nth{text-align:right; padding:5px;}td{text-align:left; padding:5px}\n</style>\nOxygen (O), number 8:\n<table>\n<tr><th>category</th><td>diatomic nonmetal</td></tr>\n<tr><th>atomic mass</th><td>15.999 u</td></tr>\n<tr><th>density</th><td>0.001429 g/cm³</td></tr>\n<tr><th>melting point</th><td>54.36 K</td></tr>\n<tr><th>boiling point</th><td>90.188 K</td></tr>\n<tr><th>phase</th><td>Gas</td></tr>\n<tr><th>shells</th><td>[2, 6]</td></tr>\n<tr><th>electron configuration</th><td>1s² 2s² 2p⁴</td></tr>\n<tr><th>summary</th><td>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.</td></tr>\n<tr><th>discovered by</th><td>Carl Wilhelm Scheele</td></tr>\n<tr><th>named by</th><td>Antoine Lavoisier</td></tr>\n<tr><th>source</th><td><a href=\"https://en.wikipedia.org/wiki/Oxygen\">https://en.wikipedia.org/wiki/Oxygen</a></td></tr>\n</table>\n<img src=\"https://commons.wikimedia.org/w/index.php?title=Special:Redirect/file/Oxygen_spectre.jpg&width=500\" alt=\"Oxygen_spectre.jpg\">\n"

@test_throws ErrorException O.name = "Issue21"
@test O.name == "Oxygen"
Expand Down Expand Up @@ -81,3 +81,8 @@ for z in eachindex(elements)
@test haskey(elmdict, elements[z])
@test elmdict[elements[z]] == z
end

# Test data plausibility
for g in [e for e in elements if e.phase=="Gas"]
@test 5e-5u"g/cm^3" < g.density < 5e-2u"g/cm^3"
end

0 comments on commit f6ce585

Please sign in to comment.