==============
Feature Manual
==============
The features of SpinDrops are described here in four sections:
:ref:`Menus`, :ref:`Windows`, :ref:`Preferences`, and :ref:`Keyboard
Shortcuts`.
Menus
=====
File Menu

Open Project
++++++++++++
Select a previously saved project to open. If there are no saved
projects, the list will be empty.
Save Project...
+++++++++++++++
This will save the state of the current project, if it is a named
project. Projects when saved contain all of your work, and allow you
to switch between different projects, without losing work you have
done in other Projects.
When a project is saved:
 The current preference settings are saved in the Project.
 The current sequence (experiment) is saved in the Project.
 The current spin system is saved in the Project.
Save Project As...
++++++++++++++++++
This creates a new project from the current simulation state with a
project name given by the user. The new project will become active.
Import...
+++++++++
Prompts the user to select a file to be imported into SpinDrops. The
file can be either a saved project, or a shaped pulse file. If
multiple files are selected for import, they will be imported one at a
time. During the import of each file the user is asked what the
imported object (project or pulse) should be called. This option is
only available on the desktop platforms that have access to a file
system (macOS,Linux,Windows,web).
Export Project...
+++++++++++++++++
This option exports the current project, allowing the user to save all
of the settings, the pulse sequence, and pulses to a project file.
The user is prompted for a file name for the project. This option is
currently only available on the desktop platforms having file systems
(macOS,Linux,Windows,web).
Delete Project...
+++++++++++++++++
This option will delete the currently active project, after getting
a confirmation from the user that they are really sure about this
action. The `Default` project can not be deleted.
Preferences...
++++++++++++++
Selecting :menuselection:`File > Preferences...` opens the
Preferences window. In the :ref:`Preferences Window` you can adjust
settings that affect the behavior of the display and underlying
simulation.
Quit SpinDrops
++++++++++++++
Quits SpinDrops. This option is only available on the desktop
platforms where quitting makes sense (macOS,Linux,Windows).
Spin System Menu

This :menuselection:`Spin System` menu provides control over the
current spin system.
1Spin
++++++
Change the current spin system to be a single spin. The system's
offset can be defined by selecting :menuselection:`Spin System >
Parameters...` to open the :ref:`System Parameters Window`.
2Spin
++++++
Change the current spin system to be two coupled spins. The system
can be further defined by selecting :menuselection:`Spin System >
Parameters...` to open the :ref:`System Parameters Window`.
3Spin Chain
++++++++++++
Change the current spin system to be three coupled spins, and changes
the spatial layout of the three magnetization droplets to be in a
line. The system can be further defined by selecting
:menuselection:`Spin System > Parameters...` to open the
:ref:`System Parameters Window`.
3Spin Triangle
+++++++++++++++
Change the current spin system to be three coupled spins, and changes
the spatial layout of the three magnetization droplets to be arranged
in a triangle. The system can be further defined by selecting
:menuselection:`Spin System > Parameters...` to open the
:ref:`System Parameters Window`.
Parameters...
+++++++++++++
Open the :ref:`System Parameters Window` for editing parameters of the
spin system.
Initial State Menu

The :menuselection:`Initial State` menu has a number of ways to
define the initial state (i.e. the :term:`density operator ` at T=0) of the spin system: a number of common states, and
a couple different editors for the states.
The common states occupy the first entries of the menu, they are
described in more detail in the tutorial section :ref:`Selecting the
Initial State`. The entries in this menu change appropriately
according to the size of the currently selected spin system.
The last two menu entries open different state editors:
Graphical Edit...
+++++++++++++++++
Opens the :ref:`Initial State Graphical Edit Window`.
Textual Edit...
+++++++++++++++
Opens the :ref:`Initial State Textual Edit Window`.
Operator Inspector...
+++++++++++++++++++++
Opens the :ref:`Operator Inspector Window`.
Pulse Sequence Menu

The pulse sequence menu is used to select the pulse sequence currently
being simulated. The top entries of this menu are spinsystem
dependent, and are described in more detail in the tutorial section
:ref:`Selecting a Pulse Sequence`.
At the bottom of the menu are three special items related to pulse
sequence definition:
Edit Sequence...
++++++++++++++++
This menu item opens the :ref:`Tabular Pulse Sequence Editor` for
editing simple pulse sequences.
Shaped Pulses...
++++++++++++++++
This menu item opens the :ref:`Pulse Explorer Window` for managing
and inspecting shaped pulses.
Sequence Explorer...
++++++++++++++++++++
This menu item opens the :ref:`Pulse Sequence Explorer Window`,
another interface for managing, inspecting and editing pulse
sequences.
Sequence Optimizer...
+++++++++++++++++++++
This menu item opens the :ref:`Pulse Sequence Optimizer Window`,
an interface for pulse and sequence optimization.
View Menu

