diff --git a/nexus/bin/nxs-test b/nexus/bin/nxs-test index 4f3a19872a..4a69a69509 100755 --- a/nexus/bin/nxs-test +++ b/nexus/bin/nxs-test @@ -1865,7 +1865,7 @@ def user_examples(label): dgen = obj(dgen) dref = obj(dref) msg = 'reference and generated input files differ\n' - msg += 'reference file: '+filepath+'\n' + msg += 'reference file: '+os.path.realpath(filepath)+'\n' msg += 'reference file difference\n' msg += 40*'='+'\n' msg += str(dref) diff --git a/nexus/nexus/basisset.py b/nexus/nexus/basisset.py index fda39dec83..997df83fea 100644 --- a/nexus/nexus/basisset.py +++ b/nexus/nexus/basisset.py @@ -5,7 +5,7 @@ import os import numpy as np -from .periodic_table import is_element +from .periodic_table import Elements from .developer import DevBase, obj, error, to_str, unavailable from .fileio import TextFile @@ -110,11 +110,11 @@ def __init__(self,filepath=None): self.filename = os.path.basename(filepath) self.location = os.path.abspath(filepath) elem_label = self.filename.split('.')[0] - is_elem,symbol = is_element(elem_label,symbol=True) + is_elem, elem = Elements.is_element(elem_label, return_element=True) if not is_elem: self.error('cannot determine element for basis file: {0}\nbasis file names must be prefixed by an atomic symbol or label\n(e.g. Si, Si1, etc)'.format(filepath)) #end if - self.element = symbol + self.element = elem.symbol self.element_label = elem_label #end if #end def __init__ diff --git a/nexus/nexus/fileio.py b/nexus/nexus/fileio.py index 5f271f3296..eb8a71f922 100644 --- a/nexus/nexus/fileio.py +++ b/nexus/nexus/fileio.py @@ -27,7 +27,7 @@ import numpy as np from numpy.linalg import det, norm from .developer import DevBase, obj, error, to_str -from .periodic_table import is_element, pt as ptable +from .periodic_table import Elements from .unit_converter import convert from . import numpy_extensions as npe @@ -826,9 +826,9 @@ def incorporate_structure(self,structure): s.recenter() elem = [] for e in s.elem: - is_elem,e = is_element(e,symbol=True) + is_elem, element = Elements.is_element(e, return_element=True) if is_elem: - elem.append(ptable.elements[e].atomic_number) + elem.append(element.atomic_number) else: elem.append(0) #end if @@ -1127,9 +1127,9 @@ def validity_checks(self): msgs.append('elem must be an array of text') else: for e in self.elem: - iselem,symbol = is_element(e,symbol=True) + iselem, element = Elements.is_element(e, return_element=True) if not iselem: - msgs.append('elem entry "{0}" is not an element'.format(e)) + msgs.append('elem entry "{0}" is not an element'.format(element)) #end if #end for #end for @@ -1193,9 +1193,9 @@ def write_text(self): #end for if self.elem is not None: for e in self.elem: - iselem,symbol = is_element(e,symbol=True) + iselem, element = Elements.is_element(e, return_element=True) if not iselem: - self.error('{0} is not an element'.format(e)) + self.error('{0} is not an element'.format(element)) #end if text += e+' ' #end for @@ -1269,7 +1269,7 @@ def incorporate_xsf(self,xsf): species_ind = species species = [] for i in species_ind: - species.append(ptable.simple_elements[i].symbol) + species.append(Elements(i).symbol) #end for self.scale = 1.0 diff --git a/nexus/nexus/gamess_input.py b/nexus/nexus/gamess_input.py index 64559c8af7..f47a0c819a 100644 --- a/nexus/nexus/gamess_input.py +++ b/nexus/nexus/gamess_input.py @@ -32,7 +32,7 @@ import numpy as np -from .periodic_table import pt +from .periodic_table import Elements from .developer import DevBase, obj, error, warn from .nexus_base import nexus_noncore from .simulation import SimulationInput @@ -1116,7 +1116,7 @@ def generate_any_gamess_input(**kwargs): #end if for i in range(len(elem)): a = elem[i] - Z = pt[a].atomic_number + Z = Elements(a).atomic_number data+='{0} {1:3.2f} {2:16.8f} {3:16.8f} {4:16.8f}\n'.format(a,Z,*pos[i]) if a in bss: data+=bss[a].text+'\n\n' @@ -1129,7 +1129,7 @@ def generate_any_gamess_input(**kwargs): ) pps = nexus_noncore.pseudopotentials.pseudos_by_atom(*pskw.pseudos) for i,a in enumerate(elem): - Z = pt[a].atomic_number + Z = Elements(a).atomic_number data+='{0} {1} {2:16.8f} {3:16.8f} {4:16.8f}\n'.format(a,Z,*pos[i]) if a in pps: data += pps[a].basis_text+'\n\n' diff --git a/nexus/nexus/numerics.py b/nexus/nexus/numerics.py index 2a88eb0111..d66a147e62 100644 --- a/nexus/nexus/numerics.py +++ b/nexus/nexus/numerics.py @@ -88,7 +88,7 @@ from numpy.linalg import norm from .developer import obj, unavailable, error from .unit_converter import convert -from .periodic_table import pt as ptable +from .periodic_table import Elements try: from scipy.special import betainc @@ -146,13 +146,14 @@ def morse_params(re, a, De, E_inf): return re, 1./a, De, E_inf # morse_reduced_mass gives the reduced mass in Hartree units # m1 and m2 are masses or atomic symbols def morse_reduced_mass(m1,m2=None): + amu_me = convert(1., "amu", "me") if isinstance(m1,str): - m1 = ptable[m1].atomic_weight.me + m1 = Elements(m1).atomic_weight * amu_me #end if if m2 is None: m2 = m1 elif isinstance(m2,str): - m2 = ptable[m2].atomic_weight.me + m2 = Elements(m2).atomic_weight * amu_me #end if m = 1./(1./m1+1./m2) # reduced mass return m diff --git a/nexus/nexus/periodic_table.py b/nexus/nexus/periodic_table.py index cdfce24d0c..c6ab454dda 100644 --- a/nexus/nexus/periodic_table.py +++ b/nexus/nexus/periodic_table.py @@ -20,1885 +20,518 @@ # # #====================================================================# - -from .developer import DevBase, obj -from .unit_converter import UnitConverter - - -def phys_value_dict(value=None,units=None): - vdict = UnitConverter.convert_scalar_to_all(units,value) - return obj(**vdict) -#end def phys_value_dict - - - - -class SimpleElement(DevBase): - def __init__(self): - - self.atomic_number = None - self.name = None - self.symbol = None - self.group = None - self.atomic_weight = None - self.atomic_radius = None - self.nuclear_charge = None - self.abundance = None - self.electron_affinity = None - self.electronegativity = None - self.ionization_energy = None - self.ionic_radius = None - self.melting_point = None - self.boiling_point = None - - self.string_rep = None - self.var_dict = None - #end def __init__ - - def create_var_dict(self): - self.var_dict = dict() - self.var_dict['atomic_number' ] = self.atomic_number - self.var_dict['name' ] = self.name - self.var_dict['symbol' ] = self.symbol - self.var_dict['group' ] = self.group - self.var_dict['atomic_weight' ] = self.atomic_weight - self.var_dict['atomic_radius' ] = self.atomic_radius - self.var_dict['nuclear_charge' ] = self.nuclear_charge - self.var_dict['abundance' ] = self.abundance - self.var_dict['electron_affinity'] = self.electron_affinity - self.var_dict['electronegativity'] = self.electronegativity - self.var_dict['ionization_energy'] = self.ionization_energy - self.var_dict['ionic_radius' ] = self.ionic_radius - self.var_dict['melting_point' ] = self.melting_point - self.var_dict['boiling_point' ] = self.boiling_point - - self.replace_None() - #end def create_var_dict - - def replace_None(self): - none_rep = -1.0 - for k,v in self.var_dict.items(): - if v is None: - self.var_dict[k] = none_rep - #end if - #end for - self.atomic_number = self.var_dict['atomic_number' ] - self.name = self.var_dict['name' ] - self.symbol = self.var_dict['symbol' ] - self.group = self.var_dict['group' ] - self.atomic_weight = self.var_dict['atomic_weight' ] - self.atomic_radius = self.var_dict['atomic_radius' ] - self.nuclear_charge = self.var_dict['nuclear_charge' ] - self.abundance = self.var_dict['abundance' ] - self.electron_affinity = self.var_dict['electron_affinity'] - self.electronegativity = self.var_dict['electronegativity'] - self.ionization_energy = self.var_dict['ionization_energy'] - self.ionic_radius = self.var_dict['ionic_radius' ] - self.melting_point = self.var_dict['melting_point' ] - self.boiling_point = self.var_dict['boiling_point' ] - #end def replace_None - - def create_string_representation(self): - ind = 4*' ' - - iformat = '%6i' - rformat = '%7.5f' - - s = '' - s += self.symbol+'{\n' - s += ind + 'atomic_number = ' + str(self.atomic_number)+'\n' - s += ind + 'name = ' + str(self.name)+'\n' - s += ind + 'symbol = ' + str(self.symbol)+'\n' - s += ind + 'group = ' + str(self.group)+'\n' - s += ind + 'atomic_weight = ' + str(self.atomic_weight)+'\n' - s += ind + 'atomic_radius = ' + str(self.atomic_radius)+'\n' - s += ind + 'nuclear_charge = ' + str(self.nuclear_charge)+'\n' - s += ind + 'abundance = ' + str(self.abundance)+'\n' - s += ind + 'electron_affinity = ' + str(self.electron_affinity)+'\n' - s += ind + 'electronegativity = ' + str(self.electronegativity)+'\n' - s += ind + 'ionization_energy = ' + str(self.ionization_energy)+'\n' - s += ind + 'ionic_radius = ' + str(self.ionic_radius)+'\n' - s += ind + 'melting_point = ' + str(self.melting_point)+'\n' - s += ind + 'boiling_point = ' + str(self.boiling_point)+'\n' - s += '}\n' - - self.string_rep = s - - #end def create_string_representation -#end class SimpleElement - - -class Element(SimpleElement): - def __init__(self,se): - SimpleElement.__init__(self) - - awu = PeriodicTable.atomic_weight_unit - aru = PeriodicTable.atomic_radius_unit - ncu = PeriodicTable.nuclear_charge_unit - eau = PeriodicTable.electron_affinity_unit - ieu = PeriodicTable.ionization_energy_units - iru = PeriodicTable.ionic_radius_units - tcu = PeriodicTable.thermal_cond_units - mpu = PeriodicTable.melting_point_units - bpu = PeriodicTable.boiling_point_units - - self.atomic_number = se.atomic_number - self.name = se.name - self.symbol = se.symbol - self.group = PeriodicTable.group_dict[se.group] - self.abundance = se.abundance - - self.atomic_weight = phys_value_dict(se.atomic_weight , awu) - self.atomic_radius = phys_value_dict(se.atomic_radius , aru) - self.nuclear_charge = phys_value_dict(se.nuclear_charge , ncu) - self.electron_affinity = phys_value_dict(se.electron_affinity, eau) - self.ionization_energy = phys_value_dict(se.ionization_energy, ieu) - self.ionic_radius = phys_value_dict(se.ionic_radius , iru) - self.thermal_cond = phys_value_dict(se.thermal_cond , tcu) - self.melting_point = phys_value_dict(se.melting_point , mpu) - self.boiling_point = phys_value_dict(se.boiling_point , bpu) - - #end def __init__ +from __future__ import annotations +from dataclasses import dataclass +from enum import Enum + + +@dataclass(frozen=True) +class ElementData: + """Dataclass for storing element data.""" + symbol: str + atomic_number: int + atomic_weight: float + group: int + isotopes: dict[int, float] + + def __hash__(self): + return hash(( + self.symbol, + self.atomic_number, + self.atomic_weight, + self.group, + tuple(self.isotopes.keys()), + tuple(self.isotopes.values()), + )) +#end class ElementData + + +class Elements(ElementData, Enum): + """Enumeration of all elements in the periodic table. + + Attributes + ---------- + symbol : str + In titlecase (H, He, ...) + atomic_number : int + Use 0 for a dummy element + (symbol "Xx", name "Unknown", all properties zero) + atomic_weight : float + Average atomic weight in amu [1]_. + group : int + Group of the element on the periodic table. + Lanthanides and Actinides are 0. + isotopes : dict[int, float] + A dictionary of the isotopes for the element [2]_. + This can be accessed as ``Element.Name.isotopes[mass_number]``, + which yields the relative atomic mass. + + References + ---------- + .. [1] https://iupac.qmul.ac.uk/AtWt/ + .. [2] https://www.nist.gov/pml/atomic-weights-and-isotopic-compositions-relative-atomic-masses + + Examples + -------- + The fastest way to grab element data is with the following signatures: + + >>> Elements("Hydrogen") is Elements.Hydrogen + True + >>> Elements("H") is Elements.Hydrogen + True + >>> Elements(1) is Elements.Hydrogen + True + + If you're unsure of the case of the input you can reliably get + case-insensitive parsing with the default interface. + + >>> Elements("h") is Elements.Hydrogen + True + >>> Elements("hydrogen") is Elements.Hydrogen + True + + It can also handle leading and trailing whitespace + + >>> Elements("Hydrogen ") is Elements.Hydrogen + True + >>> Elements(" H") is Elements.Hydrogen + True + + If you think the input is up to **one** step from the correct + signature, (e.g. ``Elements(int(val))``) you can still expect the + default call to work. + + >>> Elements("1") is Elements.Hydrogen + True + >>> Elements(1.0) is Elements.Hydrogen + True + + Printing an element calls its ``__str__`` method which will return + just the atomic symbol. + + >>> print(Elements.Hydrogen) + H + + This also works with f-strings and ``str.format`` calls. + + >>> print(f"{Elements.Hydrogen}") + H + + If you want to see the data attached to the enum member + (minus the isotopes), use ``repr``. + + >>> print(repr(Elements.Hydrogen)) + + + You can also get this view by just directly typing the element. + + >>> Elements.Hydrogen + + """ + + def __new__( + cls, + symbol: str, + atomic_number: int, + atomic_weight: float, + group: int, + isotopes: dict[int, float] + ): + element = ElementData.__new__(cls) + element._value_ = atomic_number + return element + + + # Override to not print isotopes + def __repr__(self): + # This prints on one line, but since it's nearly impossible to + # grep for this regardless of if it's on one line in the code + # it is split here for readability. + return ( + f"<{self.__class__.__name__}.{self.name}: " + f"symbol='{self.symbol}', " + f"atomic_number={self.atomic_number}, " + f"atomic_weight={self.atomic_weight}, " + f"group={self.group}>" + ) + + + def __str__(self) -> str: + return self.symbol + + + @classmethod + def _missing_(cls, value): + """Workaround to not having access to ``_add_alias_`` or + ``_add_value_alias_`` from Python 3.13. This function + automatically gets called when the traditional lookup fails. + """ + if isinstance(value, str): + value = value.strip() + if value.isalpha(): # `Elements("h")` or `Elements("hydrogen")` + val_title = value.title() + for elem in cls: + if val_title == elem.symbol or val_title == elem.name: + return elem + elif value.isdecimal(): # `Elements("1")` + try: + value = int(value) + if value > 118: + pass + else: + for elem in cls: + if value == elem.atomic_number: + return elem + except ValueError: # We don't support `Elements("1.0")` + pass + raise ValueError(f"Can not determine element for input value: {value}!") + + + @staticmethod + def is_element( + value: str, + return_element: bool = False, + ) -> bool | tuple[bool, Elements]: + """Robust method that will try to match a wide array of element + identifier formats, including all that are handled by the parent + call signature ``Elements(value)``. + + Parameters + ---------- + value : str + The string to be checked. + return_element : bool, default=False + Return the element that was identified. + This will return ``value`` if it could not be identified as + an element. + + Examples + -------- + Regular elements + + >>> Elements.is_element("H") + True + >>> Elements.is_element("He") + True + + Elements with integer identifiers + + >>> Elements.is_element("H1") + True + >>> Elements.is_element("H10") + True + >>> Elements.is_element("He1") + True + >>> Elements.is_element("He10") + True + + Elements with integer identifiers and underscores + + >>> Elements.is_element("H_1") + True + >>> Elements.is_element("H_10") + True + >>> Elements.is_element("He_1") + True + >>> Elements.is_element("He_10") + True + + Elements with integer identifiers and hyphens + + >>> Elements.is_element("H-1") + True + >>> Elements.is_element("H-10") + True + >>> Elements.is_element("He-1") + True + >>> Elements.is_element("He-10") + True + + You can optionally return the element as well + + >>> Elements.is_element("H_10", return_element=True) + (True, ) + >>> Elements.is_element("He-1", return_element=True) + (True, ) + + If it can't determine the element and you asked it to return the + element then it will return ``False`` and the supplied value. + + >>> Elements.is_element("Bean", return_element=True) + (False, 'Bean') + """ + + if isinstance(value, Elements): + if return_element: + return True, value + else: + return True + + val_len = len(value) + if "_" in value: # H_1 + value = value.split("_", maxsplit=1)[0] + elif "-" in value: # H-1 + value = value.split("-", maxsplit=1)[0] + elif val_len >= 2 and value[1:].isdigit(): # H1 / H10 + value = value[0:1].title() + elif val_len >= 3 and value[2:].isdigit(): # He1 / He10 + value = value[0:2].title() + + try: + elem = Elements(value) + if return_element: + return True, elem + else: + return True + except ValueError: + if return_element: + return False, value + else: + return False + + + # Name Symbol Number Mass Group Isotopes + Unknown = "Xx", 0, 0.0, 0, {0:0.0} + Hydrogen = "H", 1, 1.0080, 1, {1:1.00782503223, 2:2.01410177812, 3:3.0160492779} + Helium = "He", 2, 4.002602, 18, {3:3.0160293201, 4:4.00260325413} + Lithium = "Li", 3, 6.94, 1, {6:6.0151228874, 7:7.0160034366} + Beryllium = "Be", 4, 9.0121831, 2, {9:9.012183065} + Boron = "B", 5, 10.81, 13, {10:10.01293695, 11:11.00930536} + Carbon = "C", 6, 12.011, 14, {12:12.0000000, 13:13.00335483507, 14:14.0032419884} + Nitrogen = "N", 7, 14.007, 15, {14:14.00307400443, 15:15.00010889888} + Oxygen = "O", 8, 15.999, 16, {16:15.99491461957, 17:16.9991317565, 18:17.99915961286} + Fluorine = "F", 9, 18.998403162, 17, {19:18.99840316273} + Neon = "Ne", 10, 20.1797, 18, {20:19.9924401762, 21:20.993846685, 22:21.991385114} + Sodium = "Na", 11, 22.98976928, 1, {23:22.989769282} + Magnesium = "Mg", 12, 24.305, 2, {24:23.985041697, 25:24.985836976, 26:25.982592968} + Aluminum = "Al", 13, 26.9815384, 13, {27:26.98153853} + Silicon = "Si", 14, 28.085, 14, {28:27.97692653465, 29:28.9764946649, 30:29.973770136} + Phosphorus = "P", 15, 30.973761998, 15, {31:30.97376199842} + Sulfur = "S", 16, 32.06, 16, {32:31.9720711744, 33:32.9714589098, 34:33.967867004, 36:35.96708071} + Chlorine = "Cl", 17, 35.45, 17, {35:34.968852682, 37:36.965902602} + Argon = "Ar", 18, 39.95, 18, {36:35.967545105, 38:37.96273211, 40:39.9623831237} + Potassium = "K", 19, 39.0983, 1, {39:38.9637064864, 40:39.963998166, 41:40.9618252579} + Calcium = "Ca", 20, 40.078, 2, {40:39.962590863, 42:41.95861783, 43:42.95876644, 44:43.95548156, 46:45.953689, 48:47.95252276} + Scandium = "Sc", 21, 44.955907, 3, {45:44.95590828} + Titanium = "Ti", 22, 47.867, 4, {46:45.95262772, 47:46.95175879, 48:47.94794198, 49:48.94786568, 50:49.94478689} + Vanadium = "V", 23, 50.9415, 5, {50:49.94715601, 51:50.94395704} + Chromium = "Cr", 24, 51.9961, 6, {50:49.94604183, 52:51.94050623, 53:52.94064815, 54:53.93887916} + Manganese = "Mn", 25, 54.938043, 7, {55:54.93804391} + Iron = "Fe", 26, 55.845, 8, {54:53.93960899, 56:55.93493633, 57:56.93539284, 58:57.93327443} + Cobalt = "Co", 27, 58.933194, 9, {59:58.93319429} + Nickel = "Ni", 28, 58.6934, 10, {58:57.93534241, 60:59.93078588, 61:60.93105557, 62:61.92834537, 64:63.92796682} + Copper = "Cu", 29, 63.546, 11, {63:62.92959772, 65:64.9277897} + Zinc = "Zn", 30, 65.38, 12, {64:63.92914201, 66:65.92603381, 67:66.92712775, 68:67.92484455, 70:69.9253192} + Gallium = "Ga", 31, 69.723, 13, {69:68.9255735, 71:70.92470258} + Germanium = "Ge", 32, 72.630, 14, {70:69.92424875, 72:71.922075826, 73:72.923458956, 74:73.921177761, 76:75.921402726} + Arsenic = "As", 33, 74.921595, 15, {75:74.92159457} + Selenium = "Se", 34, 78.971, 16, {74:73.922475934, 76:75.919213704, 77:76.919914154, 78:77.91730928, 80:79.9165218, 82:81.9166995} + Bromine = "Br", 35, 79.904, 17, {79:78.9183376, 81:80.9162897} + Krypton = "Kr", 36, 83.798, 18, {78:77.92036494, 80:79.91637808, 82:81.91348273, 83:82.91412716, 84:83.9114977282, 86:85.9106106269} + Rubidium = "Rb", 37, 85.4678, 1, {85:84.9117897379, 87:86.909180531} + Strontium = "Sr", 38, 87.62, 2, {84:83.9134191, 86:85.9092606, 87:86.9088775, 88:87.9056125} + Yttrium = "Y", 39, 88.905838, 3, {89:88.9058403} + Zirconium = "Zr", 40, 91.222, 4, {90:89.9046977, 91:90.9056396, 92:91.9050347, 94:93.9063108, 96:95.9082714} + Niobium = "Nb", 41, 92.90637, 5, {93:92.906373} + Molybdenum = "Mo", 42, 95.95, 6, {92:91.90680796, 94:93.9050849, 95:94.90583877, 96:95.90467612, 97:96.90601812, 98:97.90540482, 100:99.9074718} + Technetium = "Tc", 43, 97.0, 7, {97:96.9063667, 98:97.9072124, 99:98.9062508} + Ruthenium = "Ru", 44, 101.07, 8, {96:95.90759025, 98:97.9052868, 99:98.9059341, 100:99.9042143, 101:100.9055769, 102:101.9043441, 104:103.9054275} + Rhodium = "Rh", 45, 102.90549, 9, {103:102.905498} + Palladium = "Pd", 46, 106.42, 10, {102:101.9056022, 104:103.9040305, 105:104.9050796, 106:105.9034804, 108:107.9038916, 110:109.9051722} + Silver = "Ag", 47, 107.8682, 11, {107:106.9050916, 109:108.9047553} + Cadmium = "Cd", 48, 112.414, 12, {106:105.9064599, 108:107.9041834, 110:109.90300661, 111:110.90418287, 112:111.90276287, 113:112.90440813, 114:113.90336509, 116:115.90476315} + Indium = "In", 49, 114.818, 13, {113:112.90406184, 115:114.903878776} + Tin = "Sn", 50, 118.710, 14, {112:111.90482387, 114:113.9027827, 115:114.903344699, 116:115.9017428, 117:116.90295398, 118:117.90160657, 119:118.90331117, 120:119.90220163, 122:121.9034438, 124:123.9052766} + Antimony = "Sb", 51, 121.760, 15, {121:120.903812, 123:122.9042132} + Tellurium = "Te", 52, 127.60, 16, {120:119.9040593, 122:121.9030435, 123:122.9042698, 124:123.9028171, 125:124.9044299, 126:125.9033109, 128:127.90446128, 130:129.906222748} + Iodine = "I", 53, 126.90447, 17, {127:126.9044719} + Xenon = "Xe", 54, 131.293, 18, {124:123.905892, 126:125.9042983, 128:127.903531, 129:128.9047808611, 130:129.903509349, 131:130.90508406, 132:131.9041550856, 134:133.90539466, 136:135.907214484} + Cesium = "Cs", 55, 132.90545196, 1, {133:132.905451961} + Barium = "Ba", 56, 137.327, 2, {130:129.9063207, 132:131.9050611, 134:133.90450818, 135:134.90568838, 136:135.90457573, 137:136.90582714, 138:137.905247} + Lanthanum = "La", 57, 138.90547, 3, {138:137.9071149, 139:138.9063563} + Cerium = "Ce", 58, 140.116, 0, {136:135.90712921, 138:137.905991, 140:139.9054431, 142:141.9092504} + Praseodymium = "Pr", 59, 140.90766, 0, {141:140.9076576} + Neodymium = "Nd", 60, 144.242, 0, {142:141.907729, 143:142.90982, 144:143.910093, 145:144.9125793, 146:145.9131226, 148:147.9168993, 150:149.9209022} + Promethium = "Pm", 61, 145.0, 0, {145:144.9127559, 147:146.915145} + Samarium = "Sm", 62, 150.36, 0, {144:143.9120065, 147:146.9149044, 148:147.9148292, 149:148.9171921, 150:149.9172829, 152:151.9197397, 154:153.9222169} + Europium = "Eu", 63, 151.964, 0, {151:150.9198578, 153:152.921238} + Gadolinium = "Gd", 64, 157.249, 0, {152:151.9197995, 154:153.9208741, 155:154.9226305, 156:155.9221312, 157:156.9239686, 158:157.9241123, 160:159.9270624} + Terbium = "Tb", 65, 158.925354, 0, {159:158.9253547} + Dysprosium = "Dy", 66, 162.500, 0, {156:155.9242847, 158:157.9244159, 160:159.9252046, 161:160.9269405, 162:161.9268056, 163:162.9287383, 164:163.9291819} + Holmium = "Ho", 67, 164.930329, 0, {165:164.9303288} + Erbium = "Er", 68, 167.259, 0, {162:161.9287884, 164:163.9292088, 166:165.9302995, 167:166.9320546, 168:167.9323767, 170:169.9354702} + Thulium = "Tm", 69, 168.934219, 0, {169:168.9342179} + Ytterbium = "Yb", 70, 173.045, 0, {168:167.9338896, 170:169.9347664, 171:170.9363302, 172:171.9363859, 173:172.9382151, 174:173.9388664, 176:175.9425764} + Lutetium = "Lu", 71, 174.96669, 0, {175:174.9407752, 176:175.9426897} + Hafnium = "Hf", 72, 178.486, 4, {174:173.9400461, 176:175.9414076, 177:176.9432277, 178:177.9437058, 179:178.9458232, 180:179.946557} + Tantalum = "Ta", 73, 180.94788, 5, {180:179.9474648, 181:180.9479958} + Tungsten = "W", 74, 183.84, 6, {180:179.9467108, 182:181.94820394, 183:182.95022275, 184:183.95093092, 186:185.9543628} + Rhenium = "Re", 75, 186.207, 7, {185:184.9529545, 187:186.9557501} + Osmium = "Os", 76, 190.23, 8, {184:183.9524885, 186:185.953835, 187:186.9557474, 188:187.9558352, 189:188.9581442, 190:189.9584437, 192:191.961477} + Iridium = "Ir", 77, 192.217, 9, {191:190.9605893, 193:192.9629216} + Platinum = "Pt", 78, 195.084, 10, {190:189.9599297, 192:191.9610387, 194:193.9626809, 195:194.9647917, 196:195.96495209, 198:197.9678949} + Gold = "Au", 79, 196.966570, 11, {197:196.96656879} + Mercury = "Hg", 80, 200.592, 12, {196:195.9658326, 198:197.9667686, 199:198.96828064, 200:199.96832659, 201:200.97030284, 202:201.9706434, 204:203.97349398} + Thallium = "Tl", 81, 204.38, 13, {203:202.9723446, 205:204.9744278} + Lead = "Pb", 82, 207.2, 14, {204:203.973044, 206:205.9744657, 207:206.9758973, 208:207.9766525} + Bismuth = "Bi", 83, 208.98040, 15, {209:208.9803991} + Polonium = "Po", 84, 209.0, 16, {209:208.9824308, 210:209.9828741} + Astatine = "At", 85, 210.0, 17, {210:209.9871479, 211:210.9874966} + Radon = "Rn", 86, 222.0, 18, {211:210.9906011, 220:220.0113941, 222:222.0175782} + Francium = "Fr", 87, 223.0, 1, {223:223.019736} + Radium = "Ra", 88, 226.0, 2, {223:223.0185023, 224:224.020212, 226:226.0254103, 228:228.0310707} + Actinium = "Ac", 89, 227.0, 3, {227:227.0277523} + Thorium = "Th", 90, 232.0377, 0, {230:230.0331341, 232:232.0380558} + Protactinium = "Pa", 91, 231.03588, 0, {231:231.0358842} + Uranium = "U", 92, 238.02891, 0, {233:233.0396355, 234:234.0409523, 235:235.0439301, 236:236.0455682, 238:238.0507884} + Neptunium = "Np", 93, 237.0, 0, {236:236.04657, 237:237.0481736} + Plutonium = "Pu", 94, 244.0, 0, {238:238.0495601, 239:239.0521636, 240:240.0538138, 241:241.0568517, 242:242.0587428, 244:244.0642053} + Americium = "Am", 95, 243.0, 0, {241:241.0568293, 243:243.0613813} + Curium = "Cm", 96, 247.0, 0, {243:243.0613893, 244:244.0627528, 245:245.0654915, 246:246.0672238, 247:247.0703541, 248:248.0723499} + Berkelium = "Bk", 97, 247.0, 0, {247:247.0703073, 249:249.0749877} + Californium = "Cf", 98, 251.0, 0, {249:249.0748539, 250:250.0764062, 251:251.0795886, 252:252.0816272} + Einsteinium = "Es", 99, 252.0, 0, {252:252.08298} + Fermium = "Fm", 100, 257.0, 0, {257:257.0951061} + Mendelevium = "Md", 101, 258.0, 0, {258:258.0984315, 260:260.10365} + Nobelium = "No", 102, 259.0, 0, {259:259.10103} + Lawrencium = "Lr", 103, 262.0, 0, {262:262.10961} + Rutherfordium = "Rf", 104, 267.0, 4, {267:267.12179} + Dubnium = "Db", 105, 270.0, 5, {268:268.12567} + Seaborgium = "Sg", 106, 269.0, 6, {271:271.13393} + Bohrium = "Bh", 107, 270.0, 7, {272:272.13826} + Hassium = "Hs", 108, 270.0, 8, {270:270.13429} + Meitnerium = "Mt", 109, 278.0, 9, {276:276.15159} + Darmstadtium = "Ds", 110, 281.0, 10, {281:281.16451} + Roentgenium = "Rg", 111, 281.0, 11, {280:280.16514} + Copernicium = "Cn", 112, 285.0, 12, {285:285.17712} + Nihonium = "Nh", 113, 286.0, 13, {284:284.17873} + Flerovium = "Fl", 114, 289.0, 14, {289:289.19042} + Moscovium = "Mc", 115, 289.0, 15, {288:288.19274} + Livermorium = "Lv", 116, 293.0, 16, {293:293.20449} + Tennessine = "Ts", 117, 293.0, 17, {292:292.20746} + Oganesson = "Og", 118, 294.0, 18, {294:294.21392} + # Name Symbol Number Mass Group Isotopes + + # Add aliases for each element. + # Once we can use features from Python 3.13, this will be replaced by + # the Enum sunder `_add_alias_` + Xx = Unknown + H = Hydrogen + He = Helium + Li = Lithium + Be = Beryllium + B = Boron + C = Carbon + N = Nitrogen + O = Oxygen + F = Fluorine + Ne = Neon + Na = Sodium + Mg = Magnesium + Al = Aluminum + Si = Silicon + P = Phosphorus + S = Sulfur + Cl = Chlorine + Ar = Argon + K = Potassium + Ca = Calcium + Sc = Scandium + Ti = Titanium + V = Vanadium + Cr = Chromium + Mn = Manganese + Fe = Iron + Co = Cobalt + Ni = Nickel + Cu = Copper + Zn = Zinc + Ga = Gallium + Ge = Germanium + As = Arsenic + Se = Selenium + Br = Bromine + Kr = Krypton + Rb = Rubidium + Sr = Strontium + Y = Yttrium + Zr = Zirconium + Nb = Niobium + Mo = Molybdenum + Tc = Technetium + Ru = Ruthenium + Rh = Rhodium + Pd = Palladium + Ag = Silver + Cd = Cadmium + In = Indium + Sn = Tin + Sb = Antimony + Te = Tellurium + I = Iodine + Xe = Xenon + Cs = Cesium + Ba = Barium + La = Lanthanum + Ce = Cerium + Pr = Praseodymium + Nd = Neodymium + Pm = Promethium + Sm = Samarium + Eu = Europium + Gd = Gadolinium + Tb = Terbium + Dy = Dysprosium + Ho = Holmium + Er = Erbium + Tm = Thulium + Yb = Ytterbium + Lu = Lutetium + Hf = Hafnium + Ta = Tantalum + W = Tungsten + Re = Rhenium + Os = Osmium + Ir = Iridium + Pt = Platinum + Au = Gold + Hg = Mercury + Tl = Thallium + Pb = Lead + Bi = Bismuth + Po = Polonium + At = Astatine + Rn = Radon + Fr = Francium + Ra = Radium + Ac = Actinium + Th = Thorium + Pa = Protactinium + U = Uranium + Np = Neptunium + Pu = Plutonium + Am = Americium + Cm = Curium + Bk = Berkelium + Cf = Californium + Es = Einsteinium + Fm = Fermium + Md = Mendelevium + No = Nobelium + Lr = Lawrencium + Rf = Rutherfordium + Db = Dubnium + Sg = Seaborgium + Bh = Bohrium + Hs = Hassium + Mt = Meitnerium + Ds = Darmstadtium + Rg = Roentgenium + Cn = Copernicium + Nh = Nihonium + Fl = Flerovium + Mc = Moscovium + Lv = Livermorium + Ts = Tennessine + Og = Oganesson #end class Element - - - -class PeriodicTable(DevBase): - - element_set=set([ - 'Ac','Al','Am','Sb','Ar','As','At','Ba','Bk','Be','Bi','B' ,'Br', - 'Cd','Ca','Cf','C' ,'Ce','Cs','Cl','Cr','Co','Cu','Cm','Dy','Es', - 'Er','Eu','Fm','F' ,'Fr','Gd','Ga','Ge','Au','Hf','Ha','Hs','He', - 'Ho','H' ,'In','I' ,'Ir','Fe','Kr','La','Lr','Pb','Li','Lu','Mg', - 'Mn','Mt','Md','Hg','Mo','Ns','Nd','Ne','Np','Ni','Nb','N' ,'No', - 'Os','O' ,'Pd','P' ,'Pt','Pu','Po','K' ,'Pr','Pm','Pa','Ra','Rn', - 'Re','Rh','Rb','Ru','Rf','Sm','Sc','Sg','Se','Si','Ag','Na','Sr', - 'S' ,'Ta','Tc','Te','Tb','Tl','Th','Tm','Sn','Ti','W' ,'U' ,'V' , - 'Xe','Yb','Y' ,'Zn','Zr']) - - - element_dict=dict({ - 'Ac':'Actinium', - 'Al':'Aluminum', - 'Am':'Americium', - 'Sb':'Antimony', - 'Ar':'Argon', - 'As':'Arsenic', - 'At':'Astatine', - 'Ba':'Barium', - 'Bk':'Berkelium', - 'Be':'Beryllium', - 'Bi':'Bismuth', - 'B':'Boron', - 'Br':'Bromine', - 'Cd':'Cadmium', - 'Ca':'Calcium', - 'Cf':'Californium', - 'C' :'Carbon', - 'Ce':'Cerium', - 'Cs':'Cesium', - 'Cl':'Chlorine', - 'Cr':'Chromium', - 'Co':'Cobalt', - 'Cu':'Copper', - 'Cm':'Curium', - 'Dy':'Dysprosium', - 'Es':'Einsteinium', - 'Er':'Erbium', - 'Eu':'Europium', - 'Fm':'Fermium', - 'F' :'Flourine', - 'Fr':'Francium', - 'Gd':'Gadolinium', - 'Ga':'Gallium', - 'Ge':'Germanium', - 'Au':'Gold', - 'Hf':'Hafnium', - 'Ha':'Hahnium', - 'Hs':'Hassium', - 'He':'Helium', - 'Ho':'Holmium', - 'H' :'Hydrogen', - 'In':'Indium', - 'I' :'Iodine', - 'Ir':'Iridium', - 'Fe':'Iron', - 'Kr':'Krypton', - 'La':'Lanthanum', - 'Lr':'Lawrencium', - 'Pb':'Lead', - 'Li':'Lithium', - 'Lu':'Lutetium', - 'Mg':'Magnesium', - 'Mn':'Manganese', - 'Mt':'Meitnerium', - 'Md':'Mendelevium', - 'Hg':'Mercury', - 'Mo':'Molybdenum', - 'Ns':'Neilsborium', - 'Nd':'Neodymium', - 'Ne':'Neon', - 'Np':'Neptunium', - 'Ni':'Nickel', - 'Nb':'Niobium', - 'N' :'Nitrogen', - 'No':'Nobelium', - 'Os':'Osmium', - 'O' :'Oxygen', - 'Pd':'Palladium', - 'P' :'Phosphorus', - 'Pt':'Platinum', - 'Pu':'Plutonium', - 'Po':'Polonium', - 'K' :'Potassium', - 'Pr':'Praseodymium', - 'Pm':'Promethium', - 'Pa':'Protactinium', - 'Ra':'Radium', - 'Rn':'Radon', - 'Re':'Rhenium', - 'Rh':'Rhodium', - 'Rb':'Rubidium', - 'Ru':'Ruthenium', - 'Rf':'Rutherfordium', - 'Sm':'Samarium', - 'Sc':'Scandium', - 'Sg':'Seaborgium', - 'Se':'Selenium', - 'Si':'Silicon', - 'Ag':'Silver', - 'Na':'Sodium', - 'Sr':'Strontium', - 'S' :'Sulfur', - 'Ta':'Tantalum', - 'Tc':'Technetium', - 'Te':'Tellurium', - 'Tb':'Terbium', - 'Tl':'Thalium', - 'Th':'Thorium', - 'Tm':'Thulium', - 'Sn':'Tin', - 'Ti':'Titanium', - 'W' :'Tungsten', - 'U' :'Uranium', - 'V' :'Vanadium', - 'Xe':'Xenon', - 'Yb':'Ytterbium', - 'Y' :'Yttrium', - 'Zn':'Zinc', - 'Zr':'Zirconium', - }) - - group_dict = dict([ - (0 ,'LanAct'), - (1 ,'IA'), - (2 ,'IIA'), - (3 ,'IIIB'), - (4 ,'IVB'), - (5 ,'VB'), - (6 ,'VIB'), - (7 ,'VIIB'), - (8 ,'VII'), - (9 ,'VII'), - (10,'VII'), - (11,'IB'), - (12,'IIB'), - (13,'IIIA'), - (14,'IVA'), - (15,'VA'), - (16,'VIA'), - (17,'VIIA'), - (18,'0') - ]) - - - atomic_weight_unit = 'amu' - atomic_radius_unit = 'pm' - nuclear_charge_unit = 'e' - electron_affinity_unit = 'kJ_mol' - ionization_energy_units = 'eV' - ionic_radius_units = 'pm' - thermal_cond_units = 'W_mK' - melting_point_units = 'degC' - boiling_point_units = 'degC' - - def __init__(self): - self.nelements = None - self.elements = None - - nelements = 103 - e = obj() - for i in range(1,nelements+1): - e[i] = SimpleElement() - #end for - - for i in range(1,nelements+1): - e[i].atomic_number = i - #end for - - - e[1].symbol='H' - e[2].symbol='He' - e[3].symbol='Li' - e[4].symbol='Be' - e[5].symbol='B' - e[6].symbol='C' - e[7].symbol='N' - e[8].symbol='O' - e[9].symbol='F' - e[10].symbol='Ne' - e[11].symbol='Na' - e[12].symbol='Mg' - e[13].symbol='Al' - e[14].symbol='Si' - e[15].symbol='P' - e[16].symbol='S' - e[17].symbol='Cl' - e[18].symbol='Ar' - e[19].symbol='K' - e[20].symbol='Ca' - e[21].symbol='Sc' - e[22].symbol='Ti' - e[23].symbol='V' - e[24].symbol='Cr' - e[25].symbol='Mn' - e[26].symbol='Fe' - e[27].symbol='Co' - e[28].symbol='Ni' - e[29].symbol='Cu' - e[30].symbol='Zn' - e[31].symbol='Ga' - e[32].symbol='Ge' - e[33].symbol='As' - e[34].symbol='Se' - e[35].symbol='Br' - e[36].symbol='Kr' - e[37].symbol='Rb' - e[38].symbol='Sr' - e[39].symbol='Y' - e[40].symbol='Zr' - e[41].symbol='Nb' - e[42].symbol='Mo' - e[43].symbol='Tc' - e[44].symbol='Ru' - e[45].symbol='Rh' - e[46].symbol='Pd' - e[47].symbol='Ag' - e[48].symbol='Cd' - e[49].symbol='In' - e[50].symbol='Sn' - e[51].symbol='Sb' - e[52].symbol='Te' - e[53].symbol='I' - e[54].symbol='Xe' - e[55].symbol='Cs' - e[56].symbol='Ba' - e[57].symbol='La' - e[58].symbol='Ce' - e[59].symbol='Pr' - e[60].symbol='Nd' - e[61].symbol='Pm' - e[62].symbol='Sm' - e[63].symbol='Eu' - e[64].symbol='Gd' - e[65].symbol='Tb' - e[66].symbol='Dy' - e[67].symbol='Ho' - e[68].symbol='Er' - e[69].symbol='Tm' - e[70].symbol='Yb' - e[71].symbol='Lu' - e[72].symbol='Hf' - e[73].symbol='Ta' - e[74].symbol='W' - e[75].symbol='Re' - e[76].symbol='Os' - e[77].symbol='Ir' - e[78].symbol='Pt' - e[79].symbol='Au' - e[80].symbol='Hg' - e[81].symbol='Tl' - e[82].symbol='Pb' - e[83].symbol='Bi' - e[84].symbol='Po' - e[85].symbol='At' - e[86].symbol='Rn' - e[87].symbol='Fr' - e[88].symbol='Ra' - e[89].symbol='Ac' - e[90].symbol='Th' - e[91].symbol='Pa' - e[92].symbol='U' - e[93].symbol='Np' - e[94].symbol='Pu' - e[95].symbol='Am' - e[96].symbol='Cm' - e[97].symbol='Bk' - e[98].symbol='Cf' - e[99].symbol='Es' - e[100].symbol='Fm' - e[101].symbol='Md' - e[102].symbol='No' - e[103].symbol='Lr' - - for i in range(1,len(e)): - e[i].name = PeriodicTable.element_dict[e[i].symbol] - #end for - - e[1].group = 1 - e[2].group = 18 - e[3].group = 1 - e[4].group = 2 - e[5].group = 13 - e[6].group = 14 - e[7].group = 15 - e[8].group = 16 - e[9].group = 17 - e[10].group = 18 - e[11].group = 1 - e[12].group = 2 - e[13].group = 13 - e[14].group = 14 - e[15].group = 15 - e[16].group = 16 - e[17].group = 17 - e[18].group = 18 - e[19].group = 1 - e[20].group = 2 - e[21].group = 3 - e[22].group = 4 - e[23].group = 5 - e[24].group = 6 - e[25].group = 7 - e[26].group = 8 - e[27].group = 9 - e[28].group = 10 - e[29].group = 11 - e[30].group = 12 - e[31].group = 13 - e[32].group = 14 - e[33].group = 15 - e[34].group = 16 - e[35].group = 17 - e[36].group = 18 - e[37].group = 1 - e[38].group = 2 - e[39].group = 3 - e[40].group = 4 - e[41].group = 5 - e[42].group = 6 - e[43].group = 7 - e[44].group = 8 - e[45].group = 9 - e[46].group = 10 - e[47].group = 11 - e[48].group = 12 - e[49].group = 13 - e[50].group = 14 - e[51].group = 15 - e[52].group = 16 - e[53].group = 17 - e[54].group = 18 - e[55].group = 1 - e[56].group = 2 - e[57].group = 3 - e[58].group = 0 - e[59].group = 0 - e[60].group = 0 - e[61].group = 0 - e[62].group = 0 - e[63].group = 0 - e[64].group = 0 - e[65].group = 0 - e[66].group = 0 - e[67].group = 0 - e[68].group = 0 - e[69].group = 0 - e[70].group = 0 - e[71].group = 0 - e[72].group = 4 - e[73].group = 5 - e[74].group = 6 - e[75].group = 7 - e[76].group = 8 - e[77].group = 9 - e[78].group = 10 - e[79].group = 11 - e[80].group = 12 - e[81].group = 13 - e[82].group = 14 - e[83].group = 15 - e[84].group = 16 - e[85].group = 17 - e[86].group = 18 - e[87].group = 1 - e[88].group = 2 - e[89].group = 3 - e[90].group = 0 - e[91].group = 0 - e[92].group = 0 - e[93].group = 0 - e[94].group = 0 - e[95].group = 0 - e[96].group = 0 - e[97].group = 0 - e[98].group = 0 - e[99].group = 0 - e[100].group = 0 - e[101].group = 0 - e[102].group = 0 - e[103].group = 0 - - e[1].atomic_weight = 1.00794 - e[2].atomic_weight = 4.002602 - e[3].atomic_weight = 6.941 - e[4].atomic_weight = 9.0122 - e[5].atomic_weight = 10.811 - e[6].atomic_weight = 12.011000 - e[7].atomic_weight = 14.007 - e[8].atomic_weight = 15.999 - e[9].atomic_weight = 18.998 - e[10].atomic_weight = 20.180 - e[11].atomic_weight = 22.990 - e[12].atomic_weight = 24.305 - e[13].atomic_weight = 26.982 - e[14].atomic_weight = 28.086 - e[15].atomic_weight = 30.974 - e[16].atomic_weight = 32.064 - e[17].atomic_weight = 35.453 - e[18].atomic_weight = 39.948 - e[19].atomic_weight = 39.098 - e[20].atomic_weight = 40.08 - e[21].atomic_weight = 44.956 - e[22].atomic_weight = 47.90 - e[23].atomic_weight = 50.942 - e[24].atomic_weight = 51.996 - e[25].atomic_weight = 54.938 - e[26].atomic_weight = 55.845 - e[27].atomic_weight = 58.933 - e[28].atomic_weight = 58.69 - e[29].atomic_weight = 63.546 - e[30].atomic_weight = 65.38 - e[31].atomic_weight = 65.38 - e[32].atomic_weight = 72.61 - e[33].atomic_weight = 74.992 - e[34].atomic_weight = 78.96 - e[35].atomic_weight = 79.904 - e[36].atomic_weight = 83.80 - e[37].atomic_weight = 85.47 - e[38].atomic_weight = 87.956 - e[39].atomic_weight = 88.905 - e[40].atomic_weight = 91.22 - e[41].atomic_weight = 92.906 - e[42].atomic_weight = 95.94 - e[43].atomic_weight = 98.00 - e[44].atomic_weight = 101.07 - e[45].atomic_weight = 102.91 - e[46].atomic_weight = 106.42 - e[47].atomic_weight = 107.87 - e[48].atomic_weight = 112.41 - e[49].atomic_weight = 114.82 - e[50].atomic_weight = 118.69 - e[51].atomic_weight = 121.175 - e[52].atomic_weight = 127.60 - e[53].atomic_weight = 126.90 - e[54].atomic_weight = 131.29 - e[55].atomic_weight = 132.91 - e[56].atomic_weight = 137.33 - e[57].atomic_weight = 138.92 - e[58].atomic_weight = 140.12 - e[59].atomic_weight = 140.91 - e[60].atomic_weight = 144.24 - e[61].atomic_weight = 145.00 - e[62].atomic_weight = 150.36 - e[63].atomic_weight = 151.97 - e[64].atomic_weight = 157.25 - e[65].atomic_weight = 158.924 - e[66].atomic_weight = 162.5 - e[67].atomic_weight = 164.930 - e[68].atomic_weight = 167.26 - e[69].atomic_weight = 169.934 - e[70].atomic_weight = 173.04 - e[71].atomic_weight = 174.97 - e[72].atomic_weight = 178.49 - e[73].atomic_weight = 180.948 - e[74].atomic_weight = 183.85 - e[75].atomic_weight = 186.2 - e[76].atomic_weight = 190.2 - e[77].atomic_weight = 192.2 - e[78].atomic_weight = 195.09 - e[79].atomic_weight = 196.197 - e[80].atomic_weight = 200.59 - e[81].atomic_weight = 204.37 - e[82].atomic_weight = 207.19 - e[83].atomic_weight = 208.980 - e[84].atomic_weight = 209.0 - e[85].atomic_weight = 210.0 - e[86].atomic_weight = 222.0 - e[87].atomic_weight = 223.0 - e[88].atomic_weight = 226.0 - e[89].atomic_weight = 227.028 - e[90].atomic_weight = 204.37 - e[91].atomic_weight = 231.0 - e[92].atomic_weight = 238.03 - e[93].atomic_weight = 237.05 - e[94].atomic_weight = 244.0 - e[95].atomic_weight = 243.0 - e[96].atomic_weight = 245.0 - e[97].atomic_weight = 247.0 - e[98].atomic_weight = 249.0 - e[99].atomic_weight = 254.0 - e[100].atomic_weight = 252.0 - e[101].atomic_weight = 256.0 - e[102].atomic_weight = 254.0 - e[103].atomic_weight = 257 - - #atomic radius (in picometers) - e[1].atomic_radius = 78.000000 - e[2].atomic_radius = 128.000000 - e[3].atomic_radius = 152.000000 - e[4].atomic_radius = 111.300000 - e[5].atomic_radius = 79.500000 - e[6].atomic_radius = 77.200000 - e[7].atomic_radius = 54.900000 - e[8].atomic_radius = 60.400000 - e[9].atomic_radius = 70.900000 - e[10].atomic_radius = 0.000000 - e[11].atomic_radius = 185.800000 - e[12].atomic_radius = 159.900000 - e[13].atomic_radius = 143.200000 - e[14].atomic_radius = 117.600000 - e[15].atomic_radius = 110.500000 - e[16].atomic_radius = 103.500000 - e[17].atomic_radius = 99.400000 - e[18].atomic_radius = 180.000000 - e[19].atomic_radius = 227.200000 - e[20].atomic_radius = 197.400000 - e[21].atomic_radius = 160.600000 - e[22].atomic_radius = 144.800000 - e[23].atomic_radius = 131.100000 - e[24].atomic_radius = 124.900000 - e[25].atomic_radius = 136.700000 - e[26].atomic_radius = 124.100000 - e[27].atomic_radius = 125.300000 - e[28].atomic_radius = 124.600000 - e[29].atomic_radius = 127.800000 - e[30].atomic_radius = 133.500000 - e[31].atomic_radius = 122.100000 - e[32].atomic_radius = 122.500000 - e[33].atomic_radius = 124.500000 - e[34].atomic_radius = 116.000000 - e[35].atomic_radius = 114.500000 - e[36].atomic_radius = 0.000000 - e[37].atomic_radius = 247.500000 - e[38].atomic_radius = 215.100000 - e[39].atomic_radius = 177.600000 - e[40].atomic_radius = 159.000000 - e[41].atomic_radius = 142.900000 - e[42].atomic_radius = 136.300000 - e[43].atomic_radius = 135.200000 - e[44].atomic_radius = 132.500000 - e[45].atomic_radius = 134.500000 - e[46].atomic_radius = 137.600000 - e[47].atomic_radius = 144.500000 - e[48].atomic_radius = 148.900000 - e[49].atomic_radius = 162.600000 - e[50].atomic_radius = 140.500000 - e[51].atomic_radius = 145.000000 - e[52].atomic_radius = 143.200000 - e[53].atomic_radius = 133.100000 - e[54].atomic_radius = 210.000000 - e[55].atomic_radius = 265.500000 - e[56].atomic_radius = 217.400000 - e[57].atomic_radius = 187.000000 - e[58].atomic_radius = 182.500000 - e[59].atomic_radius = 182.000000 - e[60].atomic_radius = 181.400000 - e[61].atomic_radius = 181.000000 - e[62].atomic_radius = 180.200000 - e[63].atomic_radius = 199.500000 - e[64].atomic_radius = 178.700000 - e[65].atomic_radius = 176.300000 - e[66].atomic_radius = 175.200000 - e[67].atomic_radius = 174.300000 - e[68].atomic_radius = 173.400000 - e[69].atomic_radius = 172.400000 - e[70].atomic_radius = 194.000000 - e[71].atomic_radius = 171.800000 - e[72].atomic_radius = 156.400000 - e[73].atomic_radius = 143.000000 - e[74].atomic_radius = 137.000000 - e[75].atomic_radius = 137.100000 - e[76].atomic_radius = 133.800000 - e[77].atomic_radius = 135.700000 - e[78].atomic_radius = 137.300000 - e[79].atomic_radius = 144.200000 - e[80].atomic_radius = 150.300000 - e[81].atomic_radius = 170.000000 - e[82].atomic_radius = 175.000000 - e[83].atomic_radius = 154.500000 - e[84].atomic_radius = 167.300000 - e[85].atomic_radius = 0.000000 - e[86].atomic_radius = 0.000000 - e[87].atomic_radius = 270.000000 - e[88].atomic_radius = 223.000000 - e[89].atomic_radius = 187.800000 - e[90].atomic_radius = 179.800000 - e[91].atomic_radius = 156.100000 - e[92].atomic_radius = 138.500000 - e[93].atomic_radius = 130.000000 - e[94].atomic_radius = 151.300000 - e[95].atomic_radius = 0.000000 - e[96].atomic_radius = 0.000000 - e[97].atomic_radius = 0.000000 - e[98].atomic_radius = 0.000000 - e[99].atomic_radius = 0.000000 - e[100].atomic_radius = 0.000000 - e[101].atomic_radius = 0.000000 - e[102].atomic_radius = 0.000000 - e[103].atomic_radius = 0.000000 - - # Nuclear charge (Slater) - # 0 for those not available - e[1].nuclear_charge = 1.00 - e[2].nuclear_charge = 1.70 - e[3].nuclear_charge = 1.30 - e[4].nuclear_charge = 1.95 - e[5].nuclear_charge = 2.60 - e[6].nuclear_charge = 3.25 - e[7].nuclear_charge = 3.90 - e[8].nuclear_charge = 4.55 - e[9].nuclear_charge = 5.20 - e[10].nuclear_charge = 5.85 - e[11].nuclear_charge = 2.20 - e[12].nuclear_charge = 2.85 - e[13].nuclear_charge = 3.50 - e[14].nuclear_charge = 4.15 - e[15].nuclear_charge = 4.80 - e[16].nuclear_charge = 5.45 - e[17].nuclear_charge = 6.10 - e[18].nuclear_charge = 6.75 - e[19].nuclear_charge = 2.20 - e[20].nuclear_charge = 2.85 - e[21].nuclear_charge = 3.00 - e[22].nuclear_charge = 3.15 - e[23].nuclear_charge = 3.30 - e[24].nuclear_charge = 3.45 - e[25].nuclear_charge = 3.60 - e[26].nuclear_charge = 3.75 - e[27].nuclear_charge = 3.90 - e[28].nuclear_charge = 4.05 - e[29].nuclear_charge = 4.20 - e[30].nuclear_charge = 4.35 - e[31].nuclear_charge = 5.00 - e[32].nuclear_charge = 5.65 - e[33].nuclear_charge = 6.30 - e[34].nuclear_charge = 6.95 - e[35].nuclear_charge = 7.60 - e[36].nuclear_charge = 8.25 - e[37].nuclear_charge = 2.20 - e[38].nuclear_charge = 2.85 - e[39].nuclear_charge = 3.00 - e[40].nuclear_charge = 3.15 - e[41].nuclear_charge = 3.30 - e[42].nuclear_charge = 3.45 - e[43].nuclear_charge = 3.60 - e[44].nuclear_charge = 3.75 - e[45].nuclear_charge = 3.90 - e[46].nuclear_charge = 4.05 - e[47].nuclear_charge = 4.20 - e[48].nuclear_charge = 4.35 - e[49].nuclear_charge = 5.00 - e[50].nuclear_charge = 5.65 - e[51].nuclear_charge = 6.30 - e[52].nuclear_charge = 6.95 - e[53].nuclear_charge = 7.60 - e[54].nuclear_charge = 8.25 - e[55].nuclear_charge = 2.20 - e[56].nuclear_charge = 2.85 - e[57].nuclear_charge = 2.85 - e[58].nuclear_charge = 2.85 - e[59].nuclear_charge = 2.85 - e[60].nuclear_charge = 2.85 - e[61].nuclear_charge = 2.85 - e[62].nuclear_charge = 2.85 - e[63].nuclear_charge = 2.85 - e[64].nuclear_charge = 2.85 - e[65].nuclear_charge = 2.85 - e[66].nuclear_charge = 2.85 - e[67].nuclear_charge = 2.85 - e[68].nuclear_charge = 2.85 - e[69].nuclear_charge = 2.85 - e[70].nuclear_charge = 2.854 - e[71].nuclear_charge = 3.00 - e[72].nuclear_charge = 3.15 - e[73].nuclear_charge = 3.30 - e[74].nuclear_charge = 4.35 - e[75].nuclear_charge = 3.60 - e[76].nuclear_charge = 3.75 - e[77].nuclear_charge = 3.90 - e[78].nuclear_charge = 4.05 - e[79].nuclear_charge = 4.20 - e[80].nuclear_charge = 4.35 - e[81].nuclear_charge = 5.00 - e[82].nuclear_charge = 5.65 - e[83].nuclear_charge = 6.30 - e[84].nuclear_charge = 6.95 - e[85].nuclear_charge = 7.60 - e[86].nuclear_charge = 8.25 - e[87].nuclear_charge = 2.20 - e[88].nuclear_charge = 1.65 - e[89].nuclear_charge = 1.8 - e[90].nuclear_charge = 1.95 - e[91].nuclear_charge = 1.80 - e[92].nuclear_charge = 1.80 - e[93].nuclear_charge = 1.80 - e[94].nuclear_charge = 1.65 - e[95].nuclear_charge = 4.65 - e[96].nuclear_charge = 1.80 - e[97].nuclear_charge = 1.65 - e[98].nuclear_charge = 1.65 - e[99].nuclear_charge = 1.65 - e[100].nuclear_charge = 1.65 - e[101].nuclear_charge = 1.65 - e[102].nuclear_charge = 1.65 - e[103].nuclear_charge = 1.8 - - e[1].abundance = 0.880000 - e[2].abundance = 0.000000 - e[3].abundance = 0.006000 - e[4].abundance = 0.000500 - e[5].abundance = 0.001000 - e[6].abundance = 0.090000 - e[7].abundance = 0.030000 - e[8].abundance = 49.400000 - e[9].abundance = 0.030000 - e[10].abundance = 0.000000 - e[11].abundance = 2.640000 - e[12].abundance = 1.940000 - e[13].abundance = 7.570000 - e[14].abundance = 25.800000 - e[15].abundance = 0.090000 - e[16].abundance = 0.050000 - e[17].abundance = 0.190000 - e[18].abundance = 0.000400 - e[19].abundance = 2.400000 - e[20].abundance = 3.390000 - e[21].abundance = 0.000500 - e[22].abundance = 0.410000 - e[23].abundance = 0.010000 - e[24].abundance = 0.020000 - e[25].abundance = 0.090000 - e[26].abundance = 4.700000 - e[27].abundance = 0.004000 - e[28].abundance = 0.010000 - e[29].abundance = 0.010000 - e[30].abundance = 0.010000 - e[31].abundance = 0.001000 - e[32].abundance = 0.000600 - e[33].abundance = 0.000600 - e[34].abundance = 0.000100 - e[35].abundance = 0.000600 - e[36].abundance = 0.000000 - e[37].abundance = 0.030000 - e[38].abundance = 0.010000 - e[39].abundance = 0.003000 - e[40].abundance = 0.020000 - e[41].abundance = 0.002000 - e[42].abundance = 0.001000 - e[43].abundance = 0.000000 - e[44].abundance = 0.000002 - e[45].abundance = 0.000000 - e[46].abundance = 0.000001 - e[47].abundance = 0.000010 - e[48].abundance = 0.000030 - e[49].abundance = 0.000010 - e[50].abundance = 0.001000 - e[51].abundance = 0.000100 - e[52].abundance = 0.000001 - e[53].abundance = 0.000006 - e[54].abundance = 0.000000 - e[55].abundance = 0.000600 - e[56].abundance = 0.030000 - e[57].abundance = 0.002000 - e[58].abundance = 0.004000 - e[59].abundance = 0.000500 - e[60].abundance = 0.002000 - e[61].abundance = 0.000000 - e[62].abundance = 0.000600 - e[63].abundance = 0.000010 - e[64].abundance = 0.000600 - e[65].abundance = 0.000090 - e[66].abundance = 0.000400 - e[67].abundance = 0.000100 - e[68].abundance = 0.000200 - e[69].abundance = 0.000020 - e[70].abundance = 0.000020 - e[71].abundance = 0.000070 - e[72].abundance = 0.000400 - e[73].abundance = 0.000800 - e[74].abundance = 0.006000 - e[75].abundance = 0.000000 - e[76].abundance = 0.000001 - e[77].abundance = 0.000000 - e[78].abundance = 0.000000 - e[79].abundance = 0.000000 - e[80].abundance = 0.000040 - e[81].abundance = 0.000030 - e[82].abundance = 0.002000 - e[83].abundance = 0.000020 - e[84].abundance = 0.000000 - e[85].abundance = 0.000000 - e[86].abundance = 0.000000 - e[87].abundance = 0.000000 - e[88].abundance = 0.000000 - e[89].abundance = 0.000000 - e[90].abundance = 0.001000 - e[91].abundance = 9.0 - e[92].abundance = 0.000300 - e[93].abundance = 0.000000 - e[94].abundance = 0.000000 - e[95].abundance = 0.000000 - e[96].abundance = 0.000000 - e[97].abundance = 0.000000 - e[98].abundance = 0.000000 - e[99].abundance = 0.000000 - e[100].abundance = 0.000000 - e[101].abundance = 0.000000 - e[102].abundance = 0.000000 - e[103].abundance = 0.000000 - - # Electron Aff. - # 0 for those not available - # Defined as 0 for Elements 2, 25,66 and 72 - e[1].electron_affinity = 72.8 - e[2].electron_affinity = 0.0 - e[3].electron_affinity = 59.6 - e[4].electron_affinity = -18 - e[5].electron_affinity = 26.7 - e[6].electron_affinity = 121.9 - e[7].electron_affinity = -7 - e[8].electron_affinity = 141 - e[9].electron_affinity = 328 - e[10].electron_affinity = -29 - e[11].electron_affinity = 52.9 - e[12].electron_affinity = -21 - e[13].electron_affinity = 44 - e[14].electron_affinity = 133.6 - e[15].electron_affinity = 72 - e[16].electron_affinity = 200.4 - e[17].electron_affinity = 349.0 - e[18].electron_affinity = -35 - e[19].electron_affinity = 48.4 - e[20].electron_affinity = -186 - e[21].electron_affinity = 18.1 - e[22].electron_affinity = 7.6 - e[23].electron_affinity = 50.7 - e[24].electron_affinity = 64.3 - e[25].electron_affinity = 0 - e[26].electron_affinity = 15.7 - e[27].electron_affinity = 63.8 - e[28].electron_affinity = 156 - e[29].electron_affinity = 188.5 - e[30].electron_affinity = 9 - e[31].electron_affinity = 30 - e[32].electron_affinity = 116 - e[33].electron_affinity = 78 - e[34].electron_affinity = 195 - e[35].electron_affinity = 324.7 - e[36].electron_affinity = -39 - e[37].electron_affinity = 46.9 - e[38].electron_affinity = -164 - e[39].electron_affinity = 29.6 - e[40].electron_affinity = 41.1 - e[41].electron_affinity = 86.2 - e[42].electron_affinity = 72.0 - e[43].electron_affinity = 96 - e[44].electron_affinity = 101 - e[45].electron_affinity = 109.7 - e[46].electron_affinity = 53.7 - e[47].electron_affinity = 125.7 - e[48].electron_affinity = -26 - e[49].electron_affinity = 30 - e[50].electron_affinity = 116 - e[51].electron_affinity = 101 - e[52].electron_affinity = 190.2 - e[53].electron_affinity = 295.2 - e[54].electron_affinity = -41 - e[55].electron_affinity = 45.5 - e[56].electron_affinity = -46 - e[57].electron_affinity = 50 - e[58].electron_affinity = 50 - e[59].electron_affinity = 50 - e[60].electron_affinity = 50 - e[61].electron_affinity = 50 - e[62].electron_affinity = 50 - e[63].electron_affinity = 50 - e[64].electron_affinity = 50 - e[65].electron_affinity = 50 - e[66].electron_affinity = 0 - e[67].electron_affinity = 50 - e[68].electron_affinity = 50 - e[69].electron_affinity = 50 - e[70].electron_affinity = 50 - e[71].electron_affinity = 50 - e[72].electron_affinity = 0 - e[73].electron_affinity = 14 - e[74].electron_affinity = 78.6 - e[75].electron_affinity = 14 - e[76].electron_affinity = 106 - e[77].electron_affinity = 151 - e[78].electron_affinity = 205.3 - e[79].electron_affinity = 222.8 - e[80].electron_affinity = -18 - e[81].electron_affinity = 20 - e[82].electron_affinity = 35.1 - e[83].electron_affinity = 91.3 - e[84].electron_affinity = 183 - e[85].electron_affinity = 270 - e[86].electron_affinity = -41 - e[87].electron_affinity = 44 - e[88].electron_affinity = 159 - e[89].electron_affinity = 406 - e[90].electron_affinity = 598.3 - e[91].electron_affinity = 607 - e[92].electron_affinity = 535.6 - e[93].electron_affinity = 0 - e[94].electron_affinity = 0 - e[95].electron_affinity = 0 - e[96].electron_affinity = 0 - e[97].electron_affinity = 0 - e[98].electron_affinity = 0 - e[99].electron_affinity = 50 - e[100].electron_affinity = 0 - e[101].electron_affinity = 0 - e[102].electron_affinity = 0 - e[103].electron_affinity = 0 - - # Electronegativity (Pauling) - # 0 for those not available - # Some noble gases defined as zero - e[1].electronegativity = 2.20 - e[2].electronegativity = 0 - e[3].electronegativity = 0.98 - e[4].electronegativity = 1.57 - e[5].electronegativity = 2.04 - e[6].electronegativity = 2.55 - e[7].electronegativity = 3.04 - e[8].electronegativity = 3.44 - e[9].electronegativity = 3.98 - e[10].electronegativity = 0 - e[11].electronegativity = 0.93 - e[12].electronegativity = 1.31 - e[13].electronegativity = 1.61 - e[14].electronegativity = 1.90 - e[15].electronegativity = 2.19 - e[16].electronegativity = 2.58 - e[17].electronegativity = 3.16 - e[18].electronegativity = 0 - e[19].electronegativity = 0.82 - e[20].electronegativity = 1.00 - e[21].electronegativity = 1.36 - e[22].electronegativity = 1.54 - e[23].electronegativity = 1.63 - e[24].electronegativity = 1.66 - e[25].electronegativity = 1.55 - e[26].electronegativity = 1.83 - e[27].electronegativity = 1.88 - e[28].electronegativity = 1.91 - e[29].electronegativity = 1.90 - e[30].electronegativity = 1.65 - e[31].electronegativity = 1.81 - e[32].electronegativity = 2.01 - e[33].electronegativity = 2.18 - e[34].electronegativity = 2.55 - e[35].electronegativity = 2.96 - e[36].electronegativity = 0 - e[37].electronegativity = 0.82 - e[38].electronegativity = 0.95 - e[39].electronegativity = 1.22 - e[40].electronegativity = 1.33 - e[41].electronegativity = 1.6 - e[42].electronegativity = 2.16 - e[43].electronegativity = 1.9 - e[44].electronegativity = 2.2 - e[45].electronegativity = 2.28 - e[46].electronegativity = 2.20 - e[47].electronegativity = 1.93 - e[48].electronegativity = 1.96 - e[49].electronegativity = 1.78 - e[50].electronegativity = 1.96 - e[51].electronegativity = 2.05 - e[52].electronegativity = 2.1 - e[53].electronegativity = 2.66 - e[54].electronegativity = 2.6 - e[55].electronegativity = 0.79 - e[56].electronegativity = 0.89 - e[57].electronegativity = 1.10 - e[58].electronegativity = 1.12 - e[59].electronegativity = 1.13 - e[60].electronegativity = 1.14 - e[61].electronegativity = 0 - e[62].electronegativity = 1.17 - e[63].electronegativity = 0 - e[64].electronegativity = 1.20 - e[65].electronegativity = 0 - e[66].electronegativity = 1.22 - e[67].electronegativity = 1.23 - e[68].electronegativity = 1.24 - e[69].electronegativity = 1.25 - e[70].electronegativity = 0 - e[71].electronegativity = 1.27 - e[72].electronegativity = 1.3 - e[73].electronegativity = 1.5 - e[74].electronegativity = 2.36 - e[75].electronegativity = 1.9 - e[76].electronegativity = 2.2 - e[77].electronegativity = 2.20 - e[78].electronegativity = 2.28 - e[79].electronegativity = 2.54 - e[80].electronegativity = 2.00 - e[81].electronegativity = 2.04 - e[82].electronegativity = 2.33 - e[83].electronegativity = 2.02 - e[84].electronegativity = 2.0 - e[85].electronegativity = 2.2 - e[86].electronegativity = 0 - e[87].electronegativity = 0.7 - e[88].electronegativity = 0.89 - e[89].electronegativity = 1.1 - e[90].electronegativity = 1.3 - e[91].electronegativity = 1.5 - e[92].electronegativity = 1.38 - e[93].electronegativity = 1.36 - e[94].electronegativity = 1.28 - e[95].electronegativity = 1.3 - e[96].electronegativity = 1.3 - e[97].electronegativity = 1.3 - e[98].electronegativity = 1.3 - e[99].electronegativity = 1.3 - e[100].electronegativity = 1.3 - e[101].electronegativity = 1.3 - e[102].electronegativity = 1.3 - e[103].electronegativity = 1.3 - - # ionization energy (in electronvolts].ionization_energy - e[1].ionization_energy = 13.598 - e[2].ionization_energy = 24.587000 - e[3].ionization_energy = 5.392000 - e[4].ionization_energy = 9.322000 - e[5].ionization_energy = 8.298000 - e[6].ionization_energy = 11.260000 - e[7].ionization_energy = 14.534000 - e[8].ionization_energy = 13.618000 - e[9].ionization_energy = 17.422000 - e[10].ionization_energy = 21.564000 - e[11].ionization_energy = 5.139000 - e[12].ionization_energy = 7.646000 - e[13].ionization_energy = 5.986000 - e[14].ionization_energy = 8.151000 - e[15].ionization_energy = 10.486000 - e[16].ionization_energy = 10.360000 - e[17].ionization_energy = 12.967000 - e[18].ionization_energy = 15.759000 - e[19].ionization_energy = 4.341000 - e[20].ionization_energy = 6.113000 - e[21].ionization_energy = 6.540000 - e[22].ionization_energy = 6.820000 - e[23].ionization_energy = 6.740000 - e[24].ionization_energy = 6.766000 - e[25].ionization_energy = 7.435000 - e[26].ionization_energy = 7.870000 - e[27].ionization_energy = 7.860000 - e[28].ionization_energy = 7.635000 - e[29].ionization_energy = 7.726000 - e[30].ionization_energy = 9.394000 - e[31].ionization_energy = 5.999000 - e[32].ionization_energy = 7.899000 - e[33].ionization_energy = 9.810000 - e[34].ionization_energy = 9.752000 - e[35].ionization_energy = 11.814000 - e[36].ionization_energy = 13.999000 - e[37].ionization_energy = 4.177000 - e[38].ionization_energy = 5.695000 - e[39].ionization_energy = 6.380000 - e[40].ionization_energy = 6.840000 - e[41].ionization_energy = 6.880000 - e[42].ionization_energy = 7.099000 - e[43].ionization_energy = 7.280000 - e[44].ionization_energy = 7.370000 - e[45].ionization_energy = 7.460000 - e[46].ionization_energy = 8.340000 - e[47].ionization_energy = 7.576000 - e[48].ionization_energy = 8.993000 - e[49].ionization_energy = 5.786000 - e[50].ionization_energy = 7.344000 - e[51].ionization_energy = 8.641000 - e[52].ionization_energy = 9.009000 - e[53].ionization_energy = 10.451000 - e[54].ionization_energy = 12.130000 - e[55].ionization_energy = 3.894000 - e[56].ionization_energy = 5.212000 - e[57].ionization_energy = 5.577000 - e[58].ionization_energy = 5.470000 - e[59].ionization_energy = 5.420000 - e[60].ionization_energy = 5.490000 - e[61].ionization_energy = 5.550000 - e[62].ionization_energy = 5.630000 - e[63].ionization_energy = 5.670000 - e[64].ionization_energy = 6.140000 - e[65].ionization_energy = 5.850000 - e[66].ionization_energy = 5.930000 - e[67].ionization_energy = 6.020000 - e[68].ionization_energy = 6.100000 - e[69].ionization_energy = 6.180000 - e[70].ionization_energy = 6.254000 - e[71].ionization_energy = 5.426000 - e[72].ionization_energy = 7.000000 - e[73].ionization_energy = 7.890000 - e[74].ionization_energy = 7.980000 - e[75].ionization_energy = 7.880000 - e[76].ionization_energy = 8.700000 - e[77].ionization_energy = 9.100000 - e[78].ionization_energy = 9.000000 - e[79].ionization_energy = 9.255000 - e[80].ionization_energy = 10.437000 - e[81].ionization_energy = 6.108000 - e[82].ionization_energy = 6.108000 - e[83].ionization_energy = 7.289000 - e[84].ionization_energy = 8.420000 - e[85].ionization_energy = 9.500000 - e[86].ionization_energy = 10.748000 - e[87].ionization_energy = 4.000000 - e[88].ionization_energy = 5.279000 - e[89].ionization_energy = 6.900000 - e[90].ionization_energy = 6.950000 - e[91].ionization_energy = 0.000000 - e[92].ionization_energy = 6.080000 - e[93].ionization_energy = 0.000000 - e[94].ionization_energy = 5.800000 - e[95].ionization_energy = 6.000000 - e[96].ionization_energy = 0.000000 - e[97].ionization_energy = 0.000000 - e[98].ionization_energy = 0.000000 - e[99].ionization_energy = 0.000000 - e[100].ionization_energy = 0.000000 - e[101].ionization_energy = 0.000000 - e[102].ionization_energy = 0.000000 - e[103].ionization_energy = 0.000000 - - - # Ionic Radius (picometers) - # Radius for smallest charge where more than one possible - # Radius for H is for hydride - # 0 for those not available or those that don't form ions - e[1].ionic_radius = 154 - e[2].ionic_radius = 0 - e[3].ionic_radius = 78 - e[4].ionic_radius = 34 - e[5].ionic_radius = 23 - e[6].ionic_radius = 260 - e[7].ionic_radius = 171 - e[8].ionic_radius = 132 - e[9].ionic_radius = 133 - e[10].ionic_radius = 112 - e[11].ionic_radius = 98 - e[12].ionic_radius = 78 - e[13].ionic_radius = 57 - e[14].ionic_radius = 271 - e[15].ionic_radius = 212 - e[16].ionic_radius = 184 - e[17].ionic_radius = 181 - e[18].ionic_radius = 154 - e[19].ionic_radius = 133 - e[20].ionic_radius = 106 - e[21].ionic_radius = 83 - e[22].ionic_radius = 80 - e[23].ionic_radius = 72 - e[24].ionic_radius = 84 - e[25].ionic_radius = 91 - e[26].ionic_radius = 82 - e[27].ionic_radius = 82 - e[28].ionic_radius = 78 - e[29].ionic_radius = 96 - e[30].ionic_radius = 83 - e[31].ionic_radius = 113 - e[32].ionic_radius = 90 - e[33].ionic_radius = 69 - e[34].ionic_radius = 69 - e[35].ionic_radius = 196 - e[36].ionic_radius = 169 - e[37].ionic_radius = 149 - e[38].ionic_radius = 127 - e[39].ionic_radius = 106 - e[40].ionic_radius = 109 - e[41].ionic_radius = 74 - e[42].ionic_radius = 92 - e[43].ionic_radius = 95 - e[44].ionic_radius = 77 - e[45].ionic_radius = 86 - e[46].ionic_radius = 86 - e[47].ionic_radius = 113 - e[48].ionic_radius = 114 - e[49].ionic_radius = 132 - e[50].ionic_radius = 93 - e[51].ionic_radius = 89 - e[52].ionic_radius = 211 - e[53].ionic_radius = 220 - e[54].ionic_radius = 190 - e[55].ionic_radius = 165 - e[56].ionic_radius = 143 - e[57].ionic_radius = 122 - e[58].ionic_radius = 107 - e[59].ionic_radius = 106 - e[60].ionic_radius = 104 - e[61].ionic_radius = 106 - e[62].ionic_radius = 111 - e[63].ionic_radius = 112 - e[64].ionic_radius = 97 - e[65].ionic_radius = 93 - e[66].ionic_radius = 91 - e[67].ionic_radius = 89 - e[68].ionic_radius = 89 - e[69].ionic_radius = 87 - e[70].ionic_radius = 113 - e[71].ionic_radius = 85 - e[72].ionic_radius = 84 - e[73].ionic_radius = 72 - e[74].ionic_radius = 68 - e[75].ionic_radius = 72 - e[76].ionic_radius = 89 - e[77].ionic_radius = 89 - e[78].ionic_radius = 85 - e[79].ionic_radius = 137 - e[80].ionic_radius = 127 - e[81].ionic_radius = 149 - e[82].ionic_radius = 132 - e[83].ionic_radius = 96 - e[84].ionic_radius = 65 - e[85].ionic_radius = 227 - e[86].ionic_radius = 0 - e[87].ionic_radius = 180 - e[88].ionic_radius = 152 - e[89].ionic_radius = 118 - e[90].ionic_radius = 101 - e[91].ionic_radius = 113 - e[92].ionic_radius = 103 - e[93].ionic_radius = 110 - e[94].ionic_radius = 108 - e[95].ionic_radius = 107 - e[96].ionic_radius = 119 - e[97].ionic_radius =118 - e[98].ionic_radius = 117 - e[99].ionic_radius = 116 - e[100].ionic_radius = 115 - e[101].ionic_radius = 114 - e[102].ionic_radius = 113 - e[103].ionic_radius = 112 - - # Thermal Conditions (W/mK at 300K) - # 0 for those not available - e[1].thermal_cond = 0.1815 - e[2].thermal_cond = 0.152 - e[3].thermal_cond = 84.7 - e[4].thermal_cond = 200 - e[5].thermal_cond = 27 - e[6].thermal_cond = 1960 - e[7].thermal_cond = 0.02598 - e[8].thermal_cond = 0.2674 - e[9].thermal_cond = 0.0279 - e[10].thermal_cond = 0.0493 - e[11].thermal_cond = 141 - e[12].thermal_cond = 156 - e[13].thermal_cond = 273 - e[14].thermal_cond = 148 - e[15].thermal_cond = 0.235 - e[16].thermal_cond = 0.269 - e[17].thermal_cond = 0.0089 - e[18].thermal_cond = 0.0177 - e[19].thermal_cond = 102.4 - e[20].thermal_cond = 200 - e[21].thermal_cond = 15.8 - e[22].thermal_cond = 21.9 - e[23].thermal_cond = 30.7 - e[24].thermal_cond = 93.7 - e[25].thermal_cond = 7.82 - e[26].thermal_cond = 80.2 - e[27].thermal_cond = 100 - e[28].thermal_cond = 90.7 - e[29].thermal_cond = 401 - e[30].thermal_cond = 116 - e[31].thermal_cond = 40.6 - e[32].thermal_cond = 59.9 - e[33].thermal_cond = 50.0 - e[34].thermal_cond = 2.04 - e[35].thermal_cond = 0.122 - e[36].thermal_cond = 0.00949 - e[37].thermal_cond = 58.2 - e[38].thermal_cond = 35.3 - e[39].thermal_cond = 17.2 - e[40].thermal_cond = 22.7 - e[41].thermal_cond = 53.7 - e[42].thermal_cond = 138 - e[43].thermal_cond = 50.6 - e[44].thermal_cond = 117 - e[45].thermal_cond = 150 - e[46].thermal_cond = 71.8 - e[47].thermal_cond = 429 - e[48].thermal_cond = 96.8 - e[49].thermal_cond = 81.6 - e[50].thermal_cond = 66.6 - e[51].thermal_cond = 24.3 - e[52].thermal_cond = 2.35 - e[53].thermal_cond = 0.449 - e[54].thermal_cond = 0.00569 - e[55].thermal_cond = 35.9 - e[56].thermal_cond = 18.4 - e[57].thermal_cond = 13.5 - e[58].thermal_cond = 11.4 - e[59].thermal_cond = 12.5 - e[60].thermal_cond = 16.5 - e[61].thermal_cond = 17.9 - e[62].thermal_cond = 13.3 - e[63].thermal_cond = 13.9 - e[64].thermal_cond = 10.6 - e[65].thermal_cond = 11.1 - e[66].thermal_cond = 10.7 - e[67].thermal_cond = 16.2 - e[68].thermal_cond = 14.3 - e[69].thermal_cond = 16.8 - e[70].thermal_cond = 34.9 - e[71].thermal_cond = 16.4 - e[72].thermal_cond = 23 - e[73].thermal_cond = 57.5 - e[74].thermal_cond = 174 - e[75].thermal_cond = 47.9 - e[76].thermal_cond = 87.6 - e[77].thermal_cond = 147 - e[78].thermal_cond = 71.6 - e[79].thermal_cond = 317 - e[80].thermal_cond = 8.34 - e[81].thermal_cond = 46.1 - e[82].thermal_cond = 35.3 - e[83].thermal_cond = 7.87 - e[84].thermal_cond = 20 - e[85].thermal_cond = 1.7 - e[86].thermal_cond = 0.00364 - e[87].thermal_cond = 15 - e[88].thermal_cond = 18.6 - e[89].thermal_cond = 12 - e[90].thermal_cond = 54.0 - e[91].thermal_cond = 47 - e[92].thermal_cond = 27.6 - e[93].thermal_cond = 6.3 - e[94].thermal_cond = 6.74 - e[95].thermal_cond = 10 - e[96].thermal_cond = 10 - e[97].thermal_cond = 10 - e[98].thermal_cond = 10 - e[99].thermal_cond = 10 - e[100].thermal_cond = 10 - e[101].thermal_cond = 10 - e[102].thermal_cond = 10 - e[103].thermal_cond = 10 - - # mpt.m creates e[deg C].melting_point - e[1].melting_point=-259.14 - e[2].melting_point=-272.2 - e[3].melting_point=180.54 - e[4].melting_point=1278.000000 - e[5].melting_point=2300. - e[6].melting_point=3550.000000 - e[7].melting_point=-209.86 - e[8].melting_point=-218.4 - e[9].melting_point=-219.62 - e[10].melting_point=-248.67 - e[11].melting_point=97.81 - e[12].melting_point=648.8 - e[13].melting_point=660.37 - e[14].melting_point=1410. - e[15].melting_point=44.100000 - e[16].melting_point=112.8 - e[17].melting_point=-100.98 - e[18].melting_point=-189.2 - e[19].melting_point=63.65 - e[20].melting_point=839.000 - e[21].melting_point=1541. - e[22].melting_point=1660. - e[23].melting_point=1890. - e[24].melting_point=1857. - e[25].melting_point=1244. - e[26].melting_point=1553. - e[27].melting_point=1495. - e[28].melting_point=1453. - e[29].melting_point=1083.4 - e[30].melting_point=419.58 - e[31].melting_point=29.78 - e[32].melting_point=937.4 - e[33].melting_point=817.00 - e[34].melting_point=217. - e[35].melting_point=-7.2 - e[36].melting_point=-156.6 - e[37].melting_point=38.89 - e[38].melting_point=769. - e[39].melting_point=1522 - e[40].melting_point=1852.00 - e[41].melting_point=2468. - e[42].melting_point=2617. - e[43].melting_point=2172. - e[44].melting_point=2310. - e[45].melting_point=1966 - e[46].melting_point=1552. - e[47].melting_point=961.93 - e[48].melting_point=320.9 - e[49].melting_point=156.61 - e[50].melting_point=231.9681 - e[51].melting_point=630.74 - e[52].melting_point=449.5 - e[53].melting_point=113.5 - e[54].melting_point=-111.9 - e[55].melting_point=28.40 - e[56].melting_point=725. - e[57].melting_point=921 - e[58].melting_point=799 - e[59].melting_point=931 - e[60].melting_point=1021 - e[61].melting_point=1168 - e[62].melting_point=1077 - e[63].melting_point=822 - e[64].melting_point=1313 - e[65].melting_point=1356 - e[66].melting_point=1356 - e[67].melting_point=1474 - e[68].melting_point=1529 - e[69].melting_point=1545 - e[70].melting_point=819 - e[71].melting_point=1663 - e[72].melting_point=2227.0 - e[73].melting_point=2996 - e[74].melting_point=3410. - e[75].melting_point=3180. - e[76].melting_point=3045. - e[77].melting_point=2410. - e[78].melting_point=1772. - e[79].melting_point=1064.43 - e[80].melting_point=-38.87 - e[81].melting_point=303.5 - e[82].melting_point=327.502 - e[83].melting_point=271.3 - e[84].melting_point=254. - e[85].melting_point=302. - e[86].melting_point=-71. - e[87].melting_point=27. - e[88].melting_point=700. - e[89].melting_point=1050. - e[90].melting_point=1750. - e[91].melting_point=1554.000000 - e[92].melting_point=1132.3 - e[93].melting_point=640. - e[94].melting_point=641. - e[95].melting_point=994. - e[96].melting_point=1340. - e[97].melting_point=986. - e[98].melting_point=900.0000 - - # bpt.m creates e[deg C].boiling_point - e[1].boiling_point=-252.87 - e[2].boiling_point=-268.934 - e[3].boiling_point=1347 - e[4].boiling_point=2870.0 - e[5].boiling_point=2550 - e[6].boiling_point=4827.0 - e[7].boiling_point=-195.8 - e[8].boiling_point=-183.962 - e[9].boiling_point=-188.14 - e[10].boiling_point=-246.048 - e[11].boiling_point=882.9 - e[12].boiling_point=1090 - e[13].boiling_point=2467 - e[14].boiling_point=2355 - e[15].boiling_point=280 - e[16].boiling_point=444.674 - e[17].boiling_point=-34.6 - e[18].boiling_point=-185.7 - e[19].boiling_point=774 - e[20].boiling_point=1484 - e[21].boiling_point=2831 - e[22].boiling_point=3287 - e[23].boiling_point=3380 - e[24].boiling_point=2672 - e[25].boiling_point=1962 - e[26].boiling_point=2750 - e[27].boiling_point=2870 - e[28].boiling_point=2732 - e[29].boiling_point=2567 - e[30].boiling_point=907 - e[31].boiling_point=2403 - e[32].boiling_point=2830 - e[33].boiling_point=613.0 - e[34].boiling_point=684.9 - e[35].boiling_point=58.78 - e[36].boiling_point=-152.30 - e[37].boiling_point=688 - e[38].boiling_point=1384 - e[39].boiling_point=3338 - e[40].boiling_point=4377 - e[41].boiling_point=4742 - e[42].boiling_point=4612 - e[43].boiling_point=4877 - e[44].boiling_point=3900 - e[45].boiling_point=3727 - e[46].boiling_point=3140 - e[47].boiling_point=2212 - e[48].boiling_point=765 - e[49].boiling_point=2080 - e[50].boiling_point=2270 - e[51].boiling_point=1750 - e[52].boiling_point=989.8 - e[53].boiling_point=184.35 - e[54].boiling_point=-107.100000 - e[55].boiling_point=678.4 - e[56].boiling_point=1640 - e[57].boiling_point=3457 - e[58].boiling_point=3426 - e[59].boiling_point=3512 - e[60].boiling_point=3068 - e[61].boiling_point=2700 - e[62].boiling_point=1791 - e[63].boiling_point=1597 - e[64].boiling_point=3266 - e[65].boiling_point=3123 - e[66].boiling_point=2562 - e[67].boiling_point=2695 - e[68].boiling_point=2863 - e[69].boiling_point=1947 - e[70].boiling_point=1194 - e[71].boiling_point=3395 - e[72].boiling_point=4602 - e[73].boiling_point=5425 - e[74].boiling_point=5660 - e[75].boiling_point=5627 - e[76].boiling_point=5027 - e[77].boiling_point=4130 - e[78].boiling_point=3827 - e[79].boiling_point=2807 - e[80].boiling_point=356.58 - e[81].boiling_point=1457 - e[82].boiling_point=1740 - e[83].boiling_point=560 - e[84].boiling_point=962 - e[85].boiling_point=337 - e[86].boiling_point=-61.8 - e[87].boiling_point=677 - e[88].boiling_point=1140 - e[86].boiling_point=3200 - e[90].boiling_point=4790 - e[92].boiling_point=3818 - e[93].boiling_point=3902 - e[94].boiling_point=3232 - e[95].boiling_point=2607 - - for i in range(1,nelements+1): - e[i].create_var_dict() - #end for - - #for i in range(len(e)): - # e[i].create_string_representation() - ##end for - - - isotope_masses = obj( - H = {1:1.00782503207, 2:2.0141017778, 3:3.0160492777}, - He = {3:3.0160293191, 4:4.00260325415}, - Li = {6:6.015122795, 7:7.01600455}, - Be = {9:9.0121822}, - B = {10:10.0129370, 11:11.0093054}, - C = {12:12.0000000, 13:13.0033548378, 14:14.003241989}, - N = {14:14.0030740048, 15:15.0001088982}, - O = {16:15.99491461956, 17:16.99913170, 18:17.9991610}, - F = {19:18.99840322}, - Ne = {20:19.9924401754, 21:20.99384668, 22:21.991385114}, - Na = {23:22.9897692809}, - Mg = {24:23.985041700, 25:24.98583692, 26:25.982592929}, - Al = {27:26.98153863}, - Si = {28:27.9769265325, 29:28.976494700, 30:29.97377017}, - P = {31:30.97376163}, - S = {32:31.97207100, 33:32.97145876, 34:33.96786690, 36:35.96708076}, - Cl = {35:34.96885268, 37:36.96590259}, - Ar = {36:35.967545106, 38:37.9627324, 40:39.9623831225}, - K = {39:38.96370668, 40:39.96399848, 41:40.96182576}, - Ca = {40:39.96259098, 42:41.95861801, 43:42.9587666, 44:43.9554818, 46:45.9536926, 48:47.952534}, - Sc = {45:44.9559119}, - Ti = {46:45.9526316, 47:46.9517631, 48:47.9479463, 49:48.9478700, 50:49.9447912}, - V = {50:49.9471585, 51:50.9439595}, - Cr = {50:49.9460442, 52:51.9405075, 53:52.9406494, 54:53.9388804}, - Mn = {55:54.9380451}, - Fe = {54:53.9396105, 56:55.9349375, 57:56.9353940, 58:57.9332756}, - Co = {59:58.9331950}, - Ni = {58:57.9353429, 60:59.9307864, 61:60.9310560, 62:61.9283451, 64:63.9279660}, - Cu = {63:62.9295975, 65:64.9277895}, - Zn = {64:63.9291422, 66:65.9260334, 67:66.9271273, 68:67.9248442, 70:69.9253193}, - Ga = {69:68.9255736, 71:70.9247013}, - Ge = {70:69.9242474, 72:71.9220758, 73:72.9234589, 74:73.9211778, 76:75.9214026}, - As = {75:74.9215965}, - Se = {74:73.9224764, 76:75.9192136, 77:76.9199140, 78:77.9173091, 80:79.9165213, 82:81.9166994}, - Br = {79:78.9183371, 81:80.9162906}, - Kr = {78:77.9203648, 80:79.9163790, 82:81.9134836, 83:82.914136, 84:83.911507, 86:85.91061073}, - Rb = {85:84.911789738, 87:86.909180527}, - Sr = {84:83.913425, 86:85.9092602, 87:86.9088771, 88:87.9056121}, - Y = {89:88.9058483}, - Zr = {90:89.9047044, 91:90.9056458, 92:91.9050408, 94:93.9063152, 96:95.9082734}, - Nb = {93:92.9063781}, - Mo = {92:91.906811, 94:93.9050883, 95:94.9058421, 96:95.9046795, 97:96.9060215, 98:97.9054082, 100:99.907477}, - Tc = {97:96.906365, 98:97.907216, 99:98.9062547}, - Ru = {96:95.907598, 98:97.905287, 99:98.9059393, 100:99.9042195, 101:100.9055821, 102:101.9043493, 104:103.905433}, - Rh = {103:102.905504}, - Pd = {102:101.905609, 104:103.904036, 105:104.905085, 106:105.903486, 108:107.903892, 110:109.905153}, - Ag = {107:106.905097, 109:108.904752}, - Cd = {106:105.906459, 108:107.904184, 110:109.9030021, 111:110.9041781, 112:111.9027578, 113:112.9044017, 114:113.9033585, 116:115.904756}, - In = {113:112.904058, 115:114.903878}, - Sn = {112:111.904818, 114:113.902779, 115:114.903342, 116:115.901741, 117:116.902952, 118:117.901603, 119:118.903308, 120:119.9021947, 122:121.9034390, 124:123.9052739}, - Sb = {121:120.9038157, 123:122.9042140}, - Te = {120:119.904020, 122:121.9030439, 123:122.9042700, 124:123.9028179, 125:124.9044307, 126:125.9033117, 128:127.9044631, 130:129.9062244}, - I = {127:126.904473}, - Xe = {124:123.9058930, 126:125.904274, 128:127.9035313, 129:128.9047794, 130:129.9035080, 131:130.9050824, 132:131.9041535, 134:133.9053945, 136:135.907219}, - Cs = {133:132.905451933}, - Ba = {130:129.9063208, 132:131.9050613, 134:133.9045084, 135:134.9056886, 136:135.9045759, 137:136.9058274, 138:137.9052472}, - La = {138:137.907112, 139:138.9063533}, - Ce = {136:135.907172, 138:137.905991, 140:139.9054387, 142:141.909244}, - Pr = {141:140.9076528}, - Nd = {142:141.9077233, 143:142.9098143, 144:143.9100873, 145:144.9125736, 146:145.9131169, 148:147.916893, 150:149.920891}, - Pm = {145:144.912749, 147:146.9151385}, - Sm = {144:143.911999, 147:146.9148979, 148:147.9148227, 149:148.9171847, 150:149.9172755, 152:151.9197324, 154:153.9222093}, - Eu = {151:150.9198502, 153:152.9212303}, - Gd = {152:151.9197910, 154:153.9208656, 155:154.9226220, 156:155.9221227, 157:156.9239601, 158:157.9241039, 160:159.9270541}, - Tb = {159:158.9253468}, - Dy = {156:155.924283, 158:157.924409, 160:159.9251975, 161:160.9269334, 162:161.9267984, 163:162.9287312, 164:163.9291748}, - Ho = {165:164.9303221}, - Er = {162:161.928778, 164:163.929200, 166:165.9302931, 167:166.9320482, 168:167.9323702, 170:169.9354643}, - Tm = {169:168.9342133}, - Yb = {168:167.933897, 170:169.9347618, 171:170.9363258, 172:171.9363815, 173:172.9382108, 174:173.9388621, 176:175.9425717}, - Lu = {175:174.9407718, 176:175.9426863}, - Hf = {174:173.940046, 176:175.9414086, 177:176.9432207, 178:177.9436988, 179:178.9458161, 180:179.9465500}, - Ta = {180:179.9474648, 181:180.9479958}, - W = {180:179.946704, 182:181.9482042, 183:182.9502230, 184:183.9509312, 186:185.9543641}, - Re = {185:184.9529550, 187:186.9557531}, - Os = {184:183.9524891, 186:185.9538382, 187:186.9557505, 188:187.9558382, 189:188.9581475, 190:189.9584470, 192:191.9614807}, - Ir = {191:190.9605940, 193:192.9629264}, - Pt = {190:189.959932, 192:191.9610380, 194:193.9626803, 195:194.9647911, 196:195.9649515, 198:197.967893}, - Au = {197:196.9665687}, - Hg = {196:195.965833, 198:197.9667690, 199:198.9682799, 200:199.9683260, 201:200.9703023, 202:201.9706430, 204:203.9734939}, - Tl = {203:202.9723442, 205:204.9744275}, - Pb = {204:203.9730436, 206:205.9744653, 207:206.9758969, 208:207.9766521}, - Bi = {209:208.9803987}, - Po = {209:208.9824304, 210:209.9828737}, - At = {210:209.987148, 211:210.9874963}, - Rn = {211:210.990601, 220:220.0113940, 222:222.0175777}, - Fr = {223:223.0197359}, - Ra = {223:223.0185022, 224:224.0202118, 226:226.0254098, 228:228.0310703}, - Ac = {227:227.0277521}, - Th = {230:230.0331338, 232:232.0380553}, - Pa = {231:231.0358840}, - U = {233:233.0396352, 234:234.0409521, 235:235.0439299, 236:236.0455680, 238:238.0507882}, - Np = {236:236.046570, 237:237.0481734}, - Pu = {238:238.0495599, 239:239.0521634, 240:240.0538135, 241:241.0568515, 242:242.0587426, 244:244.064204}, - Am = {241:241.0568291, 243:243.0613811}, - Cm = {243:243.0613891, 244:244.0627526, 245:245.0654912, 246:246.0672237, 247:247.070354, 248:248.072349}, - Bk = {247:247.070307, 249:249.0749867}, - Cf = {249:249.0748535, 250:250.0764061, 251:251.079587, 252:252.081626}, - Es = {252:252.082980}, - Fm = {257:257.095105}, - Md = {258:258.098431, 260:260.10365}, - No = {259:259.10103}, - Lr = {262:262.10963}, - Rf = {265:265.11670}, - Db = {268:268.12545}, - Sg = {271:271.13347}, - Bh = {272:272.13803}, - Hs = {270:270.13465}, - Mt = {276:276.15116}, - Ds = {281:281.16206}, - Rg = {280:280.16447}, - Cn = {285:285.17411} - ) - - - self.nelements = nelements - self.simple_elements = e - - self.elements = obj() - for i in range(1,self.nelements+1): - elem = self.simple_elements[i] - element = Element(elem) - self.elements[elem.symbol] = element - self[elem.symbol] = element - #end for - - isotopes = obj() - for symbol,element in self.elements.items(): - elem_isotopes = obj() - for mass_number,mass in isotope_masses[symbol].items(): - isotope = element.copy() - isotope.atomic_weight = phys_value_dict(mass,'amu') - elem_isotopes[mass_number] = isotope - #end for - isotopes[symbol] = elem_isotopes - #end for - self.isotopes = isotopes - - #end def __init__ - - def show(self): - for i in range(self.nelements): - print() - print(self.elements[i].string_rep) - #end for - #end def show -#end class PeriodicTable - - -pt = PeriodicTable() -periodic_table = pt -ptable = pt - - - - -def is_element(name,symbol=False): - s = name - iselem = False - if isinstance(name,str): - iselem = name in periodic_table.elements - if not iselem: - nlen = len(name) - if name.find('_')!=-1: - s,n = name.split('_',1) - elif nlen>1 and name[1:].isdigit(): - s = name[0:1] - elif nlen>2 and name[2:].isdigit(): - s = name[0:2] - #end if - if len(s)==1: - s = s.upper() - elif len(s)==2: - s = s[0].upper()+s[1].lower() - #end if - iselem = s in periodic_table.elements - #end if - #end if - if symbol: - return iselem,s - else: - return iselem - #end if -#end def is_element - - - - - - - - - - diff --git a/nexus/nexus/physical_system.py b/nexus/nexus/physical_system.py index 79a55bcd36..5c8d57e713 100644 --- a/nexus/nexus/physical_system.py +++ b/nexus/nexus/physical_system.py @@ -37,7 +37,7 @@ import numpy as np from .developer import DevBase, obj from .unit_converter import convert -from .periodic_table import is_element, ptable +from .periodic_table import Elements from .structure import Structure, generate_structure, read_structure @@ -60,7 +60,12 @@ def new_particles(cls,*particles,**named_particles): #end def new_particles def is_element(self,name,symbol=False): - return is_element(name,symbol=symbol) + if symbol is True: + is_elem, element = Elements.is_element(name, return_element=symbol) + return is_elem, element.symbol + else: + is_elem = Elements.is_element(name) + return is_elem #end def is_element #end class Matter @@ -221,31 +226,45 @@ def electron_counts(self): #end def electron_counts #end class Particles -me_amu = convert(1.,'me','amu') +amu_me = convert(1.,'amu','me') plist = [ Particle('up_electron' ,1.0,-1, 1), Particle('down_electron',1.0,-1,-1), ] -for name,a in ptable.elements.items(): +for elem in Elements: spin = 0 # don't have this data - protons = a.atomic_number - neutrons = int(round(a.atomic_weight['amu']-a.atomic_number)) - p = Ion(a.symbol,a.atomic_weight['me'],a.atomic_number,spin,protons,neutrons) + protons = elem.atomic_number + neutrons = int(round(elem.atomic_weight-elem.atomic_number)) + p = Ion( + elem.symbol, + elem.atomic_weight * amu_me, + elem.atomic_number, + spin, + protons, + neutrons, + ) plist.append(p) #end for -for name,iso in ptable.isotopes.items(): - for mass_number,a in iso.items(): +for elem in Elements: + for mass_number, rel_atomic_mass in elem.isotopes.items(): spin = 0 # don't have this data - protons = a.atomic_number - neutrons = int(round(a.atomic_weight['amu']-a.atomic_number)) - p = Ion(a.symbol+'_'+str(mass_number),a.atomic_weight['me'],a.atomic_number,spin,protons,neutrons) + protons = elem.atomic_number + neutrons = int(round(rel_atomic_mass - elem.atomic_number)) + p = Ion( + f"{elem.symbol}_{mass_number}", + rel_atomic_mass * amu_me, + elem.atomic_number, + spin, + protons, + neutrons, + ) plist.append(p) #end for #end for -Matter.set_elements(ptable.elements.keys()) +Matter.set_elements([e.symbol for e in Elements]) Matter.set_particle_collection(Particles(plist)) del plist @@ -256,7 +275,6 @@ class PhysicalSystem(Matter): def __init__(self,structure=None,net_charge=0,net_spin=0,particles=None,**valency): self.pseudized = False - if structure is None: self.structure = Structure() else: @@ -704,7 +722,7 @@ def generate_physical_system(**kwargs): remove = [] for var in kwargs: #if var in Matter.elements: - if is_element(var): + if Elements.is_element(var): valency[var] = kwargs[var] remove.append(var) #end if diff --git a/nexus/nexus/pseudopotential.py b/nexus/nexus/pseudopotential.py index 1c4a94acc2..c74ce3677a 100644 --- a/nexus/nexus/pseudopotential.py +++ b/nexus/nexus/pseudopotential.py @@ -41,7 +41,7 @@ from .execute import execute from .fileio import TextFile from .xmlreader import readxml -from .periodic_table import pt, is_element +from .periodic_table import Elements from .unit_converter import convert from .developer import DevBase, obj, unavailable, error from .basisset import process_gaussian_text, GaussianBasisSet @@ -64,14 +64,14 @@ def pp_elem_label(filename,guard=False): el+=c #end for elem_label = el - is_elem,symbol = is_element(el,symbol=True) + is_elem, element = Elements.is_element(el, return_element=True) if guard: if not is_elem: error('cannot determine element for pseudopotential file: {0}\npseudopotential file names must be prefixed by an atomic symbol or label\n(e.g. Si, Si1, etc)'.format(filename)) #end if - return elem_label,symbol + return elem_label, element.symbol else: - return elem_label,symbol,is_elem + return elem_label, element.symbol, is_elem #end if #end def pp_elem_label @@ -1621,7 +1621,7 @@ def read_text(self,text,format=None,filepath=None): else: atomic_number = int(conv_atomic_number[-2:]) #end if - element = pt.simple_elements[atomic_number].symbol + element = Elements(atomic_number).symbol if 'input' not in lines[i].lower(): self.error('INPUT must be present for crystal pseudpotential read') #end if @@ -1679,7 +1679,7 @@ def read_text(self,text,format=None,filepath=None): Zval = int(Zval) lmax = int(lmax)-1 element = self.element - Zcore = int(pt[element].atomic_number)-Zval + Zcore = int(Elements(element).atomic_number)-Zval ns = [int(n) for n in lines[i].split()]; i+=1 while ilen(pt.simple_elements): + if Zatom > (len(Elements) - 1): # Subtract the dummy element self.error('element {0} is not in the periodic table') #end if - element = pt.simple_elements[Zatom].symbol + element = Elements(Zatom).symbol units = file.readtokensf('Energy units',str) if units not in self.unitmap: self.error('units {0} unrecognized from casino PP file {1}'.format(units,filepath)) @@ -2657,7 +2657,7 @@ def read(self,filepath,format=None): if self.Zcore==0: self.core = '0' else: - self.core = pt.simple_elements[self.Zcore].symbol + self.core = Elements(self.Zcore).symbol #end if self.lmax = lmax self.local = lloc diff --git a/nexus/nexus/pwscf_analyzer.py b/nexus/nexus/pwscf_analyzer.py index 86da67d672..14cf8089a5 100644 --- a/nexus/nexus/pwscf_analyzer.py +++ b/nexus/nexus/pwscf_analyzer.py @@ -21,7 +21,7 @@ import numpy as np from .developer import obj, unavailable from .unit_converter import convert -from .periodic_table import PeriodicTable +from .periodic_table import Elements from .numerics import simstats, simplestats from .simulation import SimulationAnalyzer, Simulation from .structure import Structure, get_kpath @@ -30,8 +30,8 @@ from .fileio import TextFile from . import numpy_extensions as npe -pt = PeriodicTable() -elements = set(pt.elements.keys()) + +elements = set([e.symbol for e in Elements]) def is_number(s): diff --git a/nexus/nexus/pwscf_input.py b/nexus/nexus/pwscf_input.py index c5979a0979..8b3ce94090 100644 --- a/nexus/nexus/pwscf_input.py +++ b/nexus/nexus/pwscf_input.py @@ -51,7 +51,7 @@ from numpy import pi from numpy.linalg import inv from .unit_converter import convert -from .periodic_table import is_element +from .periodic_table import Elements from .structure import Structure, kmesh from .physical_system import PhysicalSystem from .developer import DevBase, obj, log, warn, error @@ -2210,9 +2210,9 @@ def generate_any_pwscf_input(**kwargs): pp = pw.atomic_species.pseudopotentials for atom in pw.atomic_species.atoms: if atom not in pp: - iselem,symbol = is_element(atom,symbol=True) - if iselem and symbol in pp: - pp[atom] = str(pp[symbol]) + iselem, element = Elements.is_element(atom, return_element=True) + if iselem and element.symbol in pp: + pp[atom] = str(pp[element.symbol]) #end if #end if #end for diff --git a/nexus/nexus/qmcpack_input.py b/nexus/nexus/qmcpack_input.py index 1cac450bd3..6b20ebf3df 100644 --- a/nexus/nexus/qmcpack_input.py +++ b/nexus/nexus/qmcpack_input.py @@ -140,7 +140,7 @@ from .numpy_extensions import reshape_inplace from .xmlreader import XMLreader, XMLelement from .developer import DevBase, obj, hidden, error -from .periodic_table import is_element +from .periodic_table import Elements from .structure import Structure, Jellium, get_kpath from .physical_system import PhysicalSystem from .simulation import SimulationInput, SimulationInputTemplate @@ -6328,11 +6328,11 @@ def generate_hamiltonian(name = 'h0', pseudos = collection() for ion in ions: label = ion.name - iselem,symbol = is_element(ion.name,symbol=True) + iselem, element = Elements.is_element(ion.name, return_element=True) if label in ppfiles: ppfile = ppfiles[label] - elif symbol in ppfiles: - ppfile = ppfiles[symbol] + elif element.symbol in ppfiles: + ppfile = ppfiles[element.symbol] else: QmcpackInput.class_error('pseudos provided to generate_hamiltonian are incomplete\n a pseudopotential for ion of type {0} is missing\n pseudos provided:\n{1}'.format(ion.name,str(ppfiles))) #end if diff --git a/nexus/nexus/structure.py b/nexus/nexus/structure.py index 930d3174fa..c12ada39a6 100644 --- a/nexus/nexus/structure.py +++ b/nexus/nexus/structure.py @@ -132,8 +132,7 @@ from numpy.linalg import inv, det, norm from .unit_converter import convert from .numerics import nearest_neighbors, convex_hull, voronoi_neighbors -from .periodic_table import is_element -from .periodic_table import pt as ptable +from .periodic_table import Elements from .fileio import XsfFile, PoscarFile from .developer import DevBase, obj, unavailable, error from . import numpy_extensions as npe @@ -2394,8 +2393,8 @@ def species(self,symbol=False): species_labels = set(self.elem) species = set() for e in species_labels: - is_elem,symbol = is_element(e,symbol=True) - species.add(symbol) + is_elem, element = Elements.is_element(e, return_element=True) + species.add(element.symbol) #end for return species_labels,species #end if @@ -2418,7 +2417,8 @@ def ordered_species(self,symbol=False): species = [] spec_set = set() for e in self.elem: - is_elem,symbol = is_element(e,symbol=True) + is_elem, element = Elements.is_element(e, return_element=True) + symbol = element.symbol if e not in speclab_set: speclab_set.add(e) species_labels.append(e) @@ -5008,7 +5008,7 @@ def read_xsf(self,filepath): if isinstance(n,str): elem.append(n) else: - elem.append(ptable.simple_elements[n].symbol) + elem.append(Elements(n).symbol) #end if #end for self.dim = 3 @@ -5318,22 +5318,14 @@ def write_xsf(self,filepath=None): c += ' {0} 1\n'.format(len(s.elem)) for i in range(len(s.elem)): e = s.elem[i] - identified = e in ptable.elements - if not identified: - if len(e)>2: - e = e[0:2] - elif len(e)==2: - e = e[0:1] - #end if - identified = e in ptable.elements - #end if + identified, element = Elements.is_element(e, return_element=True) if not identified: self.error( "{0} is not an element\n" "xsf file cannot be written".format(e) ) #end if - enum = ptable.elements[e].atomic_number + enum = element.atomic_number r = s.pos[i] c += ' {0:>3} {1:12.8f} {2:12.8f} {3:12.8f}\n'.format(enum,r[0],r[1],r[2]) #end for @@ -5503,11 +5495,11 @@ def get_number_of_atoms(self): def get_atomic_numbers(self): an = [] for e in self.elem: - iselem,esymb = is_element(e,symbol=True) + iselem, element = Elements.is_element(e, return_element=True) if not iselem: - self.error('Atomic symbol, {}, not recognized'.format(esymb)) + self.error('Atomic symbol, {}, not recognized'.format(element)) else: - an.append(ptable[esymb].atomic_number) + an.append(element.atomic_number) #end if #end for return np.array(an,dtype='intc') @@ -5674,11 +5666,11 @@ def equivalent_atoms(self): # collect sets of species labels species_by_specnum = obj() for e,sn in zip(self.elem,ds.equivalent_atoms): - is_elem,es = is_element(e,symbol=True) + is_elem,element = Elements.is_element(e, return_element=True) if sn not in species_by_specnum: species_by_specnum[sn] = set() #end if - species_by_specnum[sn].add(es) + species_by_specnum[sn].add(element.symbol) #end for for sn,sset in species_by_specnum.items(): if len(sset)>1: @@ -5965,10 +5957,7 @@ def get_conventional_cell( bcharge = structure.background_charge*volfac pos = dot(posd,axes) sout = structure.copy() - elem = np.empty(len(enumbers), dtype='str') - for el in ptable.elements.items(): - elem[enumbers==el[1].atomic_number]=el[0] - #end for + elem = np.array([Elements(i).symbol for i in enumbers], dtype=str) if abs(bcharge-int(bcharge)) > 1E-6: raise ValueError("Invalid background charge for conventional structure") #end if @@ -5991,10 +5980,7 @@ def get_primitive_cell( bcharge = structure.background_charge*volfac pos = dot(posd,axes) sout = structure.copy() - elem = np.array(enumbers, dtype='str') - for el in ptable.elements.items(): - elem[enumbers==el[1].atomic_number]=el[0] - #end for + elem = np.array([Elements(i).symbol for i in enumbers], dtype=str) return {'structure' : Structure(axes=axes, elem=elem, pos=pos, background_charge=bcharge, units='A'), 'T' : seekpathout['primitive_transformation_matrix']} #end def get_primitive_cell diff --git a/nexus/nexus/tests/reference/user_examples/qmcpack/rsqmc_misc/H2O/runs/dmc.in.xml b/nexus/nexus/tests/reference/user_examples/qmcpack/rsqmc_misc/H2O/runs/dmc.in.xml index 87d030f48a..41ad584e75 100644 --- a/nexus/nexus/tests/reference/user_examples/qmcpack/rsqmc_misc/H2O/runs/dmc.in.xml +++ b/nexus/nexus/tests/reference/user_examples/qmcpack/rsqmc_misc/H2O/runs/dmc.in.xml @@ -35,11 +35,11 @@ 4.05580089 4.05580089 3.00901473 - + 1 1 1 - 1837.36221934 + 1837.47159264 4.05580089 1.35193363 5.10258705 4.05580089 6.75966815 5.10258705 diff --git a/nexus/nexus/tests/reference/user_examples/qmcpack/rsqmc_misc/H2O/runs/opt.in.xml b/nexus/nexus/tests/reference/user_examples/qmcpack/rsqmc_misc/H2O/runs/opt.in.xml index 7452d0529b..31f59bfcf0 100644 --- a/nexus/nexus/tests/reference/user_examples/qmcpack/rsqmc_misc/H2O/runs/opt.in.xml +++ b/nexus/nexus/tests/reference/user_examples/qmcpack/rsqmc_misc/H2O/runs/opt.in.xml @@ -35,11 +35,11 @@ 4.05580089 4.05580089 3.00901473 - + 1 1 1 - 1837.36221934 + 1837.47159264 4.05580089 1.35193363 5.10258705 4.05580089 6.75966815 5.10258705 diff --git a/nexus/nexus/tests/reference/user_examples/qmcpack/rsqmc_misc/H2O/runs/scf.in b/nexus/nexus/tests/reference/user_examples/qmcpack/rsqmc_misc/H2O/runs/scf.in index f69e53bf03..81315687b8 100644 --- a/nexus/nexus/tests/reference/user_examples/qmcpack/rsqmc_misc/H2O/runs/scf.in +++ b/nexus/nexus/tests/reference/user_examples/qmcpack/rsqmc_misc/H2O/runs/scf.in @@ -35,7 +35,7 @@ ATOMIC_SPECIES - H 1.00794 H.BFD.upf + H 1.008 H.BFD.upf O 15.999 O.BFD.upf ATOMIC_POSITIONS bohr diff --git a/nexus/nexus/tests/reference/user_examples/qmcpack/rsqmc_misc/LiH/runs/dmc.in.xml b/nexus/nexus/tests/reference/user_examples/qmcpack/rsqmc_misc/LiH/runs/dmc.in.xml index 3c8d0ccbbf..bc4dc652a9 100644 --- a/nexus/nexus/tests/reference/user_examples/qmcpack/rsqmc_misc/LiH/runs/dmc.in.xml +++ b/nexus/nexus/tests/reference/user_examples/qmcpack/rsqmc_misc/LiH/runs/dmc.in.xml @@ -27,20 +27,20 @@ - + 1 1 3 - 12652.6689728 + 12650.8460843 0.00000000 0.00000000 0.00000000 - + 1 1 1 - 1837.36221934 + 1837.47159264 3.55000000 3.55000000 3.55000000 diff --git a/nexus/nexus/tests/reference/user_examples/qmcpack/rsqmc_misc/LiH/runs/nscf.in b/nexus/nexus/tests/reference/user_examples/qmcpack/rsqmc_misc/LiH/runs/nscf.in index 20a14cafd7..1d66ce1faa 100644 --- a/nexus/nexus/tests/reference/user_examples/qmcpack/rsqmc_misc/LiH/runs/nscf.in +++ b/nexus/nexus/tests/reference/user_examples/qmcpack/rsqmc_misc/LiH/runs/nscf.in @@ -35,8 +35,8 @@ ATOMIC_SPECIES - H 1.00794 H.TN-DF.upf - Li 6.941 Li.TN-DF.upf + H 1.008 H.TN-DF.upf + Li 6.94 Li.TN-DF.upf ATOMIC_POSITIONS bohr Li 0.00000000 0.00000000 0.00000000 diff --git a/nexus/nexus/tests/reference/user_examples/qmcpack/rsqmc_misc/LiH/runs/opt.in.xml b/nexus/nexus/tests/reference/user_examples/qmcpack/rsqmc_misc/LiH/runs/opt.in.xml index 696c01d710..2dd259bb4b 100644 --- a/nexus/nexus/tests/reference/user_examples/qmcpack/rsqmc_misc/LiH/runs/opt.in.xml +++ b/nexus/nexus/tests/reference/user_examples/qmcpack/rsqmc_misc/LiH/runs/opt.in.xml @@ -27,20 +27,20 @@ - + 1 1 3 - 12652.6689728 + 12650.8460843 0.00000000 0.00000000 0.00000000 - + 1 1 1 - 1837.36221934 + 1837.47159264 3.55000000 3.55000000 3.55000000 diff --git a/nexus/nexus/tests/reference/user_examples/qmcpack/rsqmc_misc/LiH/runs/scf.in b/nexus/nexus/tests/reference/user_examples/qmcpack/rsqmc_misc/LiH/runs/scf.in index 562ea39546..f31bad3eb9 100644 --- a/nexus/nexus/tests/reference/user_examples/qmcpack/rsqmc_misc/LiH/runs/scf.in +++ b/nexus/nexus/tests/reference/user_examples/qmcpack/rsqmc_misc/LiH/runs/scf.in @@ -35,8 +35,8 @@ ATOMIC_SPECIES - H 1.00794 H.TN-DF.upf - Li 6.941 Li.TN-DF.upf + H 1.008 H.TN-DF.upf + Li 6.94 Li.TN-DF.upf ATOMIC_POSITIONS bohr Li 0.00000000 0.00000000 0.00000000 diff --git a/nexus/nexus/tests/reference/user_examples/quantum_espresso/relax_Ge_T_vs_kpoints/runs/relax/kgrid_111/relax.in b/nexus/nexus/tests/reference/user_examples/quantum_espresso/relax_Ge_T_vs_kpoints/runs/relax/kgrid_111/relax.in index f6673f4805..6913520903 100644 --- a/nexus/nexus/tests/reference/user_examples/quantum_espresso/relax_Ge_T_vs_kpoints/runs/relax/kgrid_111/relax.in +++ b/nexus/nexus/tests/reference/user_examples/quantum_espresso/relax_Ge_T_vs_kpoints/runs/relax/kgrid_111/relax.in @@ -41,7 +41,7 @@ ATOMIC_SPECIES - Ge 72.61 Ge.pbe-kjpaw.UPF + Ge 72.63 Ge.pbe-kjpaw.UPF ATOMIC_POSITIONS bohr Ge 5.34792496 5.34792496 5.34792496 diff --git a/nexus/nexus/tests/reference/user_examples/quantum_espresso/relax_Ge_T_vs_kpoints/runs/relax/kgrid_222/relax.in b/nexus/nexus/tests/reference/user_examples/quantum_espresso/relax_Ge_T_vs_kpoints/runs/relax/kgrid_222/relax.in index 3be3e4ab30..e4542af830 100644 --- a/nexus/nexus/tests/reference/user_examples/quantum_espresso/relax_Ge_T_vs_kpoints/runs/relax/kgrid_222/relax.in +++ b/nexus/nexus/tests/reference/user_examples/quantum_espresso/relax_Ge_T_vs_kpoints/runs/relax/kgrid_222/relax.in @@ -41,7 +41,7 @@ ATOMIC_SPECIES - Ge 72.61 Ge.pbe-kjpaw.UPF + Ge 72.63 Ge.pbe-kjpaw.UPF ATOMIC_POSITIONS bohr Ge 5.34792496 5.34792496 5.34792496 diff --git a/nexus/nexus/tests/reference/user_examples/quantum_espresso/relax_Ge_T_vs_kpoints/runs/relax/kgrid_444/relax.in b/nexus/nexus/tests/reference/user_examples/quantum_espresso/relax_Ge_T_vs_kpoints/runs/relax/kgrid_444/relax.in index 76eb629eb7..9a98a28b0c 100644 --- a/nexus/nexus/tests/reference/user_examples/quantum_espresso/relax_Ge_T_vs_kpoints/runs/relax/kgrid_444/relax.in +++ b/nexus/nexus/tests/reference/user_examples/quantum_espresso/relax_Ge_T_vs_kpoints/runs/relax/kgrid_444/relax.in @@ -41,7 +41,7 @@ ATOMIC_SPECIES - Ge 72.61 Ge.pbe-kjpaw.UPF + Ge 72.63 Ge.pbe-kjpaw.UPF ATOMIC_POSITIONS bohr Ge 5.34792496 5.34792496 5.34792496 diff --git a/nexus/nexus/tests/reference/user_examples/quantum_espresso/relax_Ge_T_vs_kpoints/runs/relax/kgrid_666/relax.in b/nexus/nexus/tests/reference/user_examples/quantum_espresso/relax_Ge_T_vs_kpoints/runs/relax/kgrid_666/relax.in index 5f3044a074..0ae735f56e 100644 --- a/nexus/nexus/tests/reference/user_examples/quantum_espresso/relax_Ge_T_vs_kpoints/runs/relax/kgrid_666/relax.in +++ b/nexus/nexus/tests/reference/user_examples/quantum_espresso/relax_Ge_T_vs_kpoints/runs/relax/kgrid_666/relax.in @@ -41,7 +41,7 @@ ATOMIC_SPECIES - Ge 72.61 Ge.pbe-kjpaw.UPF + Ge 72.63 Ge.pbe-kjpaw.UPF ATOMIC_POSITIONS bohr Ge 5.34792496 5.34792496 5.34792496 diff --git a/nexus/nexus/tests/test_numerics.py b/nexus/nexus/tests/test_numerics.py index 9ff398dc87..9cbf04b710 100644 --- a/nexus/nexus/tests/test_numerics.py +++ b/nexus/nexus/tests/test_numerics.py @@ -438,7 +438,7 @@ def test_morse(): from ..numerics import morse_rDw_fit,morse_fit,morse_fit_fine rm = morse_reduced_mass('Ti','O') - assert(value_eq(rm,21862.2266134)) + assert(value_eq(rm, 21858.453534035318)) r_ref,D_ref,w_ref = 1.620,6.87,1009.18 r_ref_A = r_ref @@ -456,7 +456,7 @@ def test_morse(): assert(value_eq(float(w),w_ref)) assert(value_eq(float(Einf),0.0)) - width_ref = 1.0451690611 + width_ref = 1.0452592627174173 width = morse_width(p) assert(value_eq(float(width),width_ref)) @@ -469,7 +469,7 @@ def test_morse(): Ee = morse_Ee(p) assert(value_eq(float(Ee),-D_ref)) - k_ref = 0.462235185922 + k_ref = 0.46215541133767707 k = morse_k(p) assert(value_eq(float(k),k_ref)) diff --git a/nexus/nexus/tests/test_periodic_table.py b/nexus/nexus/tests/test_periodic_table.py index 5b2dca1b19..cae6576202 100644 --- a/nexus/nexus/tests/test_periodic_table.py +++ b/nexus/nexus/tests/test_periodic_table.py @@ -2,133 +2,282 @@ def test_import(): from .. import periodic_table - from ..periodic_table import pt,is_element + from ..periodic_table import Elements #end def test_import def test_periodic_table(): from ..testing import value_eq - from ..periodic_table import pt - - elements = set(''' - H He - Li Be B C N O F Ne - Na Mg Al Si P S Cl Ar - K Ca Sc Ti V Cr Mn Fe Co Ni Cu Zn Ga Ge As Se Br Kr - Rb Sr Y Zr Nb Mo Tc Ru Rh Pd Ag Cd In Sn Sb Te I Xe - Cs Ba La Ce Pr Nd Pm Sm Eu Gd Tb Dy Ho Er Tm Yb Lu Hf Ta W Re Os Ir Pt Au Hg Tl Pb Bi Po At Rn - Fr Ra Ac Th Pa U Np Pu Am Cm Bk Cf Es Fm Md No Lr - '''.split()) - - atomic_numbers = set(range(1,len(elements)+1)) - - missing = elements - set(pt.keys()) - assert(len(missing)==0) + from ..periodic_table import Elements + + ref_element_symbols = ( + "Xx", "H", "He", "Li", "Be", "B", "C", "N", "O", "F", + "Ne", "Na", "Mg", "Al", "Si", "P", "S", "Cl", "Ar", "K", + "Ca", "Sc", "Ti", "V", "Cr", "Mn", "Fe", "Co", "Ni", "Cu", + "Zn", "Ga", "Ge", "As", "Se", "Br", "Kr", "Rb", "Sr", "Y", + "Zr", "Nb", "Mo", "Tc", "Ru", "Rh", "Pd", "Ag", "Cd", "In", + "Sn", "Sb", "Te", "I", "Xe", "Cs", "Ba", "La", "Ce", "Pr", + "Nd", "Pm", "Sm", "Eu", "Gd", "Tb", "Dy", "Ho", "Er", "Tm", + "Yb", "Lu", "Hf", "Ta", "W", "Re", "Os", "Ir", "Pt", "Au", + "Hg", "Tl", "Pb", "Bi", "Po", "At", "Rn", "Fr", "Ra", "Ac", + "Th", "Pa", "U", "Np", "Pu", "Am", "Cm", "Bk", "Cf", "Es", + "Fm", "Md", "No", "Lr", "Rf", "Db", "Sg", "Bh", "Hs", "Mt", + "Ds", "Rg", "Cn", "Nh", "Fl", "Mc", "Lv", "Ts", "Og", + ) + + ref_atomic_numbers = tuple(range(0,len(ref_element_symbols))) + + element_symbols = [e.symbol for e in Elements] + atomic_numbers = [e.atomic_number for e in Elements] + + assert(len(element_symbols) == len(ref_element_symbols)) + assert(len(atomic_numbers) == len(ref_atomic_numbers)) + + for elem in element_symbols: + assert(elem in ref_element_symbols) + + for number in atomic_numbers: + assert(number in ref_atomic_numbers) - missing = elements - set(pt.elements.keys()) - assert(len(missing)==0) - - missing = atomic_numbers - set(pt.simple_elements.keys()) - assert(len(missing)==0) - - fields = ''' - atomic_weight - atomic_radius - nuclear_charge - electron_affinity - ionization_energy - ionic_radius - thermal_cond - melting_point - boiling_point - '''.split() - - for e in elements: - elem = pt.elements[e] - assert(id(elem)==id(pt[e])) - selem = pt.simple_elements[elem.atomic_number] - for f in fields: - assert(value_eq(selem[f],elem[f].orig)) - #end for - #end for + ref_carbon_name = "Carbon" + ref_carbon_symbol = "C" + ref_carbon_number = 6 + ref_carbon_weight = 12.011 + ref_carbon_group = 14 + ref_carbon_isotopes = {12:12.0000000, 13:13.00335483507, 14:14.0032419884} - C = pt.C - assert(C.atomic_number==6) - assert(C.symbol=='C') - assert(value_eq(C.atomic_radius.pm ,77.2)) - assert(value_eq(C.atomic_weight.amu ,12.011)) - assert(value_eq(C.boiling_point.degC ,4827.0)) - assert(value_eq(C.electron_affinity.kJ_mol,121.9)) - assert(value_eq(C.ionic_radius.pm,260.0)) - assert(value_eq(C.ionization_energy.eV,11.26)) - assert(value_eq(C.melting_point.degC,3550.0)) - assert(value_eq(C.nuclear_charge.e,3.25)) - assert(value_eq(C.thermal_cond.W_mK,1960.0)) + assert(Elements.Carbon.name == ref_carbon_name) + assert(Elements.Carbon.symbol == ref_carbon_symbol) + assert(str(Elements.Carbon) == ref_carbon_symbol) + assert(Elements.Carbon.atomic_number == ref_carbon_number) + assert(Elements.Carbon.atomic_weight == ref_carbon_weight) + assert(Elements.Carbon.group == ref_carbon_group) + assert(Elements.Carbon.isotopes == ref_carbon_isotopes) + assert(Elements.C.name == ref_carbon_name) + assert(Elements.C.symbol == ref_carbon_symbol) + assert(str(Elements.C) == ref_carbon_symbol) + assert(Elements.C.atomic_number == ref_carbon_number) + assert(Elements.C.atomic_weight == ref_carbon_weight) + assert(Elements.C.group == ref_carbon_group) + assert(Elements.C.isotopes == ref_carbon_isotopes) + + assert(Elements.Carbon is Elements.C) #end def test_periodic_table +def test_call_elements(): + from ..periodic_table import Elements + + # Good calls + assert(Elements("Hydrogen") is Elements.Hydrogen) + assert(Elements("H") is Elements.Hydrogen) + assert(Elements(1) is Elements.Hydrogen) + + # Calls that need to go through `_missing_` + # Improper case + assert(Elements("hydrogen") is Elements.Hydrogen) + assert(Elements("h") is Elements.Hydrogen) + # Trailing and leading whitespace + assert(Elements("Hydrogen ") is Elements.Hydrogen) + assert(Elements(" H") is Elements.Hydrogen) + # One step from good + assert(Elements("1") is Elements.Hydrogen) + assert(Elements(1.0) is Elements.Hydrogen) + + # Another spot check, same situations + assert(Elements("Ruthenium") is Elements.Ruthenium) + assert(Elements("Ru") is Elements.Ruthenium) + assert(Elements(44) is Elements.Ruthenium) + + assert(Elements("ruthenium") is Elements.Ruthenium) + assert(Elements("ru") is Elements.Ruthenium) + assert(Elements("Ruthenium ") is Elements.Ruthenium) + assert(Elements(" Ru") is Elements.Ruthenium) + assert(Elements("44") is Elements.Ruthenium) + assert(Elements(44.0) is Elements.Ruthenium) +#end def test_call_elements + def test_is_element(): - from ..periodic_table import is_element - - elements = ''' - H He - Li Be B C N O F Ne - Na Mg Al Si P S Cl Ar - K Ca Sc Ti V Cr Mn Fe Co Ni Cu Zn Ga Ge As Se Br Kr - Rb Sr Y Zr Nb Mo Tc Ru Rh Pd Ag Cd In Sn Sb Te I Xe - Cs Ba La Ce Pr Nd Pm Sm Eu Gd Tb Dy Ho Er Tm Yb Lu Hf Ta W Re Os Ir Pt Au Hg Tl Pb Bi Po At Rn - Fr Ra Ac Th Pa U Np Pu Am Cm Bk Cf Es Fm Md No Lr - '''.split() - - - for e in elements: - assert(is_element(e)) - is_elem,symbol = is_element(e,symbol=True) + from ..periodic_table import Elements + + ref_symbols = ( + "Xx", "H", "He", "Li", "Be", "B", "C", "N", "O", "F", + "Ne", "Na", "Mg", "Al", "Si", "P", "S", "Cl", "Ar", "K", + "Ca", "Sc", "Ti", "V", "Cr", "Mn", "Fe", "Co", "Ni", "Cu", + "Zn", "Ga", "Ge", "As", "Se", "Br", "Kr", "Rb", "Sr", "Y", + "Zr", "Nb", "Mo", "Tc", "Ru", "Rh", "Pd", "Ag", "Cd", "In", + "Sn", "Sb", "Te", "I", "Xe", "Cs", "Ba", "La", "Ce", "Pr", + "Nd", "Pm", "Sm", "Eu", "Gd", "Tb", "Dy", "Ho", "Er", "Tm", + "Yb", "Lu", "Hf", "Ta", "W", "Re", "Os", "Ir", "Pt", "Au", + "Hg", "Tl", "Pb", "Bi", "Po", "At", "Rn", "Fr", "Ra", "Ac", + "Th", "Pa", "U", "Np", "Pu", "Am", "Cm", "Bk", "Cf", "Es", + "Fm", "Md", "No", "Lr", "Rf", "Db", "Sg", "Bh", "Hs", "Mt", + "Ds", "Rg", "Cn", "Nh", "Fl", "Mc", "Lv", "Ts", "Og", + ) + + ref_elements = ( + Elements.Xx, + Elements.H, Elements.He, Elements.Li, Elements.Be, Elements.B, + Elements.C, Elements.N, Elements.O, Elements.F, Elements.Ne, + Elements.Na, Elements.Mg, Elements.Al, Elements.Si, Elements.P, + Elements.S, Elements.Cl, Elements.Ar, Elements.K, Elements.Ca, + Elements.Sc, Elements.Ti, Elements.V, Elements.Cr, Elements.Mn, + Elements.Fe, Elements.Co, Elements.Ni, Elements.Cu, Elements.Zn, + Elements.Ga, Elements.Ge, Elements.As, Elements.Se, Elements.Br, + Elements.Kr, Elements.Rb, Elements.Sr, Elements.Y, Elements.Zr, + Elements.Nb, Elements.Mo, Elements.Tc, Elements.Ru, Elements.Rh, + Elements.Pd, Elements.Ag, Elements.Cd, Elements.In, Elements.Sn, + Elements.Sb, Elements.Te, Elements.I, Elements.Xe, Elements.Cs, + Elements.Ba, Elements.La, Elements.Ce, Elements.Pr, Elements.Nd, + Elements.Pm, Elements.Sm, Elements.Eu, Elements.Gd, Elements.Tb, + Elements.Dy, Elements.Ho, Elements.Er, Elements.Tm, Elements.Yb, + Elements.Lu, Elements.Hf, Elements.Ta, Elements.W, Elements.Re, + Elements.Os, Elements.Ir, Elements.Pt, Elements.Au, Elements.Hg, + Elements.Tl, Elements.Pb, Elements.Bi, Elements.Po, Elements.At, + Elements.Rn, Elements.Fr, Elements.Ra, Elements.Ac, Elements.Th, + Elements.Pa, Elements.U, Elements.Np, Elements.Pu, Elements.Am, + Elements.Cm, Elements.Bk, Elements.Cf, Elements.Es, Elements.Fm, + Elements.Md, Elements.No, Elements.Lr, Elements.Rf, Elements.Db, + Elements.Sg, Elements.Bh, Elements.Hs, Elements.Mt, Elements.Ds, + Elements.Rg, Elements.Cn, Elements.Nh, Elements.Fl, Elements.Mc, + Elements.Lv, Elements.Ts, Elements.Og, + ) + + for symbol, element in zip(ref_symbols, ref_elements): + assert(Elements.is_element(symbol)) # True for symbols + assert(Elements.is_element(element)) # True for members + + is_elem, elem = Elements.is_element(element, return_element=True) assert(is_elem) - assert(symbol==e) + assert(elem.symbol is symbol) + assert(elem is element) + is_elem, elem = Elements.is_element(symbol, return_element=True) + assert(is_elem) + assert(elem.symbol is symbol) + assert(elem is element) #end for - valid = ''' - C - C1 - C2 - C12 - C123 - C_1 - C_2 - C_12 - C_123 - C_a - C_abc - '''.split() - for e in valid: - assert(is_element(e)) - is_elem,symbol = is_element(e,symbol=True) + funky_carbon_strs = ( + "C", + "C1", + "C2", + "C12", + "C123", + "C_1", + "C_2", + "C_12", + "C_123", + "C_a", + "C_abc", + "C-1", + "C-2", + "C-12", + "C-123", + "C-a", + "C-abc", + "c", + "c1", + "c2", + "c12", + "c123", + "c_1", + "c_2", + "c_12", + "c_123", + "c_a", + "c_abc", + "c-1", + "c-2", + "c-12", + "c-123", + "c-a", + "c-abc", + ) + + for string in funky_carbon_strs: + assert(Elements.is_element(string)) + + is_elem, elem = Elements.is_element(string, return_element=True) assert(is_elem) - assert(symbol=='C') + assert(elem is Elements.Carbon) + assert(elem.symbol == "C") + assert(elem.name == "Carbon") #end for - - valid = ''' - Co - Co1 - Co2 - Co12 - Co123 - Co_1 - Co_2 - Co_12 - Co_123 - Co_a - Co_abc - '''.split() - for e in valid: - assert(is_element(e)) - is_elem,symbol = is_element(e,symbol=True) + + funky_cobalt_strs = [ + "Co", + "Co1", + "Co2", + "Co12", + "Co123", + "Co_1", + "Co_2", + "Co_12", + "Co_123", + "Co_a", + "Co_abc", + "Co-1", + "Co-2", + "Co-12", + "Co-123", + "Co-a", + "Co-abc", + "co", + "co1", + "co2", + "co12", + "co123", + "co_1", + "co_2", + "co_12", + "co_123", + "co_a", + "co_abc", + "co-1", + "co-2", + "co-12", + "co-123", + "co-a", + "co-abc", + ] + for string in funky_cobalt_strs: + assert(Elements.is_element(string)) + + is_elem, element = Elements.is_element(string, return_element=True) assert(is_elem) - assert(symbol=='Co') + assert(element is Elements.Cobalt) + assert(element.symbol == "Co") + assert(element.name == "Cobalt") #end for - #end def test_is_element + + +def test_element_set(): + from ..periodic_table import Elements + ref_set = set([ + Elements.Xx, + Elements.H, + Elements.Dy, + Elements.U, + Elements.Nh, + ]) + + element_set = set([ + Elements.Xx, + Elements.H, Elements.H, Elements.H, + Elements.Dy, + Elements.U, Elements.U, Elements.U, Elements.U, Elements.U, + Elements.Nh, Elements.Nh, Elements.Nh, Elements.Nh, + ]) + + assert(ref_set == element_set) + + +def test_representation(): + from ..periodic_table import Elements + + ref_repr = "" + assert(repr(Elements.Carbon) == ref_repr) diff --git a/nexus/nexus/tests/test_physical_system.py b/nexus/nexus/tests/test_physical_system.py index ce91b9a2c7..7dd1734016 100644 --- a/nexus/nexus/tests/test_physical_system.py +++ b/nexus/nexus/tests/test_physical_system.py @@ -65,7 +65,7 @@ def check_none(v,vfields): # matter elements = Matter.elements - assert(len(elements)==103) + assert(len(elements)==119) assert('Si' in elements) pc = Matter.particle_collection @@ -89,7 +89,8 @@ def check_none(v,vfields): si = pc.Si assert(si.name=='Si') - assert(value_eq(si.mass,51197.6459833)) + print(si.mass) + assert(value_eq(si.mass,51195.82309476658)) assert(si.charge==14) assert(si.protons==14) assert(si.neutrons==14) diff --git a/nexus/nexus/tests/test_pwscf_input.py b/nexus/nexus/tests/test_pwscf_input.py index 457dfadf70..c20f426e71 100644 --- a/nexus/nexus/tests/test_pwscf_input.py +++ b/nexus/nexus/tests/test_pwscf_input.py @@ -2,7 +2,7 @@ from .. import testing from ..testing import failed from ..testing import divert_nexus_log,restore_nexus_log -from ..testing import value_eq,object_eq +from ..testing import value_eq,object_eq,object_diff associated_files = dict() @@ -70,7 +70,8 @@ def test_input(): # definitions def check_pw_same(pw1_,pw2_,l1='pw1',l2='pw2'): - pw_same = object_eq(pw1_,pw2_,int_as_float=True) + pw_same = object_eq(pw1_, pw2_, int_as_float=True, atol=5e-4) + if not pw_same: d,d1,d2 = object_diff(pw1_,pw2_,full=True,int_as_float=True) diff = obj({l1:obj(d1),l2:obj(d2)}) diff --git a/nexus/nexus/tests/test_qmcpack_input.py b/nexus/nexus/tests/test_qmcpack_input.py index fbac3ea30d..3cd94b508a 100644 --- a/nexus/nexus/tests/test_qmcpack_input.py +++ b/nexus/nexus/tests/test_qmcpack_input.py @@ -180,7 +180,7 @@ def generate_serial_references(): 'simulation/qmcsystem/particlesets/ion0/groups/O/valence' : 6, 'simulation/qmcsystem/particlesets/ion0/groups/V/atomicnumber' : 23, 'simulation/qmcsystem/particlesets/ion0/groups/V/charge' : 13, - 'simulation/qmcsystem/particlesets/ion0/groups/V/mass' : 92861.5851912, + 'simulation/qmcsystem/particlesets/ion0/groups/V/mass' : 92860.6737469, 'simulation/qmcsystem/particlesets/ion0/groups/V/name' : 'V', 'simulation/qmcsystem/particlesets/ion0/groups/V/position' : np.array([ [2.45778327, 8.39460555, 0.22661828], @@ -687,7 +687,7 @@ def test_compose(): charge = 13, valence = 13, atomicnumber = 23, - mass = 92861.5851912, + mass = 92860.6737469, position = np.array([ [ 2.45778327, 8.39460555, 0.22661828], [ 8.41192147, 8.75579295, -0.22661828], diff --git a/nexus/nexus/tests/test_qmcpack_input_files/VO2_M1_afm.in.xml b/nexus/nexus/tests/test_qmcpack_input_files/VO2_M1_afm.in.xml index 003768146c..2800171285 100644 --- a/nexus/nexus/tests/test_qmcpack_input_files/VO2_M1_afm.in.xml +++ b/nexus/nexus/tests/test_qmcpack_input_files/VO2_M1_afm.in.xml @@ -26,11 +26,11 @@ - + 13 13 23 - 92861.5851912 + 92860.6737469 2.45778327 8.39460555 0.22661828 8.41192147 8.75579295 -0.22661828 diff --git a/nexus/nexus/vasp_input.py b/nexus/nexus/vasp_input.py index 3ac3fa739e..862b21ce5c 100644 --- a/nexus/nexus/vasp_input.py +++ b/nexus/nexus/vasp_input.py @@ -39,7 +39,7 @@ import os import numpy as np -from .periodic_table import is_element +from .periodic_table import Elements from .nexus_base import nexus_noncore from .simulation import SimulationInput from .structure import interpolate_structures, Structure @@ -1196,11 +1196,11 @@ def write_text(self,filepath=''): #end for if self.elem is not None: for e in self.elem: - iselem,symbol = is_element(e,symbol=True) + iselem, element = Elements.is_element(e, return_element=True) if not iselem: self.error('{0} is not an element'.format(e)) #end if - text += symbol+' ' + text += element.symbol+' ' #end for text += '\n' #end if @@ -1612,7 +1612,8 @@ def set_potcar(self,pseudos,species=None): #end for ordered_pseudos = [] for element in species: - iselem,symbol = is_element(element,symbol=True) + iselem, elem = Elements.is_element(element, return_element=True) + symbol = elem.symbol if not iselem: self.error('{0} is not an element'.format(element)) elif symbol not in pseudo_map: