Source code for gasfir._atomic_data

"""First ionization potentials for all 118 elements.

Values are from the NIST Atomic Spectra Database (ASD),
https://physics.nist.gov/PhysRefData/ASD/ionEnergy.html
(accessed 2024).  Stored in electronvolts; converted to atomic units
(Hartree) on demand via ``AtomicUnits.eV``.

Public API
----------
:func:`get_ionization_potential` — return Ip in a.u. for a given element.
:data:`IONIZATION_POTENTIALS_eV`  — raw dict ``{symbol: Ip_eV}``.
"""

from __future__ import annotations

from typing import Optional

# ---------------------------------------------------------------------------
# NIST first ionization potentials  (symbol → eV)
# ---------------------------------------------------------------------------
IONIZATION_POTENTIALS_eV: dict[str, float] = {
    "H": 13.5984,
    "He": 24.5874,
    "Li": 5.3917,
    "Be": 9.3227,
    "B": 8.2980,
    "C": 11.2603,
    "N": 14.5341,
    "O": 13.6181,
    "F": 17.4228,
    "Ne": 21.5645,
    "Na": 5.1391,
    "Mg": 7.6462,
    "Al": 5.9858,
    "Si": 8.1517,
    "P": 10.4867,
    "S": 10.3600,
    "Cl": 12.9676,
    "Ar": 15.7596,
    "K": 4.3407,
    "Ca": 6.1132,
    "Sc": 6.5615,
    "Ti": 6.8281,
    "V": 6.7462,
    "Cr": 6.7665,
    "Mn": 7.4340,
    "Fe": 7.9024,
    "Co": 7.8810,
    "Ni": 7.6398,
    "Cu": 7.7264,
    "Zn": 9.3942,
    "Ga": 5.9993,
    "Ge": 7.8994,
    "As": 9.7886,
    "Se": 9.7524,
    "Br": 11.8138,
    "Kr": 13.9996,
    "Rb": 4.1771,
    "Sr": 5.6949,
    "Y": 6.2173,
    "Zr": 6.6339,
    "Nb": 6.7589,
    "Mo": 7.0924,
    "Tc": 7.28,
    "Ru": 7.3605,
    "Rh": 7.4589,
    "Pd": 8.3369,
    "Ag": 7.5762,
    "Cd": 8.9938,
    "In": 5.7864,
    "Sn": 7.3439,
    "Sb": 8.6084,
    "Te": 9.0096,
    "I": 10.4513,
    "Xe": 12.1298,
    "Cs": 3.8939,
    "Ba": 5.2117,
    "La": 5.5769,
    "Ce": 5.5387,
    "Pr": 5.473,
    "Nd": 5.5250,
    "Pm": 5.582,
    "Sm": 5.6437,
    "Eu": 5.6704,
    "Gd": 6.1498,
    "Tb": 5.8638,
    "Dy": 5.9389,
    "Ho": 6.0215,
    "Er": 6.1077,
    "Tm": 6.1843,
    "Yb": 6.2542,
    "Lu": 5.4259,
    "Hf": 6.8251,
    "Ta": 7.5496,
    "W": 7.8640,
    "Re": 7.8335,
    "Os": 8.4382,
    "Ir": 8.9670,
    "Pt": 8.9587,
    "Au": 9.2255,
    "Hg": 10.4375,
    "Tl": 6.1082,
    "Pb": 7.4167,
    "Bi": 7.2856,
    "Po": 8.417,
    "At": 9.318,
    "Rn": 10.7485,
    "Fr": 4.0727,
    "Ra": 5.2784,
    "Ac": 5.17,
    "Th": 6.3067,
    "Pa": 5.89,
    "U": 6.1941,
    "Np": 6.2657,
    "Pu": 6.0262,
    "Am": 5.9738,
    "Cm": 5.9915,
    "Bk": 6.1979,
    "Cf": 6.2817,
    "Es": 6.3676,
    "Fm": 6.50,
    "Md": 6.58,
    "No": 6.65,
    "Lr": 4.96,
    "Rf": 6.02,
    "Db": 6.8,
    "Sg": 7.8,
    "Bh": 7.7,
    "Hs": 7.6,
    "Mt": 8.7,
    "Ds": 9.6,
    "Rg": 10.6,
    "Cn": 11.97,
    "Nh": 6.9,
    "Fl": 8.63,
    "Mc": 6.0,
    "Lv": 8.0,
    "Ts": 7.7,
    "Og": 8.7,
}

