Source code for spinguin.core.nmr_isotopes

"""
This module contains a dictionary of NMR isotopes with the following properties:

- Spin quantum number
- Gyromagnetic ratio (gamma) in MHz/T
- Quadrupole moment (Q) in barns

Source: https://www.kherb.io/docs/nmr_table.html

If your isotope is not listed, you can add it by following the format of the
existing entries.

TODO: Mahdollista oman isotoopin lisääminen suoraan paketista?
TODO: Tarkista kvadrupolimomentit?
"""

# Imports
import numpy as np
from typing import Literal

ISOTOPES = {
    '1H': [0.5, 42.577478615342585, 0],
    '2D': [1.0, 6.5359028540009305, 0],
    '3T': [0.5, 45.41483815473964, 0],
    '3He': [0.5, -32.43604456417949, 0],
    '6Li': [1.0, 6.266099405837534, 0],
    '7Li': [1.5, 16.548177299618295, 0],
    '9Be': [1.5, -5.983379963834242, 0],
    '10B': [3.0, 4.57473388220653, 0],
    '11B': [1.5, 13.66160796005943, 0],
    '13C': [0.5, 10.707746367473971, 0],
    '14N': [1.0, 3.076272817251739, 20.44e-3],
    '15N': [0.5, -4.3152552187859134, 0],
    '17O': [2.5, -5.7734832203316975, 0],
    '19F': [0.5, 40.06924371705693, 0],
    '21Ne': [1.5, -3.362579959801532, 0],
    '22Na': [3.0, 4.436349259342206, 0],
    '23Na': [1.5, 11.268733657034751, 0],
    '25Mg': [2.5, -2.607933066661972, 0],
    '26Al': [5.0, 4.273225764239245, 0],
    '27Al': [2.5, 11.100630067688776, 0],
    '29Si': [0.5, -8.461871234008282, 0],
    '31P': [0.5, 17.241162495263175, 0],
    '33S': [1.5, 3.2688220630834754, 0],
    '35Cl': [1.5, 4.175656570906633, 0],
    '37Cl': [1.5, 3.4759025124743057, 0],
    '39Ar': [3.5, -3.462835209795831, 0],
    '39K': [1.5, 1.9893443809332112, 0],
    '41K': [1.5, 1.091921234883595, 0],
    '43Ca': [3.5, -2.868991639572541, 0],
    '45Sc': [3.5, 10.35365948891156, 0],
    '53Mn': [3.5, 10.961289063460638, 0],
    '60Co': [5.0, 5.7916463354780205, 0],
    '63Ni': [0.5, 7.561612483277437, 0],
    '69Ga': [1.5, 10.23978520568125, 0],
    '71Ga': [1.5, 13.010902748192017, 0],
    '73Ge': [4.5, -1.4876591727852992, 0],
    '77Se': [0.5, 8.134221686648205, 0],
    '79Se': [3.5, -2.21708568778123, 0],
    '81Kr': [3.5, -1.9753405882294452, 0],
    '83Kr': [4.5, -1.6443288722876133, 0],
    '85Kr': [4.5, -1.703226109304539, 0],
    '85Rb': [2.5, 4.125530397832004, 0],
    '87Rb': [1.5, 13.981309683545954, 0],
    '87Sr': [4.5, -1.851714225407608, 0],
    '89Y': [0.5, -2.0931336103407774, 0],
    '91Nb': [4.5, 11.032433266932337, 0],
    '92Nb': [7.0, 5.58627189504799, 0],
    '97Tc': [4.5, 9.858553909649345, 0],
    '99Ru': [2.5, -1.954432903943886, 0],
    '101Ru': [2.5, -2.189208775400484, 0],
    '102Rh': [6.0, 5.094433141455396, 0],
    '108Ag': [6.0, 4.548147293369158, 0],
    '111Cd': [0.5, -9.05564075618306, 0],
    '113Cd': [5.5, -1.5083033111346835, 0],
    '113In': [4.5, 9.351736155393834, 0],
    '115In': [4.5, 9.371724288750167, 0],
    '121Sn': [5.5, -1.920754901131635, 0],
    '125Sb': [3.5, 5.727834340731468, 0],
    '129Xe': [0.5, -11.860160502223788, 0],
    '131Xe': [1.5, 3.5157686750625525, 0],
    '133Cs': [3.5, 5.614148807428737, 0],
    '134Cs': [4.0, 5.69655448494487, 0],
    '135Cs': [3.5, 5.941920316280481, 0],
    '137Cs': [3.5, 6.179527436650749, 0],
    '133Ba': [0.5, 11.767759427100511, 0],
    '135Ba': [1.5, 4.258996923544905, 0],
    '137Ba': [1.5, 4.7641207681939495, 0],
    '137La': [3.5, 5.871574670194692, 0],
    '138La': [5.0, 5.653524946166542, 0],
    '139La': [3.5, 6.052556812291568, 0],
    '141Pr': [2.5, 13.00719308615385, 0],
    '143Nd': [3.5, -2.319446225429283, 0],
    '145Nd': [3.5, -1.4286917595132482, 0],
    '145Pm': [2.5, 11.586341708247684, 0],
    '147Pm': [3.5, 5.618940151744178, 0],
    '147Sm': [3.5, -1.7619079778143567, 0],
    '149Sm': [3.5, -1.454172999736274, 0],
    '151Sm': [2.5, -1.099177943637708, 0],
    '150Eu': [5.0, 4.119249381011216, 0],
    '151Eu': [2.5, 10.560340659609436, 0],
    '152Eu': [3.0, -4.917588978540037, 0],
    '153Eu': [2.5, 4.663197633840536, 0],
    '154Eu': [3.0, -5.081728819406879, 0],
    '155Eu': [2.5, 4.622340534132499, 0],
    '155Gd': [1.5, -1.3166759371083223, 0],
    '157Gd': [1.5, -1.726771452834457, 0],
    '157Tb': [1.5, 10.315909503395964, 0],
    '158Tb': [3.0, 4.4541353102101295, 0],
    '159Tb': [1.5, 10.20919319818842, 0],
    '161Dy': [2.5, -1.4604888626975372, 0],
    '163Dy': [2.5, 2.04590402269321, 0],
    '163Ho': [3.5, 9.190669550527298, 0],
    '165Ho': [3.5, 9.059996523742551, 0],
    '166Ho': [7.0, 3.941969641339908, 0],
    '167Er': [3.5, -1.2246240493510665, 0],
    '169Tm': [0.5, -3.5216380718489675, 0],
    '171Tm': [0.5, -3.506392885390747, 0],
    '171Yb': [0.5, 7.505205293382021, 0],
    '173Yb': [2.5, -2.067247283734719, 0],
    '173Lu': [3.5, 4.950329831362216, 0],
    '174Lu': [1.0, 15.107979780096652, 0],
    '175Lu': [3.5, 4.847315928580239, 0],
    '176Lu': [7.0, 3.4410563719983727, 0],
    '177Hf': [3.5, 1.7227060697789325, 0],
    '178Hf': [16.0, 3.8732301845416814, 0],
    '179Hf': [4.5, -1.0822388475730185, 0],
    '179Ta': [3.5, 4.978642320498912, 0],
    '180Ta': [9.0, 4.077240422770786, 0],
    '191Ir': [1.5, 0.7632756686749131, 0],
    '193Ir': [1.5, 0.8283217975633214, 0],
    '193Pt': [0.5, 9.162357061390605, 0],
    '197Au': [1.5, 0.7378670245778789, 0],
    '199Hg': [0.5, 7.68204945629738, 0],
    '201Hg': [1.5, -2.8356046812290385, 0],
    '204Tl': [2.0, 0.3430166953099643, 0],
    '205Pb': [2.5, 2.162987054692344, 0],
    '207Pb': [0.5, 9.00380712222511, 0],
    '207Bi': [4.5, 6.899124436187426, 0],
    '208Bi': [5.0, 6.970099248698476, 0],
    '210Bi': [9.0, 2.303717064797785, 0],
    '209Po': [0.5, 10.366726791590036, 0],
    '229Th': [2.5, 1.402557154156299, 0],
    '231Pa': [1.5, 10.11264035061969, 0],
    '233U': [2.5, -1.7989320020700357, 0],
    '235U': [3.5, -0.827595836303406, 0],
    '239Pu': [0.5, 3.079527664560569, 0],
    '241Pu': [2.5, -2.067247283734719, 0],
    '241Am': [2.5, 4.878459666630606, 0],
    '242Am': [5.0, 1.524518645822064, 0],
    '243Am': [2.5, 4.634536683299075, 0],
    '243Cm': [2.5, 1.2196149166576515, 0],
    '245Cm': [3.5, 1.0889418898729026, 0],
    '247Cm': [4.5, 0.6098074583288254, 0]
}

