schrodinger.application.jaguar.nmr_utils module

class schrodinger.application.jaguar.nmr_utils.NMRData(shifts: list[float], couplings: list[Tuple[int, int, float, int]], isotopes: list[str], jnames: list[str], spectrum_type: str, field: float, filename: str, map_to_struct: dict[int, int], table_data: list[dict[str, str | float]], structure_title: str, timestep_npoints: int = 8192, spectrum_npoints: int = 16536, sym_groups: list[str] | None = None, sym_spins: list[list[int]] | None = None, max_subgraph_size: int = 14, debug: bool = False)

Bases: object

shifts: list[float]
couplings: list[Tuple[int, int, float, int]]
isotopes: list[str]
jnames: list[str]
spectrum_type: str
field: float
filename: str
map_to_struct: dict[int, int]
table_data: list[dict[str, str | float]]
structure_title: str
timestep_npoints: int = 8192
spectrum_npoints: int = 16536
sym_groups: list[str] | None = None
sym_spins: list[list[int]] | None = None
max_subgraph_size: int = 14
debug: bool = False
__init__(shifts: list[float], couplings: list[Tuple[int, int, float, int]], isotopes: list[str], jnames: list[str], spectrum_type: str, field: float, filename: str, map_to_struct: dict[int, int], table_data: list[dict[str, str | float]], structure_title: str, timestep_npoints: int = 8192, spectrum_npoints: int = 16536, sym_groups: list[str] | None = None, sym_spins: list[list[int]] | None = None, max_subgraph_size: int = 14, debug: bool = False) None
schrodinger.application.jaguar.nmr_utils.read_nmr_input(infile_name: str) schrodinger.application.jaguar.nmr_utils.NMRData

Deserialise the JSON file into NMRData object for spectrum calculation.

Parameters

infile_name – Filename containing JSON serialised NMRData object.

class schrodinger.application.jaguar.nmr_utils.PauliMatrices(multiplicity: int)

Bases: object

Class building and holding Pauli matrices for a given multiplicity.

The Pauli matrices are stored as COO matrices, these are fairly efficient at building new sparse matrices because they allow the sparsity to change efficiently (unlike CSR/CSC). We aren’t doing matrix algebra with these; we will convert before doing so.

__init__(multiplicity: int)

Build the Pauli matrices.

Parameters

multiplicity – Multiplicity of the Pauli matrices to be built.

class schrodinger.application.jaguar.nmr_utils.IsotopeData(multiplicity: int, mg_ratio: float)

Bases: object

multiplicity: int
mg_ratio: float
__init__(multiplicity: int, mg_ratio: float) None
schrodinger.application.jaguar.nmr_utils.negligible(something, tolerance: float) bool

True if something is below tolerance, False otherwise. Wraps and inverts significant() function.

Operates in ‘tensor’, ‘vector’, or ‘scalar’ mode, calling respective max functions for sparse or dense tensors.

Parameters
  • something – object to check

  • tolerance – the tolerance level for significance

Returns

True if the object is negligible, False otherwise

schrodinger.application.jaguar.nmr_utils.significant(something, tolerance: float) bool

Determines whether a given object deserves attention given the tolerance specified. Used in the internal decision-making conducted by spin_system kernel functions.

Operates in ‘tensor’, ‘vector’, or ‘scalar’ mode, calling respective max functions for sparse or dense tensors.

Parameters
  • something – object to check

  • tolerance – the tolerance level for significance

Returns

True if the object is significant, False otherwise

schrodinger.application.jaguar.nmr_utils.print_proclamation(msg: str)

Utility function to print title-formatted message.

Parameters

msg – Message to be printed.

schrodinger.application.jaguar.nmr_utils.where_sorted_array(a, row)

Bisection search to find matching row in a lexicographically sorted array. Raises RuntimeError if row not in a.

Significantly accellerated by @njit numba decorator, but this is currently removed due to JAGUAR-11740.