The :menuselection:`View` menu opens some windows to view the
experiment, and over the display size. It also has some control over
how the :ref:`DROPS Representation` is displayed.
List Prod. Ops...
+++++++++++++++++
This menu opens the List :ref:`List Prod. Ops Window`.
Phase Color Ref...
++++++++++++++++++
This menu opens the :ref:`Phase Color Ref Window`.
Density Operator...
+++++++++++++++++++
This menu opens the :ref:`Density Operator Window`.
Hamiltonian...
++++++++++++++
This menu opens the :ref:`Hamiltonian Window`.
Eff. Hamiltonian...
+++++++++++++++++++
This menu opens the :ref:`Effective Hamiltonian Window`.
Propagator...
+++++++++++++
This menu opens the :ref:`Propagator Window`.
Elem. Propagator...
+++++++++++++++++++++
This menu opens the :ref:`Elem. Propagator Window`.
.. drops:: I1z + I2z
:width: 70%
:nspin: 2; v1=1; v2=2; J12=2.2
:time: 0.12
:window: Elem. Propagator
:sequence: Standard/INEPT12
:caption: 'Elem. Propagator' view
:class: border
:link:
random
Separation
++++++++++
The :menuselection:`Separation` menu lets you choose which of the
:ref:`Separation Types` is used for the DROPS Display.
These are:
 :ref:`Standard `
 :ref:`Standard Plane`
 :ref:`Coh. Order p `
 :ref:`Coh. Order p `
 :ref:`Rank j `,
 :ref:`j, p `,
 :ref:`j, p `
Zoom
++++
The GUI can be made larger or smaller according to the entries in this
menu. Be careful not to make it too small!
Save Default View
+++++++++++++++++
Selecting this menu item will save the current positioning of the 3D
view as the default view for the current :ref:`Layout `.
Each :ref:`Layout ` has its own default view. The default
view can be loaded into the viewer by double clicking the screen in
the DROPS display.
Help Menu

The :menuselection:`Help` menu entries open the SpinDrops website to a
certain section containing helpful information about the selected
topic, except the first item, `About SpinDrops...`, which opens the
:ref:`About Window`.
The following help topics are linked from the menu:
 `Tutorial... `_
 `Color Code... `_
 `DROPS... `_
 `Sequence Editor... `_
 `Examples... `_
 `Challenges... `_
 `FAQ... `_
 `Math... `_
 `Glossary... `_
 `References... `_
 `Feedback... `_
Windows
=======
Preferences Window

The menu selection :menuselection:`File > Preferences...` opens the
Preferences Window. It is the place to set userconfigurable
:ref:`Preferences`.
.. drops:: I1x
:nspin: 1
:width: 70%
:window: Preferences
:caption: Preferences Window
:class: border
:link:
The current Preferences schema is displayed at the top of the
Preferences Window. Selecting an entry from the dropdown menu
changes to another schema. Changing preferences settings only
changes the setting within the current schema.
The :guilabel:`Reset Settings` button will reset any customization in
the current schema back to the values of the Default Schema. If the
`Default Schema` is selected, then the settings will be reset to their
"factory defaults"  SpinDrops' default settings.
The :guilabel:`Remove Schema` button will delete the current schema.
To create a new schema, enter a *New Name* for your schema in the
corresponding text box, and click :guilabel:`Create`.
.. note:: It may be easier to use :ref:`Project `
to store different combinations of settings rather than
Schemas, depending on what you are trying to do.
System Parameters Window

The menu selection :menuselection:`Spin System > Parameters...`
opens the System Parameters Window.
.. drops:: I1z + I2z
:width: 70%
:nspin: 2; v1=1; v2=2; J12=2.2
:time: 0.12
:window: SysParamWindow
:sequence: Standard/INEPT12
:caption: System Parameter Editor
:class: border
:link:
Initial State Graphical Edit Window

The menu selection :menuselection:`Initial State > Graphical
Edit...` opens this window.
.. drops:: I1x + I2z
:width: 70%
:window: OperatorEditWindow
:sequence: Standard/INEPT12
:caption: Graphical Initial State Editor
:class: border
:link:
Initial State Textual Edit Window

The menu selection :menuselection:`Initial State > Textual Edit...`
opens this window.
.. drops:: I1x + I2z
:width: 70%
:window: EditProdOpWindow
:sequence: Standard/INEPT12
:caption: Textual Initial State Editor
:class: border
:link:
Product operators can be specified here in a syntax we call
:ref:`PTON` which looks like :pton:`I1xI2z`, or by using raw matrix
expressions. The raw matrix expressions can only specify matrices of
fixed size, so will only be applicable to a particular sized spin
system. The syntax for the matrix expressions is somewhat
octave/matlablike. For example, :pton:`Ix` would be specified as
:code:`[0,0.5;0.5,0]`  individual values are separated by commas and
rows are separated by semicolons. More details can be found here:
https://github.com/marcelgoldschenohm/EigenLab#definingmatriceswithinparsedexpressions .
Operator Inspector Window

