hqs_nmr.solver.implementations.Sz_conserved_routines

Routines to calculate a spectrum, if only the Sz conservation is taken into account.

Functions

calc_correlator_function_parallel_Sz_conserved(...)

Calculate spectral function for one individual spin.

calc_correlator_function_variable_spin_number(...)

Calculate specified spin contributions of an NMR spectrum.

calc_groundstate_energy(Jz, hJz, hJp)

Calculate ground state by iterating over all Sz sectors.

determine_energy_shift(Jz, hJz, hJp, beta)

Determine the energy shift corresponding to the overall groundstate energy.

diagonalize_Sz_conserved_hamiltonian(...)

Builds and diagonalizes the Hamiltonian in one Sz sector.

evaluate_braket(operator, bra, ket, ...)

Evaluate expressions of the form <n|O|m>, where O is some operator.

lowest_energy_in_Sz_sector(statemap, Jz, ...)

Builds the Hamiltonian in one Sz sector and finds the lowest eigenvalue.

set_I_minus_operator(J_minus, statemap, ...)

Sets the operator I^-.

hqs_nmr.solver.implementations.Sz_conserved_routines.calc_correlator_function_parallel_Sz_conserved(Enm: ndarray, list_expectation_values_left: list[ndarray], expectation_values_right: ndarray, threshold_matrix_elements: float, eta: float, omegas: ndarray, correlator_function_fortran: ndarray) None

Calculate spectral function for one individual spin.

Parameters:
  • Enm – Energy differences between the different eigenenergies.

  • list_expectation_values_left – Expectation values for the ladder operators on the left of the correlator.

  • expectation_values_right – Expectation values of total spin ladder operator

  • threshold_matrix_elements – Threshold until which the Matrix elements are evaluated.

  • eta – Broadening parameter.

  • omegas – Frequency range.

  • correlator_function_fortran – Empty array to be overwritten with the spin resolved spectral function. Has to fortran style.

hqs_nmr.solver.implementations.Sz_conserved_routines.calc_correlator_function_variable_spin_number(calc_greens_function: bool, spin_indices: list[int], site_resolved_operators: ExpressionSpinful | list[ExpressionSpinful], operator_sum: ExpressionSpinful, Jz: ndarray, hJz: ndarray, hJp: ndarray, omegas: ndarray, eta: float, beta: float, energy_shift: float, magnetic_shift: float, threshold_matrix_elements: float, verbose: int) ndarray

Calculate specified spin contributions of an NMR spectrum.

The spin contributions are calculated exploiting Sz conservation through a direct resolvent approach.

Parameters:
  • calc_greens_function – If true the Green’s function is calculated, otherwise the spectral function.

  • spin_indices – List of spin indices for which to calculate the spectral function.

  • site_resolved_operators – List of site-resolved operators or operators on one site.

  • operator_sum – Sum of operators acting on each site.

  • Jz – Array with Sz terms.

  • hJz – Array with the Sz Sz coupling.

  • hJp – Array with the S+ S- coupling.

  • omegas – Desired frequencies.

  • eta – Explicit broadening of the peaks.

  • beta – Inverse temperature. 0 means infinite temperature.

  • energy_shift – Constant energy offset.

  • magnetic_shift – Magnetic shift of the hamiltonian.

  • threshold_matrix_elements – Threshold until which the Matrix elements are evaluated.

  • verbose – Level of verbosity of output.

Returns:

An array of the spectral function for each frequency for this cluster.

hqs_nmr.solver.implementations.Sz_conserved_routines.calc_groundstate_energy(Jz: ndarray, hJz: ndarray, hJp: ndarray) float

Calculate ground state by iterating over all Sz sectors.

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

  • hJz – Array with the S^z S^z coupling. dim: (number_spins x number_spins).

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

Returns:

The ground state energy.

hqs_nmr.solver.implementations.Sz_conserved_routines.determine_energy_shift(Jz: ndarray, hJz: ndarray, hJp: ndarray, beta: float) float

Determine the energy shift corresponding to the overall groundstate energy.

Note that the ground state energy is only calculated if beta is larger than zero.

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

  • hJz – Array with the S^z S^z coupling. dim: (number_spins x number_spins).

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

  • beta – Inverse temperature.

Returns:

The ground state energy if beta > 0, otherwise zero.

hqs_nmr.solver.implementations.Sz_conserved_routines.diagonalize_Sz_conserved_hamiltonian(statemap: StateMap, Jz: ndarray, hJz: ndarray, hJp: ndarray) tuple[ndarray, ndarray]

Builds and diagonalizes the Hamiltonian in one Sz sector.

Parameters:
  • statemap – State map of the Sz sector.

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

  • hJz – Array with the S^z S^z coupling. dim: (number_spins x number_spins).

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

Returns:

Returns the Eigenvalues, and Eigenvectors in one Sz sector.

hqs_nmr.solver.implementations.Sz_conserved_routines.evaluate_braket(operator: ExpressionSpinful, bra: ndarray, ket: ndarray, statemap_bra: StateMap, statemap_ket: StateMap) ndarray

Evaluate expressions of the form <n|O|m>, where O is some operator.

Parameters:
  • operator – Fermion expression for which to evaluate the braket.

  • bra – Bra vectors, stored in matrix.

  • ket – Ket vectors, stored in matrix.

  • statemap_bra – State map for the bra vector.

  • statemap_ket – State map for the ket vector.

hqs_nmr.solver.implementations.Sz_conserved_routines.lowest_energy_in_Sz_sector(statemap: StateMap, Jz: ndarray, hJz: ndarray, hJp: ndarray) float

Builds the Hamiltonian in one Sz sector and finds the lowest eigenvalue.

Parameters:
  • statemap – State map of the Sz sector.

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

  • hJz – Array with the S^z S^z coupling. dim: (number_spins x number_spins).

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

Returns:

Returns the smallest algebraic eigenvalue.

hqs_nmr.solver.implementations.Sz_conserved_routines.set_I_minus_operator(J_minus: ndarray, statemap: StateMap, statemap_minus: StateMap) csr_matrix_eigen

Sets the operator I^-.

Parameters:
  • J_minus – Array with I^- terms. dim: (number_spins).

  • statemap – State map of the current Sz sector.

  • statemap_minus – State map of the Sz sector after applying I^-.

Returns:

Returns the I^- operator applied to the sites specified in J_minus.