All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.hfg.chem.Element Maven / Gradle / Ivy

There is a newer version: 20240423
Show newest version
package com.hfg.chem;

import java.util.HashMap;
import java.util.Map;
import java.util.Set;
import java.util.HashSet;

import com.hfg.util.StringUtil;
        
//------------------------------------------------------------------------------
/**
 Atomic element. Elemental mass reference:
 
Coursey JS, Schwab DJ, and Dragoset RA. 2005. Atomic Weights and Isotopic Compositions (version 2.4.1).
   [Online] Available: http://physics.nist.gov/PhysRefData/Compositions/ [2006, August 18].
   National Institute of Standards and Technology, Gaithersburg, MD.
   (Note that the value in parenthesis is the
   standard uncertainty.)
 
Organic mass values used are from:
   Zhang Z, Pan H, Chen X. 2009. Mass spectrometry for structural characterization
   of therapeutic antibodies. Mass Spectrom Rev 28:147-176.
 
@author J. Alex Taylor, hairyfatguy.com */ //------------------------------------------------------------------------------ // com.hfg XML/HTML Coding Library // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public // License as published by the Free Software Foundation; either // version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. // // You should have received a copy of the GNU Lesser General Public // License along with this library; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // // J. Alex Taylor, President, Founder, CEO, COO, CFO, OOPS hairyfatguy.com // [email protected] //------------------------------------------------------------------------------ public class Element implements Comparable, OrganicMatter { //########################################################################## // PRIVATE FIELDS //########################################################################## private String mName; private String mSymbol; private int mAtomicNum; private Double mMonoisotopicMass; private Double mAverageMass; private Double mOrganicAverageMass; // This declaration has to come before the public constants below. private static Set sValues = new HashSet<>(); //########################################################################## // PUBLIC FIELDS //########################################################################## public static final Element HYDROGEN = new Element("Hydrogen", "H", 1, 1.007825032, 1.00794, 1.007968); public static final Element HELIUM = new Element("Helium", "He", 2, 4.00260325413, 4.002602); public static final Element LITHIUM = new Element("Lithium", "Li", 3, 7.0160034366, 6.941); public static final Element BERYLLIUM = new Element("Beryllium", "Be", 4, 9.012183065, 9.012182); public static final Element BORON = new Element("Boron", "B", 5, 11.00930536, 10.811); public static final Element CARBON = new Element("Carbon", "C", 6, 12, 12.0107, 12.01079); public static final Element NITROGEN = new Element("Nitrogen", "N", 7, 14.0030740052, 14.0067, 14.00669); public static final Element OXYGEN = new Element("Oxygen", "O", 8, 15.9949146221, 15.9994, 15.99937); public static final Element FLUORINE = new Element("Fluorine", "F", 9, 18.99840316273, 18.9984032); public static final Element NEON = new Element("Neon", "Ne", 10, 19.9924401762, 20.1797); public static final Element SODIUM = new Element("Sodium", "Na", 11, 22.9897696723, 22.9897702); public static final Element MAGNESIUM = new Element("Magnesium", "Mg", 12, 23.985041697, 24.3050); public static final Element ALUMINIUM = new Element("Aluminium", "Al", 13, 26.98153853, 26.9815386); public static final Element SILICON = new Element("Silicon", "Si", 14, 27.97692653465, 28.0855); public static final Element PHOSPHOROUS = new Element("Phosphorous", "P", 15, 30.97376151, 30.973761); public static final Element SULFUR = new Element("Sulfur", "S", 16, 31.97207069, 32.065, 32.0639); public static final Element CHLORINE = new Element("Chlorine", "Cl", 17, 34.968852682, 35.453); public static final Element ARGON = new Element("Argon", "Ar", 18, 39.9623831237, 39.948); public static final Element POTASSIUM = new Element("Potassium", "K", 19, 38.96370693, 39.0983); public static final Element CALCIUM = new Element("Calcium", "Ca", 20, 39.962590863, 40.078); public static final Element SCANDIUM = new Element("Scandium", "Sc", 21, 44.95590828, 44.955912); public static final Element TITANIUM = new Element("Titanium", "Ti", 22, 47.94794198, 47.867); public static final Element VANADIUM = new Element("Vanadium", "V", 23, 50.94395704, 50.9415); public static final Element CHROMIUM = new Element("Chromium", "Cr", 24, 51.94050623, 51.9961); public static final Element MANGANESE = new Element("Manganese", "Mn", 25, 54.93804391, 54.938045); public static final Element IRON = new Element("Iron", "Fe", 26, 55.93494210, 55.845); public static final Element COBALT = new Element("Cobalt", "Co", 27, 58.93319429, 58.933195); public static final Element NICKEL = new Element("Nickel", "Ni", 28, 57.93534241, 58.6934); public static final Element COPPER = new Element("Copper", "Cu", 29, 62.92959772, 63.546); public static final Element ZINC = new Element("Zinc", "Zn", 30, 63.92914660, 65.409); public static final Element GALLIUM = new Element("Gallium", "Ga", 31, 68.9255735, 69.723); public static final Element GERMANIUM = new Element("Germanium", "Ge", 32, 73.921177761, 72.64); public static final Element ARSENIC = new Element("Arsenic", "As", 33, 74.92159457, 74.92160); public static final Element SELENIUM = new Element("Selenium", "Se", 34, 79.9165218, 78.96); public static final Element BROMINE = new Element("Bromine", "Br", 35, 78.9183376, 79.904); public static final Element KRYPTON = new Element("Krypton", "Kr", 36, 83.9114977282, 83.798); public static final Element RUBIDIUM = new Element("Rubidium", "Rb", 37, 84.9117897379, 85.4678); public static final Element STRONTIUM = new Element("Strontium", "Sr", 38, 87.9056125, 87.62); public static final Element YTTRIUM = new Element("Yttrium", "Y", 39, 88.9058403, 88.90585); public static final Element ZIRCONIUM = new Element("Zirconium", "Zr", 40, 89.9046977, 91.224); public static final Element NIOBIUM = new Element("Niobium", "Nb", 41, 92.9063730, 92.90638); public static final Element MOLYBDENUM = new Element("Molybdenum", "Mo", 42, 97.90540482, 95.94); public static final Element TECHNETIUM = new Element("Technetium", "Tc", 43, 96.9063667); public static final Element RUTHENIUM = new Element("Ruthenium", "Ru", 44, 101.9043441, 101.07); public static final Element RHODIUM = new Element("Rhodium", "Rh", 45, 102.9054980, 102.90550); public static final Element PALLADIUM = new Element("Palladium", "Pd", 46, 105.9034804, 106.42); public static final Element SILVER = new Element("Silver", "Ag", 47, 106.9050916, 107.8682); public static final Element CADMIUM = new Element("Cadmium", "Cd", 48, 113.90336509, 112.411); public static final Element INDIUM = new Element("Indium", "In", 49, 114.903878776, 114.818); public static final Element TIN = new Element("Tin", "Sn", 50, 119.90220163, 118.710); public static final Element ANTIMONY = new Element("Antimony", "Sb", 51, 120.9038120, 121.760); public static final Element TELLURIUM = new Element("Tellurium", "Te", 52, 129.906222748, 127.60); public static final Element IODINE = new Element("Iodine", "I", 53, 126.9044719, 126.90447); public static final Element XENON = new Element("Xenon", "Xe", 54, 131.9041550856, 131.293); public static final Element CESIUM = new Element("Cesium", "Cs", 55, 132.9054519610, 132.9054519); public static final Element BARIUM = new Element("Barium", "Ba", 56, 137.90524700, 137.327); public static final Element LANTHANUM = new Element("Lanthanum", "La", 57, 138.9063563, 138.90547); public static final Element CERIUM = new Element("Cerium", "Ce", 58, 139.9054431, 140.116); public static final Element PRASEODYMIUM = new Element("Praseodymium", "Pr", 59, 140.9076576, 140.90765); public static final Element NEODYMIUM = new Element("Neodymium", "Nd", 60, 141.9077290, 144.242); public static final Element PROMETHIUM = new Element("Promethium", "Pm", 61, 144.9127559); public static final Element SAMARIUM = new Element("Samarium", "Sm", 62, 151.9197397, 150.36); public static final Element EUROPIUM = new Element("Europium", "Eu", 63, 152.9212380, 151.964); public static final Element GADOLINIUM = new Element("Gadolinium", "Gd", 64, 157.9241123, 157.25); public static final Element TERBIUM = new Element("Terbium", "Tb", 65, 158.9253547, 158.92535); public static final Element DYSPROSIUM = new Element("Dysprosium", "Dy", 66, 163.9291819, 162.500); public static final Element HOLMIUM = new Element("Holmium", "Ho", 67, 164.9303288, 164.93032); public static final Element ERBIUM = new Element("Erbium", "Er", 68, 165.9302995, 167.259); public static final Element THULIUM = new Element("Thulium", "Tm", 69, 168.9342179, 168.93421); public static final Element YTTERBIUM = new Element("Ytterbium", "Yb", 70, 173.9388664, 173.04); public static final Element LUTETIUM = new Element("Lutetium", "Lu", 71, 174.9407752, 174.967); public static final Element HAFNIUM = new Element("Hafnium", "Hf", 72, 179.9465570, 178.49); public static final Element TANTALUM = new Element("Tantalum", "Ta", 73, 180.9479958, 180.94788); public static final Element TUNGSTEN = new Element("Tungsten", "W", 74, 183.95093092, 183.84); public static final Element RHENIUM = new Element("Rhenium", "Re", 75, 186.9557501, 186.207); public static final Element OSMIUM = new Element("Osmium", "Os", 76, 191.9614770, 190.23); public static final Element IRIDIUM = new Element("Iridium", "Ir", 77, 192.9629216, 192.217); public static final Element PLATINUM = new Element("Platinum", "Pt", 78, 194.9647917, 195.084); public static final Element GOLD = new Element("Gold", "Au", 79, 196.96656879, 196.966569); public static final Element MERCURY = new Element("Mercury", "Hg", 80, 201.97064340, 200.59); public static final Element THALLIUM = new Element("Thallium", "Tl", 81, 204.9744278, 204.3833); public static final Element LEAD = new Element("Lead", "Pb", 82, 207.9766525, 207.2); public static final Element BISMUTH = new Element("Bismuth", "Bi", 83, 208.9803991, 208.98040); public static final Element POLONIUM = new Element("Polonium", "Po", 84, 208.9824308); public static final Element ASTATINE = new Element("Astatine", "At", 85, 209.9871479); public static final Element RADON = new Element("Radon", "Rn", 86, 222.0175782); public static final Element FRANCIUM = new Element("Francium", "Fr", 87, 223.0197360); public static final Element RADIUM = new Element("Radium", "Ra", 88, 226.0254103); public static final Element ACTINIUM = new Element("Actinium", "Ac", 89, 227.0277523); public static final Element THORIUM = new Element("Thorium", "Th", 90, 232.0380558); public static final Element PROACTINIUM = new Element("Proactinium", "Pa", 91, 231.0358842); public static final Element URANIUM = new Element("Uranium", "U", 92, 238.0507884); public static final Element NEPTUNIUM = new Element("Neptunium", "Np", 93, 237.0481736); public static final Element PLUTONIUM = new Element("Plutonium", "Pu", 94, 238.0495601); public static final Element AMERICIUM = new Element("Americium", "Am", 95, 241.0568293); public static final Element CURIUM = new Element("Curium", "Cm", 96, 243.0613893); public static final Element BERKELIUM = new Element("Berkelium", "Bk", 97, 247.0703073); public static final Element CALIFORNIUM = new Element("Californium", "Cf", 98, 249.0748539); public static final Element EINSTEINIUM = new Element("Einsteinium", "Es", 99, 252.082980); public static final Element FERMIUM = new Element("Fermium", "Fm", 100, 257.0951061); public static final Element MENDELEVIUM = new Element("Mendelevium", "Md", 101, 258.0984315); public static final Element NOBELIUM = new Element("Nobelium", "No", 102, 259.10103); public static final Element LAWRENCIUM = new Element("Lawrencium", "Lr", 103, 262.10961); public static final Element RUTHERFORDIUM = new Element("Rutherfordium", "Rf", 104, 267.12179); public static final Element DUBNIUM = new Element("Dubnium", "Db", 105, 268.12567); public static final Element SEABORGIUM = new Element("Seaborgium", "Sg", 106, 271.13393); public static final Element BOHRIUM = new Element("Bohrium", "Bh", 107, 272.13826); public static final Element HASSIUM = new Element("Hassium", "Hs", 108, 270.13429); public static final Element MEITNERIUM = new Element("Meitnerium", "Mt", 109, 276.15159); public static final Element DARMSTADTIUM = new Element("Darmstadtium", "Ds", 110, 281.16451); public static final Element ROENTGENIUM = new Element("Roentgenium", "Rg", 111, 280.16514); public static final Element COPERNICIUM = new Element("Copernicium", "Cn", 112, 285.17712); public static final Element UNUNTRIUM = new Element("Ununtrium", "Uut", 113, 284.17873); public static final Element FLEROVIUM = new Element("Flerovium", "Fl", 114, 289.19042); public static final Element UNUNPENTIUM = new Element("Ununpentium", "Uup", 115, 288.19274); public static final Element LIVERMORIUM = new Element("Livermorium", "Lv", 116, 293.20449); public static final Element UNUNSEPTIUM = new Element("Ununseptium", "Uus", 117, 292.20746); public static final Element UNUNOCTIUM = new Element("Ununoctium", "Uuo", 118, 294.21392); //########################################################################## // CONSTRUCTORS //########################################################################## //-------------------------------------------------------------------------- private Element(String inName, String inSymbol, int inAtomicNum, double inMonoMass) { mName = inName; mSymbol = inSymbol; mAtomicNum = inAtomicNum; mMonoisotopicMass = inMonoMass; if (getClass().equals(Element.class)) // We don't want to include isotopes { sValues.add(this); } } //-------------------------------------------------------------------------- protected Element(String inName, String inSymbol, int inAtomicNum, double inMonoMass, double inAvgMass) { this(inName, inSymbol, inAtomicNum, inMonoMass); mAverageMass = inAvgMass; } //-------------------------------------------------------------------------- protected Element(String inName, String inSymbol, int inAtomicNum, double inMonoMass, double inAvgMass, double inOrgainicAvgMass) { this(inName, inSymbol, inAtomicNum, inMonoMass, inAvgMass); mOrganicAverageMass = inOrgainicAvgMass; } //########################################################################## // PUBLIC METHODS //########################################################################## //-------------------------------------------------------------------------- public static Element valueOf(String inString) { Element value = null; if (StringUtil.isSet(inString)) { for (Element element : sValues) { if (element.getName().equalsIgnoreCase(inString) || element.getSymbol().equals(inString)) { value = element; break; } } } return value; } //-------------------------------------------------------------------------- public static Element valueOf(Integer inAtomicNum) { Element value = null; if (inAtomicNum != null) { for (Element element : sValues) { if (element.getAtomicNum() == inAtomicNum) { value = element; break; } } } return value; } //-------------------------------------------------------------------------- public static Element[] values() { return sValues.toArray(new Element[sValues.size()]); } //-------------------------------------------------------------------------- public String getName() { return mName; } //-------------------------------------------------------------------------- public String getSymbol() { return mSymbol; } //-------------------------------------------------------------------------- public int getAtomicNum() { return mAtomicNum; } //-------------------------------------------------------------------------- @Override public String toString() { return getSymbol(); } //-------------------------------------------------------------------------- public int compareTo(Element element) { int result = 0; if (mMonoisotopicMass > element.mMonoisotopicMass) { result = 1; } else if (mMonoisotopicMass < element.mMonoisotopicMass) { result = -1; } return result; } // OrganicMatter interface methods: //-------------------------------------------------------------------------- public Map getElementalComposition() { Map elemComp = new HashMap<>(1); elemComp.put(this, 1.0f); return elemComp; } //-------------------------------------------------------------------------- public Double getMonoisotopicMass() { return mMonoisotopicMass; } //-------------------------------------------------------------------------- public Double getAverageMass() { return mAverageMass; } //-------------------------------------------------------------------------- /** Returns the average mass as estimated from organic sources. [Zhang Z, Pan H, Chen X. 2009. Mass spectrometry for structural characterization of therapeutic antibodies. Mass Spectrom Rev 28:147-176.] */ public Double getOrganicAverageMass() { return mOrganicAverageMass; } }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy