Solver
The HQS NMR Tool comes with a variety of solvers to calculate the NMR spectrum where is the total spin weighted by the gyromagnetic factors, is the density matrix, and is a convergence factor for the Fourier transform. can be understood in terms of nuclear spins coupling to very small noise leading to a broadening of NMR peaks in the signal or as the intrinsic resolution of the spectrometer. See the chapter Background for details on the general math behind all solvers and on NMR.
Typically, though, one does not directly interface with a specific solver, but just use the convenience function calculate_spectrum to calculate NMR spectra.
All currently implemented solvers in the HQS NMR tool are frequency solvers and offer an identical base interface but differ by additional solver arguments.
Frequency solvers
Frequency solvers calculate the spectrum in the frequency domain and avoid the FFT that would be required for time solvers. These solvers calculate N correlation functions for given frequency points and return them as a numpy array where is the number of spins and the number of frequency points, Here, is the total spin creation operator scaled by the gyromagnetic factor . The full NMR signal is the sum of spin-resolved signals,
Frequency solver interface
All frequency solvers take the following positional arguments plus additional solver-dependent options:
frequency_solver(
calc_greens_function: bool,
hamiltonian: SpinHamiltonianSystem,
gyromagnetic_ratios: np.ndarray[tuple[Any,], np.dtype[np.floating]],
omegas: np.ndarray[tuple[Any,], np.dtype[np.floating]],
**kwargs
)
All frequency solvers return a numpy array where is the number of spins and the number of frequency points.
calc_greens_function
: bool
If set to True
, the Green's function rather than the spectrum is calculated. The spectrum can be obtained as the imaginary part of the Green's function.
hamiltonian
: struqture_py.spins.SpinHamiltonianSystem
The spin-Hamiltonian in the rotating frame given as a struqture.spins.SpinHamiltonianSystem
.
The HQS NMR Tool provides libraries to obtain the Hamiltonian from molecule inputs, see Molecule input.
Arbitrary Hamiltonians can be generated in Python:
from struqture_py import spins
number_spins = 2
coupling = 1.0
shift = 1.0
hamiltonian = spins.SpinHamiltonianSystem(number_spins)
# Generate nearest neighbor xx + yy interaction
for i in range(number_spins - 1):
hamiltonian.add_operator_product(spins.PauliProduct().x(i).x(i + 1), coupling)
hamiltonian.add_operator_product(spins.PauliProduct().y(i).y(i + 1), coupling)
# Generate Zeeman terms
for i in range(number_spins ):
hamiltonian.add_operator_product(spins.PauliProduct().z(i), shift)
gyromagnetic_ratios
: np.ndarray
List of gyromagnetic ratios for the spins included in the simulation. Used to obtain the operators
omegas
: np.ndarray
Numpy array of frequency points the spectrum should be evaluated at.
Available solvers
The HQS NMR tool comes with the following frequency solvers:
- Direct solver
- Cluster solver
- Spin dependent cluster solver
- Automated solver (experimental)