schrodinger.application.jaguar.nmr_basis module

exception schrodinger.application.jaguar.nmr_basis.BasisSizeException

Bases: Exception

class schrodinger.application.jaguar.nmr_basis.Basis(conmatrix: ndarray[Any, dtype[float64]], mults: ndarray[Any, dtype[int]], nspins: int, max_subgraph_size: int, sym_groups: list[str] | None = None, sym_spins: list[list[int]] | None = None, zq_spins: dict[str, list[int]] | None = None, use_symmetry: bool = False, use_Sz_conservation_filter: bool = True, use_zero_quantum_filter: bool = True)

Bases: object

Basis class for spin simulation

Parameters:
  • conmatrix – Connectivity matrix

  • mults – Spins multiplicity

  • nspins – Number of spins

  • max_subgraph_size – Maximum allowed subgraph size

  • sym_groups – List of symmetry groups

  • sym_spins – List of spins belonging to each symmetry group

  • zq_spins – Dict keyed by isotope with list of indices of zero-quantum spins

  • use_symmetry – Whether to use symmetry

  • use_Sz_conservation_filter – Whether to use Sz conservation filter

  • use_zero_quantum_filter – Whether to use the zero-quantum filter

__init__(conmatrix: ndarray[Any, dtype[float64]], mults: ndarray[Any, dtype[int]], nspins: int, max_subgraph_size: int, sym_groups: list[str] | None = None, sym_spins: list[list[int]] | None = None, zq_spins: dict[str, list[int]] | None = None, use_symmetry: bool = False, use_Sz_conservation_filter: bool = True, use_zero_quantum_filter: bool = True)
build_irreps(nspins: int)

Destructive workflow for reducing the basis by removing states identical by permutational symmetry. Then generate the respective projectors for later manipulation. Only the A1g (totally symmetric) projectors are generated.

This function builds and populates self.irrep_projector and self.irrep_dimension.

NOTE: This algorithm works by building every permutation then screening duplicate states. This is both wasteful in runtime and its memory use explodes with system size and symmetry order. As such, we cannot use it in production and it remains here for reference.

If required, we should implement a constructive algorithm instead that builds the symmetry-unique states directly, avoiding the wasteful create-and-filter.

Parameters:

nspins – Number of spins in the system.

static remove_subset_clusters(mat: csr_array) → csr_array

Remove clusters that are subsets of other clusters.

If a cluster is purely a subset of another cluster, it does not add any value to the simulation.

Parameters:

mat – matrix with rows that may be subsets

Returns:

matrix with subset rows removed

static lin2lm(indices: list[int] | numpy.ndarray[Any, numpy.dtype[int]])

Converts linear indexing of spin states into L,M indexing. In the linear indexing convention, spin states are listed in the order of increasing L rank, and, within ranks, in the order of decreasing M projection:

I=0 -> (L=0,M=0) I=1 -> (L=1,M=1) I=2 -> (L=1,M=0) …

Parameters:

indices – Linear indices of spin states

Returns:

[L,M] where L is the ranks of the spin states and M the projections of the spin states

apply_Sz_conservation_filter(basis: ndarray[Any, dtype[int]]) → ndarray[Any, dtype[int]]

Eliminate states not consistent with M=+1 from the basis

Param:

NDArray with basis states

Returns:

NDArray with basis states with M=+1

apply_zero_quantum_filter(basis: ndarray[Any, dtype[int]], zq_spins: list[int]) → ndarray[Any, dtype[int]]

Eliminate states from the basis not consistent with M=0 for selected zero-quantum spins

Parameters:
  • basis – NDArray with basis states

  • zq_spins – List of indices of zero-quantum spins

Returns:

NDArray with filtered basis states