The menu selection :menuselection:`Initial State > Operator
Inspector...` opens this window. It can be used to inspect and
explore operator expressions. The functions :code:`rho()` and
:code:`t_()` can be used to query information from the simulation.
.. drops:: I1x + I2z
:width: 70%
:window: Operator Inspector
:sequence: Standard/INEPT12
:caption: Operator Inspector
:prefs: Operator Inspector Expr="rho(t_())"
:class: border
:link:
EigenLab Cheat Sheet
++++++++++++++++++++
The `EigenLab `_
language in short:
Defining matrices:
.. codeblock:: text
[1,2;3,4]
ones(N) ones(M,N)
zeros(N) zeros(M,N)
eye(N) eye(M,N)
zeros(N) zeros(M,N)
rand(N) rand(M,N)
Elementwise operations:
.. codeblock:: text
C = A  B
C = A + B
C = A .* B
C = A ./ B
C = A ^ b (b scalar)
abs(A) = [abs(A(1,1) abs(A(1,2)) ... ; abs(A(2,1)) abs(A(2,2)) ... ; ...]
sqrt(A)= "
exp(A) = "
log(A) = "
log10(A)= "
sin(A) = "
cos(A) = "
tan(A) = "
asin(A)= "
acos(A)= "
Matrix operations:
.. codeblock:: text
C = A * B
trace(A)
norm(A)
size(A,0) size(A,1) // size of dim 0/1
mean(A) mean(A,0) mean(A,1) // mean along dim 0/1
sum(A) sum(A,0) sum(A,1) // sum along dim 0/1
prod(A) prod(A,0) prod(A,1) // prod along dim 0/1
kron(A,B)
transpose(A)
conjugate(A)
adjoint(A)
normalize(A)
expm(A)
logm(A)
Special functions and matrices to probe the simulation
.. codeblock:: text
Id // Identity matrix for current system
I1x,I1y,.. // Various basis elements, see PTON
rho() // return the current density matrix
rho(1.1) // return the density matrix at time t=1.1 s
t_() // return the current time of the time slider
t_(1) // return the time at the end of the 1st sequence element
rho(t_(1)) // return the density matrix at the end of the 1st sequence element
Tabular Pulse Sequence Editor

The menu selection :menuselection:`Pulse Sequence > Edit
Sequence...` opens this window. It provides an interface for editing
simple pulse sequences.
.. drops:: I1x + I2z
:width: 70%
:window: SequenceEditTable
:sequence: Standard/INEPT12
:caption: Simple Sequence Editor
:class: border
:link:
Pulse Sequence Explorer Window

The menu selection :menuselection:`Pulse Sequence > Sequence
Explorer...` opens this window.
.. drops:: I1x
:window: SequenceExplWindow
:sequence: Industrial/ImperfectPulse
:caption: Pulse Sequence Explorer
:class: border
:link:
Show Raw Sequence
+++++++++++++++++
This checkbox in the :ref:`Pulse Sequence Explorer Window` enables the
raw editing of the JSON that defines tabletype sequences. Normally
these sequences can be edited using the tableeditor.
.. drops:: I1x
:window: SequenceExplWindow
:sequence: Standard/PulDel100msec
:caption: Raw JSON sequence view
:class: border
:link:
:event: id:checkbox_json,e:CLICK
Apply to Simulation
+++++++++++++++++++
This checkbox in the :ref:`Pulse Sequence Explorer Window` enables
continuous update of the simulation as the sequence text is edited.
Pulse Sequence Optimizer Window

The menu selection :menuselection:`Pulse Sequence > Sequence
Optimizer...` opens this window.
.. drops:: I1x
:window: OptimWindow
:sequence: Standard/Gauss90degy
:caption: Pulse Optimizer
:class: border
:time: 0.1
:link:
This window optimizes the pulse sequence according to a cost
function  which is some distance measurement between the final
simulation state (the :term:`Density Operator` at the end of the
simulation time) and a "target state". The target state can be set in
the text box :guilabel:`Target`. More information about sequence
optimization and this tool can be found under :ref:`Sequence
Optimizer`.
Pulse Explorer Window

The menu selection :menuselection:`Pulse Sequence > Shaped
Pulses...` opens this window.
.. drops:: I1x
:window: PulseExplWindow
:sequence: Industrial/ImperfectPulse
:caption: Pulse Explorer Window
:class: border
:link:
:event: id:Standard/sinc3_100.exc,e:CLICK
.. todo::
finish description
Phase Color Ref Window

The menu selection :menuselection:`View > List Prod. Ops...` opens
this window.
List Prod. Ops Window

The menu selection :menuselection:`View > List Prod. Ops.` opens
this window . A list of the current Density Operator factored into
the Cartesian Product Operator basis is displayed by default.
Rightclicking (or longclicking) on the window brings up a list of
other possible bases by which the Density Operator can be factored.
This list can be hidden by closing the window.
View Operator Windows

There are a number of Operator viewing windows. They all have the
same behavior, but display different operators for different aspects
of the experiment.
The set of operators that can be displayed are:
 the Density Operator
 the Hamiltonian
 the Effective Hamiltonian
 the (effective) Propagator
 the (current) Propagator
Any of these Operators can be viewed in a number of different ways.
There are three basic views of an Operator in SpinDrops: 1) the
:ref:`DROPS Representation`, 2) raw matrices, and 3) basis
decomposition.
Rightclicking (or longclicking) on an Operator Viewing window brings
up a menu that selects the viewing mode for the window. This presents
different ways to view the operator:
.. drops::
:nspin: 2
:width: 350
:window: Density Op.
:prefs: Show Axes=true;Show Droplet Labels=false
:caption: Operator View Menu
:event: id:opwidget,e:LCLICK,tx:30,ty:30
:class: border
:link:
random
Colored Matrix Elements
+++++++++++++++++++++++
This draws the Operator as a matrix. It uses the matrix elements'
phase to color the background of the entry, and it does NOT show
any numerical values.
.. drops::
:nspin: 2
:width: 350
:window: Density Op.
:prefs: Show Axes=true;Show Droplet Labels=false
:caption: 'Colored Matrix Elements' view
:event: id:opwidget,e:LCLICK,tx:30,ty:30; id:Colored Matrix Elements,e:CLICK
:class: border
:link:
random
Color Matrix with Values
++++++++++++++++++++++++
This shows the Operator as a matrix. It uses the matrix elements'
phase to color the background of the entry, and draws the numerical
value of the entries in a contrasting color.
.. drops::
:nspin: 2
:width: 350
:window: Density Op.
:prefs: Show Axes=true;Show Droplet Labels=false
:caption: 'Color Matrix with Values' view
:event: id:opwidget,e:LCLICK,tx:30,ty:30; id:Color Matrix with Values,e:CLICK
:class: border
:link:
random
Matrix Monochrome
+++++++++++++++++
This shows the Operator as a numeric matrix, using the
:ref:`Foreground` and :ref:`Background` colors for the fore and
background, respectively.
.. drops::
:nspin: 2
:width: 350
:window: Density Op.
:prefs: Show Axes=true;Show Droplet Labels=false;Foreground=[1,1,1,0.9]
:caption: 'Matrix Monochrome' view
:event: id:opwidget,e:LCLICK,tx:30,ty:30; id:Matrix Monochrome,e:CLICK
:class: border
:link:
random
Matrix Values Only
++++++++++++++++++
This shows the Operator as a numeric matrix, using the phase of the
entries to choose the color to draw the entry. This is similar to the
:ref:`Color Matrix with Values`, but instead of using the :ref:`phase
color ` for the background, it is used for the text
itself.
.. drops::
:nspin: 2
:width: 350
:window: Density Op.
:prefs: Show Axes=true;Show Droplet Labels=false
:caption: 'Matrix Values Only' view
:event: id:opwidget,e:LCLICK,tx:30,ty:30; id:Matrix Values Only,e:CLICK
:class: border
:link:
random
Eigen Decomposition
+++++++++++++++++++
This view of an operator presents an eigen value/eigen vector
decomposition of the operator's matrix representation. The view is
nonsquare, with the leftmost column showing the eigenvalues, and the
"matrix part" displaying the eigenvectors as columns of the matrix.
The eigenvalues are first sorted by amplitude and then phase (if the
amplitudes are the same, then the phase determines the order). The
remaining :math:`N` columns of the matrix are the eigenvectors. If
there are nonunique eigenvalues, the eigenvalues will be sorted by
the entries of the eigenvectors. The eigen decomposition of some,
particularly (nearly) unitary matrices is not necessarily numerically
stable, so small changes in, for example, a time duration may change
the display suddenly.
.. drops::
:nspin: 2
:width: 350
:window: Density Op.
:prefs: Show Axes=true;Show Droplet Labels=false
:caption: 'Eigen Decomposition' view
:event: id:opwidget,e:LCLICK,tx:30,ty:30; id:Eigen Decomposition,e:CLICK
:class: border
:link:
random
.. comment: using `` on DROPS here to hide the label from sphinx:
`DROPS`
+++++++
This shows the selected Operator using the currently selected
:ref:`DROPS Representation`. This display is explained in detail
in the section :ref:`DROPS Representation`.
.. drops::
:nspin: 2
:width: 350
:window: Density Op.
:prefs: Show Axes=true;Show Droplet Labels=false
:caption: 'DROPS' view
:event: id:opwidget,e:LCLICK,tx:30,ty:30; id:DROPS,e:CLICK
random
List Basis Elements
+++++++++++++++++++
This mode decomposes the Operator into the selected basis. There are a
number of common bases available:
.. drops::
:nspin: 2
:width: 450
:window: Density Op.
:prefs: Show Axes=true;Show Droplet Labels=false
:caption: Basis selection menu
:event: id:opwidget,e:LCLICK; id:List Basis Elements,e:CLICK
:class: border
:link:
random
.. listtable::
:class: nocapnum
:headerrows: 1
*  Basis name
 Product Elements

