def __init__(self, symbol): self.symbol = "%s" % symbol d = _pt_data[symbol] # Store key variables for quick access self.Z = d["Atomic no"] self.X = d.get("X", 0) for a in ["mendeleev_no", "electrical_resistivity", "velocity_of_sound", "reflectivity", "refractive_index", "poissons_ratio", "molar_volume", "electronic_structure", "thermal_conductivity", "boiling_point", "melting_point", "critical_temperature", "superconduction_temperature", "liquid_range", "bulk_modulus", "youngs_modulus", "brinell_hardness", "rigidity_modulus", "mineral_hardness", "vickers_hardness", "density_of_solid", "atomic_radius_calculated", "van_der_waals_radius", "coefficient_of_linear_thermal_expansion"]: kstr = a.capitalize().replace("_", " ") val = d.get(kstr, None) if str(val).startswith("no data"): val = None setattr(self, a, val) if str(d.get("Atomic radius", "no data")).startswith("no data"): self.atomic_radius = None else: self.atomic_radius = Length(d["Atomic radius"], "ang") self.atomic_mass = Mass(d["Atomic mass"], "amu") self._data = d
def weight(self): """ Total molecular weight of Composition """ return Mass( sum([amount * el.atomic_mass for el, amount in self.items()]), "amu")
def __init__(self, symbol): self.symbol = "%s" % symbol d = _pt_data[symbol] # Store key variables for quick access self.Z = d["Atomic no"] self.X = d.get("X", 0) for a in [ "mendeleev_no", "electrical_resistivity", "velocity_of_sound", "reflectivity", "refractive_index", "poissons_ratio", "molar_volume", "electronic_structure", "thermal_conductivity", "boiling_point", "melting_point", "critical_temperature", "superconduction_temperature", "liquid_range", "bulk_modulus", "youngs_modulus", "brinell_hardness", "rigidity_modulus", "mineral_hardness", "vickers_hardness", "density_of_solid", "atomic_radius_calculated", "van_der_waals_radius", "coefficient_of_linear_thermal_expansion" ]: kstr = a.capitalize().replace("_", " ") val = d.get(kstr, None) if str(val).startswith("no data"): val = None else: try: val = float(val) except ValueError: toks_nobracket = re.sub(r'\(.*\)', "", val) toks = toks_nobracket.replace("about", "").strip().split(" ", 1) if len(toks) == 2: try: if "10<sup>" in toks[1]: base_power = re.findall(r'([+-]?\d+)', toks[1]) factor = "e" + base_power[1] toks[0] += factor if a == "electrical_resistivity": unit = "ohm m" elif a == "coefficient_of_linear_thermal_expansion": unit = "K^-1" else: unit = toks[1] val = FloatWithUnit(toks[0], unit) else: unit = toks[1].replace("<sup>", "^").replace( "</sup>", "").replace("Ω", "ohm") units = Unit(unit) if set(units.keys()).issubset( SUPPORTED_UNIT_NAMES): val = FloatWithUnit(toks[0], unit) except ValueError as ex: # Ignore error. val will just remain a string. pass setattr(self, a, val) if str(d.get("Atomic radius", "no data")).startswith("no data"): self.atomic_radius = None else: self.atomic_radius = Length(d["Atomic radius"], "ang") self.atomic_mass = Mass(d["Atomic mass"], "amu") self._data = d
def test_compound_operations(self): g = 10 * Length(1, "m") / (Time(1, "s") ** 2) e = Mass(1, "kg") * g * Length(1, "m") self.assertEqual(str(e), "10.0 N m") form_e = FloatWithUnit(10, unit="kJ mol^-1") self.assertEqual(str(form_e.to("eV atom^-1")), "0.103642691905 eV atom^-1") self.assertRaises(UnitError, form_e.to, "m s^-1") a = FloatWithUnit(1.0, "Ha^3") self.assertEqual(str(a.to("J^3")), "8.28672661615e-53 J^3") a = FloatWithUnit(1.0, "Ha bohr^-2") self.assertEqual(str(a.to("J m^-2")), "1556.89291457 J m^-2")
def __init__(self, symbol): self.symbol = "%s" % symbol d = _pt_data[symbol] # Store key variables for quick access self.Z = d["Atomic no"] at_r = d.get("Atomic radius", "no data") if str(at_r).startswith("no data"): self.atomic_radius = None else: self.atomic_radius = Length(at_r, "ang") self.atomic_mass = Mass(d["Atomic mass"], "amu") self._data = d
def test_compound_operations(self): g = 10 * Length(1, "m") / (Time(1, "s")**2) e = Mass(1, "kg") * g * Length(1, "m") self.assertEqual(str(e), "10.0 N m") form_e = FloatWithUnit(10, unit="kJ mol^-1").to("eV atom^-1") self.assertAlmostEqual(float(form_e), 0.103642691905) self.assertEqual(str(form_e.unit), "eV atom^-1") self.assertRaises(UnitError, form_e.to, "m s^-1") a = FloatWithUnit(1.0, "Ha^3") b = a.to("J^3") self.assertAlmostEqual(b, 8.28672661615e-53) self.assertEqual(str(b.unit), "J^3") a = FloatWithUnit(1.0, "Ha bohr^-2") b = a.to("J m^-2") self.assertAlmostEqual(b, 1556.893078472351) self.assertEqual(str(b.unit), "J m^-2")
def __init__(self, symbol: str): """ Basic immutable element object with all relevant properties. Only one instance of Element for each symbol is stored after creation, ensuring that a particular element behaves like a singleton. For all attributes, missing data (i.e., data for which is not available) is represented by a None unless otherwise stated. Args: symbol (str): Element symbol, e.g., "H", "Fe" .. attribute:: Z Atomic number .. attribute:: symbol Element symbol .. attribute:: X Pauling electronegativity. Elements without an electronegativity number are assigned a value of zero by default. .. attribute:: number Alternative attribute for atomic number .. attribute:: max_oxidation_state Maximum oxidation state for element .. attribute:: min_oxidation_state Minimum oxidation state for element .. attribute:: oxidation_states Tuple of all known oxidation states .. attribute:: common_oxidation_states Tuple of all common oxidation states .. attribute:: full_electronic_structure Full electronic structure as tuple. E.g., The electronic structure for Fe is represented as: [(1, "s", 2), (2, "s", 2), (2, "p", 6), (3, "s", 2), (3, "p", 6), (3, "d", 6), (4, "s", 2)] .. attribute:: row Returns the periodic table row of the element. .. attribute:: group Returns the periodic table group of the element. .. attribute:: block Return the block character "s,p,d,f" .. attribute:: is_noble_gas True if element is noble gas. .. attribute:: is_transition_metal True if element is a transition metal. .. attribute:: is_post_transition_metal True if element is a post transition metal. .. attribute:: is_rare_earth_metal True if element is a rare earth metal. .. attribute:: is_metalloid True if element is a metalloid. .. attribute:: is_alkali True if element is an alkali metal. .. attribute:: is_alkaline True if element is an alkaline earth metal (group II). .. attribute:: is_halogen True if element is a halogen. .. attribute:: is_lanthanoid True if element is a lanthanoid. .. attribute:: is_actinoid True if element is a actinoid. .. attribute:: iupac_ordering Ordering according to Table VI of "Nomenclature of Inorganic Chemistry (IUPAC Recommendations 2005)". This ordering effectively follows the groups and rows of the periodic table, except the Lanthanides, Actanides and hydrogen. .. attribute:: long_name Long name for element. E.g., "Hydrogen". .. attribute:: atomic_mass Atomic mass for the element. .. attribute:: atomic_radius Atomic radius for the element. This is the empirical value. Data is obtained from http://en.wikipedia.org/wiki/Atomic_radii_of_the_elements_(data_page). .. attribute:: atomic_radius_calculated Calculated atomic radius for the element. This is the empirical value. Data is obtained from http://en.wikipedia.org/wiki/Atomic_radii_of_the_elements_(data_page). .. attribute:: van_der_waals_radius Van der Waals radius for the element. This is the empirical value. Data is obtained from http://en.wikipedia.org/wiki/Atomic_radii_of_the_elements_(data_page). .. attribute:: mendeleev_no Mendeleev number from definition given by Pettifor, D. G. (1984). A chemical scale for crystal-structure maps. Solid State Communications, 51 (1), 31-34 .. attribute:: electrical_resistivity Electrical resistivity .. attribute:: velocity_of_sound Velocity of sound .. attribute:: reflectivity Reflectivity .. attribute:: refractive_index Refractice index .. attribute:: poissons_ratio Poisson's ratio .. attribute:: molar_volume Molar volume .. attribute:: electronic_structure Electronic structure. E.g., The electronic structure for Fe is represented as [Ar].3d6.4s2 .. attribute:: atomic_orbitals Atomic Orbitals. Energy of the atomic orbitals as a dict. E.g., The orbitals energies in eV are represented as {'1s': -1.0, '2s': -0.1} Data is obtained from https://www.nist.gov/pml/data/atomic-reference-data-electronic-structure-calculations The LDA values for neutral atoms are used .. attribute:: thermal_conductivity Thermal conductivity .. attribute:: boiling_point Boiling point .. attribute:: melting_point Melting point .. attribute:: critical_temperature Critical temperature .. attribute:: superconduction_temperature Superconduction temperature .. attribute:: liquid_range Liquid range .. attribute:: bulk_modulus Bulk modulus .. attribute:: youngs_modulus Young's modulus .. attribute:: brinell_hardness Brinell hardness .. attribute:: rigidity_modulus Rigidity modulus .. attribute:: mineral_hardness Mineral hardness .. attribute:: vickers_hardness Vicker's hardness .. attribute:: density_of_solid Density of solid phase .. attribute:: coefficient_of_linear_thermal_expansion Coefficient of linear thermal expansion .. attribute:: average_ionic_radius Average ionic radius for element in ang. The average is taken over all oxidation states of the element for which data is present. .. attribute:: average_cationic_radius Average cationic radius for element in ang. The average is taken over all positive oxidation states of the element for which data is present. .. attribute:: average_anionic_radius Average ionic radius for element in ang. The average is taken over all negative oxidation states of the element for which data is present. .. attribute:: ionic_radii All ionic radii of the element as a dict of {oxidation state: ionic radii}. Radii are given in ang. """ self.symbol = "%s" % symbol d = _pt_data[symbol] # Store key variables for quick access self.Z = d["Atomic no"] at_r = d.get("Atomic radius", "no data") if str(at_r).startswith("no data"): self._atomic_radius = None else: self._atomic_radius = Length(at_r, "ang") self._atomic_mass = Mass(d["Atomic mass"], "amu") self.long_name = d["Name"] self._data = d
def __init__(self, symbol: str): """ Basic immutable element object with all relevant properties. Only one instance of Element for each symbol is stored after creation, ensuring that a particular element behaves like a singleton. For all attributes, missing data (i.e., data for which is not available) is represented by a None unless otherwise stated. Args: symbol (str): Element symbol, e.g., "H", "Fe" .. attribute:: Z Atomic number .. attribute:: symbol Element symbol .. attribute:: long_name Long name for element. E.g., "Hydrogen". .. attribute:: atomic_radius_calculated Calculated atomic radius for the element. This is the empirical value. Data is obtained from http://en.wikipedia.org/wiki/Atomic_radii_of_the_elements_(data_page). .. attribute:: van_der_waals_radius Van der Waals radius for the element. This is the empirical value determined from critical reviews of X-ray diffraction, gas kinetic collision cross-section, and other experimental data by Bondi and later workers. The uncertainty in these values is on the order of 0.1 Å. Data are obtained from "Atomic Radii of the Elements" in CRC Handbook of Chemistry and Physics, 91st Ed.; Haynes, W.M., Ed.; CRC Press: Boca Raton, FL, 2010. .. attribute:: mendeleev_no Mendeleev number from definition given by Pettifor, D. G. (1984). A chemical scale for crystal-structure maps. Solid State Communications, 51 (1), 31-34 .. attribute:: electrical_resistivity Electrical resistivity .. attribute:: velocity_of_sound Velocity of sound .. attribute:: reflectivity Reflectivity .. attribute:: refractive_index Refractice index .. attribute:: poissons_ratio Poisson's ratio .. attribute:: molar_volume Molar volume .. attribute:: electronic_structure Electronic structure. E.g., The electronic structure for Fe is represented as [Ar].3d6.4s2 .. attribute:: atomic_orbitals Atomic Orbitals. Energy of the atomic orbitals as a dict. E.g., The orbitals energies in eV are represented as {'1s': -1.0, '2s': -0.1} Data is obtained from https://www.nist.gov/pml/data/atomic-reference-data-electronic-structure-calculations The LDA values for neutral atoms are used .. attribute:: thermal_conductivity Thermal conductivity .. attribute:: boiling_point Boiling point .. attribute:: melting_point Melting point .. attribute:: critical_temperature Critical temperature .. attribute:: superconduction_temperature Superconduction temperature .. attribute:: liquid_range Liquid range .. attribute:: bulk_modulus Bulk modulus .. attribute:: youngs_modulus Young's modulus .. attribute:: brinell_hardness Brinell hardness .. attribute:: rigidity_modulus Rigidity modulus .. attribute:: mineral_hardness Mineral hardness .. attribute:: vickers_hardness Vicker's hardness .. attribute:: density_of_solid Density of solid phase .. attribute:: coefficient_of_linear_thermal_expansion Coefficient of linear thermal expansion .. attribute:: ground_level Ground level for element .. attribute:: ionization_energies List of ionization energies. First value is the first ionization energy, second is the second ionization energy, etc. Note that this is zero-based indexing! So Element.ionization_energies[0] refer to the 1st ionization energy. Values are from the NIST Atomic Spectra Database. Missing values are None. """ self.symbol = "%s" % symbol d = _pt_data[symbol] # Store key variables for quick access self.Z = d["Atomic no"] at_r = d.get("Atomic radius", "no data") if str(at_r).startswith("no data"): self._atomic_radius = None else: self._atomic_radius = Length(at_r, "ang") self._atomic_mass = Mass(d["Atomic mass"], "amu") self.long_name = d["Name"] self._data = d