corems.encapsulation.constant

  1from corems.encapsulation import nist_atoms
  2
  3# Default gzip level for HDF5 datasets on the mass spectrum and LC-MS
  4# export path. Callers pass it as the compression argument of
  5# hdf5_dataset_kwargs and to_hdf().
  6DEFAULT_HDF5_COMPRESSION = 4
  7
  8
  9class Labels:  # pragma: no cover
 10    """Class for Labels used in CoreMS
 11
 12    These labels are used to define:
 13    * types of columns in plaintext data inputs,
 14    * types of data/mass spectra
 15    * types of assignment for ions
 16
 17    """
 18
 19    mz = "m/z"
 20    abundance = "Peak Height"
 21    rp = "Resolving Power"
 22    s2n = "S/N"
 23
 24    label = "label"
 25    bruker_profile = "Bruker_Profile"
 26    thermo_profile = "Thermo_Profile"
 27    simulated_profile = "Simulated Profile"
 28    booster_profile = "Booster Profile"
 29    bruker_frequency = "Bruker_Frequency"
 30    midas_frequency = "Midas_Frequency"
 31    thermo_centroid = "Thermo_Centroid"
 32    corems_centroid = "CoreMS_Centroid"
 33    gcms_centroid = "Thermo_Centroid"
 34
 35    unassigned = "unassigned"
 36
 37    radical_ion = "RADICAL"
 38    protonated_de_ion = "DE_OR_PROTONATED"
 39    protonated = "protonated"
 40    de_protonated = "de-protonated"
 41    adduct_ion = "ADDUCT"
 42    neutral = "neutral"
 43    ion_type = "IonType"
 44
 45    ion_type_translate = {
 46        "protonated": "DE_OR_PROTONATED",
 47        "de-protonated": "DE_OR_PROTONATED",
 48        "radical": "RADICAL",
 49        "adduct": "ADDUCT",
 50        "ADDUCT": "ADDUCT",
 51    }
 52
 53
 54class Atoms:  # pragma: no cover
 55    """Class for Atoms in CoreMS
 56
 57    Public API for exact masses, isotopic abundances, rare-isotope lists,
 58    formula-string order, English names, and covalence. Do not use
 59    ``nist_atoms.isotopes`` as ``Atoms.isotopes``: the generated module stores
 60    a list of rare keys (or ``[None]``); this class stores
 61    ``[English name, rare keys]``.
 62
 63    IUPAC monoisotopic mass uses the most abundant isotope of each element.
 64    Bare element symbols are the most abundant isotope (C, Cl). Rare isotopes
 65    use mass-number keys (13C, 37Cl). Hydrogen uses H and D. Masses and
 66    abundances may also be looked up by nuclide key (12C, 1H). Formula strings
 67    and mass-list columns use ``atoms_order`` (canonical keys only).
 68
 69    Masses, abundances, rare lists, and ``atoms_order`` come from a pinned NIST
 70    snapshot (``corems.encapsulation.nist_atoms``). English names and covalence
 71    are hand-maintained. ``Atoms.isotopes`` membership is not enough to search
 72    an element: ``usedAtoms`` still needs a valence in
 73    ``used_atom_valences`` (usually from ``atoms_covalence``). Pin deltas
 74    and breaking notes are in ``tools/nist_atoms/CHANGES.md``.
 75
 76    References
 77    ----------
 78
 79    1. NIST Atomic Weights and Isotopic Compositions (Coursey et al., version 4.1)
 80    https://www.nist.gov/pml/atomic-weights-and-isotopic-compositions-relative-atomic-masses
 81
 82    """
 83
 84    electron_mass = 0.0005_485_799_090_65  # NIST value
 85
 86    atomic_masses = nist_atoms.atomic_masses
 87    isotopic_abundance = nist_atoms.isotopic_abundance
 88    atoms_order = nist_atoms.atoms_order
 89
 90    # Not a NIST field (the dump has no name column).
 91    element_names = {
 92        "H": "Hydrogen",
 93        "He": "Helium",
 94        "Li": "Lithium",
 95        "Be": "Beryllium",
 96        "B": "Boron",
 97        "C": "Carbon",
 98        "N": "Nitrogen",
 99        "O": "Oxygen",
100        "F": "Fluorine",
101        "Ne": "Neon",
102        "Na": "Sodium",
103        "Mg": "Magnesium",
104        "Al": "Aluminum",
105        "Si": "Silicon",
106        "P": "Phosphorus",
107        "S": "Sulfur",
108        "Cl": "Chlorine",
109        "Ar": "Argon",
110        "K": "Potassium",
111        "Ca": "Calcium",
112        "Sc": "Scandium",
113        "Ti": "Titanium",
114        "V": "Vanadium",
115        "Cr": "Chromium",
116        "Mn": "Manganese",
117        "Fe": "Iron",
118        "Co": "Cobalt",
119        "Ni": "Nickel",
120        "Cu": "Copper",
121        "Zn": "Zinc",
122        "Ga": "Gallium",
123        "Ge": "Germanium",
124        "As": "Arsenic",
125        "Se": "Selenium",
126        "Br": "Bromine",
127        "Kr": "Krypton",
128        "Rb": "Rubidium",
129        "Sr": "Strontium",
130        "Y": "Yttrium",
131        "Zr": "Zirconium",
132        "Nb": "Niobium",
133        "Mo": "Molybdenum",
134        "Ru": "Ruthenium",
135        "Rh": "Rhodium",
136        "Pd": "Palladium",
137        "Ag": "Silver",
138        "Cd": "Cadmium",
139        "In": "Indium",
140        "Sn": "Tin",
141        "Sb": "Antimony",
142        "Te": "Tellurium",
143        "I": "Iodine",
144        "Xe": "Xenon",
145        "Cs": "Cesium",
146        "Ba": "Barium",
147        "La": "Lanthanum",
148        "Ce": "Cerium",
149        "Pr": "Praseodymium",
150        "Nd": "Neodymium",
151        "Sm": "Samarium",
152        "Eu": "Europium",
153        "Gd": "Gadolinium",
154        "Tb": "Terbium",
155        "Dy": "Dysprosium",
156        "Ho": "Holmium",
157        "Er": "Erbium",
158        "Tm": "Thulium",
159        "Yb": "Ytterbium",
160        "Lu": "Lutetium",
161        "Hf": "Hafnium",
162        "Ta": "Tantalum",
163        "W": "Tungsten",
164        "Re": "Rhenium",
165        "Os": "Osmium",
166        "Ir": "Iridium",
167        "Pt": "Platinum",
168        "Au": "Gold",
169        "Hg": "Mercury",
170        "Tl": "Thallium",
171        "Pb": "Lead",
172        "Bi": "Bismuth",
173        "Th": "Thorium",
174        "Pa": "Protactinium",
175        "U": "Uranium",
176    }
177
178    isotopes = {}
179    for symbol, rares in nist_atoms.isotopes.items():
180        isotopes[symbol] = [element_names.get(symbol, symbol), list(rares)]
181    del symbol, rares
182
183    atoms_covalence = {
184        "C": (4),
185        "13C": (4),
186        "N": (3),
187        "O": (2),
188        "S": (2),
189        "H": (1),
190        "F": (1, 0),
191        "Cl": (1, 0),
192        "Br": (1, 0),
193        "I": (1, 0),
194        "Li": (1, 0),
195        "Na": (1, 0),
196        "K": (1, 0),
197        "Rb": (1),
198        "Cs": (1),
199        "B": (4, 3, 2, 1),
200        "In": (3, 2, 1),
201        "Al": (3, 1, 2),
202        "P": (3, 5, 4, 2, 1),
203        "Ga": (3, 1, 2),
204        "Mg": (2, 1),
205        "Be": (2, 1),
206        "Ca": (2, 1),
207        "Sr": (2, 1),
208        "Ba": (2),
209        "V": (5, 4, 3, 2, 1),
210        "Fe": (3, 2, 4, 5, 6),
211        "Si": (4, 3, 2),
212        "Sc": (3, 2, 1),
213        "Ti": (4, 3, 2, 1),
214        "Cr": (1, 2, 3, 4, 5, 6),
215        "Mn": (1, 2, 3, 4, 5, 6, 7),
216        "Co": (1, 2, 3, 4, 5),
217        "Ni": (1, 2, 3, 4),
218        "Cu": (2, 1, 3, 4),
219        "Zn": (2, 1),
220        "Ge": (4, 3, 2, 1),
221        "As": (5, 3, 2, 1),
222        "Se": (6, 4, 2, 1),
223        "Y": (3, 2, 1),
224        "Zr": (4, 3, 2, 1),
225        "Nb": (5, 4, 3, 2, 1),
226        "Mo": (6, 5, 4, 3, 2, 1),
227        "Ru": (8, 7, 6, 5, 4, 3, 2, 1),
228        "Rh": (6, 5, 4, 3, 2, 1),
229        "Pd": (4, 2, 1),
230        "Ag": (0, 1, 2, 3, 4),
231        "Cd": (2, 1),
232        "Sn": (4, 2),
233        "Sb": (5, 3),
234        "Te": (6, 5, 4, 2),
235        "La": (3, 2),
236        "Hf": (4, 3, 2),
237        "Ta": (5, 4, 3, 2),
238        "W": (6, 5, 4, 3, 2, 1),
239        "Re": (4, 7, 6, 5, 3, 2, 1),
240        "Os": (4, 8, 7, 6, 5, 3, 2, 1),
241        "Ir": (4, 8, 6, 5, 3, 2, 1),
242        "Pt": (4, 6, 5, 3, 2, 1),
243        "Au": (3, 5, 2, 1),
244        "Hg": (1, 2, 4),
245        "Tl": (3, 1),
246        "Pb": (4, 2),
247        "Bi": (3, 1, 5),
248    }
249
250
251ION_TYPE_DICT = {
252    "M+": {
253        "add": {},
254        "sub": {},
255        "polarity": "positive",
256    },
257    "[M]+": {
258        "add": {},
259        "sub": {},
260        "polarity": "positive",
261    },
262    "protonated": {
263        "add": {"H": 1},
264        "sub": {},
265        "polarity": "positive",
266    },
267    "[M+H]+": {
268        "add": {"H": 1},
269        "sub": {},
270        "polarity": "positive",
271    },
272    "[M+2H]2+": {
273        "add": {"H": 2},
274        "sub": {},
275        "polarity": "positive",
276    },
277    "[M+3H]3+": {
278        "add": {"H": 3},
279        "sub": {},
280        "polarity": "positive",
281    },
282    "[M+NH4]+": {
283        "add": {"N": 1, "H": 4},
284        "sub": {},
285        "polarity": "positive",
286    },
287    "[M+Na]+": {
288        "add": {"Na": 1},
289        "sub": {},
290        "polarity": "positive",
291    },
292    "[M+K]+": {
293        "add": {"K": 1},
294        "sub": {},
295        "polarity": "positive",
296    },
297    "[M+2Na]2+": {
298        "add": {"Na": 2},
299        "sub": {},
300        "polarity": "positive",
301    },
302    "[M+H+Na]2+": {
303        "add": {"H": 1, "Na": 1},
304        "sub": {},
305        "polarity": "positive",
306    },
307    "[M+H+K]2+": {
308        "add": {"H": 1, "K": 1},
309        "sub": {},
310        "polarity": "positive",
311    },
312    "[M+2Na+Cl]+": {
313        "add": {"Na": 2, "Cl": 1},
314        "sub": {},
315        "polarity": "positive",
316    },
317    "[M+2Na-H]+": {
318        "add": {"Na": 2},
319        "sub": {"H": 1},
320        "polarity": "positive",
321    },
322    "[M-H+2Na]+": {
323        "add": {"Na": 2},
324        "sub": {"H": 1},
325        "polarity": "positive",
326    },
327    "[M+C2H3Na2O2]+": {
328        "add": {"C": 2, "H": 3, "Na": 2, "O": 2},
329        "sub": {},
330        "polarity": "positive",
331    },
332    "[M+C4H10N3]+": {
333        "add": {"C": 4, "H": 10, "N": 3},
334        "sub": {},
335        "polarity": "positive",
336    },
337    "[M+NH4+ACN]+": {
338        "add": {"C": 2, "H": 7, "N": 2},
339        "sub": {},
340        "polarity": "positive",
341    },
342    "[M+H-H2O]+": {
343        "add": {},
344        "sub": {"H": 1, "O": 1},
345        "polarity": "positive",
346    },
347    "[M+H-2H2O]+": {
348        "add": {},
349        "sub": {"H": 3, "O": 2},
350        "polarity": "positive",
351    },
352    "[M+H-NH3]+": {
353        "add": {},
354        "sub": {"N": 1, "H": 2},
355        "polarity": "positive",
356    },
357    "[M+2H-NH3]2+": {
358        "add": {},
359        "sub": {"N": 1, "H": 1},
360        "polarity": "positive",
361    },
362    "[M+2H-H2O]2+": {
363        "add": {},
364        "sub": {"O": 1},
365        "polarity": "positive",
366    },
367    "[M+NH4-H2O]+": {
368        "add": {"N": 1, "H": 2},
369        "sub": {},
370        "polarity": "positive",
371    },
372    "[M+H+H2O]+": {
373        "add": {"H": 3, "O": 1},
374        "sub": {},
375        "polarity": "positive",
376    },
377    "de-protonated": {
378        "add": {},
379        "sub": {"H": 1},
380        "polarity": "negative",
381    },
382    "[M-H]-": {
383        "add": {},
384        "sub": {"H": 1},
385        "polarity": "negative",
386    },
387    "[M-2H]2-": {
388        "add": {},
389        "sub": {"H": 2},
390        "polarity": "negative",
391    },
392    "[M-H-H2O]-": {
393        "add": {},
394        "sub": {"H": 3, "O": 1},
395        "polarity": "negative",
396    },
397    "[M-H+H2O]-": {
398        "add": {"H": 1, "O": 1},
399        "sub": {},
400        "polarity": "negative",
401    },
402    "[M+Cl]-": {
403        "add": {"Cl": 1},
404        "sub": {},
405        "polarity": "negative",
406    },
407    "[M+HCOO]-": {
408        "add": {"C": 1, "H": 1, "O": 2},
409        "sub": {},
410        "polarity": "negative",
411    },
412    "[M+CH3COO]-": {
413        "add": {"C": 2, "H": 3, "O": 2},
414        "sub": {},
415        "polarity": "negative",
416    },
417    "[M+2NaAc+Cl]-": {
418        "add": {"Na": 2, "C": 2, "H": 3, "O": 2, "Cl": 1},
419        "sub": {},
420        "polarity": "negative",
421    },
422    "[M+K-2H]-": {
423        "add": {"K": 1},
424        "sub": {"H": 2},
425        "polarity": "negative",
426    },
427    "[M+Na-2H]-": {
428        "add": {"Na": 1},
429        "sub": {"H": 2},
430        "polarity": "negative",
431    },
432}
433
434ADDUCT_ALIASES = {
435    "[M+HCOOH-H]-": "[M+HCOO]-",
436    "[M+CH3COOH-H]-": "[M+CH3COO]-",
437    "[M+FA-H]-": "[M+HCOO]-",
438    "[M+AcOH-H]-": "[M+CH3COO]-",
439}
DEFAULT_HDF5_COMPRESSION = 4
class Labels:
10class Labels:  # pragma: no cover
11    """Class for Labels used in CoreMS
12
13    These labels are used to define:
14    * types of columns in plaintext data inputs,
15    * types of data/mass spectra
16    * types of assignment for ions
17
18    """
19
20    mz = "m/z"
21    abundance = "Peak Height"
22    rp = "Resolving Power"
23    s2n = "S/N"
24
25    label = "label"
26    bruker_profile = "Bruker_Profile"
27    thermo_profile = "Thermo_Profile"
28    simulated_profile = "Simulated Profile"
29    booster_profile = "Booster Profile"
30    bruker_frequency = "Bruker_Frequency"
31    midas_frequency = "Midas_Frequency"
32    thermo_centroid = "Thermo_Centroid"
33    corems_centroid = "CoreMS_Centroid"
34    gcms_centroid = "Thermo_Centroid"
35
36    unassigned = "unassigned"
37
38    radical_ion = "RADICAL"
39    protonated_de_ion = "DE_OR_PROTONATED"
40    protonated = "protonated"
41    de_protonated = "de-protonated"
42    adduct_ion = "ADDUCT"
43    neutral = "neutral"
44    ion_type = "IonType"
45
46    ion_type_translate = {
47        "protonated": "DE_OR_PROTONATED",
48        "de-protonated": "DE_OR_PROTONATED",
49        "radical": "RADICAL",
50        "adduct": "ADDUCT",
51        "ADDUCT": "ADDUCT",
52    }

