Rapid scan: Steady-state solution of the Bloch equations

This user guide explains how to calculate steady-state solutions of the Bloch equations for a spin-1/2 in the presence of field modulation, using EasySpin's function blochsteady. This forms the basis of Rapid-Scan EPR.

This user guide contains the following topics:

Keep in mind that blochsteady is a new function as of EasySpin 5, and it will likely change and expand in future releases.

Time-domain cw EPR signal

EasySpin can calculate the periodic time-dependent response of a simple spin-1/2 to the excitation fields in a cw EPR experiment: an oscillating microwave field of amplitude B1 perpendicular to the applied magnetic field B0, which is modulated with peak-to-peak amplitude Bm.

The function that calculates this response is blochsteady. It is called with many input arguments.

```blochsteady(g,T1,T2,deltaB0,B1,ModAmp,ModFreq)
```

The first three input parameters contain the essentials about the spin-1/2: its g factor in `g`, its longitudinal relaxation time (in μs) in `T1`, and its transverse relaxation time (in μs) in `T2`. These three spin system parameters are sufficient to calculate the response. blochsteady currently does not support any more complicated spin systems beyond a spin-1/2. Some exemplary values are:

```g = 2;
T1 = 4;    % microseconds
T2 = 0.5;  % microseconds
```

The next four input parameters give the experimental parameters. `deltaB1` is the field offset from the resonance frequency of the spin, in mT. Setting it to zero sets the field on-resonance with the spin. `B1` is the microwave magnetic field amplitude at the sample, in mT. The last two parameters give the peak-to-peak modulation amplitude (`ModAmp`, in mT) and the modulation frequency (`ModFreq`, in kHz) of the applied field modulation along B0. Again, here are some exemplary values:

```B1 = 0.05;      % mT
deltaB0 = 0;    % mT
ModAmp = 0.5;   % mT
ModFreq = 100;  % kHz
```

With these inputs, blochsteady calculates one period of the periodic steady-state response of the magnetic moment of the spin. You can call blochsteady without any outputs:

```blochsteady(g,T1,T2,deltaB0,B1,ModAmp,ModFreq);
```

Then it will plot the calculated results. Or you can ask for up to four outputs, which will give the time axis and the three components of the time-dependent magnetization vector. For example, to plot the absorption (`My`, component of the magnetic moment out of phase with the microwave) and the dispersion (`Mx`, component of the magnetic moment in phase with the microwave), use

```[t,Mx,My,Mz] = blochsteady(g,T1,T2,deltaB0,B1,ModAmp,ModFreq);
plot(t,My,t,Mx);
```
Some options

In order to let you change some of the calculation settings, blochsteady can take one more input argument, a structure. In it, you can set the number of points you want to have in the time-domain signal:

```Opt.nPoints = 1000;   % number of points
```

There are settings for the solving algorithm, which runs in the frequency domain: `Opt.kmax` can be used to manually specify the maximum Fourier order used in the calculation. Normally, there is no need to specify this, since an optimal value for this is determined automatically. `Opt.Method` can be used to select the method for the construction of the time-domain signal. Except for speed, this setting has no effect on the final outcome.

```Opt.kmax = 200;      % the higher the better (but also slower)
Opt.Method = 'fft';  % alternative: 'td', which is slower
```
Field sweeps

blochsteady does not have built-in capabilities for a field sweep. However, you can set one up using a `for` loop. Here is a brief example, using the same inputs as above:

```deltaB0 = linspace(-1,1)*2;  % range of field offsets, mT
for b = 1:numel(deltaB0)
end
```

This gives a two-dimensional array `My`. One way of plotting it is as follows:

```pcolor(deltaB0,t,My);
xlabel('field offset (mT)');
ylabel('time (\mus)');
```
Powders
You can use blochsteady to simulate rapid-scan spectra of powders. For spin systems with essentially isotropic g factors, there is a very compact way: First simulate the spectrum using pepper, and then use this to run a field sweep with blochsteady.

Let's take a nitroxide as an example. First, simulate the powder spectrum, without field modulation

```Nx.g = [2.008 2.006 2.002];
Nx.Nucs = '14N';
Nx.A = [20 20 90];   % MHz
Nx.lwpp = 0.2;       % mT
Exp.mwFreq = 9.5;    % GHz
Exp.Harmonic = 0;    % no field modulation!
Exp.Range = [333 345];   % mT
[B,spc] = pepper(Nx,Exp);
```

Next, define the field offset range and all the other parameters needed for the rapid-scan signal.

```DeltaB0 = B-mean(B); % range of field offsets, mT

T1 = 1;    % microseconds
T2 = 0.2;  % microseconds
B1 = 0.01; % microwave field amplitude, mT
Bmpp = 7;  % peak-to-peak modulation amplitude, mT
fm = 100;  % modulation frequency, kHz

Options.nPoints = 4000; % lots of points due to the large modulation amplitude
```

Now, loop over the field offset range, calculate the time-domain signals for each field value, and add them up using the spectral intensity as weight.

```spc_rs = 0;
for k = 1:numel(spc)
```plot(t,spc_rs);