schrodinger.application.jaguar.nmr_utils module

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) float