Parameters
  • a – The array to be searched.

  • row – The row to locate.

Returns

The index of the row in the array.

schrodinger.application.jaguar.nmr_utils.lexical_ordering(a: numpy.ndarray, b: numpy.ndarray) int

Compare two 1D arrays lexicographically. Returns 1 if a > b, -1 if a < b, or 0 if a == b.

This function is significantly accellerated by @njit numba decorator, but this is currently removed due to JAGUAR-11740

Parameters
  • a – first array

  • b – second array

Returns

1 if a > b, -1 if a < b, 0 if a == b

schrodinger.application.jaguar.nmr_utils.remove_vals_below_thresh(mat: scipy.sparse._arrays.csr_array, thresh: float)

Floor small values to 0 in sparse matrices so that they are not stored explicitly. Modifies mat in place.

Parameters
  • mat – matrix possibly with some small values

  • thresh – threshold for small values to be floored to zeros

schrodinger.application.jaguar.nmr_utils.tesla_to_mhz(magnet: float, isotope: str = '1H') float
schrodinger.application.jaguar.nmr_utils.mhz_to_tesla(magnet: float, isotope: str = '1H') float
schrodinger.application.jaguar.nmr_utils.hz_to_ppm(hz: float, magnet: float, isotope: str = '1H') float
Parameters
  • hz – Value to convert in Hz (note NOT MHz).

  • magnet – Magnetic field strength in Tesla.

  • isotope – The isotope the experiment is probing.

Returns

Value in ppm.

schrodinger.application.jaguar.nmr_utils.ppm_to_hz(ppm: float, magnet: float, isotope: str = '1H') float
Parameters
  • ppm – Value to convert in ppm.

  • magnet – Magnetic field strength in Tesla.

  • isotope – The isotope the experiment is probing.

Returns

Value in Hz (note NOT MHz).

schrodinger.application.jaguar.nmr_utils.convert_to_acs_label(split_lab: str) str

Helper function to convert general splitting label into ACS format. Truncates >5 into “multiplet”.

schrodinger.application.jaguar.nmr_utils.count_protons(st: schrodinger.structure._structure.Structure, excluded_atoms: set[str]) int

Count the number of atoms in a structure that are hydrogen with isotope 1 or 0 (default) and are not part of the excluded set. Exclusion allows us to ignore things like acidic hydrogen which do not show in NMR.

Parameters
  • st – Structure to be counted.

  • excluded_atoms – Atom name strings which should be excluded.

Returns

The number of non-excluded protons.

schrodinger.application.jaguar.nmr_utils.json_to_nmrdata(infile_name: pathlib.Path) schrodinger.application.jaguar.nmr_utils.NMRData

Reads a JSON file into an NMRData object. Will raise an exception if the NMR data is not for a 1H spectrum. Performs some additional checks for backward compatibility.

Parameters

infile_name – Path to JSON file.

Returns

NMRData object deserialized from JSON.

schrodinger.application.jaguar.nmr_utils.read_csv(fname: str) tuple[numpy.ndarray[typing.Any, numpy.dtype[+ScalarType]], numpy.ndarray[typing.Any, numpy.dtype[+ScalarType]]]

Helper function for parsing nmr.py format CSV into (X, Y) spectrum data.

Parameters

fname – Path to CSV file.

Returns

X data for spectrum (ppm).

Returns

Y data for spectrum (intensity).

schrodinger.application.jaguar.nmr_utils.all_were_assigned(mapping: dict['Signal', list['Signal']]) int

Check if every experimental Signal has had enough theoretical signals assigned to it to exactly fill its expected number of protons and report details of this check.

Parameters

mapping – Dictionary mapping the experimental signals to the theoretical signals.

Returns

True if every experimental signal was exactly filled, false otherwise.

Returns

The number of correctly filled experimental signals.

Returns

The total number of experimental signals.