Class for Labels used in CoreMS

These labels are used to define:

  • types of columns in plaintext data inputs,
  • types of data/mass spectra
  • types of assignment for ions
mz = 'm/z'
abundance = 'Peak Height'
rp = 'Resolving Power'
s2n = 'S/N'
label = 'label'
bruker_profile = 'Bruker_Profile'
thermo_profile = 'Thermo_Profile'
simulated_profile = 'Simulated Profile'
booster_profile = 'Booster Profile'
bruker_frequency = 'Bruker_Frequency'
midas_frequency = 'Midas_Frequency'
thermo_centroid = 'Thermo_Centroid'
corems_centroid = 'CoreMS_Centroid'
gcms_centroid = 'Thermo_Centroid'
unassigned = 'unassigned'
radical_ion = 'RADICAL'
protonated_de_ion = 'DE_OR_PROTONATED'
protonated = 'protonated'
de_protonated = 'de-protonated'
adduct_ion = 'ADDUCT'
neutral = 'neutral'
ion_type = 'IonType'
ion_type_translate = {'protonated': 'DE_OR_PROTONATED', 'de-protonated': 'DE_OR_PROTONATED', 'radical': 'RADICAL', 'adduct': 'ADDUCT', 'ADDUCT': 'ADDUCT'}
class Atoms:
 55class Atoms:  # pragma: no cover
 56    """Class for Atoms in CoreMS
 57
 58    Public API for exact masses, isotopic abundances, rare-isotope lists,
 59    formula-string order, English names, and covalence. Do not use
 60    ``nist_atoms.isotopes`` as ``Atoms.isotopes``: the generated module stores
 61    a list of rare keys (or ``[None]``); this class stores
 62    ``[English name, rare keys]``.
 63
 64    IUPAC monoisotopic mass uses the most abundant isotope of each element.
 65    Bare element symbols are the most abundant isotope (C, Cl). Rare isotopes
 66    use mass-number keys (13C, 37Cl). Hydrogen uses H and D. Masses and
 67    abundances may also be looked up by nuclide key (12C, 1H). Formula strings
 68    and mass-list columns use ``atoms_order`` (canonical keys only).
 69
 70    Masses, abundances, rare lists, and ``atoms_order`` come from a pinned NIST
 71    snapshot (``corems.encapsulation.nist_atoms``). English names and covalence
 72    are hand-maintained. ``Atoms.isotopes`` membership is not enough to search
 73    an element: ``usedAtoms`` still needs a valence in
 74    ``used_atom_valences`` (usually from ``atoms_covalence``). Pin deltas
 75    and breaking notes are in ``tools/nist_atoms/CHANGES.md``.
 76
 77    References
 78    ----------
 79
 80    1. NIST Atomic Weights and Isotopic Compositions (Coursey et al., version 4.1)
 81    https://www.nist.gov/pml/atomic-weights-and-isotopic-compositions-relative-atomic-masses
 82
 83    """
 84
 85    electron_mass = 0.0005_485_799_090_65  # NIST value
 86
 87    atomic_masses = nist_atoms.atomic_masses
 88    isotopic_abundance = nist_atoms.isotopic_abundance
 89    atoms_order = nist_atoms.atoms_order
 90
 91    # Not a NIST field (the dump has no name column).
 92    element_names = {
 93        "H": "Hydrogen",
 94        "He": "Helium",
 95        "Li": "Lithium",
 96        "Be": "Beryllium",
 97        "B": "Boron",
 98        "C": "Carbon",
 99        "N": "Nitrogen",
100        "O": "Oxygen",
101        "F": "Fluorine",
102        "Ne": "Neon",
103        "Na": "Sodium",
104        "Mg": "Magnesium",
105        "Al": "Aluminum",
106        "Si": "Silicon",
107        "P": "Phosphorus",
108        "S": "Sulfur",
109        "Cl": "Chlorine",
110        "Ar": "Argon",
111        "K": "Potassium",
112        "Ca": "Calcium",
113        "Sc": "Scandium",
114        "Ti": "Titanium",
115        "V": "Vanadium",
116        "Cr": "Chromium",
117        "Mn": "Manganese",
118        "Fe": "Iron",
119        "Co": "Cobalt",
120        "Ni": "Nickel",
121        "Cu": "Copper",
122        "Zn": "Zinc",
123        "Ga": "Gallium",
124        "Ge": "Germanium",
125        "As": "Arsenic",
126        "Se": "Selenium",
127        "Br": "Bromine",
128        "Kr": "Krypton",
129        "Rb": "Rubidium",
130        "Sr": "Strontium",
131        "Y": "Yttrium",
132        "Zr": "Zirconium",
133        "Nb": "Niobium",
134        "Mo": "Molybdenum",
135        "Ru": "Ruthenium",
136        "Rh": "Rhodium",
137        "Pd": "Palladium",
138        "Ag": "Silver",
139        "Cd": "Cadmium",
140        "In": "Indium",
141        "Sn": "Tin",
142        "Sb": "Antimony",
143        "Te": "Tellurium",
144        "I": "Iodine",
145        "Xe": "Xenon",
146        "Cs": "Cesium",
147        "Ba": "Barium",
148        "La": "Lanthanum",
149        "Ce": "Cerium",
150        "Pr": "Praseodymium",
151        "Nd": "Neodymium",
152        "Sm": "Samarium",
153        "Eu": "Europium",
154        "Gd": "Gadolinium",
155        "Tb": "Terbium",
156        "Dy": "Dysprosium",
157        "Ho": "Holmium",
158        "Er": "Erbium",
159        "Tm": "Thulium",
160        "Yb": "Ytterbium",
161        "Lu": "Lutetium",
162        "Hf": "Hafnium",
163        "Ta": "Tantalum",
164        "W": "Tungsten",
165        "Re": "Rhenium",
166        "Os": "Osmium",
167        "Ir": "Iridium",
168        "Pt": "Platinum",
169        "Au": "Gold",
170        "Hg": "Mercury",
171        "Tl": "Thallium",
172        "Pb": "Lead",
173        "Bi": "Bismuth",
174        "Th": "Thorium",
175        "Pa": "Protactinium",
176        "U": "Uranium",
177    }
178
179    isotopes = {}
180    for symbol, rares in nist_atoms.isotopes.items():
181        isotopes[symbol] = [element_names.get(symbol, symbol), list(rares)]
182    del symbol, rares
183
184    atoms_covalence = {
185        "C": (4),
186        "13C": (4),
187        "N": (3),
188        "O": (2),
189        "S": (2),
190        "H": (1),
191        "F": (1, 0),
192        "Cl": (1, 0),
193        "Br": (1, 0),
194        "I": (1, 0),
195        "Li": (1, 0),
196        "Na": (1, 0),
197        "K": (1, 0),
198        "Rb": (1),
199        "Cs": (1),
200        "B": (4, 3, 2, 1),
201        "In": (3, 2, 1),
202        "Al": (3, 1, 2),
203        "P": (3, 5, 4, 2, 1),
204        "Ga": (3, 1, 2),
205        "Mg": (2, 1),
206        "Be": (2, 1),
207        "Ca": (2, 1),
208        "Sr": (2, 1),
209        "Ba": (2),
210        "V": (5, 4, 3, 2, 1),
211        "Fe": (3, 2, 4, 5, 6),
212        "Si": (4, 3, 2),
213        "Sc": (3, 2, 1),
214        "Ti": (4, 3, 2, 1),
215        "Cr": (1, 2, 3, 4, 5, 6),
216        "Mn": (1, 2, 3, 4, 5, 6, 7),
217        "Co": (1, 2, 3, 4, 5),
218        "Ni": (1, 2, 3, 4),
219        "Cu": (2, 1, 3, 4),
220        "Zn": (2, 1),
221        "Ge": (4, 3, 2, 1),
222        "As": (5, 3, 2, 1),
223        "Se": (6, 4, 2, 1),
224        "Y": (3, 2, 1),
225        "Zr": (4, 3, 2, 1),
226        "Nb": (5, 4, 3, 2, 1),
227        "Mo": (6, 5, 4, 3, 2, 1),
228        "Ru": (8, 7, 6, 5, 4, 3, 2, 1),
229        "Rh": (6, 5, 4, 3, 2, 1),
230        "Pd": (4, 2, 1),
231        "Ag": (0, 1, 2, 3, 4),
232        "Cd": (2, 1),
233        "Sn": (4, 2),
234        "Sb": (5, 3),
235        "Te": (6, 5, 4, 2),
236        "La": (3, 2),
237        "Hf": (4, 3, 2),
238        "Ta": (5, 4, 3, 2),
239        "W": (6, 5, 4, 3, 2, 1),
240        "Re": (4, 7, 6, 5, 3, 2, 1),
241        "Os": (4, 8, 7, 6, 5, 3, 2, 1),
242        "Ir": (4, 8, 6, 5, 3, 2, 1),
243        "Pt": (4, 6, 5, 3, 2, 1),
244        "Au": (3, 5, 2, 1),
245        "Hg": (1, 2, 4),
246        "Tl": (3, 1),
247        "Pb": (4, 2),
248        "Bi": (3, 1, 5),
249    }