*  Cartesian {x,y,z,e}
 :math:`I_x,I_y,I_z,I_e`
 See :ref:`Cartesian Basis`.
*  SemiCart. A {+,,z,e}
 :math:`I^+,I^,I_z,I_e`
 See :ref:`SemiCartesian Basis`.
*  SemiCart. A, Homog. {+,,z,e}
 :math:`I^+,I^,I_z,I_e`
 See :ref:`SemiCartesian Basis`.
*  SemiCart. B {x,y,α,β}
 :math:`I_x,I_y,I_\alpha,I_\beta`
 See :ref:`SemiCartesian Basis`.
*  SemiCart. B, Homog. {x,y,α,β}
 :math:`I_x,I_y,I_\alpha,I_\beta`
 See :ref:`SemiCartesian Basis`.
*  Single Elem. {+,,α,β}
 :math:`I^+,I^,I_\alpha,I_\beta`
 See :ref:`Single Element Basis`.
*  LISA Basis

 See :ref:`LISA Basis`.
*  Qbit Basis
 :math:`0\rangle\langle{0},0\rangle\langle{1},1\rangle\langle{0},1\rangle\langle{1}`
 See :ref:`Qbit Basis`.
Cartesian Basis
```````````````
The Cartesian basis elements are defined to be generators of rotation
such that, ie :math:`e^{i \frac{\pi}{2} I_y} I_z e^{i \frac{\pi}{2}
I_y} = I_x`. The scalar product here is defined as :math:`\langle A_i
 A_j \rangle = Tr(A_i^\dagger A_j)`, and the norm :math:`A_i =
