The package was introduced in 2011 in the Journal of Magnetic Resonance as a library for simulating spin dynamics in large spin systems. Subsequent publications describe its use for large-scale magnetic resonance simulations, including reduced state-space calculations, Fokker-Planck treatment of spatial dynamics, quantum mechanical MRI simulation, and optimal control calculations.
The source code is maintained in a public GitHub repository and distributed under the MIT License. The name of the package whimsically refers to the physical concept of spin and to Popeye the Sailor who, in the eponymous comic books, becomes stronger after consuming spinach.
History
Spinach was developed for simulations in which the conventional direct product Hilbert space description of multi-spin systems becomes intractable due to the exponential complexity scaling. The 2011 paper describes a library that uses reduced Liouville space basis sets and sparse matrix methods to simulate liquid-state NMR experiments for systems with more than forty spins on a desktop workstation.
Subsequent development added modules for spatial dynamics, MRI, tensor trains, and optimal control. A 2016 article described Fokker-Planck formalism implementation in Spinach, in which spatial dynamics (sample spinning, diffusion, and flow) can coexist with spin dynamics. A 2019 Science Advances paper reported quantum-mechanical MRI simulations of coupled spin systems with three-dimensional diffusion, flow, chemical kinetics, and relaxation.
Computational approach
250 MHz ECOSY NMR spectrum of strychnine alkaloid simulated using Spinach.
Spinach implements magnetic resonance spectroscopy and imaging simulations by solving the equation of motion for the density matrix in the time domain:
where the Liouvillian superoperator is a sum of the Hamiltonian commutation superoperator , relaxation superoperator , kinetics superoperator , and potentially other terms that govern spatial dynamics and coupling to other degrees of freedom:
Computational efficiency is achieved through the use of reduced state spaces, sparse matrix arithmetic, on-the-fly trajectory analysis, and dynamic parallelization.
Functionality
As of 2026, Spinach is cited in over 600 academic publications. According to the documentation and academic papers citing its features, the most recent version 2.12 of the package performs:
Spinach contains an implementation the gradient ascent pulse engineering (GRAPE) algorithm for quantum optimal control. The documentation and the book describing the optimal control module of the package list the following features:
Dissipative background evolution generators and control operators are supported, as well as ensemble control over distributions in common instrument calibration parameters, such as control channel power and offset. Common models of spin relaxation (Redfield theory, stochastic Liouville equation, Lindblad theory) and chemical kinetics are supported, and a library of powder averaging grids is included with the package.
123Hogben, H. J.; Krzystyniak, M.; Charnock, G. T. P.; Hore, P. J.; Kuprov, I. (2011). "Spinach - a software library for simulation of spin dynamics in large spin systems". Journal of Magnetic Resonance. 208 (2): 179–194. doi:10.1016/j.jmr.2010.11.008. PMID21169043.
↑"Release 2.13". GitHub. 22 September 2026. Retrieved 23 September 2026.
12Hogben, H.J.; Krzystyniak, M.; Charnock, G.T.P.; Hore, P.J.; Kuprov, I. (2011). "Spinach – a software library for simulation of spin dynamics in large spin systems". Journal of Magnetic Resonance. 208 (2): 179–194. doi:10.1016/j.jmr.2010.11.008. ISSN1090-7807.
↑Dumez, J.-N. (2021). "Frequency-swept pulses for ultrafast spatially encoded NMR". Journal of Magnetic Resonance. 323 106817. doi:10.1016/j.jmr.2020.106817. ISSN1090-7807.
↑Redrouthu, V.S.; Mathies, G. (2022). "Efficient pulsed dynamic nuclear polarization with the X-inverse-X sequence". Journal of the American Chemical Society. 144 (4): 1513–1516. doi:10.1021/jacs.1c09900. ISSN0002-7863.
↑Khaneja, N.; Reiss, T.; Kehlet, C.; Schulte-Herbrüggen, T.; Glaser, S.J. (2005). "Optimal control of coupled spin dynamics: design of NMR pulse sequences by gradient ascent algorithms". Journal of Magnetic Resonance. 172 (2): 296–305. doi:10.1016/j.jmr.2004.11.004. ISSN1090-7807.