Class for Atoms in CoreMS

Public API for exact masses, isotopic abundances, rare-isotope lists, formula-string order, English names, and covalence. Do not use nist_atoms.isotopes as Atoms.isotopes: the generated module stores a list of rare keys (or [None]); this class stores [English name, rare keys].

IUPAC monoisotopic mass uses the most abundant isotope of each element. Bare element symbols are the most abundant isotope (C, Cl). Rare isotopes use mass-number keys (13C, 37Cl). Hydrogen uses H and D. Masses and abundances may also be looked up by nuclide key (12C, 1H). Formula strings and mass-list columns use atoms_order (canonical keys only).

Masses, abundances, rare lists, and atoms_order come from a pinned NIST snapshot (corems.encapsulation.nist_atoms). English names and covalence are hand-maintained. Atoms.isotopes membership is not enough to search an element: usedAtoms still needs a valence in used_atom_valences (usually from atoms_covalence). Pin deltas and breaking notes are in tools/nist_atoms/CHANGES.md.

References
  1. NIST Atomic Weights and Isotopic Compositions (Coursey et al., version 4.1) https://www.nist.gov/pml/atomic-weights-and-isotopic-compositions-relative-atomic-masses
electron_mass = 0.000548579909065
atomic_masses = {'C': 12.0, 'H': 1.00782503223, 'O': 15.99491461957, 'N': 14.00307400443, 'P': 30.97376199842, 'S': 31.9720711744, 'F': 18.99840316273, 'Cl': 34.968852682, 'Br': 78.9183376, 'I': 126.9044719, 'Li': 7.0160034366, 'Na': 22.989769282, 'K': 38.9637064864, 'Rb': 84.9117897379, 'Cs': 132.905451961, 'He': 4.00260325413, 'Ne': 19.9924401762, 'Ar': 39.9623831237, 'Kr': 83.9114977282, 'Xe': 131.9041550856, 'Be': 9.012183065, 'B': 11.00930536, 'Mg': 23.985041697, 'Al': 26.98153853, 'Si': 27.97692653465, 'Ca': 39.962590863, 'Sc': 44.95590828, 'Ti': 47.94794198, 'V': 50.94395704, 'Cr': 51.94050623, 'Mn': 54.93804391, 'Fe': 55.93493633, 'Co': 58.93319429, 'Ni': 57.93534241, 'Cu': 62.92959772, 'Zn': 63.92914201, 'Ga': 68.9255735, 'Ge': 73.921177761, 'As': 74.92159457, 'Se': 79.9165218, 'Sr': 87.9056125, 'Y': 88.9058403, 'Zr': 89.9046977, 'Nb': 92.906373, 'Mo': 97.90540482, 'Ru': 101.9043441, 'Rh': 102.905498, 'Pd': 105.9034804, 'Ag': 106.9050916, 'Cd': 113.90336509, 'In': 114.903878776, 'Sn': 119.90220163, 'Sb': 120.903812, 'Te': 129.906222748, 'Ba': 137.905247, 'La': 138.9063563, 'Hf': 179.946557, 'Ta': 180.9479958, 'W': 183.95093092, 'Re': 186.9557501, 'Os': 191.961477, 'Ir': 192.9629216, 'Pt': 194.9647917, 'Au': 196.96656879, 'Hg': 201.9706434, 'Tl': 204.9744278, 'Pb': 207.9766525, 'Bi': 208.9803991, 'Ce': 139.9054431, 'Pr': 140.9076576, 'Nd': 141.907729, 'Sm': 151.9197397, 'Eu': 152.921238, 'Gd': 157.9241123, 'Tb': 158.9253547, 'Dy': 163.9291819, 'Ho': 164.9303288, 'Er': 165.9302995, 'Tm': 168.9342179, 'Yb': 173.9388664, 'Lu': 174.9407752, 'Th': 232.0380558, 'Pa': 231.0358842, 'U': 238.0507884, 'D': 2.01410177812, '3He': 3.0160293201, '6Li': 6.0151228874, '10B': 10.01293695, '13C': 13.00335483507, '15N': 15.00010889888, '17O': 16.9991317565, '18O': 17.99915961286, '21Ne': 20.993846685, '22Ne': 21.991385114, '25Mg': 24.985836976, '26Mg': 25.982592968, '29Si': 28.9764946649, '30Si': 29.973770136, '33S': 32.9714589098, '34S': 33.967867004, '36Ar': 35.967545105, '36S': 35.96708071, '37Cl': 36.965902602, '38Ar': 37.96273211, '40K': 39.963998166, '41K': 40.9618252579, '42Ca': 41.95861783, '43Ca': 42.95876644, '44Ca': 43.95548156, '46Ca': 45.953689, '46Ti': 45.95262772, '47Ti': 46.95175879, '48Ca': 47.95252276, '49Ti': 48.94786568, '50Cr': 49.94604183, '50Ti': 49.94478689, '50V': 49.94715601, '53Cr': 52.94064815, '54Cr': 53.93887916, '54Fe': 53.93960899, '57Fe': 56.93539284, '58Fe': 57.93327443, '60Ni': 59.93078588, '61Ni': 60.93105557, '62Ni': 61.92834537, '64Ni': 63.92796682, '65Cu': 64.9277897, '66Zn': 65.92603381, '67Zn': 66.92712775, '68Zn': 67.92484455, '70Ge': 69.92424875, '70Zn': 69.9253192, '71Ga': 70.92470258, '72Ge': 71.922075826, '73Ge': 72.923458956, '74Se': 73.922475934, '76Ge': 75.921402726, '76Se': 75.919213704, '77Se': 76.919914154, '78Kr': 77.92036494, '78Se': 77.91730928, '80Kr': 79.91637808, '81Br': 80.9162897, '82Kr': 81.91348273, '82Se': 81.9166995, '83Kr': 82.91412716, '84Sr': 83.9134191, '86Kr': 85.9106106269, '86Sr': 85.9092606, '87Rb': 86.909180531, '87Sr': 86.9088775, '91Zr': 90.9056396, '92Mo': 91.90680796, '92Zr': 91.9050347, '94Mo': 93.9050849, '94Zr': 93.9063108, '95Mo': 94.90583877, '96Mo': 95.90467612, '96Ru': 95.90759025, '96Zr': 95.9082714, '97Mo': 96.90601812, '98Ru': 97.9052868, '99Ru': 98.9059341, '100Mo': 99.9074718, '100Ru': 99.9042143, '101Ru': 100.9055769, '102Pd': 101.9056022, '104Pd': 103.9040305, '104Ru': 103.9054275, '105Pd': 104.9050796, '106Cd': 105.9064599, '108Cd': 107.9041834, '108Pd': 107.9038916, '109Ag': 108.9047553, '110Cd': 109.90300661, '110Pd': 109.9051722, '111Cd': 110.90418287, '112Cd': 111.90276287, '112Sn': 111.90482387, '113Cd': 112.90440813, '113In': 112.90406184, '114Sn': 113.9027827, '115Sn': 114.903344699, '116Cd': 115.90476315, '116Sn': 115.9017428, '117Sn': 116.90295398, '118Sn': 117.90160657, '119Sn': 118.90331117, '120Te': 119.9040593, '122Sn': 121.9034438, '122Te': 121.9030435, '123Sb': 122.9042132, '123Te': 122.9042698, '124Sn': 123.9052766, '124Te': 123.9028171, '124Xe': 123.905892, '125Te': 124.9044299, '126Te': 125.9033109, '126Xe': 125.9042983, '128Te': 127.90446128, '128Xe': 127.903531, '129Xe': 128.9047808611, '130Ba': 129.9063207, '130Xe': 129.903509349, '131Xe': 130.90508406, '132Ba': 131.9050611, '134Ba': 133.90450818, '134Xe': 133.90539466, '135Ba': 134.90568838, '136Ba': 135.90457573, '136Ce': 135.90712921, '136Xe': 135.907214484, '137Ba': 136.90582714, '138Ce': 137.905991, '138La': 137.9071149, '142Ce': 141.9092504, '143Nd': 142.90982, '144Nd': 143.910093, '144Sm': 143.9120065, '145Nd': 144.9125793, '146Nd': 145.9131226, '147Sm': 146.9149044, '148Nd': 147.9168993, '148Sm': 147.9148292, '149Sm': 148.9171921, '150Nd': 149.9209022, '150Sm': 149.9172829, '151Eu': 150.9198578, '152Gd': 151.9197995, '154Gd': 153.9208741, '154Sm': 153.9222169, '155Gd': 154.9226305, '156Dy': 155.9242847, '156Gd': 155.9221312, '157Gd': 156.9239686, '158Dy': 157.9244159, '160Dy': 159.9252046, '160Gd': 159.9270624, '161Dy': 160.9269405, '162Dy': 161.9268056, '162Er': 161.9287884, '163Dy': 162.9287383, '164Er': 163.9292088, '167Er': 166.9320546, '168Er': 167.9323767, '168Yb': 167.9338896, '170Er': 169.9354702, '170Yb': 169.9347664, '171Yb': 170.9363302, '172Yb': 171.9363859, '173Yb': 172.9382151, '174Hf': 173.9400461, '176Hf': 175.9414076, '176Lu': 175.9426897, '176Yb': 175.9425764, '177Hf': 176.9432277, '178Hf': 177.9437058, '179Hf': 178.9458232, '180Ta': 179.9474648, '180W': 179.9467108, '182W': 181.94820394, '183W': 182.95022275, '184Os': 183.9524885, '185Re': 184.9529545, '186Os': 185.953835, '186W': 185.9543628, '187Os': 186.9557474, '188Os': 187.9558352, '189Os': 188.9581442, '190Os': 189.9584437, '190Pt': 189.9599297, '191Ir': 190.9605893, '192Pt': 191.9610387, '194Pt': 193.9626809, '196Hg': 195.9658326, '196Pt': 195.96495209, '198Hg': 197.9667686, '198Pt': 197.9678949, '199Hg': 198.96828064, '200Hg': 199.96832659, '201Hg': 200.97030284, '203Tl': 202.9723446, '204Hg': 203.97349398, '204Pb': 203.973044, '206Pb': 205.9744657, '207Pb': 206.9758973, '234U': 234.0409523, '235U': 235.0439301, '102Ru': 101.9043441, '103Rh': 102.905498, '106Pd': 105.9034804, '107Ag': 106.9050916, '114Cd': 113.90336509, '115In': 114.903878776, '11B': 11.00930536, '120Sn': 119.90220163, '121Sb': 120.903812, '127I': 126.9044719, '12C': 12.0, '130Te': 129.906222748, '132Xe': 131.9041550856, '133Cs': 132.905451961, '138Ba': 137.905247, '139La': 138.9063563, '140Ce': 139.9054431, '141Pr': 140.9076576, '142Nd': 141.907729, '14N': 14.00307400443, '152Sm': 151.9197397, '153Eu': 152.921238, '158Gd': 157.9241123, '159Tb': 158.9253547, '164Dy': 163.9291819, '165Ho': 164.9303288, '166Er': 165.9302995, '169Tm': 168.9342179, '16O': 15.99491461957, '174Yb': 173.9388664, '175Lu': 174.9407752, '180Hf': 179.946557, '181Ta': 180.9479958, '184W': 183.95093092, '187Re': 186.9557501, '192Os': 191.961477, '193Ir': 192.9629216, '195Pt': 194.9647917, '197Au': 196.96656879, '19F': 18.99840316273, '1H': 1.00782503223, '202Hg': 201.9706434, '205Tl': 204.9744278, '208Pb': 207.9766525, '209Bi': 208.9803991, '20Ne': 19.9924401762, '231Pa': 231.0358842, '232Th': 232.0380558, '238U': 238.0507884, '23Na': 22.989769282, '24Mg': 23.985041697, '27Al': 26.98153853, '28Si': 27.97692653465, '2H': 2.01410177812, '31P': 30.97376199842, '32S': 31.9720711744, '35Cl': 34.968852682, '39K': 38.9637064864, '40Ar': 39.9623831237, '40Ca': 39.962590863, '45Sc': 44.95590828, '48Ti': 47.94794198, '4He': 4.00260325413, '51V': 50.94395704, '52Cr': 51.94050623, '55Mn': 54.93804391, '56Fe': 55.93493633, '58Ni': 57.93534241, '59Co': 58.93319429, '63Cu': 62.92959772, '64Zn': 63.92914201, '69Ga': 68.9255735, '74Ge': 73.921177761, '75As': 74.92159457, '79Br': 78.9183376, '7Li': 7.0160034366, '80Se': 79.9165218, '84Kr': 83.9114977282, '85Rb': 84.9117897379, '88Sr': 87.9056125, '89Y': 88.9058403, '90Zr': 89.9046977, '93Nb': 92.906373, '98Mo': 97.90540482, '9Be': 9.012183065}
isotopic_abundance = {'C': 0.9893, 'H': 0.999885, 'O': 0.99757, 'N': 0.99636, 'P': 1, 'S': 0.9499, 'F': 1, 'Cl': 0.7576, 'Br': 0.5069, 'I': 1, 'Li': 0.9241, 'Na': 1, 'K': 0.932581, 'Rb': 0.7217, 'Cs': 1, 'He': 0.99999866, 'Ne': 0.9048, 'Ar': 0.996035, 'Kr': 0.56987, 'Xe': 0.269086, 'Be': 1, 'B': 0.801, 'Mg': 0.7899, 'Al': 1, 'Si': 0.92223, 'Ca': 0.96941, 'Sc': 1, 'Ti': 0.7372, 'V': 0.9975, 'Cr': 0.83789, 'Mn': 1, 'Fe': 0.91754, 'Co': 1, 'Ni': 0.68077, 'Cu': 0.6915, 'Zn': 0.4917, 'Ga': 0.60108, 'Ge': 0.365, 'As': 1, 'Se': 0.4961, 'Sr': 0.8258, 'Y': 1, 'Zr': 0.5145, 'Nb': 1, 'Mo': 0.2439, 'Ru': 0.3155, 'Rh': 1, 'Pd': 0.2733, 'Ag': 0.51839, 'Cd': 0.2873, 'In': 0.9571, 'Sn': 0.3258, 'Sb': 0.5721, 'Te': 0.3408, 'Ba': 0.71698, 'La': 0.9991119, 'Hf': 0.3508, 'Ta': 0.9998799, 'W': 0.3064, 'Re': 0.626, 'Os': 0.4078, 'Ir': 0.627, 'Pt': 0.3378, 'Au': 1, 'Hg': 0.2986, 'Tl': 0.7048, 'Pb': 0.524, 'Bi': 1, 'Ce': 0.8845, 'Pr': 1, 'Nd': 0.27152, 'Sm': 0.2675, 'Eu': 0.5219, 'Gd': 0.2484, 'Tb': 1, 'Dy': 0.2826, 'Ho': 1, 'Er': 0.33503, 'Tm': 1, 'Yb': 0.32026, 'Lu': 0.97401, 'Th': 1, 'Pa': 1, 'U': 0.992742, 'D': 0.000115, '3He': 1.34e-06, '6Li': 0.0759, '10B': 0.199, '13C': 0.0107, '15N': 0.00364, '17O': 0.00038, '18O': 0.00205, '21Ne': 0.0027, '22Ne': 0.0925, '25Mg': 0.1, '26Mg': 0.1101, '29Si': 0.04685, '30Si': 0.03092, '33S': 0.0075, '34S': 0.0425, '36Ar': 0.003336, '36S': 0.0001, '37Cl': 0.2424, '38Ar': 0.000629, '40K': 0.000117, '41K': 0.067302, '42Ca': 0.00647, '43Ca': 0.00135, '44Ca': 0.02086, '46Ca': 4e-05, '46Ti': 0.0825, '47Ti': 0.0744, '48Ca': 0.00187, '49Ti': 0.0541, '50Cr': 0.04345, '50Ti': 0.0518, '50V': 0.0025, '53Cr': 0.09501, '54Cr': 0.02365, '54Fe': 0.05845, '57Fe': 0.02119, '58Fe': 0.00282, '60Ni': 0.26223, '61Ni': 0.011399, '62Ni': 0.036346, '64Ni': 0.009255, '65Cu': 0.3085, '66Zn': 0.2773, '67Zn': 0.0404, '68Zn': 0.1845, '70Ge': 0.2057, '70Zn': 0.0061, '71Ga': 0.39892, '72Ge': 0.2745, '73Ge': 0.0775, '74Se': 0.0089, '76Ge': 0.0773, '76Se': 0.0937, '77Se': 0.0763, '78Kr': 0.00355, '78Se': 0.2377, '80Kr': 0.02286, '81Br': 0.4931, '82Kr': 0.11593, '82Se': 0.0873, '83Kr': 0.115, '84Sr': 0.0056, '86Kr': 0.17279, '86Sr': 0.0986, '87Rb': 0.2783, '87Sr': 0.07, '91Zr': 0.1122, '92Mo': 0.1453, '92Zr': 0.1715, '94Mo': 0.0915, '94Zr': 0.1738, '95Mo': 0.1584, '96Mo': 0.1667, '96Ru': 0.0554, '96Zr': 0.028, '97Mo': 0.096, '98Ru': 0.0187, '99Ru': 0.1276, '100Mo': 0.0982, '100Ru': 0.126, '101Ru': 0.1706, '102Pd': 0.0102, '104Pd': 0.1114, '104Ru': 0.1862, '105Pd': 0.2233, '106Cd': 0.0125, '108Cd': 0.0089, '108Pd': 0.2646, '109Ag': 0.48161, '110Cd': 0.1249, '110Pd': 0.1172, '111Cd': 0.128, '112Cd': 0.2413, '112Sn': 0.0097, '113Cd': 0.1222, '113In': 0.0429, '114Sn': 0.0066, '115Sn': 0.0034, '116Cd': 0.0749, '116Sn': 0.1454, '117Sn': 0.0768, '118Sn': 0.2422, '119Sn': 0.0859, '120Te': 0.0009, '122Sn': 0.0463, '122Te': 0.0255, '123Sb': 0.4279, '123Te': 0.0089, '124Sn': 0.0579, '124Te': 0.0474, '124Xe': 0.000952, '125Te': 0.0707, '126Te': 0.1884, '126Xe': 0.00089, '128Te': 0.3174, '128Xe': 0.019102, '129Xe': 0.264006, '130Ba': 0.00106, '130Xe': 0.04071, '131Xe': 0.212324, '132Ba': 0.00101, '134Ba': 0.02417, '134Xe': 0.104357, '135Ba': 0.06592, '136Ba': 0.07854, '136Ce': 0.00185, '136Xe': 0.088573, '137Ba': 0.11232, '138Ce': 0.00251, '138La': 0.0008881, '142Ce': 0.11114, '143Nd': 0.12174, '144Nd': 0.23798, '144Sm': 0.0307, '145Nd': 0.08293, '146Nd': 0.17189, '147Sm': 0.1499, '148Nd': 0.05756, '148Sm': 0.1124, '149Sm': 0.1382, '150Nd': 0.05638, '150Sm': 0.0738, '151Eu': 0.4781, '152Gd': 0.002, '154Gd': 0.0218, '154Sm': 0.2275, '155Gd': 0.148, '156Dy': 0.00056, '156Gd': 0.2047, '157Gd': 0.1565, '158Dy': 0.00095, '160Dy': 0.02329, '160Gd': 0.2186, '161Dy': 0.18889, '162Dy': 0.25475, '162Er': 0.00139, '163Dy': 0.24896, '164Er': 0.01601, '167Er': 0.22869, '168Er': 0.26978, '168Yb': 0.00123, '170Er': 0.1491, '170Yb': 0.02982, '171Yb': 0.1409, '172Yb': 0.2168, '173Yb': 0.16103, '174Hf': 0.0016, '176Hf': 0.0526, '176Lu': 0.02599, '176Yb': 0.12996, '177Hf': 0.186, '178Hf': 0.2728, '179Hf': 0.1362, '180Ta': 0.0001201, '180W': 0.0012, '182W': 0.265, '183W': 0.1431, '184Os': 0.0002, '185Re': 0.374, '186Os': 0.0159, '186W': 0.2843, '187Os': 0.0196, '188Os': 0.1324, '189Os': 0.1615, '190Os': 0.2626, '190Pt': 0.00012, '191Ir': 0.373, '192Pt': 0.00782, '194Pt': 0.3286, '196Hg': 0.0015, '196Pt': 0.2521, '198Hg': 0.0997, '198Pt': 0.07356, '199Hg': 0.1687, '200Hg': 0.231, '201Hg': 0.1318, '203Tl': 0.2952, '204Hg': 0.0687, '204Pb': 0.014, '206Pb': 0.241, '207Pb': 0.221, '234U': 5.4e-05, '235U': 0.007204, '102Ru': 0.3155, '103Rh': 1, '106Pd': 0.2733, '107Ag': 0.51839, '114Cd': 0.2873, '115In': 0.9571, '11B': 0.801, '120Sn': 0.3258, '121Sb': 0.5721, '127I': 1, '12C': 0.9893, '130Te': 0.3408, '132Xe': 0.269086, '133Cs': 1, '138Ba': 0.71698, '139La': 0.9991119, '140Ce': 0.8845, '141Pr': 1, '142Nd': 0.27152, '14N': 0.99636, '152Sm': 0.2675, '153Eu': 0.5219, '158Gd': 0.2484, '159Tb': 1, '164Dy': 0.2826, '165Ho': 1, '166Er': 0.33503, '169Tm': 1, '16O': 0.99757, '174Yb': 0.32026, '175Lu': 0.97401, '180Hf': 0.3508, '181Ta': 0.9998799, '184W': 0.3064, '187Re': 0.626, '192Os': 0.4078, '193Ir': 0.627, '195Pt': 0.3378, '197Au': 1, '19F': 1, '1H': 0.999885, '202Hg': 0.2986, '205Tl': 0.7048, '208Pb': 0.524, '209Bi': 1, '20Ne': 0.9048, '231Pa': 1, '232Th': 1, '238U': 0.992742, '23Na': 1, '24Mg': 0.7899, '27Al': 1, '28Si': 0.92223, '2H': 0.000115, '31P': 1, '32S': 0.9499, '35Cl': 0.7576, '39K': 0.932581, '40Ar': 0.996035, '40Ca': 0.96941, '45Sc': 1, '48Ti': 0.7372, '4He': 0.99999866, '51V': 0.9975, '52Cr': 0.83789, '55Mn': 1, '56Fe': 0.91754, '58Ni': 0.68077, '59Co': 1, '63Cu': 0.6915, '64Zn': 0.4917, '69Ga': 0.60108, '74Ge': 0.365, '75As': 1, '79Br': 0.5069, '7Li': 0.9241, '80Se': 0.4961, '84Kr': 0.56987, '85Rb': 0.7217, '88Sr': 0.8258, '89Y': 1, '90Zr': 0.5145, '93Nb': 1, '98Mo': 0.2439, '9Be': 1}
atoms_order = ['C', 'H', 'O', 'N', 'P', 'S', 'F', 'Cl', 'Br', 'I', 'Li', 'Na', 'K', 'Rb', 'Cs', 'He', 'Ne', 'Ar', 'Kr', 'Xe', 'Be', 'B', 'Mg', 'Al', 'Si', 'Ca', 'Sc', 'Ti', 'V', 'Cr', 'Mn', 'Fe', 'Co', 'Ni', 'Cu', 'Zn', 'Ga', 'Ge', 'As', 'Se', 'Sr', 'Y', 'Zr', 'Nb', 'Mo', 'Ru', 'Rh', 'Pd', 'Ag', 'Cd', 'In', 'Sn', 'Sb', 'Te', 'Ba', 'La', 'Hf', 'Ta', 'W', 'Re', 'Os', 'Ir', 'Pt', 'Au', 'Hg', 'Tl', 'Pb', 'Bi', 'Ce', 'Pr', 'Nd', 'Sm', 'Eu', 'Gd', 'Tb', 'Dy', 'Ho', 'Er', 'Tm', 'Yb', 'Lu', 'Th', 'Pa', 'U', 'D', '3He', '6Li', '10B', '13C', '15N', '17O', '18O', '21Ne', '22Ne', '25Mg', '26Mg', '29Si', '30Si', '33S', '34S', '36Ar', '36S', '37Cl', '38Ar', '40K', '41K', '42Ca', '43Ca', '44Ca', '46Ca', '46Ti', '47Ti', '48Ca', '49Ti', '50Cr', '50Ti', '50V', '53Cr', '54Cr', '54Fe', '57Fe', '58Fe', '60Ni', '61Ni', '62Ni', '64Ni', '65Cu', '66Zn', '67Zn', '68Zn', '70Ge', '70Zn', '71Ga', '72Ge', '73Ge', '74Se', '76Ge', '76Se', '77Se', '78Kr', '78Se', '80Kr', '81Br', '82Kr', '82Se', '83Kr', '84Sr', '86Kr', '86Sr', '87Rb', '87Sr', '91Zr', '92Mo', '92Zr', '94Mo', '94Zr', '95Mo', '96Mo', '96Ru', '96Zr', '97Mo', '98Ru', '99Ru', '100Mo', '100Ru', '101Ru', '102Pd', '104Pd', '104Ru', '105Pd', '106Cd', '108Cd', '108Pd', '109Ag', '110Cd', '110Pd', '111Cd', '112Cd', '112Sn', '113Cd', '113In', '114Sn', '115Sn', '116Cd', '116Sn', '117Sn', '118Sn', '119Sn', '120Te', '122Sn', '122Te', '123Sb', '123Te', '124Sn', '124Te', '124Xe', '125Te', '126Te', '126Xe', '128Te', '128Xe', '129Xe', '130Ba', '130Xe', '131Xe', '132Ba', '134Ba', '134Xe', '135Ba', '136Ba', '136Ce', '136Xe', '137Ba', '138Ce', '138La', '142Ce', '143Nd', '144Nd', '144Sm', '145Nd', '146Nd', '147Sm', '148Nd', '148Sm', '149Sm', '150Nd', '150Sm', '151Eu', '152Gd', '154Gd', '154Sm', '155Gd', '156Dy', '156Gd', '157Gd', '158Dy', '160Dy', '160Gd', '161Dy', '162Dy', '162Er', '163Dy', '164Er', '167Er', '168Er', '168Yb', '170Er', '170Yb', '171Yb', '172Yb', '173Yb', '174Hf', '176Hf', '176Lu', '176Yb', '177Hf', '178Hf', '179Hf', '180Ta', '180W', '182W', '183W', '184Os', '185Re', '186Os', '186W', '187Os', '188Os', '189Os', '190Os', '190Pt', '191Ir', '192Pt', '194Pt', '196Hg', '196Pt', '198Hg', '198Pt', '199Hg', '200Hg', '201Hg', '203Tl', '204Hg', '204Pb', '206Pb', '207Pb', '234U', '235U']
element_names = {'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', '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', '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', 'Th': 'Thorium', 'Pa': 'Protactinium', 'U': 'Uranium'}
isotopes = {'C': ['Carbon', ['13C']], 'H': ['Hydrogen', ['D']], 'O': ['Oxygen', ['17O', '18O']], 'N': ['Nitrogen', ['15N']], 'P': ['Phosphorus', [None]], 'S': ['Sulfur', ['33S', '34S', '36S']], 'F': ['Fluorine', [None]], 'Cl': ['Chlorine', ['37Cl']], 'Br': ['Bromine', ['81Br']], 'I': ['Iodine', [None]], 'Li': ['Lithium', ['6Li']], 'Na': ['Sodium', [None]], 'K': ['Potassium', ['40K', '41K']], 'Rb': ['Rubidium', ['87Rb']], 'Cs': ['Cesium', [None]], 'He': ['Helium', ['3He']], 'Ne': ['Neon', ['21Ne', '22Ne']], 'Ar': ['Argon', ['36Ar', '38Ar']], 'Kr': ['Krypton', ['78Kr', '80Kr', '82Kr', '83Kr', '86Kr']], 'Xe': ['Xenon', ['124Xe', '126Xe', '128Xe', '129Xe', '130Xe', '131Xe', '134Xe', '136Xe']], 'Be': ['Beryllium', [None]], 'B': ['Boron', ['10B']], 'Mg': ['Magnesium', ['25Mg', '26Mg']], 'Al': ['Aluminum', [None]], 'Si': ['Silicon', ['29Si', '30Si']], 'Ca': ['Calcium', ['42Ca', '43Ca', '44Ca', '46Ca', '48Ca']], 'Sc': ['Scandium', [None]], 'Ti': ['Titanium', ['46Ti', '47Ti', '49Ti', '50Ti']], 'V': ['Vanadium', ['50V']], 'Cr': ['Chromium', ['50Cr', '53Cr', '54Cr']], 'Mn': ['Manganese', [None]], 'Fe': ['Iron', ['54Fe', '57Fe', '58Fe']], 'Co': ['Cobalt', [None]], 'Ni': ['Nickel', ['60Ni', '61Ni', '62Ni', '64Ni']], 'Cu': ['Copper', ['65Cu']], 'Zn': ['Zinc', ['66Zn', '67Zn', '68Zn', '70Zn']], 'Ga': ['Gallium', ['71Ga']], 'Ge': ['Germanium', ['70Ge', '72Ge', '73Ge', '76Ge']], 'As': ['Arsenic', [None]], 'Se': ['Selenium', ['74Se', '76Se', '77Se', '78Se', '82Se']], 'Sr': ['Strontium', ['84Sr', '86Sr', '87Sr']], 'Y': ['Yttrium', [None]], 'Zr': ['Zirconium', ['91Zr', '92Zr', '94Zr', '96Zr']], 'Nb': ['Niobium', [None]], 'Mo': ['Molybdenum', ['92Mo', '94Mo', '95Mo', '96Mo', '97Mo', '100Mo']], 'Ru': ['Ruthenium', ['96Ru', '98Ru', '99Ru', '100Ru', '101Ru', '104Ru']], 'Rh': ['Rhodium', [None]], 'Pd': ['Palladium', ['102Pd', '104Pd', '105Pd', '108Pd', '110Pd']], 'Ag': ['Silver', ['109Ag']], 'Cd': ['Cadmium', ['106Cd', '108Cd', '110Cd', '111Cd', '112Cd', '113Cd', '116Cd']], 'In': ['Indium', ['113In']], 'Sn': ['Tin', ['112Sn', '114Sn', '115Sn', '116Sn', '117Sn', '118Sn', '119Sn', '122Sn', '124Sn']], 'Sb': ['Antimony', ['123Sb']], 'Te': ['Tellurium', ['120Te', '122Te', '123Te', '124Te', '125Te', '126Te', '128Te']], 'Ba': ['Barium', ['130Ba', '132Ba', '134Ba', '135Ba', '136Ba', '137Ba']], 'La': ['Lanthanum', ['138La']], 'Hf': ['Hafnium', ['174Hf', '176Hf', '177Hf', '178Hf', '179Hf']], 'Ta': ['Tantalum', ['180Ta']], 'W': ['Tungsten', ['180W', '182W', '183W', '186W']], 'Re': ['Rhenium', ['185Re']], 'Os': ['Osmium', ['184Os', '186Os', '187Os', '188Os', '189Os', '190Os']], 'Ir': ['Iridium', ['191Ir']], 'Pt': ['Platinum', ['190Pt', '192Pt', '194Pt', '196Pt', '198Pt']], 'Au': ['Gold', [None]], 'Hg': ['Mercury', ['196Hg', '198Hg', '199Hg', '200Hg', '201Hg', '204Hg']], 'Tl': ['Thallium', ['203Tl']], 'Pb': ['Lead', ['204Pb', '206Pb', '207Pb']], 'Bi': ['Bismuth', [None]], 'Ce': ['Cerium', ['136Ce', '138Ce', '142Ce']], 'Pr': ['Praseodymium', [None]], 'Nd': ['Neodymium', ['143Nd', '144Nd', '145Nd', '146Nd', '148Nd', '150Nd']], 'Sm': ['Samarium', ['144Sm', '147Sm', '148Sm', '149Sm', '150Sm', '154Sm']], 'Eu': ['Europium', ['151Eu']], 'Gd': ['Gadolinium', ['152Gd', '154Gd', '155Gd', '156Gd', '157Gd', '160Gd']], 'Tb': ['Terbium', [None]], 'Dy': ['Dysprosium', ['156Dy', '158Dy', '160Dy', '161Dy', '162Dy', '163Dy']], 'Ho': ['Holmium', [None]], 'Er': ['Erbium', ['162Er', '164Er', '167Er', '168Er', '170Er']], 'Tm': ['Thulium', [None]], 'Yb': ['Ytterbium', ['168Yb', '170Yb', '171Yb', '172Yb', '173Yb', '176Yb']], 'Lu': ['Lutetium', ['176Lu']], 'Th': ['Thorium', [None]], 'Pa': ['Protactinium', [None]], 'U': ['Uranium', ['234U', '235U']]}
atoms_covalence = {'C': 4, '13C': 4, 'N': 3, 'O': 2, 'S': 2, 'H': 1, 'F': (1, 0), 'Cl': (1, 0), 'Br': (1, 0), 'I': (1, 0), 'Li': (1, 0), 'Na': (1, 0), 'K': (1, 0), 'Rb': 1, 'Cs': 1, 'B': (4, 3, 2, 1), 'In': (3, 2, 1), 'Al': (3, 1, 2), 'P': (3, 5, 4, 2, 1), 'Ga': (3, 1, 2), 'Mg': (2, 1), 'Be': (2, 1), 'Ca': (2, 1), 'Sr': (2, 1), 'Ba': 2, 'V': (5, 4, 3, 2, 1), 'Fe': (3, 2, 4, 5, 6), 'Si': (4, 3, 2), 'Sc': (3, 2, 1), 'Ti': (4, 3, 2, 1), 'Cr': (1, 2, 3, 4, 5, 6), 'Mn': (1, 2, 3, 4, 5, 6, 7), 'Co': (1, 2, 3, 4, 5), 'Ni': (1, 2, 3, 4), 'Cu': (2, 1, 3, 4), 'Zn': (2, 1), 'Ge': (4, 3, 2, 1), 'As': (5, 3, 2, 1), 'Se': (6, 4, 2, 1), 'Y': (3, 2, 1), 'Zr': (4, 3, 2, 1), 'Nb': (5, 4, 3, 2, 1), 'Mo': (6, 5, 4, 3, 2, 1), 'Ru': (8, 7, 6, 5, 4, 3, 2, 1), 'Rh': (6, 5, 4, 3, 2, 1), 'Pd': (4, 2, 1), 'Ag': (0, 1, 2, 3, 4), 'Cd': (2, 1), 'Sn': (4, 2), 'Sb': (5, 3), 'Te': (6, 5, 4, 2), 'La': (3, 2), 'Hf': (4, 3, 2), 'Ta': (5, 4, 3, 2), 'W': (6, 5, 4, 3, 2, 1), 'Re': (4, 7, 6, 5, 3, 2, 1), 'Os': (4, 8, 7, 6, 5, 3, 2, 1), 'Ir': (4, 8, 6, 5, 3, 2, 1), 'Pt': (4, 6, 5, 3, 2, 1), 'Au': (3, 5, 2, 1), 'Hg': (1, 2, 4), 'Tl': (3, 1), 'Pb': (4, 2), 'Bi': (3, 1, 5)}
ION_TYPE_DICT = {'M+': {'add': {}, 'sub': {}, 'polarity': 'positive'}, '[M]+': {'add': {}, 'sub': {}, 'polarity': 'positive'}, 'protonated': {'add': {'H': 1}, 'sub': {}, 'polarity': 'positive'}, '[M+H]+': {'add': {'H': 1}, 'sub': {}, 'polarity': 'positive'}, '[M+2H]2+': {'add': {'H': 2}, 'sub': {}, 'polarity': 'positive'}, '[M+3H]3+': {'add': {'H': 3}, 'sub': {}, 'polarity': 'positive'}, '[M+NH4]+': {'add': {'N': 1, 'H': 4}, 'sub': {}, 'polarity': 'positive'}, '[M+Na]+': {'add': {'Na': 1}, 'sub': {}, 'polarity': 'positive'}, '[M+K]+': {'add': {'K': 1}, 'sub': {}, 'polarity': 'positive'}, '[M+2Na]2+': {'add': {'Na': 2}, 'sub': {}, 'polarity': 'positive'}, '[M+H+Na]2+': {'add': {'H': 1, 'Na': 1}, 'sub': {}, 'polarity': 'positive'}, '[M+H+K]2+': {'add': {'H': 1, 'K': 1}, 'sub': {}, 'polarity': 'positive'}, '[M+2Na+Cl]+': {'add': {'Na': 2, 'Cl': 1}, 'sub': {}, 'polarity': 'positive'}, '[M+2Na-H]+': {'add': {'Na': 2}, 'sub': {'H': 1}, 'polarity': 'positive'}, '[M-H+2Na]+': {'add': {'Na': 2}, 'sub': {'H': 1}, 'polarity': 'positive'}, '[M+C2H3Na2O2]+': {'add': {'C': 2, 'H': 3, 'Na': 2, 'O': 2}, 'sub': {}, 'polarity': 'positive'}, '[M+C4H10N3]+': {'add': {'C': 4, 'H': 10, 'N': 3}, 'sub': {}, 'polarity': 'positive'}, '[M+NH4+ACN]+': {'add': {'C': 2, 'H': 7, 'N': 2}, 'sub': {}, 'polarity': 'positive'}, '[M+H-H2O]+': {'add': {}, 'sub': {'H': 1, 'O': 1}, 'polarity': 'positive'}, '[M+H-2H2O]+': {'add': {}, 'sub': {'H': 3, 'O': 2}, 'polarity': 'positive'}, '[M+H-NH3]+': {'add': {}, 'sub': {'N': 1, 'H': 2}, 'polarity': 'positive'}, '[M+2H-NH3]2+': {'add': {}, 'sub': {'N': 1, 'H': 1}, 'polarity': 'positive'}, '[M+2H-H2O]2+': {'add': {}, 'sub': {'O': 1}, 'polarity': 'positive'}, '[M+NH4-H2O]+': {'add': {'N': 1, 'H': 2}, 'sub': {}, 'polarity': 'positive'}, '[M+H+H2O]+': {'add': {'H': 3, 'O': 1}, 'sub': {}, 'polarity': 'positive'}, 'de-protonated': {'add': {}, 'sub': {'H': 1}, 'polarity': 'negative'}, '[M-H]-': {'add': {}, 'sub': {'H': 1}, 'polarity': 'negative'}, '[M-2H]2-': {'add': {}, 'sub': {'H': 2}, 'polarity': 'negative'}, '[M-H-H2O]-': {'add': {}, 'sub': {'H': 3, 'O': 1}, 'polarity': 'negative'}, '[M-H+H2O]-': {'add': {'H': 1, 'O': 1}, 'sub': {}, 'polarity': 'negative'}, '[M+Cl]-': {'add': {'Cl': 1}, 'sub': {}, 'polarity': 'negative'}, '[M+HCOO]-': {'add': {'C': 1, 'H': 1, 'O': 2}, 'sub': {}, 'polarity': 'negative'}, '[M+CH3COO]-': {'add': {'C': 2, 'H': 3, 'O': 2}, 'sub': {}, 'polarity': 'negative'}, '[M+2NaAc+Cl]-': {'add': {'Na': 2, 'C': 2, 'H': 3, 'O': 2, 'Cl': 1}, 'sub': {}, 'polarity': 'negative'}, '[M+K-2H]-': {'add': {'K': 1}, 'sub': {'H': 2}, 'polarity': 'negative'}, '[M+Na-2H]-': {'add': {'Na': 1}, 'sub': {'H': 2}, 'polarity': 'negative'}}
ADDUCT_ALIASES = {'[M+HCOOH-H]-': '[M+HCOO]-', '[M+CH3COOH-H]-': '[M+CH3COO]-', '[M+FA-H]-': '[M+HCOO]-', '[M+AcOH-H]-': '[M+CH3COO]-'}