Coupling¶
- class mrsimulator.Coupling(*, property_units: Dict = {'isotropic_j': 'Hz'}, name: str = None, label: str = None, description: str = None, site_index: List[int], isotropic_j: float = 0.0, j_symmetric: mrsimulator.spin_system.tensors.SymmetricTensor = None, j_antisymmetric: mrsimulator.spin_system.tensors.AntisymmetricTensor = None, dipolar: mrsimulator.spin_system.tensors.SymmetricTensor = None)¶
Bases:
mrsimulator.utils.parseable.Parseable
Base class representing a two-site coupled nuclear spin interaction tensor parameters, which include the J-coupling and dipolar tensor.
Attribute Documentation
- site_index¶
A list of two integers, each corresponding to the index of the coupled sites.
Example
>>> coupling = Coupling(site_index=[0, 1])
- Type
list of int (required)
- isotropic_j¶
The isotropic j-coupling, in Hz, between the coupled sites. The default is 0.
Example
>>> coupling.isotropic_j = 43.3
- Type
float (optional)
- j_symmetric¶
The attribute represents the parameters of the irreducible second-rank traceless symmetric part of the J-coupling tensor. The default value is None.
The allowed attributes of the SymmetricTensor class for j_symmetric are
zeta
,eta
,alpha
,beta
, andgamma
, wherezeta
is the J anisotropy, in Hz, andeta
is the J asymmetry parameter defined using the Haeberlen convention. The Euler anglesalpha
,beta
, andgamma
are in radians.Example
>>> coupling.j_symmetric = {'zeta': 10, 'eta': 0.5}
>>> # or equivalently >>> coupling.j_symmetric = SymmetricTensor(zeta=10, eta=0.5)
- Type
SymmetricTensor or equivalent dict object (optional).
- j_antisymmetric¶
The attribute represents the parameters of the irreducible first-rank antisymmetric part of the J tensor. The default value is None.
The allowed attributes of the AntisymmetricTensor class for j_antisymmetric are
zeta
,alpha
, andbeta
, wherezeta
is the anisotropy parameter of the anti-symmetric first-rank tensor given in Hz. The anglesalpha
andbeta
are in radians.Example
>>> coupling.j_antisymmetric = {'zeta': 20}
>>> # or equivalently >>> coupling.j_antisymmetric = AntisymmetricTensor(zeta=20)
- Type
AntisymmetricTensor or equivalent dict object (optional).
- dipolar¶
The attribute represents the parameters of the irreducible second-rank traceless symmetric part of the direct-dipolar coupling tensor. The default value is None.
The allowed attributes of the SymmetricTensor class for dipolar are
D
,alpha
,beta
, andgamma
, whereD
is the dipolar coupling constant, in Hz. The Euler anglesalpha
,beta
, andgamma
are in radians.Example
>>> coupling.dipolar = {'D': 320}
>>> # or equivalently >>> coupling.dipolar = SymmetricTensor(D=320)
- Type
SymmetricTensor or equivalent dict object (optional).
- name¶
The name or id of the coupling. The default value is None.
Example
>>> coupling.name = '1H-1H' >>> coupling.name '1H-1H'
- Type
str (optional)
- label¶
The label for the coupling. The default value is None.
Example
>>> coupling.label = 'Weak coupling' >>> coupling.label 'Weak coupling'
- Type
str (optional)
- description¶
A description of the coupling. The default value is None.
Example
>>> coupling.description = 'An example coupled sites.' >>> coupling.description 'An example coupled sites.'
- Type
str (optional)
Example
The following are a few examples of setting the site object.
>>> coupling1 = Coupling( ... site_index=[0, 1], ... isotropic_j=20, # in Hz ... j_symmetric={ ... "zeta": 10, # in Hz ... "eta": 0.5 ... }, ... dipolar={"D": 5.1e3}, # in Hz ... )
Using SymmetricTensor objects.
>>> coupling1 = Coupling( ... site_index=[0, 1], ... isotropic_j=20, # in Hz ... j_symmetric=SymmetricTensor(zeta=10, eta=0.5), ... dipolar=SymmetricTensor(D=5.1e3), # in Hz ... )
Method Documentation
- classmethod parse_dict_with_units(py_dict: dict)¶
Parse the physical quantity from a dictionary representation of the Coupling 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
>>> coupling_dict = { ... "site_index": [1, 2], ... "isotropic_j": "20 Hz", ... "j_symmetric": {"zeta": "10 Hz", "eta":0.5} ... } >>> coupling1 = Coupling.parse_dict_with_units(coupling_dict)
- json() dict ¶
Parse the class object to a JSON compliant python dictionary object, where the attribute value with physical quantity is expressed as a string with a number and a unit.
>>> pprint(coupling1.json()) {'isotropic_j': '20.0 Hz', 'j_symmetric': {'eta': 0.5, 'zeta': '10.0 Hz'}, 'site_index': [0, 1]}