Site

class mrsimulator.Site(*, name: str = None, description: str = None, label: str = None, property_units: Dict = {'isotropic_chemical_shift': 'ppm'}, isotope: str = '1H', isotropic_chemical_shift: float = 0.0, shielding_symmetric: SymmetricTensor = None, shielding_antisymmetric: AntisymmetricTensor = None, quadrupolar: SymmetricTensor = None)

Bases: Parseable

Base class representing a single-site nuclear spin interaction tensor parameters. The single-site nuclear spin interaction tensors include the nuclear shielding and the electric quadrupolar tensor.

Attribute Documentation

isotope

A string expressed as an atomic number followed by an isotope symbol, eg., ‘13C’, ‘17O’. The default value is ‘1H’.

Example

>>> site = Site(isotope='2H')
Type:

str (optional).

isotropic_chemical_shift

The isotropic chemical shift of the site in ppm. The default value is 0.

Example

>>> site.isotropic_chemical_shift = 43.3
Type:

float (optional).

shielding_symmetric

The attribute represents the parameters of the irreducible second-rank traceless symmetric part of the nuclear shielding tensor. The default value is None.

The allowed attributes of the SymmetricTensor class for shielding_symmetric are zeta, eta, alpha, beta, and gamma, where zeta is the shielding anisotropy, in ppm, and eta is the shielding asymmetry parameter defined using the Haeberlen convention. The Euler angles alpha, beta, and gamma are in radians.

Example

>>> site.shielding_symmetric = {'zeta': 10, 'eta': 0.5}
>>> # or equivalently
>>> site.shielding_symmetric = SymmetricTensor(zeta=10, eta=0.5)
Type:

SymmetricTensor or equivalent dict object (optional).

shielding_antisymmetric

The attribute represents the parameters of the irreducible first-rank antisymmetric part of the nuclear shielding tensor. The default value is None.

The allowed attributes of the AntisymmetricTensor class for shielding_antisymmetric are zeta, alpha, and beta, where zeta is the anisotropy parameter, in ppm, of the anti-symmetric first-rank tensor. The angles alpha and beta are in radians.

Example

>>> site.shielding_antisymmetric = {'zeta': 20}
>>> # or equivalently
>>> site.shielding_antisymmetric = AntisymmetricTensor(zeta=20)
Type:

AntisymmetricTensor or equivalent dict object (optional).

quadrupolar

The attribute represents the parameters of the traceless irreducible second-rank symmetric part of the electric-field gradient tensor. The default value is None.

The allowed attributes of the SymmetricTensor class for quadrupolar are Cq, eta, alpha, beta, and gamma, where Cq is the quadrupolar coupling constant, in Hz, and eta is the quadrupolar asymmetry parameter. The Euler angles alpha, beta, and gamma are in radians.

Example

>>> site.quadrupolar = {'Cq': 3.2e6, 'eta': 0.52}
>>> # or equivalently
>>> site.quadrupolar = SymmetricTensor(Cq=3.2e6, eta=0.52)
Type:

SymmetricTensor or equivalent dict object (optional).

name

The name or id of the site. The default value is None.

Example

>>> site.name = '2H-0'
>>> site.name
'2H-0'
Type:

str (optional).

label

The label for the site. The default value is None.

Example

>>> site.label = 'Quad site'
>>> site.label
'Quad site'
Type:

str (optional).

description

A description of the site. The default value is None.

Example

>>> site.description = 'An example Quadrupolar site.'
>>> site.description
'An example Quadrupolar site.'
Type:

str (optional).

Example

The following are a few examples of the site object.

>>> site1 = Site(
...     isotope='33S',
...     isotropic_chemical_shift=20, # in ppm
...     shielding_symmetric={
...         "zeta": 10, # in ppm
...         "eta": 0.5
...     },
...     quadrupolar={
...         "Cq": 5.1e6, # in Hz
...         "eta": 0.5
...     }
... )

Using SymmetricTensor objects.

>>> site1 = Site(
...     isotope='13C',
...     isotropic_chemical_shift=20, # in ppm
...     shielding_symmetric=SymmetricTensor(zeta=10, eta=0.5),
... )
json(exclude={}, units=True) dict

Parse the class object to a JSON compliant python dictionary object.

Parameters:
  • exclude – Set of keys that will be excluded from the result.

  • units – If true, the attribute value is a physical quantity expressed as a string with a number and a unit, else a float.

Returns: dict

classmethod parse_dict_with_units(py_dict: dict)

Parse the physical quantity from a dictionary representation of the Site object, where the physical quantity is expressed as a string with a number and a unit.

Parameters:

py_dict (dict) – A required python dict object.

Returns:

Site object.

Example

>>> site_dict = {
...    "isotope": "13C",
...    "isotropic_chemical_shift": "20 ppm",
...    "shielding_symmetric": {"zeta": "10 ppm", "eta":0.5}
... }
>>> site1 = Site.parse_dict_with_units(site_dict)
reduced_dict(exclude={}) dict

Returns a reduced dictionary representation of the class object by removing all key-value pair corresponding to keys listed in the exclude argument, and keys with value as None.

Parameters:

exclude – A list of keys to exclude from the dictionary.

Return: A dict.