hqs_nmr.spin_dependent_clustering

Functions that can identify for a particular spin the most strongly coupled spins.

Used to construct spin-dependent clusters.

Functions

get_weight_matrix(hJp, Jz, weight_offset)

Create weight matrix according to perturbation theory.

identify_spin_dependent_clusters(Jz, hJp, ...)

Identify for each spin the best cluster and group spins with the same cluster together.

spin_dependent_cluster_finder(spin_index, ...)

For one spin return sorted list with indices of spins its strongest coupled with.

spin_dependent_cluster_list(weights, ...[, ...])

Identify clusters for each spin.

hqs_nmr.spin_dependent_clustering.get_weight_matrix(hJp: ndarray, Jz: ndarray, weight_offset: float) ndarray

Create weight matrix according to perturbation theory.

\[w_{x,y} = \frac{|J_{x,y}|^2}{|J^z_x - J^z_y| + d}\]
Parameters:
  • hJp – J-coupling matrix.

  • Jz – Jz vector.

  • weight_offset – Small factor to avoid division by zero.

Returns:

Matrix with weights from perturbation theory.

hqs_nmr.spin_dependent_clustering.identify_spin_dependent_clusters(Jz: ndarray, hJp: ndarray, solver_settings: NMRSolverSettings) tuple[list, list]

Identify for each spin the best cluster and group spins with the same cluster together.

Parameters:
  • Jz – Array with S^z terms. dim: (number_spins).

  • hJp – Array with the S^+ S^- coupling. dim: (number_spins x number_spins).

  • solver_settings – NMRSolverSettings object containing information on the cluster and solver method.

Returns:

List of lists of spins that are associated with identical clusters. List of integer arrays with sorted indices that make up the clusters.

hqs_nmr.spin_dependent_clustering.spin_dependent_cluster_finder(spin_index: int, weights: ndarray, J_coupling: ndarray, max_cluster_size: int, minimize_cluster: bool = False) list[int]

For one spin return sorted list with indices of spins its strongest coupled with.

Parameters:
  • spin_index – Index of the spin for which to find the coupled spins.

  • weights – Weight matrix of the effective spin system.

  • J_coupling – Matrix with J-coupling values.

  • max_cluster_size – Maximum number of spins the spin is allowed to couple to.

  • minimize_cluster – If True, it is checked, if independent partitions can be identified in the cluster. Defaults to False.

Returns:

Integer array with sorted indices that make up the cluster for the spin.

hqs_nmr.spin_dependent_clustering.spin_dependent_cluster_list(weights: ndarray, J_coupling: ndarray, max_cluster_size: int, number_spins: int, verbose: int = 0, minimize_cluster: bool = False) tuple[list, list]

Identify clusters for each spin.

Parameters:
  • weights – Weight matrix of the effective spin system.

  • J_coupling – Matrix with J-coupling values.

  • max_cluster_size – Maximum number of spins the spin is allowed to couple to.

  • number_spins – Number of spin half in the full system.

  • verbose – Verbosity level of output.

  • minimize_cluster – If True, it is checked, if partitions can be identified in the cluster. Defaults to False.

Returns:

List of lists of spins that are associated with identical clusters. List of integer arrays with sorted indices that make up the clusters.