# ---------------------------------------------------------------------------
# Full element names → symbol
# ---------------------------------------------------------------------------
_NAME_TO_SYMBOL: dict[str, str] = {
    "hydrogen": "H",
    "helium": "He",
    "lithium": "Li",
    "beryllium": "Be",
    "boron": "B",
    "carbon": "C",
    "nitrogen": "N",
    "oxygen": "O",
    "fluorine": "F",
    "neon": "Ne",
    "sodium": "Na",
    "magnesium": "Mg",
    "aluminium": "Al",
    "aluminum": "Al",
    "silicon": "Si",
    "phosphorus": "P",
    "sulfur": "S",
    "sulphur": "S",
    "chlorine": "Cl",
    "argon": "Ar",
    "potassium": "K",
    "calcium": "Ca",
    "scandium": "Sc",
    "titanium": "Ti",
    "vanadium": "V",
    "chromium": "Cr",
    "manganese": "Mn",
    "iron": "Fe",
    "cobalt": "Co",
    "nickel": "Ni",
    "copper": "Cu",
    "zinc": "Zn",
    "gallium": "Ga",
    "germanium": "Ge",
    "arsenic": "As",
    "selenium": "Se",
    "bromine": "Br",
    "krypton": "Kr",
    "rubidium": "Rb",
    "strontium": "Sr",
    "yttrium": "Y",
    "zirconium": "Zr",
    "niobium": "Nb",
    "molybdenum": "Mo",
    "technetium": "Tc",
    "ruthenium": "Ru",
    "rhodium": "Rh",
    "palladium": "Pd",
    "silver": "Ag",
    "cadmium": "Cd",
    "indium": "In",
    "tin": "Sn",
    "antimony": "Sb",
    "tellurium": "Te",
    "iodine": "I",
    "xenon": "Xe",
    "caesium": "Cs",
    "cesium": "Cs",
    "barium": "Ba",
    "lanthanum": "La",
    "cerium": "Ce",
    "praseodymium": "Pr",
    "neodymium": "Nd",
    "promethium": "Pm",
    "samarium": "Sm",
    "europium": "Eu",
    "gadolinium": "Gd",
    "terbium": "Tb",
    "dysprosium": "Dy",
    "holmium": "Ho",
    "erbium": "Er",
    "thulium": "Tm",
    "ytterbium": "Yb",
    "lutetium": "Lu",
    "hafnium": "Hf",
    "tantalum": "Ta",
    "tungsten": "W",
    "rhenium": "Re",
    "osmium": "Os",
    "iridium": "Ir",
    "platinum": "Pt",
    "gold": "Au",
    "mercury": "Hg",
    "thallium": "Tl",
    "lead": "Pb",
    "bismuth": "Bi",
    "polonium": "Po",
    "astatine": "At",
    "radon": "Rn",
    "francium": "Fr",
    "radium": "Ra",
    "actinium": "Ac",
    "thorium": "Th",
    "protactinium": "Pa",
    "uranium": "U",
    "neptunium": "Np",
    "plutonium": "Pu",
    "americium": "Am",
    "curium": "Cm",
    "berkelium": "Bk",
    "californium": "Cf",
    "einsteinium": "Es",
    "fermium": "Fm",
    "mendelevium": "Md",
    "nobelium": "No",
    "lawrencium": "Lr",
}

# eV → a.u. conversion factor (Hartree)
_EV_TO_AU: float = 1.0 / 27.21138383


[docs] def get_ionization_potential(element: str) -> Optional[float]: """Return the first ionization potential of an element in atomic units. Args: element: Element symbol (e.g. ``"Ar"``, ``"He"``) or full name (e.g. ``"argon"``, ``"helium"``). Case-insensitive. Returns: Ionization potential in atomic units (Hartree), or ``None`` if the element is not recognised. Example: >>> get_ionization_potential("Ar") # argon 0.5791... >>> get_ionization_potential("helium") 0.9035... """ key = element.strip() # Try symbol first (case-insensitive, but preserve capitalisation for lookup) symbol = key.capitalize() # "ar" → "Ar", "AR" → "Ar" if len(key) == 1: symbol = key.upper() # single-letter symbols: "h" → "H" if symbol in IONIZATION_POTENTIALS_eV: return IONIZATION_POTENTIALS_eV[symbol] * _EV_TO_AU # Try full name sym = _NAME_TO_SYMBOL.get(key.lower()) if sym and sym in IONIZATION_POTENTIALS_eV: return IONIZATION_POTENTIALS_eV[sym] * _EV_TO_AU return None
def list_elements() -> list[str]: """Return all element symbols with known ionization potentials.""" return sorted( IONIZATION_POTENTIALS_eV.keys(), key=lambda s: list(IONIZATION_POTENTIALS_eV).index(s), )