# Frequently asked questions

## Contents

- 1 Why is Octave not supported?
- 2 Can you implement my favourite pulse sequence?
- 3 My algorithm is better than what you are using.
- 4 The optimal control sequence is produced, but the fidelity is low.
- 5 The optimal control sequence is produced, but does not work on the spectrometer.
- 6 I am seeing broken 3D graphics or graphics performance is bad.
- 7 Why does the stationary flow infrastructure only support periodic boundary conditions?
- 8 Which rotation conventions does Spinach use?
- 9 Matlab's parallel pool keeps getting stuck.

## Why is Octave not supported?

Because there are only 24 hours in a day - we don't have the manpower. Octave also has difficulty with parallelization and GPU support. Spinach relies on very recent Matlab features; it would be impractical to maintain compatibility with Octave.

## Can you implement my favourite pulse sequence?

Yes, but only if there is some new science to be done in the process. Please send an email to Ilya Kuprov and we'll do our best.

## My algorithm is better than what you are using.

Careful there. We have seen *a lot* of such claims. Spinach runs across half a dozen different spectroscopies: anything that's been swept under the rug in your published benchmarks will come out. There are very few things in numerical linear algebra that survive dissipative systems with thousands of spins and matrix dimensions that exceed a million.

## The optimal control sequence is produced, but the fidelity is low.

Make the pulse longer, stronger and give it more points. Generally speaking, if the system doesn’t get where you send it, it simply cannot – but for reasons that have to do with physics, not programming: you might not be giving it enough time or control power, or the destination state might be unreachable from your initial condition.

## The optimal control sequence is produced, but does not work on the spectrometer.

You need to check three things:

- The phase convention. Some spectrometers count phases clockwise (i.e. in the opposite direction from the ISO definition of polar coordinates). Try running the same pulse with a minus sign in front of the phase table.
- Power translation and calibration. It is easy to lose a factor of 2*pi in translation between Hz and rad/s. Instrument power calibration settings and methods vary between manufacturers.
- Probe geometry. Note that MAS probes usually have the coil at the magic angle, and so the control operator is not just Lx, but cos(theta)*Lz + sin(theta)*Lx, where theta is the magic angle. However, the pulse "power" only refers to sin(theta)*Lx.

## I am seeing broken 3D graphics or graphics performance is bad.

This is a persistent problem in Matlab, there's nothing we can do. The following command executed from inside Matlab usually fixes the appearance on Windows:

opengl software

On Linux you need to launch Matlab with the following command:

matlab -softwareopengl

On Macs, 3D graphics issues in Matlab are still unresolved as of version R2018b. We informed MathWorks, they are hopefully working on it.

## Why does the stationary flow infrastructure only support periodic boundary conditions?

Because the boundary condition problem at the generator level has no general solution. If you would like to have an absorptive boundary, put rapid relaxation into boundary voxels. If you would like some specifiic non-absorptive boundary behaviour, adjust your velocity field accordingly.

## Which rotation conventions does Spinach use?

Active ZYZ, described in detail here.

## Matlab's parallel pool keeps getting stuck.

If you press Ctrl-C in the middle of a lengthy parallel calculation, the worker processes do not stop until they have completed their current chunks.

- In benign cases, this would mean that a new calculation cannot be started until all worker nodes complete their chunks and exit. To force parallel pool shutdown use smack.m function.
- In bad cases, Matlab's parallel pool becomes hopelessly confused. You will be getting the following error message:

Error using Composite/subsref (line ###) An invalid indexing request was made.

- The only solution is to restart Matlab.

*Version 2.1, authors: Ilya Kuprov*