In this work, we describe essential tools of linear algebra necessary for
calculating the effect of chemical exchange on spin dynamics and polarization
transfer in various nuclear magnetic resonance (NMR) experiments. We show how
to construct Hamiltonian, relaxation, and chemical exchange superoperators in
the Liouville space, as well as demonstrate corresponding code in Python.
Examples of applying the code are given for problems involving chemical
exchange between NH3 and NH4+ at zero and high magnetic field and polarization
transfer from parahydrogen relevant in SABRE (signal amplification by
reversible exchange) at low magnetic field (0-20 mT). The presented methodology
finds utility for describing the effect of chemical exchange on NMR spectra and
can be extended further by taking into account non-linearities in the master
equation