hqs_nmr.hamiltonian_tools

Tools to obtain and manipulate a NMR Hamiltonian.

Functions

cluster_molecule(molecule_parms, ...)

Cluster the molecule into spin-dependent cluster.

extract_cluster_nmr_parameters(...)

Extract the NMR parameters of a cluster from the NMR parameters of the molecule.

extract_coupling(H)

Extract the coupling matrices from a Struqture spin Hamiltonian.

magnetically_equivalent_spins(...[, ...])

Identify magnetically equivalent spins and return them as groups.

nmr_spin_hamiltonian(molecule_parms, ...)

Construct the NMR spin Hamiltonian of a molecule.

normalized_spin_dependent_gyromagnetic_ratios(...)

Gyromagnetic ratios of each spin, normalized w.r.t.

sh_to_matrix(H)

Convert a Struqture spin Hamiltonian to its matrix representation.

hqs_nmr.hamiltonian_tools.cluster_molecule(molecule_parms: NMRParameters, gyromagnetic_ratios: dict[Isotope, float], field: float, reference_energy: float, solver_settings: NMRSolverSettings, homoisotope: Isotope) list[Dict[str, Any]]

Cluster the molecule into spin-dependent cluster.

Parameters:
  • molecule_parms – The molecular isotopes, shifts and J-coupling values.

  • gyromagnetic_ratios – Dictionary of gyromagnetic ratios in rad / (T s).

  • field – Magnetic field in T.

  • reference_energy – Reference energy in rad / s.

  • solver_settings – NMRSolverSettings object containing information on the clustering and solver methods.

  • homoisotope – Isotope specified as Isotope(mass, symbol) to define the frequency (w=gamma*field) of the rotating frame. Defaults to Isotope(1, ‘H’).

Returns:

List with a dictionary defining each spin-dependent cluster.

hqs_nmr.hamiltonian_tools.extract_cluster_nmr_parameters(molecule_parms: NMRParameters, cluster_indices: list[int]) NMRParameters

Extract the NMR parameters of a cluster from the NMR parameters of the molecule.

Parameters:
  • molecule_parms – The molecular isotopes, shifts and J-coupling values.

  • cluster_indices – Indices of the cluster.

Returns:

An object storing the NMR data of the cluster Hamiltonian.

hqs_nmr.hamiltonian_tools.extract_coupling(H: SpinHamiltonianSystem) tuple[ndarray, ndarray, ndarray]

Extract the coupling matrices from a Struqture spin Hamiltonian.

Parameters:

H – Struqture Spin Hamiltonian.

Returns:

Array with S^z term with prefactor 2, array with the S^z-S^z coupling, array with the S^+-S^- coupling.

hqs_nmr.hamiltonian_tools.magnetically_equivalent_spins(molecule_parms: NMRParameters, frequency_MHz: float, gyromagnetic_ratios: dict[Isotope, float] = {(1, 'H'): 267522128.0, (13, 'C'): 67282840.0, (15, 'N'): -27126180.4, (19, 'F'): 251814800.0, (31, 'P'): 108394000.0}, homoisotope: Isotope = (1, 'H'), tolerance_couplings: float = 1.0, tolerance_shifts: float = 1.0, verbose: int = 0) list[ndarray]

Identify magnetically equivalent spins and return them as groups.

Parameters:
  • molecule_parms – The molecular isotopes, shifts and J-coupling values.

  • frequency_MHz – Spectrometer frequency in MHz.

  • gyromagnetic_ratios – Dictionary of gyromagnetic ratios in radians per second per Tesla.

  • homoisotope – Isotope specified as Isotope(mass, symbol) to define the frequency (w=gamma*field) of the rotating frame. Defaults to Isotope(1, ‘H’).

  • tolerance_couplings – Tolerance for the J-couplings in the group identifier in percent. Defaults to 1.

  • tolerance_shifts – Tolerance for the shifts in the group identifier in percent. Defaults to 1.

  • verbose – Verbosity level of output. Defaults to 0.

Returns:

A list of integer arrays with the indices of spins in the individual groups.

hqs_nmr.hamiltonian_tools.nmr_spin_hamiltonian(molecule_parms: NMRParameters, gyromagnetic_ratios: dict[Isotope, float], field: float, reference_energy: float) SpinHamiltonianSystem

Construct the NMR spin Hamiltonian of a molecule.

Parameters:
  • molecule_parms – The molecular isotopes, shifts and J-coupling values.

  • gyromagnetic_ratios – Dictionary of gyromagnetic ratios in rad / (T s).

  • field – Magnetic field in T.

  • reference_energy – Reference energy in rad / s.

Returns:

Hamiltonian in rad / s.

hqs_nmr.hamiltonian_tools.normalized_spin_dependent_gyromagnetic_ratios(molecule_parms: NMRParameters, gyromagnetic_ratios: dict[Isotope, float] = {(1, 'H'): 267522128.0, (13, 'C'): 67282840.0, (15, 'N'): -27126180.4, (19, 'F'): 251814800.0, (31, 'P'): 108394000.0}) ndarray

Gyromagnetic ratios of each spin, normalized w.r.t. the gyromagnetic ratio of hydrogen.

Parameters:
  • molecule_parms – The molecular isotopes, shifts and J-coupling values.

  • gyromagnetic_ratios – Dictionary of gyromagnetic ratios in rad / (T s).

Returns:

Scaled gyromagnetic ratios of each spin.

hqs_nmr.hamiltonian_tools.sh_to_matrix(H: SpinHamiltonianSystem) ndarray[tuple[int, ...], dtype[complexfloating]]

Convert a Struqture spin Hamiltonian to its matrix representation.

Parameters:

H – Struqture Spin Hamiltonian

Returns:

The Spin Hamiltonian as a dense matrix (numpy array).