Computes isotropic and fast-motional cw EPR spectra of radicals in solution.

spec = garlic(...)
[B,spec] = garlic(...)

See also the user guide on how to use garlic.


garlic computes isotropic and fast-motional cw EPR spectra of douplet radicals in solution, i.e., of spin systems with an electron spin S=1/2 coupled to an arbitrary number of nuclear spins I>=1/2 with small hyperfine couplings.

The composition of the spin system is specified in Sys, and the experimental settings are given in Exp.

garlic then returns the spectrum in spec and, if requested, a field range vector in B (in units of mT). If neither B nor spec are requested, garlic plots the simulated spectrum. garlic can also simulate frequency-swept spectra.

Input: Spin system

The following table lists all possible fields in the spin system structure Sys. Note that Sys here contains only a few fields of the general spin system structure as used by functions like pepper and salt. All fields except n are mandatory.

Array with 1, 2 or 3 elements, either isotropic g factor or principal values of an axial or orthorhombic g tensor.

Sys.g = 2.005;                  % isotropic g
Sys.g = [2.001 2.004];          % axial g
Sys.g = [2.001 2.002 2.004];    % orthorhombic g
String with comma-separated list of isotopes, e.g. Sys.Nucs = '1H,13C'.
Vector of number of equivalent nuclei, e.g. Sys.n = [2,3], if the spin system contains two 1H and three 13C nuclei. Can be omitted if all nuclei in Sys.Nucs occur only once.
1xN or Nx3 array. Vector of isotropic hyperfine couplings in MHz, e.g. Sys.A = [10 52].
Alternatively, array containing the principal values for all hyperfine tensors, one row per nucleus. E.g., Sys.A = [15 15 40;-4 -3 7] for two nuclei.
1- or 2-element array of peak-to-peak (PP) linewidths (all in mT).
1- or 2-element array of FWHM linewidths (all in mT).

For simulations in the fast motional regime, the principal values of the g and all A tensors have to be given. One more parameter in Sys specifies the speed of the rotational motion:

tcorr, scalar
Rotational correlation time for isotropic rotational diffusion, in seconds. See also the function fastmotion. If tcorr is omitted or set to zero, the isotropic limit spectrum is computed.

For isotropic rotational motion, the correlation time tcorr and the diffusion rate D are related by tcorr = 1/(6*D).

Anisotropic diffusion is not supported.

Base-10 logarithm of the correlation time, offering an alternative way to input the correlation time. If given, tcorr is ignored.

If tcorr or logtcorr is given, the fast-motional spectrum is computed. The necessary line widths are computed via the function fastmotion (for details see there). The resulting spectrum is additionally broadened by Lorentzian and Gaussian broadenings specified in Sys.lw using convolution, just as in the isotropic case.

If the inverse of the correlation time becomes similar in magnitude to the spectral anisotropy, the fast-motional model used by garlic (via fastmotion) is not valid anymore.

For simulating a multi-component mixture, Sys should be a cell array of spin systems, e.g. {Sys1,Sys2} for a two-component mixture. Each of the component spin systems should have a field weight that specifies the weight of the corresponding component in the final spectrum.

Input: Experimental parameters

The experiment structure Exp contains all parameters relating to the experiment. These settings are identical for all cw EPR simulation functions (pepper, chili, garlic). See the page on cw EPR experimental parameters.

Input: Simulation options

The structure Opt collects computational parameters. Opt need not be specified, in which case default values for all fields are used. The field names and their possible values are listed below.

Method: 'exact', 'perturb1', 'perturb2', 'perturb3', 'perturb4', 'perturb5'
Specifies the method to be used in the simulation of field-swept spectra.

'exact', which is also the default, indicates the Breit-Rabi method. This gives exact resonance fields for each single nucleus, which are then combined to give the total spectrum. Cross-nuclear terms are neglected.

'perturb1' etc. indicate the order of perturbation theory (1st through 5th) to be used to calculate the single-nucleus resonance fields. Cross-nuclear terms are neglected as well. Apart from demonstration purposes, there is no reason to use perturbation theory.

If cross-nuclear terms are anticipated to be significant (e.g. in a 250 MHz EPR spectrum of a radical containing a nucleus with a hyperfine coupling of 100 MHz and other nuclei), then use pepper with matrix diagonalization (Opt.Method='matrix' instead of garlic.

Verbosity: 0, 1, or 2
Determines how much information garlic prints to the command window. If Opt.Verbosity=0, garlic is silent. 1 logs relevant information, 2 gives more details.
IsoCutoff: scalar
This gives a cut-off value for the relative abundance of isotopologues. Any isotopologue with a relative abundance below this value will not be included in the simulation. The most abundant isotopologue (magnetic or not) has relative abundance 1. The default value for IsoCutoff is 1e-6.
AccumMethod: '' (default), 'binning', 'explicit', 'template'

Determines how the spectrum is constructed once all the line positions, intensities and widths are calculated.


To compute resonance fields, garlic uses a fixed-point iteration based on the exact Breit-Rabi solutions for a S=1/2 with an arbitrary nuclear spin. This is superior to using perturbation expressions, since it gives resonance field values accurate to within numerical error. For multi-nuclear spin systems, cross-terms between nuclei are neglected, so the Breit-Rabi solver is not exact in that case.

Only allowed transitions are computed. If the hyperfine couplings are too large, garlic will refuse to run. All transition intensities are assumed to be equal.

Sets of equivalent nuclei are transformed into a coupled representation (see equivcouple). Non-equivalent groups of equivalent nuclei are treated sequentially, i.e. cross terms are neglected.

For the computation of fast-motional line widths, the function fastmotion is used.


Spectra from systems with many nuclei are easily simulated.

Sys = struct('g',2,'Nucs','1H,14N','A',[30,40],'n',[5 4]);
Sys.lwpp = [0 0.1]; % only Lorentzian broadening
Exp = struct('mwFreq',9.7);
To simulate a radical spectrum with its 13C satellite lines, just specify 'C' instead of '13C' for the carbon nucleus, and EasySpin will automatically simulate the spectra of all isotope combinations, in this case 98.93% with 12C and 1.07% with 13C.
Sys.g = 2;
Sys.Nucs = '1H,1H,C';
Sys.n = [2 3 1];
Sys.A = [10 11 3];
Sys.lwpp = [0 0.01];
Exp.mwFreq = 9.7;
Exp.CenterSweep = [346.5 2.8];

Zoom in to see the 13C satellite lines.

A simple example of a spectral simulation in the fast motional regime using the rotational correlation time:

A = mt2mhz([5.8 5.8 30.8]/10);
Sys = struct('g',[2.0088 2.0061 2.0027],'Nucs','14N','A',A);
Sys.tcorr = 5e-9;
Exp = struct('mwFreq',9.5);
See also

esfit, fastmotion, pepper, resfields, resfields_perturb, salt