Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Spin Hamiltonian

With the molecular data or just the NMR parameters mentioned in the previous section, it is possible to set up the spin Hamiltonian of the spin system relevant for an NMR simulation. This can be achieved by calling the hqs_nmr_parameters.nmr_hamiltonian function that returns the spin Hamiltonian defined in a struqture format. It contains the terms normally needed to represent the spin Hamiltonian of a closed-shell organic molecule in solution:

  • Zeeman interaction of nuclei with the static magnetic field
  • isotropic chemical shifts
  • indirect spin-spin scalar couplings

Note that the units of the spin Hamiltonian conform to the conventions in the field of NMR. In consequence, the Hamiltonian is in angular frequency units of rad s−1. To convert to Hz, the Hamiltonian needs to be divided by 2π. To convert to energy units (Joule), the Hamiltonian needs to be multiplied with the reduced Planck constant ℏ.

The parameters argument in nmr_hamiltonian can accept either a MolecularData or an NMRParameters object. For example, an NMR spin Hamiltonian with the example parameters for nitrobenzene at a field of 2.5 T can be set up as shown below (for information on how to retrieve the molecular data from a dataset, see the next section):

from hqs_nmr_parameters import examples, nmr_hamiltonian

parameters = examples.molecules["C6H5NO2"]
hamiltonian = nmr_hamiltonian(parameters=parameters, field=2.5)

Furthermore, the following optional arguments can be set:

  • reference_isotope: Used to set up a relative spin Hamiltonian for use within the rotating frame approximation. The Larmor frequency of the reference isotope is subtracted from the Zeeman terms of all nuclei. The default value is None, i.e., the full Hamiltonian will be set up instead.
  • reference_shift: Shift in ppm for the reference frequency in the rotating frame approximation. It can help to evaluate the Hamiltonian in the correct range of frequencies. Default: 0.0.
  • gyromagnetic_ratios: Gyromagnetic ratios in rad s−1 T−1 of relevant isotopes. Default: pre-saved values.

As mentioned above, the reference_isotope option should be set to construct the spin Hamiltonian in the rotating frame approximation. For example, using the Larmor frequency of 1H with a shift of 0 ppm as the reference frequency (default), a spin Hamiltonian is obtained via:

from hqs_nmr_parameters import examples, nmr_hamiltonian

parameters = examples.molecules["C6H5NO2"]
hamiltonian_rf = nmr_hamiltonian(
    parameters=parameters,
    field=2.5,
    reference_isotope=(1, "H"),
)

As discussed in the Molecular data section, it is possible to drop terms related to, e.g., 13C isotopes. Here this is not necessary, as the examples.molecules dataset used here only contains 1H NMR parameters for the selected molecule C6H5NO2.

For a more detailed introduction on how to set up and work with a spin Hamiltonian, please have a look at the example notebooks.