[docs] def spin(isotope: str) -> float: """ Returns the spin quantum number of the requested isotope. Parameters ---------- isotope : str Nucleus symbol (e.g. `'1H'`) used to select the spin quantum number. Returns ------- spin : float Spin quantum number. """ return ISOTOPES[isotope][0]
[docs] def gamma(isotope: str, unit: Literal["Hz", "rad/s"]): """ Returns the gyromagnetic ratio of the requested isotope. Parameters ---------- isotope : str Nucleus symbol (e.g. `'1H'`) used to select the gyromagnetic ratio. unit : {'Hz', 'rad/s'} Specifies in which unit the gyromagnetic ratio is returned. Returns ------- gamma : float Gyromagnetic ratio in the requested units. """ if unit == "Hz": return ISOTOPES[isotope][1] * 1e6 elif unit == "rad/s": return ISOTOPES[isotope][1] * 1e6 * 2*np.pi else: raise ValueError(f"Incorrect units: {unit}")
[docs] def quadrupole_moment(isotope: str): """ Returns the quadrupole moments in the units of m^2. Parameters ---------- isotope : str Nucleus symbol (e.g. `'1H'`) used to select the quadrupole moment. Returns ------- quadrupole_moment : float Quadrupole moment in the units of m^2. """ return ISOTOPES[isotope][2] * 1e-28