Cartesian Tensor utils¶
- mrsimulator.utils.cartesian_tensor.to_symmetric_tensor(tensor: ndarray, type: str = 'shielding') SymmetricTensor¶
Cartesian 3x3 tensor to mrsimulator SymmetricTensor object. Note that only the traceless symmetric part of the tensor is converted to the SymmetricTensor object.
- Parameters:
tensor – A 3x3 np.ndarray Cartesian tensor
type – String with any one of the allowed listings. [
"shielding","j_coupling","quadrupolar","dipolar"]
- Returns:
A SymmetricTensor object.
Example
>>> tensor = np.array([ ... [-8.05713333, -1.4523, 35.7252], ... [-5.5725, 26.38916667, -5.2804], ... [33.1405, -0.6241, -18.33203333], ... ]) >>> symmetric_tensor = to_symmetric_tensor(tensor, type="shielding")
- mrsimulator.utils.cartesian_tensor.dipolar_tensor(site_1: list, site_2: list) ndarray¶
Generates a 3x3 symmetric cartesian tensor from isotope site coordinates.
- Parameters:
site_1 – A list of (isotope_symbol, site_coordiantes) for site 1, where
isotope_symbolis a string of any of the mrsimulator allowed isotopes andsite_coordiantesis a list or ndarray of (x, y, z) site coordinates in units of Angstrom.site_2 – A list of (isotope_symbol, site_coordiantes) for site 2, where
isotope_symbolis a string of any of the mrsimulator allowed isotopes andsite_coordiantesis a list or ndarray of (x, y, z) site coordinates in units of Angstrom.
- Returns:
A 3x3 ndarray of symmetric dipolar Cartesian tensor in units of Hz.
Example
>>> site1_coords = [2.1, 3.1, 1.3] # coords for 1H in A >>> site2_coords = [0, 0, 1.2] # coords for 13C in A >>> dipole_tensor = dipolar_tensor( ... site_1=['1H', site1_coords], ... site_2=['13C', site2_coords] ... )
- mrsimulator.utils.cartesian_tensor.to_mehring_params(tensor: ndarray) Tuple[ndarray, ndarray]¶
Cartesian 3x3 tensor to Mehring parameters. Note, for non-symmetric tensors, the conversion is applied by first symmetrizing the tensor using (tensor + tensor.T) / 2.
- Parameters:
tensor – A 3x3 np.ndarray Cartesian tensor.
- Returns:
A tuple of (euler_angles, eigenvalues) where
euler_anglesis an ndarray of three Euler angles [alpha,beta,gamma] using the “zyz” convention, andeigenvaluesare the corresponding ndarray of three Eigenvalues.
- mrsimulator.utils.cartesian_tensor.from_mehring_params(euler_angles: List[float], eigenvalues: List[float]) ndarray¶
Mehring parameters to a 3x3 symmetric Cartesian tensor.
- Parameters:
euler_angles – An ndarray of three Euler angles [
alpha,beta,gamma] using the “zyz” convention.eigenvalues – The corresponding ndarray of three Eigenvalues.
- Returns:
A 3x3 np.ndarray of symmetric Cartesian tensor.
- Return type:
tensor
- mrsimulator.utils.cartesian_tensor.to_haeberlen_params(tensor: ndarray) Tuple[ndarray, float, float, float]¶
Cartesian 3x3 tensor to Haeberlen parameters. Note, for non-symmetric tensors, the conversion is applied by first symmetrizing the tensor using (tensor + tensor.T) / 2.
- Parameters:
tensor – A 3x3 np.ndarray Cartesian tensor.
- Returns:
A tuple of (euler_angles, zeta_sigma, eta_sigma, isotropic_component) where
euler_anglesis an ndarray of three the Euler angles [alpha,beta,gamma] using the “zyz” convention,zeta_sigma,eta_sigma, andisotropic_componentare the corresponding Haeberlen anisotropy, asymmetry, and isotropic parameters.
- mrsimulator.utils.cartesian_tensor.from_haeberlen_params(euler_angles: List[float], zeta_sigma: float, eta_sigma: float, isotropic_component: float) ndarray¶
Haeberlen parameters to a 3x3 symmetric Cartesian tensor.
- Parameters:
euler_angles – An ndarray of three Euler angles [
alpha,beta,gamma] using the “zyz” convention.zeta_sigma – Anisotropy parameter.
eta_sigma – Asymmetry parameter
isotropic_component – Isotropic parameter
- Returns:
A 3x3 np.ndarray of symmetric Cartesian tensor.
- Return type:
tensor
- mrsimulator.utils.cartesian_tensor.mehring_principal_components_to_maryland(lambdas: List[float]) Tuple[float, float, float]¶
Mehring principal components to Maryland.
- Parameters:
lambdas – Eigenvalues from Mehring convention.
- Returns:
A tuple of (span, skew, isotropic) in Maryland convention where
spanis the width,skewis the asymmetry, andisotropicis the isotropic components.
- mrsimulator.utils.cartesian_tensor.maryland_to_mehring_principal_components(isotropic: float, span: float, skew: float) ndarray¶
Maryland components to Mehring principal components.
- Parameters:
span – Maryland anisotropy component.
skew – Maryland asymmetry component.
isotropic – Maryland isotropic component.
- Returns:
A ndarray of Mehring Eigenvalues.
- mrsimulator.utils.cartesian_tensor.maryland_to_haeberlen_params(isotropic: float, span: float, skew: float) Tuple[float, float, float]¶
- mrsimulator.utils.cartesian_tensor.haeberlen_params_to_maryland(zeta_sigma: float, eta_sigma: float, isotropic_component: float) Tuple[float, float, float]¶
- mrsimulator.utils.cartesian_tensor.dipolar_coupling_constant(isotope_symbol_1: str, isotope_symbol_2: str, distance: float)¶
Dipolar coupling constant between two isotopes a distance apart
- Parameters:
isotope_symbol_1 – A string of any of the mrsimulator allowed isotopes for isotope 1.
isotope_symbol_2 – A string of any of the mrsimulator allowed isotopes for isotope 2.
distance – Distance between the isotopes in units of Angstrom.
- Returns:
Dipolar coupling constant in units of Hz.