\sqrt{\langle A_i  A_i \rangle}`.
Thus, while the Cartesian product operator basis is orthogonal, and
all basis elements have the same norm, it is generally not normalized
in the sense of :math:`A_i = 1` (except specifically in the 2spin
case). For 1, 2, and 3 spin systems, the norms of the Cartesian
product operator basis elements, :math:`B_r`, are
.. listtable::
:class: nocapnum
:headerrows: 1
:stubcolumns: 1
* 
 :math:`B_r`
 :math:` B_r `
*  1 spin
 :math:`I_x`
 :math:`\frac{1}{\sqrt 2}`
*  2 spin
 :math:`I_{1x}`
 :math:`1`
*  2 spin
 :math:`2I_{1x}I_{2y}`
 :math:`1`
*  3 spin
 :math:`I_{1x}`
 :math:`\sqrt 2`
*  3 spin
 :math:`2I_{1x}I_{2y}`
 :math:`\sqrt 2`
*  3 spin
 :math:`4I_{1x}I_{2y}I_{3z}`
 :math:`\sqrt 2`
*  N spin
 :math:`2^{q1}\prod^q I_d \quad d \in \{x,y,z\}`
 :math:`2^{\frac{N}{2}1}`
Spherical Tensor Basis
``````````````````````
Single Element Basis
````````````````````
SemiCartesian Basis
````````````````````
The :ref:`List Basis Elements` offers four different `SemiCartesian
Basis` decompositions. These consist of two different selections of
generating operators (*A* and *B*), each of which can have different
scalings of the individual basis elements (*Regular* and
*Homogenous* scalings).
As a reminder, the one spin basis elements in matrix form are shown
in Table :numref:`manual_b_elems`.
.. listtable:: Basic onespin operators
:name: manual_b_elems
:headerrows: 1
:stubcolumns: 1
*  .. math::
I_x = \frac{1}{2} \begin{bmatrix}
0 & 1 \\
1 & 0
\end{bmatrix}
 .. math::
I_y = \frac{1}{2} \begin{bmatrix}
0 & i \\
i & 0
\end{bmatrix}
 .. math::
I_z = \frac{1}{2} \begin{bmatrix}
1 & 0 \\
0 & 1
\end{bmatrix}
 .. math::
I_e = \frac{1}{2} \begin{bmatrix}
1 & 0 \\
0 & 1
\end{bmatrix}
*  .. math::
I^+ = I_x + iI_y = \\
\begin{bmatrix}
0 & 1 \\
0 & 0
\end{bmatrix}
 .. math::
I^ = I_x  iI_y = \\
\begin{bmatrix}
0 & 0 \\
1 & 0
\end{bmatrix}
 .. math::
I^\alpha = I_e + I_z = \\
\begin{bmatrix}
1 & 0 \\
0 & 0
\end{bmatrix}
 .. math::
I^\beta = I_e  I_z = \\
\begin{bmatrix}
0 & 0 \\
0 & 1
\end{bmatrix}
The *A*type SemiCartesian basis is composed of product operators
created from the elements :math:`I^+`, :math:`I^`, :math:`I_z`, and
:math:`I_e` (:math:`\frac{1}{2}E`).
The *B*type SemiCartesian basis is composed of product operators
generated from the elements :math:`I_x`, :math:`I_y`,
:math:`I^\alpha`, and :math:`I^\beta`.
The *Regular* (nonHomogenous) element scaling simply defines the
elements of the basis as the unscaled products of the terms from Table
:numref:`manual_b_elems`. For a concrete example, take a
threespin1/2 operator in the *A*type SemiCartesian basis
:pton:`I1pI2mI3z`, defined as :pton:`I^+ \otimes I^ \otimes I_z`.
The norm of this operator (:pton:`I1pI2mI3z`) is :math:`xxx`, but in
the Homogenous basis, it is rescaled so that it only represents a
`direction`, so to say, and has the same norm as, say, :pton:`I1x`:
:math:`xxx`.
A basis element :math:`B` is written below by defining :math:`q` as
the number of :math:`x,y,z` terms, and :math:`q'` as the number of
single element terms (:math:`+,,\alpha,\beta`) :
.. math::
B = \prod^q I_d \prod^{q'} I_f \quad d \in \{x,y,z\}, f \in \{+,,\alpha,\beta\} .
Defining
.. math::
\hat q =
\begin{cases}
q, & \text{if}\ q \neq 0 \\
0, & \text{if}\ q = 0 \ \text{and}\ q' = 0 \\
1, & \text{if}\ q = 0 \ \text{and}\ q' \neq 0 \\
\end{cases} ,
the regular scaling of the elements B is
.. math::
B_r = 2^{\hat q1} B
and the Homogenous scaling is
.. math::
B_h = 2^{q  1 + \frac{q'}{2}} B .
This table provides some more concrete examples:
.. math::
\begin{array}{ l  r l  c  c  c  c  c }
N\text{spin} & 2^{\hat q1} & B & q & q' & \hat q& B & \begin{array}{c} B_r \\
 2^{\hat q1}B 
\end{array} & \begin{array}{c} B_h \\
2^{q1+\frac{q'}{2}}B
\end{array} \\
\hline
\text{1spin} & \frac{1}{2} & E_2 & 0 & 0 & 0 & 2^\frac{1}{2} & 2^{\frac{1}{2}} & 2^{\frac{1}{2}} \\
\text{1spin} & & I_x & 1 & 0 & 1 & 2^{\frac{1}{2}} & 2^{\frac{1}{2}} & 2^{\frac{1}{2}} \\
\text{1spin} & & I^+ & 0 & 1 & 1 & 1 & 1 & 2^{\frac{1}{2}} \\
\hline
\text{2spin} & \frac{1}{2} & E_4 & 0 & 0 & 0 & 2 & 1 & 1 \\
\text{2spin} & & I_{1x} & 1 & 0 & 1 & 1 & 1 & 1 \\
\text{2spin} & 2 & I_{1x}I_{2y} & 2 & 0 & 2 & \frac{1}{2} & 1 & 1 \\
\text{2spin} & & I_1^+ & 0 & 1 & 1 & 2^\frac{1}{2} & 2^{\frac{1}{2}} & 1 \\
\text{2spin} & & I_1^I_2^+ & 0 & 2 & 1 & 1 & 1 & 1 \\
\text{2spin} & & I_{1x}I_2^+ & 1 & 1 & 1 & 2^{\frac{1}{2}} & 2^{\frac{1}{2}} & 1 \\
\hline
\text{3spin} & \frac{1}{2} & E_8 & 0 & 0 & 0 & 2^{\frac{3}{2}} & 2^{\frac{1}{2}} & 2^{\frac{1}{2}} \\
\text{3spin} & & I_{1x} & 1 & 0 & 1 & 2^{\frac{1}{2}} & 2^{\frac{1}{2}} & 2^{\frac{1}{2}} \\
\text{3spin} & 2 & I_{1x}I_{2y} & 2 & 0 & 2 & 2^{\frac{1}{2}} & 2^{\frac{1}{2}} & 2^{\frac{1}{2}} \\
\text{3spin} & 4 & I_{1x}I_{2y}I_{3z}& 3 & 0 & 3 & 2^{\frac{3}{2}} & 2^{\frac{1}{2}} & 2^{\frac{1}{2}} \\
\text{3spin} & & I_1^+ & 0 & 1 & 1 & 2 & 2 & 2^{\frac{1}{2}} \\
\text{3spin} & & I_1^+I_2^+ & 0 & 2 & 1 & 2^{\frac{3}{2}} & 2^{\frac{1}{2}} & 2^{\frac{1}{2}} \\
\text{3spin} & & I_1^+I_2^+I_3^\beta &0& 3 & 1 & 1 & 1 & 2^{\frac{1}{2}} \\
\text{3spin} & & I_{1x}I_2^+ & 1 & 1 & 1 & 1 & 1 & 2^{\frac{1}{2}} \\
\text{3spin} & 2 & I_{1x}I_{2z}I_3^ & 2 & 1 & 2 & 2^{1} & 1 & 2^{\frac{1}{2}} \\
\text{3spin} & & I_{1x}I_2^+I_3^ & 1 & 2 & 1 & 2^{\frac{1}{2}} & 2^{\frac{1}{2}} & 2^{\frac{1}{2}} \\
\hline
N\text{spin} & & I... & q & q'& \hat q& & & \\
\end{array}
Qbit Basis
``````````
The basis elements are actually the same as the :ref:`Single Element
Basis` elements, but use naming familiar to the Quantum Information
community. The elements are named using `braket` notation, in the
form of a `ket` followed by a `bra`. The `wave function` name
contained within the `braket`\ s is a bit string identifying the
state. For example, a twolevel system has the pure states
:math:`\lvert0\rangle` and :math:`\lvert1\rangle`, a four level system
has pure states :math:`\lvert00\rangle`, :math:`\lvert01\rangle`,
:math:`\lvert10\rangle`, and :math:`\lvert11\rangle`, and so on for
each additional quantum bit.
The operators of the density operator basis are then composed by
`ketbra` combinations of these states, ie for a two level system:
:math:`\lvert1\rangle\langle{1}\rvert`. Each operator basis element
in matrix form has exactly one nonzero (unitary) entry, which can be
though of also as the matrix element at the (row,column) corresponding
to the (ket,bra) pair: :math:`\lvert1\rangle\langle{0}\rvert` is a 2x2
matrix with a :math:`1` at (row 1, column 0) and zeros elsewhere. For
larger systems, the addresses can be interpreted as binary numbers for
the (row,column): :math:`\lvert11\rangle\langle{10}\rvert` is a 4x4
matrix with a :math:`1` at (row :math:`11b`, column :math:`10b`), ie
(row 3, column 2):
.. math::
\lvert11\rangle\langle{10}\rvert =
\begin{array}{ r c }
& \begin{array}{ c c c c } \quad 00 & 01 & \textbf{10} & 11 \quad \end{array} \\
\begin{array}{c} 00 \\ 01 \\ 10 \\ \textbf{11} \end{array} &
\left( \begin{array}{ c c c c }
\quad 0 & \ 0 & \quad 0 & \ 0 \\
\quad 0 & \ 0 & \quad 0 & \ 0 \\
\quad 0 & \ 0 & \quad 0 & \ 0 \\
\quad 0 & \ 0 & \quad 1 & \ 0
\end{array} \quad \right)
\end{array}
Operators from the Qbit Basis can also be used in defining the initial
state and in sequence definitions by using the :ref:`associated PTON
notation `, which in this example would
be :code:`11><10`.
Density Operator Window

The menu selection :menuselection:`View > Density Operator...` opens
this window. This is one of the :ref:`View Operator Windows`, it
shows the Density Operator: :math:`\rho(T)` where :math:`T` is the
current time.
Hamiltonian Window

The menu selection :menuselection:`View > Hamiltonian...` opens this
window. This is one of the :ref:`View Operator Windows`, it shows the
Hamiltonian Operator: :math:`\frac{\mathcal{H}(T)}{2\pi}` where
:math:`T` is the current time. It has the same features as all View
Operator Windows. An expression for the current Hamiltonian can be
seen by enabling the :ref:`Show Details` preference setting.
Effective Hamiltonian Window

The menu selection :menuselection:`View > Eff. Hamiltonian...` opens
this window. This is one of the :ref:`View Operator Windows`, it
shows the Effective Hamiltonian Operator,
:math:`\mathcal{H_{\text{eff}}}(T)` where :math:`T` is the current
time.
The Effective Hamiltonian is defined as the timeconstant Hamiltonian
that would produce the current propagation until the current time,
:math:`T`. It is closely related to the propagator :math:`U(T)`
displayed in the :ref:`Propagator Window`, and defined as
.. math::
\mathcal{H_{\text{eff}}}(T) =
\begin{cases}
\displaystyle\frac{\log( U(T) )}{i 2 \pi T}, & \text{if } \ T > 0 \\[8pt]
\displaystyle\frac{\mathcal{H}(0)}{2\pi}, & \text{if } \ T = 0
\end{cases}
Using the matrix :math:`log()` in this case can sometimes produce
unexpected results. There is not necessarily a unique solution `B`
that satisfies `B = log(A)`; for a given `A`, also `C = log(A)` can be
true, where `B \neq C`. Due to the way `log(A)` is calculated, small
changes to the argument, ie `A+\epsilon` can produce large sudden
changes is the value of `log(A)`, as the solver jumps between
different smoothly connected solutions `B'` and `C'`.
Propagator Window

The menu selection :menuselection:`View > Propagator...` opens this
window. This is one of the :ref:`View Operator Windows`, it shows the
Propagator as an Operator, :math:`U(T)`, where :math:`T` is the current
time.
:math:`U(T)` is defined in terms of an experiment consisting of `n+1`
:math:time periods having constant Hamiltonians for each per
:math:`\mathcal{H_0} .. \mathcal{H_n}`, each of duration
:math::math:`\tau_k`, and defining the start of a period :math:`t_0 =
:math:0, t_{kk>0} = \sum_{n=0}^{k1} \tau_n`, the propagator of a
:math:period :math:`U_k = exp(i \mathcal{H_k} \tau_k)`, and the index
:math::math:`m` of the period in which the time :math:`T` can be
:math:found, :math:`m \text{ s.t. } t_m < T < t_{m+1}` .
.. math::
U(T) = exp(i \mathcal{H_m} (t  t_m) ) \prod_{j=0}^{m1} U_j
Elem. Propagator Window

The menu selection :menuselection:`View > Elem. Propagator...` opens
this window. This is one of the :ref:`View Operator Windows`, it
shows the propagator for the current time segment as an Operator,
:math:`U_k([T_k,T_{k+1}])`, where :math:`T_k` is the beginning of the
current sequence element :math:`k` containing :math:`T`.
Notice that this is a different propagator from the one defined in the
:ref:`Propagator Window`. This propagator is only for a single,
entire pulse sequence *element*, wherease the `Propagator Window`
shows the effective propagator from the beginning of the sequence
until the current time point.
This is simply :math:`U_k = exp(i \mathcal{H_k} \tau_k)`, where
:math:`\mathcal{H_k}` is the Hamiltonian for the current time period.
.. math::
U(T) = exp(i \mathcal{H_m} (T_{k+1}  T_k) )
About Window

The `about window` displays information about the current version of
SpinDrops, the environment that SpinDrops is currently running on,
some current lowlevel settings, and, on desktop versions, a short
summary of the :ref:`keyboard shortcuts`.
Preferences
===========
This section details the userconfigurable settings of SpinDrops.
These settings can be controlled from the :ref:`Preferences Window`
which can be opened from the menu :menuselection:`File >
Preferences...`.
DROPS

Apply RX Phase
++++++++++++++
When this option is enabled, the Density Operator is shown in the
DROPS Display with the :term:`receiver phase `
applied. For example, if the sequence sets the receiver phase to
180°, and the current Density Operator is :pton:`I1x`, then the DROPS
display will show the Operator :pton:`e^{i \pi} I1x`, ie
:pton:`I1x`, the phase of the receiver will also be indicated by the
color of the "coil" icon and label in the topright corner of the
DROPS display. When the "coil" icon is not present, the receiver
phase is :math:`0°`.
:numref:`fig_manual_rxphase_off` and :numref:`fig_manual_rxphase_on`
show the same sequence. The sequence has two subsequences with
different receiver phases. The first subsequence is a 90°x pulse
followed by an acquisition with the receiver set to xphase, the
second subsequence is a 90°(x) pulse followed by an acquisition
followed by an acquisition with the receiver set to x phase.
Enabling the `Apply RX Phase` option shows the subsequence as the
receiver would see it, as in :numref:`fig_manual_rxphase_on`, the
magnetization *appears* to be in the y direction. An important point
to note here is that the receiver phase does not change the *shapes*
of the droplets, it only changes the *colors*.
.. _fig_manual_rxphase_off:
.. drops:: I1z
:aspect: 200%
:sequence: Industrial/ImperfectPulse
:time: 0.15
:prefs: Show Axes=true;Show Droplet Labels=false; Apply RX Phase=false; Spectrum Height=0; FID Height=0
:caption: Sequence with two different RX Phases, `Apply RX Phase` disabled
:link:
:class: border
.. _fig_manual_rxphase_on:
.. drops:: I1z
:aspect: 200%
:sequence: Industrial/ImperfectPulse
:time: 0.15
:prefs: Show Axes=true;Show Droplet Labels=false; Apply RX Phase=true; Spectrum Height=0; FID Height=0
:caption: Sequence with two different RX Phases, `Apply RX Phase` enabled
:link:
:class: border
This setting does not affect how the signal summation is performed 
in the panel on the right, the summation of the subexperiments is
always performed by the pulse sequence's receiver phase definition.
Extra Droplet Labels
++++++++++++++++++++
This adds text labels to identify the nonMagnetization Droplets,
additionally, droplets that are :ref:`separated ` will
have labels indicating their rank :math:`j` and coherence(s)
:math:`p`.
Hide Couplings
++++++++++++++
By default, the J couplings between spins are indicated by lines. To
remove these lines, select :ref:`Hide Couplings`.
To show the lines again, uncheck :ref:`Hide Couplings`.
Magnetization Droplets
++++++++++++++++++++++
This enables drawing Droplets to represent the magnetization
components of the density operator. When it is disabled, no droplet
will be drawn for the magnetization. When :ref:`Magnetization
Vectors` is enabled, the Magnetization Droplets are drawn
transparently, so that the vectors can be seen. But when the Vectors
are not drawn, the Magnetization Droplets are drawn opaquely, like the
other Droplets.
Magnetization Only
++++++++++++++++++
Hide all droplets that are not magnetization droplets. This is useful
if for some reason you want to hide the complications of coupling.
Magnetization Vectors
+++++++++++++++++++++
This enables drawing Bloch Vectors at the spin positions representing
the magnetization of the respective spin. If :ref:`Magnetization
Droplets` are also enabled, those droplets will be drawn
semitransparently so that the Bloch Vectors can be seen.
Show Droplet Labels
+++++++++++++++++++
This enables the basic Droplet labels on spins I1, I2 and I3. It does
not enable the other droplet labels, which are controlled by
:ref:`Extra Droplet Labels`.
Show Id Droplet
+++++++++++++++
This enables drawing of the Identity Droplet, which is a sphere
indicating the magnitude and phase of the Identity part of the
Operator.
Colors

Background
++++++++++
The background color of the SpinDrops App, internally this is stored
as a fourvalued RGBA color. The alpha channel can be set to
transparent to affect the background of saved movie frames and saved
DROPS images.
Foreground
++++++++++
The foreground color of the SpinDrops App, internally this is stored
as a fourvalued RGBA color. This is the color that text and the
coupling bars are drawn in. Ideally it should offer some contrast
when compared with the :ref:`Background` color.
.. Continuous Paint
~~~~~~~~~~~~~~~~
This is an option for debugging the frame rate of the DROPS
Representation, it is not really useful, other than it can tell you
how fast SpinDrops renders on your computer.
General

Grid Layout
+++++++++++
This setting controls the layout of multiple frames, multiple frames
occur when the experiment has several concurrent parts, e.g., for
phase cycling. When Grid Layout is enabled, the layout will attempt
to layout the frames in a square grid. If Grid Layout is not
enabled, the frames will be laid out in either rows or columns,
depending on the value of the :ref:`Row Layout` setting.
Row Layout
++++++++++
This setting interacts with the :ref:`Grid Layout` setting to
determine how multiframe experiments are displayed. If `Grid Layout`
is disabled, this setting controls whether the frames are laidout in
rows or columns.
Show Axes
+++++++++
This enables the drawing of a 3D Axes glyph to orient the viewer in 3D
space.
+++
 'Show Axes' Enabled  'Show Axes' Disabled 
 with_axes  without_axes 
+++
.. with_axes drops::
:nspin: 2
:width: 48%
:prefs: Show Axes=true;Show Droplet Labels=false
:caption:
I1x
.. without_axes drops::
:nspin: 2
:width: 48%
:prefs: Show Axes=false;Show Droplet Labels=false
:caption:
I1x
Show Details
++++++++++++
When this option is enabled, extra information about the current
sequence and simulation will be drawn in the top right corner of the
screen. It includes the current preferences scheme, the current
sequence name, the current Hamiltonian and the textual representation
of the current Initial State.
Show Pointer
++++++++++++
By choosing the option `Show Pointer`, touch points can be highlighted
by orange circles.
This option is particularly useful when the SpinDrops display is
projected on a big screen. For example during a lecture, a touch point
can be used as a pointer to focus attention on specific items on the
screen. This option can also help to explain the effects of touch
gestures when the position of the fingers cannot be seen on the big
screen, see example below.
Simulation

Ideal Pulses
++++++++++++
This setting affects the Hamiltonian that is used to calculate pulse
evolution. When it is enabled, the Hamiltonian during pulses will not
contain :math:`H_{\text{free}}` (ie :term:`chemical shift `) terms.
Keyboard Shortcuts
==================
The Desktop and Web versions of SpinDrops have a number of keyboard
shortcuts to make navigating the UI easier
.. codeblock:: text
q e  Rotate (counter)clockwise
w s  Roll forward/backward
a d  Twist left/right
+   Zoom in/out
< >  Jump to next/previous sequence element
[ ]  Jump to begin/end of sequence
shift.
shift,  Jump to next/previous sequence element
* /  Simulate faster/slower
arrow keys  Slide view around the frame
[space]  Start/stop simulation
1,2,3  Change to 1,2, or 3spin systems
4  Change to 3spin systems in chain layout
r  Toggle simulation repeat mode
D  Open the Density Operator window
E  Open the Eff. Hamiltonian window
H  Open the Hamiltonian window
U  Open the Propagator window
R  Set a random initial density operator
b  Load a random sequence
n  Cycle through separation modes
ctrli  Open the Info window
ctrl,  Open the Preferences window
ctrl.  Open the Spin System parameter editor
ctrld  Toggle display of details box
ctrle  Open the Sequence Editor
ctrlf  Toggle the finger/touch circles
ctrlF  Toggle Fullscreen mode
ctrll  Open the list product operator window
ctrlo  Open the pton initial operator window
ctrlO  Open the graphical operator edit window