hqs_nmr.solver.implementations.reference_solver

A simple direct solver as a reference implementation.

Functions

calc_correlator_function_parallel(vectors, ...)

Calculate spectral function using a serial loop.

calc_correlator_function_serial(vectors, ...)

Calculate spectral function using a serial loop.

reference_nmr_solver(hamiltonian, ...[, ...])

Calculate a NMR spectrum brute force from a SpinHamiltonianSystem.

hqs_nmr.solver.implementations.reference_solver.calc_correlator_function_parallel(vectors: ndarray, Enm: ndarray, Ims: list[SpinSystem], ImZ: ndarray, eta: float, omegas: ndarray, As_fortran: ndarray, spin_contributions: list[int]) None

Calculate spectral function using a serial loop.

Note: This function will only be called, if the lattice_functions are installed.

Parameters:
  • vectors – Eigenstates of the hamiltonian.

  • Enm – Energy differences between the different eigenenergies (E_n - E_m).

  • Ims – Ladder operators for individual spins (I_l^-).

  • ImZ – Expectation values of total spin ladder operator (exp(E_n beta) <n|I_total^+|m> / Z).

  • eta – Broadening parameter.

  • omegas – Frequency range.

  • As_fortran – Empty array to be overwritten with the spin resolved spectral function. Has to

  • style. (have fortran)

  • spin_contributions – List of indices l of I^+_l for which to evaluate the correlator.

hqs_nmr.solver.implementations.reference_solver.calc_correlator_function_serial(vectors: ndarray, Enm: ndarray, Ims: list[SpinSystem], ImZ: ndarray, eta: float, omegas: ndarray, As: ndarray, spin_contributions: list[int]) None

Calculate spectral function using a serial loop.

Parameters:
  • vectors – Eigenstates of the hamiltonian.

  • Enm – Energy differences between the different eigenenergies (E_n - E_m).

  • Ims – Ladder operators for individual spins (I_l^-).

  • ImZ – Expectation values of total spin ladder operator (exp(E_n beta) <n|I_total^+|m> / Z).

  • eta – Broadening parameter.

  • omegas – Frequency range.

  • As – Empty array to save in the spin resolved spectral function.

  • spin_contributions – List of indices l of I^+_l for which to evaluate the correlator.

hqs_nmr.solver.implementations.reference_solver.reference_nmr_solver(hamiltonian: SpinHamiltonianSystem, gyromagnetic_ratios: np.ndarray, omegas: np.ndarray, eta: float, beta: float, spin_contributions: list[int], solver_settings: NMRSolverSettings, calc_parallel: bool = True, **kwargs: dict[str, Any]) np.ndarray

Calculate a NMR spectrum brute force from a SpinHamiltonianSystem.

Evaluates a correlator function of the form .. math:: sum_n frac{bra{n} I^+ ket{m} bra{m} I^- ket{n}}{omega + E_n - E_m + i eta} where I_^- = sum_l I^-_l.

Parameters:
  • hamiltonian – Struqture spin Hamiltonian.

  • gyromagnetic_ratios – Array of the gyromagnetic factors per site.

  • omegas – Desired frequencies.

  • eta – Explicit broadening of the peaks.

  • beta – Inverse temperature. 0 means infinite temperature.

  • spin_contributions – List of indices l of I^+_l for which to evaluate the correlator.

  • solver_settings – Object storing solver-specific settings.

  • calc_parallel – If True, the parallel implementation is used, otherwise the serial one.

  • kwargs – Catch all for general interface.

Returns:

An array of the spectral function for the specified spin contributions at each frequency.

Raises:

ValueError – If number of spins does not match the number of gyromagnetic factors.