soprano.properties.nmr.isc#
Implementation of AtomsProperties that relate to NMR J couplings
Classes
|
Produces an array containing eigenvalues and eigenvectors for the symmetric part of each J coupling tensor in the system. |
|
Produces a dictionary of J coupling anisotropies for atom pairs in the system. |
|
Produces a dictionary of J coupling asymmetries for atom pairs in the system. |
|
Produces a dictionary of diagonalised J coupling tensors for atom pairs in the system. |
|
Produces a dictionary of J coupling isotropies for atom pairs in the system. |
|
Produces a dictionary of J ase.Quaternion objects expressing the orientation of the J coupling tensors with respect to the cartesian axes for atom pairs in the system. |
|
Produces a dictionary of J coupling reduced anisotropies for atom pairs in the system. |
|
Produces a dictionary of J coupling skews for atom pairs in the system. |
|
Produces a dictionary of J coupling spans for atom pairs in the system. |
- class soprano.properties.nmr.isc.ISCDiagonal(name=None, **params)[source]#
Bases:
AtomsProperty
Produces an array containing eigenvalues and eigenvectors for the symmetric part of each J coupling tensor in the system. By default saves them as part of the Atoms’ arrays as well. Requires the Atoms object to have been loaded from a .magres file containing the relevant information.
- Parameters:
tag (str) – name of the J coupling component to return. Magres files usually contain isc, isc_spin, isc_fc, isc_orbital_p and isc_orbital_d. Default is isc.
save_info (bool) – if True, save the diagonalised tensors in the Atoms object as info. By default True.
- Returns:
- dictionary of eigenvalues and eigenvectors by atom
index pairs (lower index first)
- Return type:
isc_diag (dict)
Initialize an AtomsProperty and set its parameters. The AtomsProperty instance can then be called with a structure as its only argument to get the property with the given parameters.
Args:name (str): a name to give to this specific instance of theproperty (will be used to store it as array ifrequested)params: named arguments specific to this type of property- __call__(s, store_array=False, selection=None)#
Calling the AtomsProperty returns the value of the property as extracted with the parameters of this specific instance.
Args:s (ase.Atoms or AtomsCollection): the structure or collectionfrom which to extract thepropertystore_array (bool): if s is a collection, whether to store theresulting data as an array in the collectionusing the given name for this instanceselection (str): a selection string to filter the atoms or AtomSelectionReturns:property: the value of the property for the given structure ora list of values if a collection has been passed
- static extract(s, *args, **kwargs)[source]#
Extract the given property with given parameters from an Atoms object.
Args:s (ase.Atoms): the structure from which to extract the propertyparams: named arguments specific to this type of propertyReturns:property: the value of the property for the given structure andparameters
- classmethod get(s, store_array=False, selection=None, **kwargs)#
Extract the given property using the default parameters on an Atoms object s
Args:s (ase.Atoms or AtomsCollection): the structure or collectionfrom which to extract thepropertystore_array (bool): if s is a collection, whether to store theresulting data as an array in the collectionusing the default name for this propertyselection (str): a selection string to filter the atoms or AtomSelectionReturns:property: the value of the property for the given structure ora list of values if a collection has been passed
- mean(s, axis=None, weights=None, **kwargs)#
Compute the mean of the property over a list of structures.
The default behaviours are: - For a list of scalars, compute the mean along the specified axis. - For a list of dictionaries, compute the mean for each key across all dictionaries. - For a list of NMRTensor objects, compute the mean using the NMRTensor.mean method. - For a list of arrays, convert to numpy array and then compute the mean along the specified axis.
- Parameters:
s (list[ase.Atoms] | AtomsCollection) – The structure or collection from which to extract the property.
axis (int | None) – Axis along which the means are computed. If None, compute the mean of scalars.
weights (np.ndarray | None) – An array of weights associated with the values. If specified, the weighted average will be computed. Must have the same shape as the property values.
**kwargs – Additional arguments passed to the property’s get method.
- Returns:
The mean value of the property for the given structures.
- Return type:
dict | float | np.ndarray | NMRTensor
- Raises:
ValueError – If s is not a collection/list, if property values are None, or if there’s an incompatible shape for computing the mean.
TypeError – If the property values are of a type that cannot be averaged.
- class soprano.properties.nmr.isc.JCAnisotropy(name=None, **params)[source]#
Bases:
AtomsProperty
Produces a dictionary of J coupling anisotropies for atom pairs in the system. See JCDiagonal for how reduced couplings are transformed into couplings.
- Parameters:
sel_i (AtomSelection or [int]) – Selection or list of indices of atoms for which to return the J coupling. By default is None (= all of them).
sel_j (AtomSelection or [int]) – Selection or list of indices of atoms for which to return the J coupling with the ones in sel_i. By default is None (= same as sel_i).
tag (str) – name of the J coupling component to return. Magres files usually contain isc, isc_spin, isc_fc, isc_orbital_p and isc_orbital_d. Default is isc.
isotopes (dict) – dictionary of specific isotopes to use, by element symbol. If the isotope doesn’t exist an error will be raised.
isotope_list (list) – list of isotopes, atom-by-atom. To be used if different atoms of the same element are supposed to be of different isotopes. Where a ‘None’ is present will fall back on the previous definitions. Where an isotope is present it overrides everything else.
self_coupling (bool) – if True, include coupling of a nucleus with itself. Otherwise excluded. Default is False.
force_recalc (bool) – if True, always diagonalise the tensors even if already present. Default is False.
- Returns:
Dictionary of couplings by atomic index pair, in Hz.
- Return type:
dip_dict (dict)
Initialize an AtomsProperty and set its parameters. The AtomsProperty instance can then be called with a structure as its only argument to get the property with the given parameters.
Args:name (str): a name to give to this specific instance of theproperty (will be used to store it as array ifrequested)params: named arguments specific to this type of property- __call__(s, store_array=False, selection=None)#
Calling the AtomsProperty returns the value of the property as extracted with the parameters of this specific instance.
Args:s (ase.Atoms or AtomsCollection): the structure or collectionfrom which to extract thepropertystore_array (bool): if s is a collection, whether to store theresulting data as an array in the collectionusing the given name for this instanceselection (str): a selection string to filter the atoms or AtomSelectionReturns:property: the value of the property for the given structure ora list of values if a collection has been passed
- static extract(s, *args, **kwargs)[source]#
Extract the given property with given parameters from an Atoms object.
Args:s (ase.Atoms): the structure from which to extract the propertyparams: named arguments specific to this type of propertyReturns:property: the value of the property for the given structure andparameters
- classmethod get(s, store_array=False, selection=None, **kwargs)#
Extract the given property using the default parameters on an Atoms object s
Args:s (ase.Atoms or AtomsCollection): the structure or collectionfrom which to extract thepropertystore_array (bool): if s is a collection, whether to store theresulting data as an array in the collectionusing the default name for this propertyselection (str): a selection string to filter the atoms or AtomSelectionReturns:property: the value of the property for the given structure ora list of values if a collection has been passed
- mean(s, axis=None, weights=None, **kwargs)#
Compute the mean of the property over a list of structures.
The default behaviours are: - For a list of scalars, compute the mean along the specified axis. - For a list of dictionaries, compute the mean for each key across all dictionaries. - For a list of NMRTensor objects, compute the mean using the NMRTensor.mean method. - For a list of arrays, convert to numpy array and then compute the mean along the specified axis.
- Parameters:
s (list[ase.Atoms] | AtomsCollection) – The structure or collection from which to extract the property.
axis (int | None) – Axis along which the means are computed. If None, compute the mean of scalars.
weights (np.ndarray | None) – An array of weights associated with the values. If specified, the weighted average will be computed. Must have the same shape as the property values.
**kwargs – Additional arguments passed to the property’s get method.
- Returns:
The mean value of the property for the given structures.
- Return type:
dict | float | np.ndarray | NMRTensor
- Raises:
ValueError – If s is not a collection/list, if property values are None, or if there’s an incompatible shape for computing the mean.
TypeError – If the property values are of a type that cannot be averaged.
- class soprano.properties.nmr.isc.JCAsymmetry(name=None, **params)[source]#
Bases:
AtomsProperty
Produces a dictionary of J coupling asymmetries for atom pairs in the system. See JCDiagonal for how reduced couplings are transformed into couplings.
- Parameters:
sel_i (AtomSelection or [int]) – Selection or list of indices of atoms for which to return the J coupling. By default is None (= all of them).
sel_j (AtomSelection or [int]) – Selection or list of indices of atoms for which to return the J coupling with the ones in sel_i. By default is None (= same as sel_i).
tag (str) – name of the J coupling component to return. Magres files usually contain isc, isc_spin, isc_fc, isc_orbital_p and isc_orbital_d. Default is isc.
isotopes (dict) – dictionary of specific isotopes to use, by element symbol. If the isotope doesn’t exist an error will be raised.
isotope_list (list) – list of isotopes, atom-by-atom. To be used if different atoms of the same element are supposed to be of different isotopes. Where a ‘None’ is present will fall back on the previous definitions. Where an isotope is present it overrides everything else.
self_coupling (bool) – if True, include coupling of a nucleus with itself. Otherwise excluded. Default is False.
force_recalc (bool) – if True, always diagonalise the tensors even if already present. Default is False.
- Returns:
Dictionary of couplings by atomic index pair, in Hz.
- Return type:
dip_dict (dict)
Initialize an AtomsProperty and set its parameters. The AtomsProperty instance can then be called with a structure as its only argument to get the property with the given parameters.
Args:name (str): a name to give to this specific instance of theproperty (will be used to store it as array ifrequested)params: named arguments specific to this type of property- __call__(s, store_array=False, selection=None)#
Calling the AtomsProperty returns the value of the property as extracted with the parameters of this specific instance.
Args:s (ase.Atoms or AtomsCollection): the structure or collectionfrom which to extract thepropertystore_array (bool): if s is a collection, whether to store theresulting data as an array in the collectionusing the given name for this instanceselection (str): a selection string to filter the atoms or AtomSelectionReturns:property: the value of the property for the given structure ora list of values if a collection has been passed
- static extract(s, *args, **kwargs)[source]#
Extract the given property with given parameters from an Atoms object.
Args:s (ase.Atoms): the structure from which to extract the propertyparams: named arguments specific to this type of propertyReturns:property: the value of the property for the given structure andparameters
- classmethod get(s, store_array=False, selection=None, **kwargs)#
Extract the given property using the default parameters on an Atoms object s
Args:s (ase.Atoms or AtomsCollection): the structure or collectionfrom which to extract thepropertystore_array (bool): if s is a collection, whether to store theresulting data as an array in the collectionusing the default name for this propertyselection (str): a selection string to filter the atoms or AtomSelectionReturns:property: the value of the property for the given structure ora list of values if a collection has been passed
- mean(s, axis=None, weights=None, **kwargs)#
Compute the mean of the property over a list of structures.
The default behaviours are: - For a list of scalars, compute the mean along the specified axis. - For a list of dictionaries, compute the mean for each key across all dictionaries. - For a list of NMRTensor objects, compute the mean using the NMRTensor.mean method. - For a list of arrays, convert to numpy array and then compute the mean along the specified axis.
- Parameters:
s (list[ase.Atoms] | AtomsCollection) – The structure or collection from which to extract the property.
axis (int | None) – Axis along which the means are computed. If None, compute the mean of scalars.
weights (np.ndarray | None) – An array of weights associated with the values. If specified, the weighted average will be computed. Must have the same shape as the property values.
**kwargs – Additional arguments passed to the property’s get method.
- Returns:
The mean value of the property for the given structures.
- Return type:
dict | float | np.ndarray | NMRTensor
- Raises:
ValueError – If s is not a collection/list, if property values are None, or if there’s an incompatible shape for computing the mean.
TypeError – If the property values are of a type that cannot be averaged.
- class soprano.properties.nmr.isc.JCDiagonal(name=None, **params)[source]#
Bases:
AtomsProperty
Produces a dictionary of diagonalised J coupling tensors for atom pairs in the system. The J coupling for a pair of nuclei i and j is defined as:
where the gammas represent the gyromagnetic ratios of the nuclei and K is the J coupling reduced tensor found in a .magres file, in
.- Parameters:
sel_i (AtomSelection or [int]) – Selection or list of indices of atoms for which to return the J coupling. By default is None (= all of them).
sel_j (AtomSelection or [int]) – Selection or list of indices of atoms for which to return the J coupling with the ones in sel_i. By default is None (= same as sel_i).
tag (str) – name of the J coupling component to return. Magres files usually contain isc, isc_spin, isc_fc, isc_orbital_p and isc_orbital_d. Default is isc.
isotopes (dict) – dictionary of specific isotopes to use, by element symbol. If the isotope doesn’t exist an error will be raised.
isotope_list (list) – list of isotopes, atom-by-atom. To be used if different atoms of the same element are supposed to be of different isotopes. Where a ‘None’ is present will fall back on the previous definitions. Where an isotope is present it overrides everything else.
self_coupling (bool) – if True, include coupling of a nucleus with itself. Otherwise excluded. Default is False.
force_recalc (bool) – if True, always diagonalise the tensors even if already present. Default is False.
- Returns:
Dictionary of couplings by atomic index pair.
- Return type:
dip_dict (dict)
Initialize an AtomsProperty and set its parameters. The AtomsProperty instance can then be called with a structure as its only argument to get the property with the given parameters.
Args:name (str): a name to give to this specific instance of theproperty (will be used to store it as array ifrequested)params: named arguments specific to this type of property- __call__(s, store_array=False, selection=None)#
Calling the AtomsProperty returns the value of the property as extracted with the parameters of this specific instance.
Args:s (ase.Atoms or AtomsCollection): the structure or collectionfrom which to extract thepropertystore_array (bool): if s is a collection, whether to store theresulting data as an array in the collectionusing the given name for this instanceselection (str): a selection string to filter the atoms or AtomSelectionReturns:property: the value of the property for the given structure ora list of values if a collection has been passed
- static extract(s, *args, **kwargs)[source]#
Extract the given property with given parameters from an Atoms object.
Args:s (ase.Atoms): the structure from which to extract the propertyparams: named arguments specific to this type of propertyReturns:property: the value of the property for the given structure andparameters
- classmethod get(s, store_array=False, selection=None, **kwargs)#
Extract the given property using the default parameters on an Atoms object s
Args:s (ase.Atoms or AtomsCollection): the structure or collectionfrom which to extract thepropertystore_array (bool): if s is a collection, whether to store theresulting data as an array in the collectionusing the default name for this propertyselection (str): a selection string to filter the atoms or AtomSelectionReturns:property: the value of the property for the given structure ora list of values if a collection has been passed
- mean(s, axis=None, weights=None, **kwargs)#
Compute the mean of the property over a list of structures.
The default behaviours are: - For a list of scalars, compute the mean along the specified axis. - For a list of dictionaries, compute the mean for each key across all dictionaries. - For a list of NMRTensor objects, compute the mean using the NMRTensor.mean method. - For a list of arrays, convert to numpy array and then compute the mean along the specified axis.
- Parameters:
s (list[ase.Atoms] | AtomsCollection) – The structure or collection from which to extract the property.
axis (int | None) – Axis along which the means are computed. If None, compute the mean of scalars.
weights (np.ndarray | None) – An array of weights associated with the values. If specified, the weighted average will be computed. Must have the same shape as the property values.
**kwargs – Additional arguments passed to the property’s get method.
- Returns:
The mean value of the property for the given structures.
- Return type:
dict | float | np.ndarray | NMRTensor
- Raises:
ValueError – If s is not a collection/list, if property values are None, or if there’s an incompatible shape for computing the mean.
TypeError – If the property values are of a type that cannot be averaged.
- class soprano.properties.nmr.isc.JCIsotropy(name=None, **params)[source]#
Bases:
AtomsProperty
Produces a dictionary of J coupling isotropies for atom pairs in the system. See JCDiagonal for how reduced couplings are transformed into couplings.
- Parameters:
sel_i (AtomSelection or [int]) – Selection or list of indices of atoms for which to return the J coupling. By default is None (= all of them).
sel_j (AtomSelection or [int]) – Selection or list of indices of atoms for which to return the J coupling with the ones in sel_i. By default is None (= same as sel_i).
tag (str) – name of the J coupling component to return. Magres files usually contain isc, isc_spin, isc_fc, isc_orbital_p and isc_orbital_d. Default is isc.
isotopes (dict) – dictionary of specific isotopes to use, by element symbol. If the isotope doesn’t exist an error will be raised.
isotope_list (list) – list of isotopes, atom-by-atom. To be used if different atoms of the same element are supposed to be of different isotopes. Where a ‘None’ is present will fall back on the previous definitions. Where an isotope is present it overrides everything else.
self_coupling (bool) – if True, include coupling of a nucleus with itself. Otherwise excluded. Default is False.
force_recalc (bool) – if True, always diagonalise the tensors even if already present. Default is False.
- Returns:
Dictionary of couplings by atomic index pair, in Hz.
- Return type:
dip_dict (dict)
Initialize an AtomsProperty and set its parameters. The AtomsProperty instance can then be called with a structure as its only argument to get the property with the given parameters.
Args:name (str): a name to give to this specific instance of theproperty (will be used to store it as array ifrequested)params: named arguments specific to this type of property- __call__(s, store_array=False, selection=None)#
Calling the AtomsProperty returns the value of the property as extracted with the parameters of this specific instance.
Args:s (ase.Atoms or AtomsCollection): the structure or collectionfrom which to extract thepropertystore_array (bool): if s is a collection, whether to store theresulting data as an array in the collectionusing the given name for this instanceselection (str): a selection string to filter the atoms or AtomSelectionReturns:property: the value of the property for the given structure ora list of values if a collection has been passed
- static extract(s, *args, **kwargs)[source]#
Extract the given property with given parameters from an Atoms object.
Args:s (ase.Atoms): the structure from which to extract the propertyparams: named arguments specific to this type of propertyReturns:property: the value of the property for the given structure andparameters
- classmethod get(s, store_array=False, selection=None, **kwargs)#
Extract the given property using the default parameters on an Atoms object s
Args:s (ase.Atoms or AtomsCollection): the structure or collectionfrom which to extract thepropertystore_array (bool): if s is a collection, whether to store theresulting data as an array in the collectionusing the default name for this propertyselection (str): a selection string to filter the atoms or AtomSelectionReturns:property: the value of the property for the given structure ora list of values if a collection has been passed
- mean(s, axis=None, weights=None, **kwargs)#
Compute the mean of the property over a list of structures.
The default behaviours are: - For a list of scalars, compute the mean along the specified axis. - For a list of dictionaries, compute the mean for each key across all dictionaries. - For a list of NMRTensor objects, compute the mean using the NMRTensor.mean method. - For a list of arrays, convert to numpy array and then compute the mean along the specified axis.
- Parameters:
s (list[ase.Atoms] | AtomsCollection) – The structure or collection from which to extract the property.
axis (int | None) – Axis along which the means are computed. If None, compute the mean of scalars.
weights (np.ndarray | None) – An array of weights associated with the values. If specified, the weighted average will be computed. Must have the same shape as the property values.
**kwargs – Additional arguments passed to the property’s get method.
- Returns:
The mean value of the property for the given structures.
- Return type:
dict | float | np.ndarray | NMRTensor
- Raises:
ValueError – If s is not a collection/list, if property values are None, or if there’s an incompatible shape for computing the mean.
TypeError – If the property values are of a type that cannot be averaged.
- class soprano.properties.nmr.isc.JCQuaternion(name=None, **params)[source]#
Bases:
AtomsProperty
Produces a dictionary of J ase.Quaternion objects expressing the orientation of the J coupling tensors with respect to the cartesian axes for atom pairs in the system. Requires the Atoms object to have been loaded from a .magres file containing the relevant information.
- Parameters:
sel_i (AtomSelection or [int]) – Selection or list of indices of atoms for which to return the J coupling. By default is None (= all of them).
sel_j (AtomSelection or [int]) – Selection or list of indices of atoms for which to return the J coupling with the ones in sel_i. By default is None (= same as sel_i).
tag (str) – name of the J coupling component to return. Magres files usually contain isc, isc_spin, isc_fc, isc_orbital_p and isc_orbital_d. Default is isc.
isotopes (dict) – dictionary of specific isotopes to use, by element symbol. If the isotope doesn’t exist an error will be raised.
isotope_list (list) – list of isotopes, atom-by-atom. To be used if different atoms of the same element are supposed to be of different isotopes. Where a ‘None’ is present will fall back on the previous definitions. Where an isotope is present it overrides everything else.
self_coupling (bool) – if True, include coupling of a nucleus with itself. Otherwise excluded. Default is False.
force_recalc (bool) – if True, always diagonalise the tensors even if already present. Default is False.
- Returns:
Dictionary of coupling quaternions by atomic index pair, in Hz.
- Return type:
quat_dict (dict)
Initialize an AtomsProperty and set its parameters. The AtomsProperty instance can then be called with a structure as its only argument to get the property with the given parameters.
Args:name (str): a name to give to this specific instance of theproperty (will be used to store it as array ifrequested)params: named arguments specific to this type of property- __call__(s, store_array=False, selection=None)#
Calling the AtomsProperty returns the value of the property as extracted with the parameters of this specific instance.
Args:s (ase.Atoms or AtomsCollection): the structure or collectionfrom which to extract thepropertystore_array (bool): if s is a collection, whether to store theresulting data as an array in the collectionusing the given name for this instanceselection (str): a selection string to filter the atoms or AtomSelectionReturns:property: the value of the property for the given structure ora list of values if a collection has been passed
- static extract(s, *args, **kwargs)[source]#
Extract the given property with given parameters from an Atoms object.
Args:s (ase.Atoms): the structure from which to extract the propertyparams: named arguments specific to this type of propertyReturns:property: the value of the property for the given structure andparameters
- classmethod get(s, store_array=False, selection=None, **kwargs)#
Extract the given property using the default parameters on an Atoms object s
Args:s (ase.Atoms or AtomsCollection): the structure or collectionfrom which to extract thepropertystore_array (bool): if s is a collection, whether to store theresulting data as an array in the collectionusing the default name for this propertyselection (str): a selection string to filter the atoms or AtomSelectionReturns:property: the value of the property for the given structure ora list of values if a collection has been passed
- mean(s, axis=None, weights=None, **kwargs)#
Compute the mean of the property over a list of structures.
The default behaviours are: - For a list of scalars, compute the mean along the specified axis. - For a list of dictionaries, compute the mean for each key across all dictionaries. - For a list of NMRTensor objects, compute the mean using the NMRTensor.mean method. - For a list of arrays, convert to numpy array and then compute the mean along the specified axis.
- Parameters:
s (list[ase.Atoms] | AtomsCollection) – The structure or collection from which to extract the property.
axis (int | None) – Axis along which the means are computed. If None, compute the mean of scalars.
weights (np.ndarray | None) – An array of weights associated with the values. If specified, the weighted average will be computed. Must have the same shape as the property values.
**kwargs – Additional arguments passed to the property’s get method.
- Returns:
The mean value of the property for the given structures.
- Return type:
dict | float | np.ndarray | NMRTensor
- Raises:
ValueError – If s is not a collection/list, if property values are None, or if there’s an incompatible shape for computing the mean.
TypeError – If the property values are of a type that cannot be averaged.
- class soprano.properties.nmr.isc.JCReducedAnisotropy(name=None, **params)[source]#
Bases:
AtomsProperty
Produces a dictionary of J coupling reduced anisotropies for atom pairs in the system. See JCDiagonal for how reduced couplings are transformed into couplings.
- Parameters:
sel_i (AtomSelection or [int]) – Selection or list of indices of atoms for which to return the J coupling. By default is None (= all of them).
sel_j (AtomSelection or [int]) – Selection or list of indices of atoms for which to return the J coupling with the ones in sel_i. By default is None (= same as sel_i).
tag (str) – name of the J coupling component to return. Magres files usually contain isc, isc_spin, isc_fc, isc_orbital_p and isc_orbital_d. Default is isc.
isotopes (dict) – dictionary of specific isotopes to use, by element symbol. If the isotope doesn’t exist an error will be raised.
isotope_list (list) – list of isotopes, atom-by-atom. To be used if different atoms of the same element are supposed to be of different isotopes. Where a ‘None’ is present will fall back on the previous definitions. Where an isotope is present it overrides everything else.
self_coupling (bool) – if True, include coupling of a nucleus with itself. Otherwise excluded. Default is False.
force_recalc (bool) – if True, always diagonalise the tensors even if already present. Default is False.
- Returns:
Dictionary of couplings by atomic index pair, in Hz.
- Return type:
dip_dict (dict)
Initialize an AtomsProperty and set its parameters. The AtomsProperty instance can then be called with a structure as its only argument to get the property with the given parameters.
Args:name (str): a name to give to this specific instance of theproperty (will be used to store it as array ifrequested)params: named arguments specific to this type of property- __call__(s, store_array=False, selection=None)#
Calling the AtomsProperty returns the value of the property as extracted with the parameters of this specific instance.
Args:s (ase.Atoms or AtomsCollection): the structure or collectionfrom which to extract thepropertystore_array (bool): if s is a collection, whether to store theresulting data as an array in the collectionusing the given name for this instanceselection (str): a selection string to filter the atoms or AtomSelectionReturns:property: the value of the property for the given structure ora list of values if a collection has been passed
- static extract(s, *args, **kwargs)[source]#
Extract the given property with given parameters from an Atoms object.
Args:s (ase.Atoms): the structure from which to extract the propertyparams: named arguments specific to this type of propertyReturns:property: the value of the property for the given structure andparameters
- classmethod get(s, store_array=False, selection=None, **kwargs)#
Extract the given property using the default parameters on an Atoms object s
Args:s (ase.Atoms or AtomsCollection): the structure or collectionfrom which to extract thepropertystore_array (bool): if s is a collection, whether to store theresulting data as an array in the collectionusing the default name for this propertyselection (str): a selection string to filter the atoms or AtomSelectionReturns:property: the value of the property for the given structure ora list of values if a collection has been passed
- mean(s, axis=None, weights=None, **kwargs)#
Compute the mean of the property over a list of structures.
The default behaviours are: - For a list of scalars, compute the mean along the specified axis. - For a list of dictionaries, compute the mean for each key across all dictionaries. - For a list of NMRTensor objects, compute the mean using the NMRTensor.mean method. - For a list of arrays, convert to numpy array and then compute the mean along the specified axis.
- Parameters:
s (list[ase.Atoms] | AtomsCollection) – The structure or collection from which to extract the property.
axis (int | None) – Axis along which the means are computed. If None, compute the mean of scalars.
weights (np.ndarray | None) – An array of weights associated with the values. If specified, the weighted average will be computed. Must have the same shape as the property values.
**kwargs – Additional arguments passed to the property’s get method.
- Returns:
The mean value of the property for the given structures.
- Return type:
dict | float | np.ndarray | NMRTensor
- Raises:
ValueError – If s is not a collection/list, if property values are None, or if there’s an incompatible shape for computing the mean.
TypeError – If the property values are of a type that cannot be averaged.
- class soprano.properties.nmr.isc.JCSkew(name=None, **params)[source]#
Bases:
AtomsProperty
Produces a dictionary of J coupling skews for atom pairs in the system. See JCDiagonal for how reduced couplings are transformed into couplings.
- Parameters:
sel_i (AtomSelection or [int]) – Selection or list of indices of atoms for which to return the J coupling. By default is None (= all of them).
sel_j (AtomSelection or [int]) – Selection or list of indices of atoms for which to return the J coupling with the ones in sel_i. By default is None (= same as sel_i).
tag (str) – name of the J coupling component to return. Magres files usually contain isc, isc_spin, isc_fc, isc_orbital_p and isc_orbital_d. Default is isc.
isotopes (dict) – dictionary of specific isotopes to use, by element symbol. If the isotope doesn’t exist an error will be raised.
isotope_list (list) – list of isotopes, atom-by-atom. To be used if different atoms of the same element are supposed to be of different isotopes. Where a ‘None’ is present will fall back on the previous definitions. Where an isotope is present it overrides everything else.
self_coupling (bool) – if True, include coupling of a nucleus with itself. Otherwise excluded. Default is False.
force_recalc (bool) – if True, always diagonalise the tensors even if already present. Default is False.
- Returns:
Dictionary of couplings by atomic index pair, in Hz.
- Return type:
dip_dict (dict)
Initialize an AtomsProperty and set its parameters. The AtomsProperty instance can then be called with a structure as its only argument to get the property with the given parameters.
Args:name (str): a name to give to this specific instance of theproperty (will be used to store it as array ifrequested)params: named arguments specific to this type of property- __call__(s, store_array=False, selection=None)#
Calling the AtomsProperty returns the value of the property as extracted with the parameters of this specific instance.
Args:s (ase.Atoms or AtomsCollection): the structure or collectionfrom which to extract thepropertystore_array (bool): if s is a collection, whether to store theresulting data as an array in the collectionusing the given name for this instanceselection (str): a selection string to filter the atoms or AtomSelectionReturns:property: the value of the property for the given structure ora list of values if a collection has been passed
- static extract(s, *args, **kwargs)[source]#
Extract the given property with given parameters from an Atoms object.
Args:s (ase.Atoms): the structure from which to extract the propertyparams: named arguments specific to this type of propertyReturns:property: the value of the property for the given structure andparameters
- classmethod get(s, store_array=False, selection=None, **kwargs)#
Extract the given property using the default parameters on an Atoms object s
Args:s (ase.Atoms or AtomsCollection): the structure or collectionfrom which to extract thepropertystore_array (bool): if s is a collection, whether to store theresulting data as an array in the collectionusing the default name for this propertyselection (str): a selection string to filter the atoms or AtomSelectionReturns:property: the value of the property for the given structure ora list of values if a collection has been passed
- mean(s, axis=None, weights=None, **kwargs)#
Compute the mean of the property over a list of structures.
The default behaviours are: - For a list of scalars, compute the mean along the specified axis. - For a list of dictionaries, compute the mean for each key across all dictionaries. - For a list of NMRTensor objects, compute the mean using the NMRTensor.mean method. - For a list of arrays, convert to numpy array and then compute the mean along the specified axis.
- Parameters:
s (list[ase.Atoms] | AtomsCollection) – The structure or collection from which to extract the property.
axis (int | None) – Axis along which the means are computed. If None, compute the mean of scalars.
weights (np.ndarray | None) – An array of weights associated with the values. If specified, the weighted average will be computed. Must have the same shape as the property values.
**kwargs – Additional arguments passed to the property’s get method.
- Returns:
The mean value of the property for the given structures.
- Return type:
dict | float | np.ndarray | NMRTensor
- Raises:
ValueError – If s is not a collection/list, if property values are None, or if there’s an incompatible shape for computing the mean.
TypeError – If the property values are of a type that cannot be averaged.
- class soprano.properties.nmr.isc.JCSpan(name=None, **params)[source]#
Bases:
AtomsProperty
Produces a dictionary of J coupling spans for atom pairs in the system. See JCDiagonal for how reduced couplings are transformed into couplings.
- Parameters:
sel_i (AtomSelection or [int]) – Selection or list of indices of atoms for which to return the J coupling. By default is None (= all of them).
sel_j (AtomSelection or [int]) – Selection or list of indices of atoms for which to return the J coupling with the ones in sel_i. By default is None (= same as sel_i).
tag (str) – name of the J coupling component to return. Magres files usually contain isc, isc_spin, isc_fc, isc_orbital_p and isc_orbital_d. Default is isc.
isotopes (dict) – dictionary of specific isotopes to use, by element symbol. If the isotope doesn’t exist an error will be raised.
isotope_list (list) – list of isotopes, atom-by-atom. To be used if different atoms of the same element are supposed to be of different isotopes. Where a ‘None’ is present will fall back on the previous definitions. Where an isotope is present it overrides everything else.
self_coupling (bool) – if True, include coupling of a nucleus with itself. Otherwise excluded. Default is False.
force_recalc (bool) – if True, always diagonalise the tensors even if already present. Default is False.
- Returns:
Dictionary of couplings by atomic index pair, in Hz.
- Return type:
dip_dict (dict)
Initialize an AtomsProperty and set its parameters. The AtomsProperty instance can then be called with a structure as its only argument to get the property with the given parameters.
Args:name (str): a name to give to this specific instance of theproperty (will be used to store it as array ifrequested)params: named arguments specific to this type of property- __call__(s, store_array=False, selection=None)#
Calling the AtomsProperty returns the value of the property as extracted with the parameters of this specific instance.
Args:s (ase.Atoms or AtomsCollection): the structure or collectionfrom which to extract thepropertystore_array (bool): if s is a collection, whether to store theresulting data as an array in the collectionusing the given name for this instanceselection (str): a selection string to filter the atoms or AtomSelectionReturns:property: the value of the property for the given structure ora list of values if a collection has been passed
- static extract(s, *args, **kwargs)[source]#
Extract the given property with given parameters from an Atoms object.
Args:s (ase.Atoms): the structure from which to extract the propertyparams: named arguments specific to this type of propertyReturns:property: the value of the property for the given structure andparameters
- classmethod get(s, store_array=False, selection=None, **kwargs)#
Extract the given property using the default parameters on an Atoms object s
Args:s (ase.Atoms or AtomsCollection): the structure or collectionfrom which to extract thepropertystore_array (bool): if s is a collection, whether to store theresulting data as an array in the collectionusing the default name for this propertyselection (str): a selection string to filter the atoms or AtomSelectionReturns:property: the value of the property for the given structure ora list of values if a collection has been passed
- mean(s, axis=None, weights=None, **kwargs)#
Compute the mean of the property over a list of structures.
The default behaviours are: - For a list of scalars, compute the mean along the specified axis. - For a list of dictionaries, compute the mean for each key across all dictionaries. - For a list of NMRTensor objects, compute the mean using the NMRTensor.mean method. - For a list of arrays, convert to numpy array and then compute the mean along the specified axis.
- Parameters:
s (list[ase.Atoms] | AtomsCollection) – The structure or collection from which to extract the property.
axis (int | None) – Axis along which the means are computed. If None, compute the mean of scalars.
weights (np.ndarray | None) – An array of weights associated with the values. If specified, the weighted average will be computed. Must have the same shape as the property values.
**kwargs – Additional arguments passed to the property’s get method.
- Returns:
The mean value of the property for the given structures.
- Return type:
dict | float | np.ndarray | NMRTensor
- Raises:
ValueError – If s is not a collection/list, if property values are None, or if there’s an incompatible shape for computing the mean.
TypeError – If the property values are of a type that cannot be averaged.