001package com.hfg.chem;
002
003import java.util.HashMap;
004import java.util.Map;
005import java.util.Set;
006import java.util.HashSet;
007
008import com.hfg.units.length.Angstroms;
009import com.hfg.units.length.Length;
010import com.hfg.util.Case;
011import com.hfg.util.StringUtil;
012        
013//------------------------------------------------------------------------------
014/**
015 Atomic element. Elemental mass reference:
016 <pre><i>Coursey JS, Schwab DJ, and Dragoset RA. 2005. Atomic Weights and Isotopic Compositions (version 2.4.1).
017   [Online] Available: http://physics.nist.gov/PhysRefData/Compositions/ [2006, August 18].
018   National Institute of Standards and Technology, Gaithersburg, MD.
019   (Note that the value in parenthesis is the
020   <a href='http://physics.nist.gov/cgi-bin/cuu/Info/Constants/definitions.html'>standard uncertainty</a>.)</i>
021 </pre>
022 Organic mass values used are from:
023 <pre>
024   <i>Zhang Z, Pan H, Chen X. 2009. Mass spectrometry for structural characterization
025   of therapeutic antibodies. Mass Spectrom Rev 28:147-176.</i>
026 </pre>
027
028 @author J. Alex Taylor, hairyfatguy.com
029 */
030//------------------------------------------------------------------------------
031// com.hfg XML/HTML Coding Library
032//
033// This library is free software; you can redistribute it and/or
034// modify it under the terms of the GNU Lesser General Public
035// License as published by the Free Software Foundation; either
036// version 2.1 of the License, or (at your option) any later version.
037//
038// This library is distributed in the hope that it will be useful,
039// but WITHOUT ANY WARRANTY; without even the implied warranty of
040// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
041// Lesser General Public License for more details.
042//
043// You should have received a copy of the GNU Lesser General Public
044// License along with this library; if not, write to the Free Software
045// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
046//
047// J. Alex Taylor, President, Founder, CEO, COO, CFO, OOPS hairyfatguy.com
048// jataylor@hairyfatguy.com
049//------------------------------------------------------------------------------
050
051public class Element implements Comparable<Element>, Matter
052{
053   //##########################################################################
054   // PRIVATE FIELDS
055   //##########################################################################
056
057   private final String mName;
058   private final String mSymbol;
059   private final int    mAtomicNum;
060   private final Double mMonoisotopicMass;
061   private Double mAverageMass;
062   private Double mOrganicAverageMass;
063   private int[]  mDefaultValences;
064   private Length mVanderWaalsRadius;
065   private Length mCovalentRadius;
066
067   // This declaration has to come before the public constants below.
068   private static Set<Element> sValues = new HashSet<>(120);
069
070   //##########################################################################
071   // PUBLIC FIELDS
072   //##########################################################################
073
074   public static final Element HYDROGEN      = new Element("Hydrogen",       "H",     1,   1.007825032,    1.00794,        1.007968);
075   public static final Element HELIUM        = new Element("Helium",         "He",    2,   4.00260325413,  4.002602);
076   public static final Element LITHIUM       = new Element("Lithium",        "Li",    3,   7.0160034366,   6.941);
077   public static final Element BERYLLIUM     = new Element("Beryllium",      "Be",    4,   9.012183065,    9.012182);
078   public static final Element BORON         = new Element("Boron",          "B",     5,  11.00930536,    10.811);
079   public static final Element CARBON        = new Element("Carbon",         "C",     6,  12,             12.0107,        12.01079);
080   public static final Element NITROGEN      = new Element("Nitrogen",       "N",     7,  14.0030740052,  14.0067,        14.00669);
081   public static final Element OXYGEN        = new Element("Oxygen",         "O",     8,  15.9949146221,  15.9994,        15.99937);
082   public static final Element FLUORINE      = new Element("Fluorine",       "F",     9,  18.99840316273, 18.9984032);
083   public static final Element NEON          = new Element("Neon",           "Ne",   10,  19.9924401762,  20.1797);
084   public static final Element SODIUM        = new Element("Sodium",         "Na",   11,  22.9897696723,  22.9897702);
085   public static final Element MAGNESIUM     = new Element("Magnesium",      "Mg",   12,  23.985041697,   24.3050);
086   public static final Element ALUMINIUM     = new Element("Aluminium",      "Al",   13,  26.98153853,    26.9815386);
087   public static final Element SILICON       = new Element("Silicon",        "Si",   14,  27.97692653465, 28.0855);
088   public static final Element PHOSPHOROUS   = new Element("Phosphorous",    "P",    15,  30.97376151,    30.973761);
089   public static final Element SULFUR        = new Element("Sulfur",         "S",    16,  31.97207069,    32.065,         32.0639);
090   public static final Element CHLORINE      = new Element("Chlorine",       "Cl",   17,  34.968852682,   35.453);
091   public static final Element ARGON         = new Element("Argon",          "Ar",   18,  39.9623831237,  39.948);
092   public static final Element POTASSIUM     = new Element("Potassium",      "K",    19,  38.96370693,    39.0983);
093   public static final Element CALCIUM       = new Element("Calcium",        "Ca",   20,  39.962590863,   40.078);
094   public static final Element SCANDIUM      = new Element("Scandium",       "Sc",   21,  44.95590828,    44.955912);
095   public static final Element TITANIUM      = new Element("Titanium",       "Ti",   22,  47.94794198,    47.867);
096   public static final Element VANADIUM      = new Element("Vanadium",       "V",    23,  50.94395704,    50.9415);
097   public static final Element CHROMIUM      = new Element("Chromium",       "Cr",   24,  51.94050623,    51.9961);
098   public static final Element MANGANESE     = new Element("Manganese",      "Mn",   25,  54.93804391,    54.938045);
099   public static final Element IRON          = new Element("Iron",           "Fe",   26,  55.93494210,    55.845);
100   public static final Element COBALT        = new Element("Cobalt",         "Co",   27,  58.93319429,    58.933195);
101   public static final Element NICKEL        = new Element("Nickel",         "Ni",   28,  57.93534241,    58.6934);
102   public static final Element COPPER        = new Element("Copper",         "Cu",   29,  62.92959772,    63.546);
103   public static final Element ZINC          = new Element("Zinc",           "Zn",   30,  63.92914660,    65.409);
104   public static final Element GALLIUM       = new Element("Gallium",        "Ga",   31,  68.9255735,     69.723);
105   public static final Element GERMANIUM     = new Element("Germanium",      "Ge",   32,  73.921177761,   72.64);
106   public static final Element ARSENIC       = new Element("Arsenic",        "As",   33,  74.92159457,    74.92160);
107   public static final Element SELENIUM      = new Element("Selenium",       "Se",   34,  79.9165218,     78.96);
108   public static final Element BROMINE       = new Element("Bromine",        "Br",   35,  78.9183376,     79.904);
109   public static final Element KRYPTON       = new Element("Krypton",        "Kr",   36,  83.9114977282,  83.798);
110   public static final Element RUBIDIUM      = new Element("Rubidium",       "Rb",   37,  84.9117897379,  85.4678);
111   public static final Element STRONTIUM     = new Element("Strontium",      "Sr",   38,  87.9056125,     87.62);
112   public static final Element YTTRIUM       = new Element("Yttrium",        "Y",    39,  88.9058403,     88.90585);
113   public static final Element ZIRCONIUM     = new Element("Zirconium",      "Zr",   40,  89.9046977,     91.224);
114   public static final Element NIOBIUM       = new Element("Niobium",        "Nb",   41,  92.9063730,     92.90638);
115   public static final Element MOLYBDENUM    = new Element("Molybdenum",     "Mo",   42,  97.90540482,    95.94);
116   public static final Element TECHNETIUM    = new Element("Technetium",     "Tc",   43,  96.9063667);
117   public static final Element RUTHENIUM     = new Element("Ruthenium",      "Ru",   44, 101.9043441,    101.07);
118   public static final Element RHODIUM       = new Element("Rhodium",        "Rh",   45, 102.9054980,    102.90550);
119   public static final Element PALLADIUM     = new Element("Palladium",      "Pd",   46, 105.9034804,    106.42);
120   public static final Element SILVER        = new Element("Silver",         "Ag",   47, 106.9050916,    107.8682);
121   public static final Element CADMIUM       = new Element("Cadmium",        "Cd",   48, 113.90336509,   112.411);
122   public static final Element INDIUM        = new Element("Indium",         "In",   49, 114.903878776,  114.818);
123   public static final Element TIN           = new Element("Tin",            "Sn",   50, 119.90220163,   118.710);
124   public static final Element ANTIMONY      = new Element("Antimony",       "Sb",   51, 120.9038120,    121.760);
125   public static final Element TELLURIUM     = new Element("Tellurium",      "Te",   52, 129.906222748,  127.60);
126   public static final Element IODINE        = new Element("Iodine",         "I",    53, 126.9044719,    126.90447);
127   public static final Element XENON         = new Element("Xenon",          "Xe",   54, 131.9041550856, 131.293);
128   public static final Element CESIUM        = new Element("Cesium",         "Cs",   55, 132.9054519610, 132.9054519);
129   public static final Element BARIUM        = new Element("Barium",         "Ba",   56, 137.90524700,   137.327);
130   public static final Element LANTHANUM     = new Element("Lanthanum",      "La",   57, 138.9063563,    138.90547);
131   public static final Element CERIUM        = new Element("Cerium",         "Ce",   58, 139.9054431,    140.116);
132   public static final Element PRASEODYMIUM  = new Element("Praseodymium",   "Pr",   59, 140.9076576,    140.90765);
133   public static final Element NEODYMIUM     = new Element("Neodymium",      "Nd",   60, 141.9077290,    144.242);
134   public static final Element PROMETHIUM    = new Element("Promethium",     "Pm",   61, 144.9127559);
135   public static final Element SAMARIUM      = new Element("Samarium",       "Sm",   62, 151.9197397,    150.36);
136   public static final Element EUROPIUM      = new Element("Europium",       "Eu",   63, 152.9212380,    151.964);
137   public static final Element GADOLINIUM    = new Element("Gadolinium",     "Gd",   64, 157.9241123,    157.25);
138   public static final Element TERBIUM       = new Element("Terbium",        "Tb",   65, 158.9253547,    158.92535);
139   public static final Element DYSPROSIUM    = new Element("Dysprosium",     "Dy",   66, 163.9291819,    162.500);
140   public static final Element HOLMIUM       = new Element("Holmium",        "Ho",   67, 164.9303288,    164.93032);
141   public static final Element ERBIUM        = new Element("Erbium",         "Er",   68, 165.9302995,    167.259);
142   public static final Element THULIUM       = new Element("Thulium",        "Tm",   69, 168.9342179,    168.93421);
143   public static final Element YTTERBIUM     = new Element("Ytterbium",      "Yb",   70, 173.9388664,    173.04);
144   public static final Element LUTETIUM      = new Element("Lutetium",       "Lu",   71, 174.9407752,    174.967);
145   public static final Element HAFNIUM       = new Element("Hafnium",        "Hf",   72, 179.9465570,    178.49);
146   public static final Element TANTALUM      = new Element("Tantalum",       "Ta",   73, 180.9479958,    180.94788);
147   public static final Element TUNGSTEN      = new Element("Tungsten",       "W",    74, 183.95093092,   183.84);
148   public static final Element RHENIUM       = new Element("Rhenium",        "Re",   75, 186.9557501,    186.207);
149   public static final Element OSMIUM        = new Element("Osmium",         "Os",   76, 191.9614770,    190.23);
150   public static final Element IRIDIUM       = new Element("Iridium",        "Ir",   77, 192.9629216,    192.217);
151   public static final Element PLATINUM      = new Element("Platinum",       "Pt",   78, 194.9647917,    195.084);
152   public static final Element GOLD          = new Element("Gold",           "Au",   79, 196.96656879,   196.966569);
153   public static final Element MERCURY       = new Element("Mercury",        "Hg",   80, 201.97064340,   200.59);
154   public static final Element THALLIUM      = new Element("Thallium",       "Tl",   81, 204.9744278,    204.3833);
155   public static final Element LEAD          = new Element("Lead",           "Pb",   82, 207.9766525,    207.2);
156   public static final Element BISMUTH       = new Element("Bismuth",        "Bi",   83, 208.9803991,    208.98040);
157   public static final Element POLONIUM      = new Element("Polonium",       "Po",   84, 208.9824308);
158   public static final Element ASTATINE      = new Element("Astatine",       "At",   85, 209.9871479);
159   public static final Element RADON         = new Element("Radon",          "Rn",   86, 222.0175782);
160   public static final Element FRANCIUM      = new Element("Francium",       "Fr",   87, 223.0197360);
161   public static final Element RADIUM        = new Element("Radium",         "Ra",   88, 226.0254103);
162   public static final Element ACTINIUM      = new Element("Actinium",       "Ac",   89, 227.0277523);
163   public static final Element THORIUM       = new Element("Thorium",        "Th",   90, 232.0380558);
164   public static final Element PROACTINIUM   = new Element("Proactinium",    "Pa",   91, 231.0358842);
165   public static final Element URANIUM       = new Element("Uranium",        "U",    92, 238.0507884);
166   public static final Element NEPTUNIUM     = new Element("Neptunium",      "Np",   93, 237.0481736);
167   public static final Element PLUTONIUM     = new Element("Plutonium",      "Pu",   94, 238.0495601);
168   public static final Element AMERICIUM     = new Element("Americium",      "Am",   95, 241.0568293);
169   public static final Element CURIUM        = new Element("Curium",         "Cm",   96, 243.0613893);
170   public static final Element BERKELIUM     = new Element("Berkelium",      "Bk",   97, 247.0703073);
171   public static final Element CALIFORNIUM   = new Element("Californium",    "Cf",   98, 249.0748539);
172   public static final Element EINSTEINIUM   = new Element("Einsteinium",    "Es",   99, 252.082980);
173   public static final Element FERMIUM       = new Element("Fermium",        "Fm",  100, 257.0951061);
174   public static final Element MENDELEVIUM   = new Element("Mendelevium",    "Md",  101, 258.0984315);
175   public static final Element NOBELIUM      = new Element("Nobelium",       "No",  102, 259.10103);
176   public static final Element LAWRENCIUM    = new Element("Lawrencium",     "Lr",  103, 262.10961);
177   public static final Element RUTHERFORDIUM = new Element("Rutherfordium",  "Rf",  104, 267.12179);
178   public static final Element DUBNIUM       = new Element("Dubnium",        "Db",  105, 268.12567);
179   public static final Element SEABORGIUM    = new Element("Seaborgium",     "Sg",  106, 271.13393);
180   public static final Element BOHRIUM       = new Element("Bohrium",        "Bh",  107, 272.13826);
181   public static final Element HASSIUM       = new Element("Hassium",        "Hs",  108, 270.13429);
182   public static final Element MEITNERIUM    = new Element("Meitnerium",     "Mt",  109, 276.15159);
183   public static final Element DARMSTADTIUM  = new Element("Darmstadtium",   "Ds",  110, 281.16451);
184   public static final Element ROENTGENIUM   = new Element("Roentgenium",    "Rg",  111, 280.16514);
185   public static final Element COPERNICIUM   = new Element("Copernicium",    "Cn",  112, 285.17712);
186   public static final Element UNUNTRIUM     = new Element("Ununtrium",      "Uut", 113, 284.17873);
187   public static final Element FLEROVIUM     = new Element("Flerovium",      "Fl",  114, 289.19042);
188   public static final Element UNUNPENTIUM   = new Element("Ununpentium",    "Uup", 115, 288.19274);
189   public static final Element LIVERMORIUM   = new Element("Livermorium",    "Lv",  116, 293.20449);
190   public static final Element UNUNSEPTIUM   = new Element("Ununseptium",    "Uus", 117, 292.20746);
191   public static final Element UNUNOCTIUM    = new Element("Ununoctium",     "Uuo", 118, 294.21392);
192
193   static
194   {
195      // From Table 1 in
196      // Alvarez, Santiago. 2013.
197      // “A Cartography of the van Der Waals Territories.”
198      // Dalton Transactions 42 (24): 8617–36.
199      // https://doi.org/10.1039/c3dt50599e.
200      HYDROGEN.setVanderWaalsRadius(new Angstroms(1.20));
201      HELIUM.setVanderWaalsRadius(new Angstroms(1.43));
202      LITHIUM.setVanderWaalsRadius(new Angstroms(2.12));
203      BERYLLIUM.setVanderWaalsRadius(new Angstroms(1.98));
204      BORON.setVanderWaalsRadius(new Angstroms(1.91));
205      CARBON.setVanderWaalsRadius(new Angstroms(1.77));
206      NITROGEN.setVanderWaalsRadius(new Angstroms(1.66));
207      OXYGEN.setVanderWaalsRadius(new Angstroms(1.50));
208      FLUORINE.setVanderWaalsRadius(new Angstroms(1.46));
209      NEON.setVanderWaalsRadius(new Angstroms(1.58));
210      SODIUM.setVanderWaalsRadius(new Angstroms(2.50));
211      MAGNESIUM.setVanderWaalsRadius(new Angstroms(2.51));
212      ALUMINIUM.setVanderWaalsRadius(new Angstroms(2.25));
213      SILICON.setVanderWaalsRadius(new Angstroms(2.19));
214      PHOSPHOROUS.setVanderWaalsRadius(new Angstroms(1.90));
215      SULFUR.setVanderWaalsRadius(new Angstroms(1.89));
216      CHLORINE.setVanderWaalsRadius(new Angstroms(1.82));
217      ARGON.setVanderWaalsRadius(new Angstroms(1.83));
218      POTASSIUM.setVanderWaalsRadius(new Angstroms(2.73));
219      CALCIUM.setVanderWaalsRadius(new Angstroms(2.62));
220      SCANDIUM.setVanderWaalsRadius(new Angstroms(2.58));
221      TITANIUM.setVanderWaalsRadius(new Angstroms(2.46));
222      VANADIUM.setVanderWaalsRadius(new Angstroms(2.42));
223      CHROMIUM.setVanderWaalsRadius(new Angstroms(2.45));
224      MANGANESE.setVanderWaalsRadius(new Angstroms(2.45));
225      IRON.setVanderWaalsRadius(new Angstroms(2.44));
226      COBALT.setVanderWaalsRadius(new Angstroms(2.40));
227      NICKEL.setVanderWaalsRadius(new Angstroms(2.40));
228      COPPER.setVanderWaalsRadius(new Angstroms(2.38));
229      ZINC.setVanderWaalsRadius(new Angstroms(2.39));
230      GALLIUM.setVanderWaalsRadius(new Angstroms(2.32));
231      GERMANIUM.setVanderWaalsRadius(new Angstroms(2.29));
232      ARSENIC.setVanderWaalsRadius(new Angstroms(1.88));
233      SELENIUM.setVanderWaalsRadius(new Angstroms(1.82));
234      BROMINE.setVanderWaalsRadius(new Angstroms(1.86));
235      KRYPTON.setVanderWaalsRadius(new Angstroms(2.25));
236      RUBIDIUM.setVanderWaalsRadius(new Angstroms(3.21));
237      STRONTIUM.setVanderWaalsRadius(new Angstroms(2.84));
238      YTTRIUM.setVanderWaalsRadius(new Angstroms(2.75));
239      ZIRCONIUM.setVanderWaalsRadius(new Angstroms(2.52));
240      NIOBIUM.setVanderWaalsRadius(new Angstroms(2.56));
241      MOLYBDENUM.setVanderWaalsRadius(new Angstroms(2.45));
242      TECHNETIUM.setVanderWaalsRadius(new Angstroms(2.44));
243      RUTHENIUM.setVanderWaalsRadius(new Angstroms(2.46));
244      RHODIUM.setVanderWaalsRadius(new Angstroms(2.44));
245      PALLADIUM.setVanderWaalsRadius(new Angstroms(2.15));
246      SILVER.setVanderWaalsRadius(new Angstroms(2.53));
247      CADMIUM.setVanderWaalsRadius(new Angstroms(2.49));
248      INDIUM.setVanderWaalsRadius(new Angstroms(2.43));
249      TIN.setVanderWaalsRadius(new Angstroms(2.42));
250      ANTIMONY.setVanderWaalsRadius(new Angstroms(2.47));
251      TELLURIUM.setVanderWaalsRadius(new Angstroms(1.99));
252      IODINE.setVanderWaalsRadius(new Angstroms(2.04));
253      XENON.setVanderWaalsRadius(new Angstroms(2.06));
254      CESIUM.setVanderWaalsRadius(new Angstroms(3.48));
255      BARIUM.setVanderWaalsRadius(new Angstroms(3.03));
256      LANTHANUM.setVanderWaalsRadius(new Angstroms(2.98));
257      CERIUM.setVanderWaalsRadius(new Angstroms(2.88));
258      PRASEODYMIUM.setVanderWaalsRadius(new Angstroms(2.92));
259      NEODYMIUM.setVanderWaalsRadius(new Angstroms(2.95));
260//      PROMETHIUM.setVanderWaalsRadius(new Angstroms());
261      SAMARIUM.setVanderWaalsRadius(new Angstroms(2.90));
262      EUROPIUM.setVanderWaalsRadius(new Angstroms(2.87));
263      GADOLINIUM.setVanderWaalsRadius(new Angstroms(2.83));
264      TERBIUM.setVanderWaalsRadius(new Angstroms(2.79));
265      DYSPROSIUM.setVanderWaalsRadius(new Angstroms(2.87));
266      HOLMIUM.setVanderWaalsRadius(new Angstroms(2.81));
267      ERBIUM.setVanderWaalsRadius(new Angstroms(2.83));
268      THULIUM .setVanderWaalsRadius(new Angstroms(2.79));
269      YTTERBIUM.setVanderWaalsRadius(new Angstroms(2.80));
270      LUTETIUM.setVanderWaalsRadius(new Angstroms(2.74));
271      HAFNIUM.setVanderWaalsRadius(new Angstroms(2.63));
272      TANTALUM.setVanderWaalsRadius(new Angstroms(2.53));
273      TUNGSTEN.setVanderWaalsRadius(new Angstroms(2.57));
274      RHENIUM.setVanderWaalsRadius(new Angstroms(2.49));
275      OSMIUM.setVanderWaalsRadius(new Angstroms(2.48));
276      IRIDIUM.setVanderWaalsRadius(new Angstroms(2.41));
277      PLATINUM.setVanderWaalsRadius(new Angstroms(2.29));
278      GOLD.setVanderWaalsRadius(new Angstroms(2.32));
279      MERCURY.setVanderWaalsRadius(new Angstroms(2.45));
280      THALLIUM.setVanderWaalsRadius(new Angstroms(2.47));
281      LEAD.setVanderWaalsRadius(new Angstroms(2.60));
282      BISMUTH.setVanderWaalsRadius(new Angstroms(2.54));
283//      POLONIUM.setVanderWaalsRadius(new Angstroms());
284//      ASTATINE.setVanderWaalsRadius(new Angstroms());
285//      RADON.setVanderWaalsRadius(new Angstroms());
286//      FRANCIUM.setVanderWaalsRadius(new Angstroms());
287//      RADIUM.setVanderWaalsRadius(new Angstroms());
288      ACTINIUM.setVanderWaalsRadius(new Angstroms(2.8));
289      THORIUM.setVanderWaalsRadius(new Angstroms(2.93));
290      PROACTINIUM.setVanderWaalsRadius(new Angstroms(2.88));
291      URANIUM.setVanderWaalsRadius(new Angstroms(2.71));
292      NEPTUNIUM.setVanderWaalsRadius(new Angstroms(2.82));
293      PLUTONIUM.setVanderWaalsRadius(new Angstroms(2.81));
294      AMERICIUM.setVanderWaalsRadius(new Angstroms(2.83));
295      CURIUM.setVanderWaalsRadius(new Angstroms(3.05));
296      BERKELIUM.setVanderWaalsRadius(new Angstroms(3.4));
297      CALIFORNIUM.setVanderWaalsRadius(new Angstroms(3.05));
298      EINSTEINIUM.setVanderWaalsRadius(new Angstroms(2.7));
299
300      
301      // From Table 2 in
302      // Cordero, Beatriz, Verónica Gómez, Ana E. Platero-Prats,
303      // Marc Revés, Jorge Echeverría, Eduard Cremades,
304      // Flavia Barragán, and Santiago Alvarez. 2008.
305      // “Covalent Radii Revisited.”
306      // Journal of the Chemical Society. Dalton Transactions, no. 21: 2832–38.
307      // https://doi.org/10.1039/b801115j.
308      HYDROGEN. setCovalentRadius(new Angstroms(0.31));
309      HELIUM. setCovalentRadius(new Angstroms(0.28));
310      LITHIUM. setCovalentRadius(new Angstroms(1.28));
311      BERYLLIUM. setCovalentRadius(new Angstroms(0.96));
312      BORON. setCovalentRadius(new Angstroms(0.84));
313      CARBON. setCovalentRadius(new Angstroms(0.76));
314      NITROGEN. setCovalentRadius(new Angstroms(0.71));
315      OXYGEN. setCovalentRadius(new Angstroms(0.66));
316      FLUORINE. setCovalentRadius(new Angstroms(0.57));
317      NEON. setCovalentRadius(new Angstroms(0.58));
318      SODIUM. setCovalentRadius(new Angstroms(1.66));
319      MAGNESIUM. setCovalentRadius(new Angstroms(1.41));
320      ALUMINIUM. setCovalentRadius(new Angstroms(1.21));
321      SILICON. setCovalentRadius(new Angstroms(1.11));
322      PHOSPHOROUS. setCovalentRadius(new Angstroms(1.07));
323      SULFUR. setCovalentRadius(new Angstroms(1.05));
324      CHLORINE. setCovalentRadius(new Angstroms(1.02));
325      ARGON. setCovalentRadius(new Angstroms(1.06));
326      POTASSIUM. setCovalentRadius(new Angstroms(2.03));
327      CALCIUM. setCovalentRadius(new Angstroms(1.76));
328      SCANDIUM. setCovalentRadius(new Angstroms(1.70));
329      TITANIUM. setCovalentRadius(new Angstroms(1.60));
330      VANADIUM. setCovalentRadius(new Angstroms(1.53));
331      CHROMIUM. setCovalentRadius(new Angstroms(1.39));
332      MANGANESE. setCovalentRadius(new Angstroms(1.39));
333      IRON. setCovalentRadius(new Angstroms(1.32));
334      COBALT. setCovalentRadius(new Angstroms(1.26));
335      NICKEL. setCovalentRadius(new Angstroms(1.24));
336      COPPER. setCovalentRadius(new Angstroms(1.32));
337      ZINC. setCovalentRadius(new Angstroms(1.22));
338      GALLIUM. setCovalentRadius(new Angstroms(1.22));
339      GERMANIUM. setCovalentRadius(new Angstroms(1.20));
340      ARSENIC. setCovalentRadius(new Angstroms(1.19));
341      SELENIUM. setCovalentRadius(new Angstroms(1.20));
342      BROMINE. setCovalentRadius(new Angstroms(1.20));
343      KRYPTON. setCovalentRadius(new Angstroms(1.16));
344      RUBIDIUM. setCovalentRadius(new Angstroms(2.20));
345      STRONTIUM. setCovalentRadius(new Angstroms(1.95));
346      YTTRIUM. setCovalentRadius(new Angstroms(1.90));
347      ZIRCONIUM. setCovalentRadius(new Angstroms(1.75));
348      NIOBIUM. setCovalentRadius(new Angstroms(1.64));
349      MOLYBDENUM. setCovalentRadius(new Angstroms(1.54));
350      TECHNETIUM. setCovalentRadius(new Angstroms(1.47));
351      RUTHENIUM. setCovalentRadius(new Angstroms(1.46));
352      RHODIUM. setCovalentRadius(new Angstroms(1.42));
353      PALLADIUM. setCovalentRadius(new Angstroms(1.39));
354      SILVER. setCovalentRadius(new Angstroms(1.45));
355      CADMIUM. setCovalentRadius(new Angstroms(1.44));
356      INDIUM. setCovalentRadius(new Angstroms(1.42));
357      TIN. setCovalentRadius(new Angstroms(1.39));
358      ANTIMONY. setCovalentRadius(new Angstroms(1.39));
359      TELLURIUM. setCovalentRadius(new Angstroms(1.38));
360      IODINE. setCovalentRadius(new Angstroms(1.39));
361      XENON. setCovalentRadius(new Angstroms(1.40));
362      CESIUM. setCovalentRadius(new Angstroms(2.44));
363      BARIUM. setCovalentRadius(new Angstroms(2.15));
364      LANTHANUM. setCovalentRadius(new Angstroms(2.07));
365      CERIUM. setCovalentRadius(new Angstroms(2.04));
366      PRASEODYMIUM. setCovalentRadius(new Angstroms(2.03));
367      NEODYMIUM. setCovalentRadius(new Angstroms(2.01));
368      PROMETHIUM. setCovalentRadius(new Angstroms(1.99));
369      SAMARIUM. setCovalentRadius(new Angstroms(1.98));
370      EUROPIUM. setCovalentRadius(new Angstroms(1.98));
371      GADOLINIUM. setCovalentRadius(new Angstroms(1.96));
372      TERBIUM. setCovalentRadius(new Angstroms(1.94));
373      DYSPROSIUM. setCovalentRadius(new Angstroms(1.92));
374      HOLMIUM. setCovalentRadius(new Angstroms(1.92));
375      ERBIUM. setCovalentRadius(new Angstroms(1.89));
376      THULIUM . setCovalentRadius(new Angstroms(1.90));
377      YTTERBIUM. setCovalentRadius(new Angstroms(1.87));
378      LUTETIUM. setCovalentRadius(new Angstroms(1.87));
379      HAFNIUM. setCovalentRadius(new Angstroms(1.75));
380      TANTALUM. setCovalentRadius(new Angstroms(1.70));
381      TUNGSTEN. setCovalentRadius(new Angstroms(1.62));
382      RHENIUM. setCovalentRadius(new Angstroms(1.51));
383      OSMIUM. setCovalentRadius(new Angstroms(1.44));
384      IRIDIUM. setCovalentRadius(new Angstroms(1.41));
385      PLATINUM. setCovalentRadius(new Angstroms(1.36));
386      GOLD. setCovalentRadius(new Angstroms(1.36));
387      MERCURY. setCovalentRadius(new Angstroms(1.32));
388      THALLIUM. setCovalentRadius(new Angstroms(1.45));
389      LEAD. setCovalentRadius(new Angstroms(1.46));
390      BISMUTH. setCovalentRadius(new Angstroms(1.48));
391      POLONIUM. setCovalentRadius(new Angstroms(1.40));
392      ASTATINE. setCovalentRadius(new Angstroms(1.50));
393      RADON. setCovalentRadius(new Angstroms(1.50));
394      FRANCIUM. setCovalentRadius(new Angstroms(2.60));
395      RADIUM. setCovalentRadius(new Angstroms(2.21));
396      ACTINIUM. setCovalentRadius(new Angstroms(2.15));
397      THORIUM. setCovalentRadius(new Angstroms(2.06));
398      PROACTINIUM. setCovalentRadius(new Angstroms(2.00));
399      URANIUM. setCovalentRadius(new Angstroms(1.96));
400      NEPTUNIUM. setCovalentRadius(new Angstroms(1.90));
401      PLUTONIUM. setCovalentRadius(new Angstroms(1.87));
402      AMERICIUM. setCovalentRadius(new Angstroms(1.80));
403      CURIUM. setCovalentRadius(new Angstroms(1.69));
404
405
406
407      HYDROGEN.setDefaultValences(new int[] { 1 });
408      BORON.setDefaultValences(new int[] { 3 });
409      CARBON.setDefaultValences(new int[] { 4 });
410      NITROGEN.setDefaultValences(new int[] { 3 });
411      OXYGEN.setDefaultValences(new int[] { 2 });
412      FLUORINE.setDefaultValences(new int[] { 1 });
413      SILICON.setDefaultValences(new int[] { 4 });
414      PHOSPHOROUS.setDefaultValences(new int[] { 3, 5 });
415      SULFUR.setDefaultValences(new int[] { 2, 4, 6 });
416      CHLORINE.setDefaultValences(new int[] { 1, 3, 5, 7 });
417      ARSENIC.setDefaultValences(new int[] { 3, 5 });
418      SELENIUM.setDefaultValences(new int[] { 2, 4, 6 });
419      BROMINE.setDefaultValences(new int[] { 1, 3, 5, 7 });
420      TELLURIUM.setDefaultValences(new int[] { 2, 4, 6 });
421      IODINE.setDefaultValences(new int[] { 1, 3, 5, 7 });
422      ASTATINE.setDefaultValences(new int[] { 1, 3, 5, 7 });
423   }
424
425   //##########################################################################
426   // CONSTRUCTORS
427   //##########################################################################
428
429   //--------------------------------------------------------------------------
430   private Element(String inName, String inSymbol, int inAtomicNum,
431                   double inMonoMass)
432   {
433      mName   = inName;
434      mSymbol = inSymbol;
435      mAtomicNum = inAtomicNum;
436      mMonoisotopicMass   = inMonoMass;
437
438      if (getClass().equals(Element.class)) // We don't want to include isotopes
439      {
440         sValues.add(this);
441      }
442   }
443
444   //--------------------------------------------------------------------------
445   protected Element(String inName, String inSymbol, int inAtomicNum,
446                   double inMonoMass, double inAvgMass)
447   {
448      this(inName, inSymbol, inAtomicNum, inMonoMass);
449      mAverageMass        = inAvgMass;
450   }
451
452   //--------------------------------------------------------------------------
453   protected Element(String inName, String inSymbol, int inAtomicNum,
454                   double inMonoMass, double inAvgMass, double inOrgainicAvgMass)
455   {
456      this(inName, inSymbol, inAtomicNum, inMonoMass, inAvgMass);
457      mOrganicAverageMass = inOrgainicAvgMass;
458   }
459
460   //##########################################################################
461   // PUBLIC METHODS
462   //##########################################################################
463
464   //--------------------------------------------------------------------------
465   public static Element valueOf(String inString)
466   {
467      return valueOf(inString, Case.SENSITIVE);
468   }
469
470   //--------------------------------------------------------------------------
471   public static Element valueOf(String inString, Case inCaseSensetive)
472   {
473      Element value = null;
474
475      if (StringUtil.isSet(inString))
476      {
477         for (Element element : sValues)
478         {
479            if(inCaseSensetive != null
480                  && inCaseSensetive.equals(Case.INSENSITIVE))
481            {
482               if (element.getName().equalsIgnoreCase(inString)
483                     || element.getSymbol().equalsIgnoreCase(inString))
484               {
485                  value = element;
486                  break;
487               }
488            }
489            else if (element.getName().equals(inString)
490                     || element.getSymbol().equals(inString))
491            {
492               value = element;
493               break;
494            }
495         }
496      }
497
498      return value;
499   }
500
501   //--------------------------------------------------------------------------
502   public static Element valueOf(Integer inAtomicNum)
503   {
504      Element value = null;
505
506      if (inAtomicNum != null)
507      {
508         for (Element element : sValues)
509         {
510            if (element.getAtomicNum() == inAtomicNum)
511            {
512               value = element;
513               break;
514            }
515         }
516      }
517
518      return value;
519   }
520
521   //--------------------------------------------------------------------------
522   public static Element[] values()
523   {
524      return sValues.toArray(new Element[sValues.size()]);
525   }
526
527   //--------------------------------------------------------------------------
528   public String getName()
529   {
530      return mName;
531   }
532
533   //--------------------------------------------------------------------------
534   public String getSymbol()
535   {
536      return mSymbol;
537   }
538
539   //--------------------------------------------------------------------------
540   public int getAtomicNum()
541   {
542      return mAtomicNum;
543   }
544
545   //--------------------------------------------------------------------------
546   @Override
547   public String toString()
548   {
549      return getSymbol();
550   }
551
552   //--------------------------------------------------------------------------
553   public int compareTo(Element element)
554   {
555      int result = 0;
556
557      if (mMonoisotopicMass > element.mMonoisotopicMass)
558      {
559         result = 1;
560      }
561      else if (mMonoisotopicMass < element.mMonoisotopicMass)
562      {
563         result = -1;
564      }
565
566      return result;
567   }
568
569   // Matter interface methods:
570
571   //--------------------------------------------------------------------------
572   public Map<Element, Float> getElementalComposition()
573   {
574      Map<Element, Float> elemComp = new HashMap<>(1);
575      elemComp.put(this, 1.0f);
576
577      return elemComp;
578   }
579
580   //--------------------------------------------------------------------------
581   /**
582    Returns a chemical formula String. For Elements this returns the symbol.
583    @return the chemical formula string
584    */
585   public String getChemicalFormula()
586   {
587      return getSymbol();
588   }
589
590   //--------------------------------------------------------------------------
591   public Double getMonoisotopicMass()
592   {
593      return mMonoisotopicMass;
594   }
595
596   //--------------------------------------------------------------------------
597   public Double getAverageMass()
598   {
599      return mAverageMass;
600   }
601
602   //--------------------------------------------------------------------------
603   /**
604    Returns the average mass as estimated from organic sources.
605    [<i>Zhang Z, Pan H, Chen X. 2009. Mass spectrometry for structural characterization
606    of therapeutic antibodies. Mass Spectrom Rev 28:147-176.</i>]
607    */
608   public Double getOrganicAverageMass()
609   {
610      return mOrganicAverageMass;
611   }
612
613
614
615
616   //---------------------------------------------------------------------------
617   private void setVanderWaalsRadius(Length inValue)
618   {
619      mVanderWaalsRadius = inValue;
620   }
621
622   //---------------------------------------------------------------------------
623   /**
624    Returns the Van der Waals radius. [From Table 1 in Alvarez, Santiago. 2013.
625    “A Cartography of the van Der Waals Territories.” Dalton Transactions 42 (24): 8617–36.
626    <a href="https://doi.org/10.1039/c3dt50599e">https://doi.org/10.1039/c3dt50599e</a>.
627    @return the Van der Waals radius
628    */
629   public Length getVanderWaalsRadius()
630   {
631      return mVanderWaalsRadius;
632   }
633
634
635   //---------------------------------------------------------------------------
636   private void setCovalentRadius(Length inValue)
637   {
638      mCovalentRadius = inValue;
639   }
640
641   //---------------------------------------------------------------------------
642   /**
643    Returns the covalent radius. [From Table 2 in Cordero, Beatriz, Verónica Gómez,
644    Ana E. Platero-Prats, Marc Revés, Jorge Echeverría, Eduard Cremades, Flavia Barragán,
645    and Santiago Alvarez. 2008. “Covalent Radii Revisited.”
646    Journal of the Chemical Society. Dalton Transactions, no. 21: 2832–38.
647    <a href="https://doi.org/10.1039/b801115j">https://doi.org/10.1039/b801115j</a>.
648    @return the Van der Waals radius
649    */
650   public Length getCovalentRadius()
651   {
652      return mCovalentRadius;
653   }
654
655
656   //---------------------------------------------------------------------------
657   private void setDefaultValences(int[] inValues)
658   {
659      mDefaultValences = inValues;
660   }
661
662   //---------------------------------------------------------------------------
663   /**
664    Returns the default values for the number of valence electrons for the element.
665    Used when calculating implicit hydrogens for a compound.
666    */
667   public int[] getDefaultValences()
668   {
669      return mDefaultValences;
670   }
671}