Coherent Interactions
The coherent dynamics of spin ensembles are mostly governed by interactions of spins with external fields and pairwise spin-spin interactions. Simos provides a series of methods to simplify construction of Hamiltonians for the most common sources of coherent dynamics of optically adressable spins.

Of course you do not have to utilize these functions to introduce coherent interactions - especially for simple, isotropic interactions (or interactions which are not covered by our helper-functions) it is very easy to just define them “by hand” using the operators of your spin system. For example, a Zeeman interaction of a spin can simply be introduced as
S = {"name": "S", "val": 1/2}
s = sos.System([S])
Hz = sos.ye * s.Sz
Tip
SimOS provides you with a set of physical constants as well as a complete set of gyromagnetic ratios.
General Framework
Any coherent spin-spin or spin-spin or spin-field interaction can be described by a Hamiltonian of the form
where \(\vec{\hat{S}} = (\hat{S_x}, \hat{S_y}, \hat{S_z})\) is a vector of spin operators, \(\textbf{A}\) is a 3x3 matrix which describes the spatial part of the interaction and \(\vec{X}\) is either a spin-operator vector for a second spin, i.e. \(\vec{X} \equiv (\hat{I_x}, \hat{I_y}, \hat{I_z})\), or a magnetic field vector i.e. \(\vec{X} \equiv (B_x, B_y, B_z)\).
The interaction matrix \(\textbf{A}\) can alternatively be formulated as spherical tensors of rank 0, 1 and 2 whose construction and utilization is detailed in our section on spherical tensors. Further, we can for each interaction distinguish the laboratory frame of reference (LAB) from a principal axis system (PAS) of reference. In the PAS of the interaction, the rank 0 and rank 2 contributions, which together constitute the symmetric part of \(\mathbf{A}\), are diagonal. The PAS representation of \(\mathbf{A}\), in the following referred to as \(\mathbf{a}\), is conveniently parametrized via
the trace \(\overline{a} = (a_{xx} + a_{yy} + a_{zz}) / 3\) for rank 0
the elements \(a_{xy}, a_{xz}, a_{yz}\) for the rank 1 component, and,
the anisotropy \(\delta = a_{zz} - \overline{a}\) and asymmetry \(\eta = \frac{a_{yy}-a_{xx}}{\delta}\) for the rank 2 component.
Here we assume the ordering
of the principal components which ensures that \(\eta\) is always positive and smaller than one. Transformation from PAS to LAB frame is further parametrized with a set of three euler angles \(\alpha, \beta, \gamma\) assuming a \(zyz\) convention which is illustrated on the right side of the scheme below.

Initialising the Spatial Part
To facilitate handling of various formalisms as well as LAB and PAS representations for the spatial component of coherent interactions, we provide the class AnisotropicCoupling
.
It can be initialised from LAB or PAS matrix or spherical tensor representations of the spatial interaction component or a subset of parameters \(\overline{a}, a_{xy}, a_{xz}, a_{yz}, \delta, \eta\).
If the interaction is initialised from a PAS representation, a set of euler-anngles \(\alpha, \beta, \gamma\) can be specified to also generate the LAB representation. When initialising
from a LAB representation the euler angles are automatically determined via matrix diagonalisation of the rank 2 component.
The code below showcases the initialisation of a generic anisotropic interaction with rank 0 and 2 components from trace, anisotropy, asymmetry and euler angles.
import simos as sos
# Interaction parameters
iso = sos.f2w(1e6) # 6 MHz
delta = sos.f2w(0.5e6)
eta = 0.5
alpha = sos.deg2rad(20)
beta = sos.deg2rad(40)
gamma = sos.deg2rad(30)
# Initialise from parameters
A = sos.AnisotropicCoupling(iso = iso, delta = delta, eta = eta , euler = [alpha, beta, gamma])
We can now exctract the matrix and spherical tensor representations of PAS and LAB frames as well as the interaction parameters as illustrated below.
A_matrix_lab = A.mat("lab") # Matrix representation, LAB
A_matrix_pas = A.mat("pas") # Matrix representation, PAS
A_spher_lab = A.spher("lab") # Spherical tensor representation, LAB
A_spher_pas = A.spher("pas") # Spherical tensor representation, PAS
A_params = A.parameters() # Interaction parameters can be accessesed as a dictionary
Alternatively, the same interaction object could be obtained directly from matrix or spherical tensor representation as indicated below.
A = sos.AnisotropicCoupling(mat = A_matrix_lab)
A = sos.AnisotropicCoupling(mat = A_matrix_pas, euler = [alpha, beta, gamma] )
A = sos.AnisotropicCoupling(spher = A_spher_lab )
A = sos.AnisotropicCoupling(spher = A_spher_pas, euler = [alpha, beta, gamma] )
Initialising the Interaction Hamiltonian
The actual interaction Hamiltonian can be initiated with the interaction_hamiltonian()
method. For example, a generic spin-spin coupling would be obtained as
S = {"name": "S", "val": 1/2}
I = {"name": "I", "val": 1/2}
s = sos.System([S,I])
A = sos.AnisotropicCoupling(iso = iso, delta = delta, eta = eta , euler = [alpha, beta, gamma])
Hcoupling = sos.interaction_hamiltonian(s, "S", A, spin2 = "I", frame = "lab", approx = "None")
The keyword argument approx
supports a series of common approximations as summarized in the table below.
Argument |
\(\hat{H}^{\prime}\propto\) |
Assumes … |
---|---|---|
|
\(\hat{H}\) |
no approximation made |
|
\(\hat{S}_{z}\hat{I}_{z}\) |
high-field approximation (A term of the dipolar alphabet) |
|
\(\hat{I}_{x}\hat{S}_{x} + \hat{S}_{y}\hat{I}_{y} + \hat{S}_{z}\hat{I}_{z}\) |
high-field approximation for a pair of spins with the same Larmor frequency (homonuclear case; A+B term of the dipolar alphabet) |
|
\(\hat{S}_{z}\hat{I}_{x} + \hat{S}_{z}\hat{I}_{y} + \hat{S}_{z}\hat{I}_{z}\) |
selective high-field approximation for the first spin of the pair , commonly applies for hyperfine interactions. |
For spin-field interactions, the routine is called with a field
instead of the spin2
keyword arugment and only no or secular approximations
are applicable.
Hfield = sos.interaction_hamiltonian(s, "S", A, spin2 = "I", field = [0,0,1e-3], approx = "None")
Specific Interaction Hamiltonians
For a series of common interactions, we provide further high-level functions to facilitate generation of the Hamiltonian. All these methods utilize the generic
interaction_hamiltonian()
routine in the background.
Zeeman Interaction
Electron and nuclear spin is associated with a magnetic dipole moment and therefore sensitive to surrounding magnetic fields via the Zeeman interaction. The magnetic-field sensitivity of a given spin is defined by the gyromagnetic ratio of the nucleus or electron which is proportional to the magnitude of the spin magnetic dipole moment. The interaction of nuclear or electronic spins with static magnetic fields is described by the Zeeman Hamiltonian
where \(\mathbf{\delta}\) is the chemical shift tensor that accounts for the microscopically corrected Zeeman interaction in an external magnetic field \(\vec{B}\).
In isotropic media, the Hamiltonian simplifies to
with a scalar, isotropic chemical shift \(\delta_{\mathrm{iso}}\). In the simplest case \(\delta_{\mathrm{iso}} = \gamma\) , the gyromagnetic
ratio of the bare nucleus or electron. SimOS provides a method zeeman_interaction()
to specify generic Zeeman interactions for individual spins. The interaction strength,
i.e. \(\mathbf{\delta}\) can be provided as a scalar (for isotropic interactions), a 3x3 matrix, an instance of the AnisotropicCoupling
class or a tuple with 3 or 6 entries,
specifying the isotropic chemical shift \(\delta_{\mathrm{iso}}\), span \(\Omega\), skew \(\kappa\) and, possibly, three euler angles in \(zyz\) ordering.
Span and skew are commonly utilized to parametrize the anisotropic chemical shift and are defined as
from the principal components of the chemical shift tensor assuming an ordering \(\delta_{xx} \geq \delta_{yy} \geq \delta_{zz}\) of the principal components following the IUPAC convention for chemical shift. The code below illustrates initialisation of a zeeman interaction for the isotropic case and for an anisotropic CSA, utilizing initialisation from CSA parameters.
S = {"name": "S", "val": 1/2}
I = {"name": "I", "val": 1/2}
s = sos.System([S,I])
iso = sos.f2w(400e6)
omega = sos.f2w(2e6)
kappa = 0.4
alpha = sos.deg2rad(30)
beta = sos.deg2rad(20)
gamma =sos.deg2rad(50)
Hz_iso = sos.zeeman_interaction(s, "A", iso, [0,0, B0])
Hz_aniso = sos.zeeman_interaction(s, "A", (iso, omega, kappa, alpha, beta, gamma), [0,0, B0])
Further, a method auto_zeeman_interaction()
automatically calculates the isotropic Zeeman interactions for an entire spin system and
thus requires that the isotopes are specified for all spin members of the quantum system.
RF Pulses and Spin Rotations
The effect of radiofrequency control pulses with well-defined phase and rotation angle is readily incorporated with our rot()
method which is further
documented in our section on time propagation.
Dipolar Coupling
The dipolar coupling between pairs of nuclear or electronic spins is a through-space magnetic interaction of their associated magnetic dipoles. The dipolar coupling Hamiltonian
can be calculated from the gyromagnetic ratios \(\gamma_1, \gamma_2\) of the spins and the distance and orientation of their connecting vector \(r\) with respect to the external magnetic field. The resulting dipolar coupling tensor \(\mathbf{D}\) is apure rank-2 3x3 matrix which may be expressed in terms of the so-called “dipolar alphabet” with components:
SimOS provides two methods for purely dipolar couplings. The dipolar_spatial()
method only returns the spatial part, i.e. the dipolar coupling tensor, of the interaction while
the dipolar_coupling()
method returns the complete dipolar coupling Hamiltonian.
Zero-Field Splitting
To incorporate zero-field splittings (ZFS)
of electron spins \(\geq\) 1 SimOS provides a method zfs_interaction()
. The spatial part \(\mathbf{D}\) of the of the ZFS interaction can be specified as a 3x3 matrix, an instance of the AnisotropicCoupling
class
or via the parallel \(D\) and \(E\) and anti-parallel components of the ZFS tensor and (optionally) a set of euler angles. In the PAS of the interaction, the ZFS Hamiltonian as a function of \(D\) and \(E\) results as
Quadrupole Interaction
Nuclear spins with \(I \geq 1\) are quadrupolar and a non-spheric charge distribution of their nucleus translates into a finite electric quadrupole moment \(Q\). This quadrupole moment couples to electric field gradient (EFG) \(\mathbf{V}\) at the nuclear site, resulting in a nuclear quadrupole interaction
SimOS provides method quad_interaction()
to facilitate incorporation of quadrupole interactions. The spatial part of the interaction, i.e. \(\frac{e Q \mathbf{V}}{2I(2I-1)\hbar}\) can either be provided as a 3x3 matrix, as an instance of
the AnisotropicCoupling
or via the anisotropy \(\delta_{\mathrm{Q}}\), the asymmetry \(\eta_{\mathrm{Q}}\) and, if PAS and LAB frames are not aligned, a set of euler angles. Parameters \(\delta_{\mathrm{Q}}\) and \(\eta_{\mathrm{Q}}\) are defined as follows:
and
using an ordering \(|V_{ZZ}| \geq |V_{XX}| \geq |V_{YY}|\) of the principal components of the EFG tensor and introducing the quadrupolar coupling constant \(C_{\mathrm{Q}}\), a common out put parameter of many quantum mechanical modelling packages.
Syntax Reference
- class AnisotropicCoupling(labonly=True, euler=[0, 0, 0], **kwargs)[source]
A class for representing the spatial component of (anisotropic) coherent interactions.
- R
Scipy rotation object / sympy quaternion that specifies rotation from principal axes system to laboratory frame of reference.
- _mat_lab
Matrix representation in the laboratory frame of reference.
- _mat_pas
Matrix representation in the principal axes frame of reference.
- _spher_lab
Spherical tensor representation in the laboratory frame of reference.
- Type:
dict
- _spher_pas
Spherical tensor representation in the principal axes frame of reference.
- Type:
dict
- auto_zeeman_interaction(spin_system, *args, mode='cart', rotating_frame=[])[source]
Returns the combined Zeeman Hamiltonian for all spins in a system using the tabulated isotropic gyromagnetic ratios of their type (i.e. does not not consider any chemical shielding or anisotropy!).
- Parameters:
spin_system (System) – An instance of the System class.
*args –
Magnetic field, specified as a single argument [x,y,z] or three separate arguments x,y,z.
- Keyword Arguments:
mode (
str
) – Can be ‘cart’ or ‘spher’, specifies whether the field is provided in cartesian or spherical coordinates.rotating_frame (
list
) – A list of all spin types for which a rotating frame approximation is used (i.e. their Zeeman interactions are not considered).
- Returns:
The Zeeman Hamiltonian, a 3x3 matrix.
- dipolar_coupling(system, spin1, spin2, y1, y2, *args, mode='spher', **kwargs)[source]
Returns a dipolar coupling Hamiltonian.
- Parameters:
system (System) – An instance of the System class.
spin1 (str) – Name of the first spin.
spin2 (str) – Name of the second spin.
y1 – Gyromagnetic ratio of the first spin, a scalar.
y2 – Gyromagnetic ratio of the second spin, a scalar.
*args –
Distance vector of the coupled spins in the laboratory frame of reference. Can be specified as a single argument or three separate arguments.
- Keyword Arguments:
mode (
str
) – Can be ‘cart’ or ‘spher’, specifies whether the vectors are provided in cartesian or spherical coordinates.approx (
str
) – Can be ‘none’, ‘full’,’secular’, ‘pseudosecular’, ‘hfi’ or a string with all desired letters of the dipolar alphabet. If ‘None’ or ‘full’, the interaction is not truncated. If ‘secular’ (pseudosecular) the interaction is truncated to the secular (pseudosecular) component.
- Returns:
The dipolar coupling Hamiltonian, a 3x3 matrix, in angular frequencies.
- dipolar_spatial(y1, y2, *args, mode='spher', case='matrix')[source]
Returns a dipolar coupling tensor in angular frequencies. This is a vecorized routine, multiple dipolar couplings are calculated if a list of coordinates is provided.
- Parameters:
y1 – Gyromagnetic ratio of the first spin, a scalar.
y2 – Gyromagnetic ratio of the second spin, a scalar.
*args –
Distance vector of the spin pair in the laboratory frame of reference. Can be specified as a single argument or three separate arguments. If multiple vectors are provided, a list of dipolar couplings will be returned for all of these.
- Keyword Arguments:
mode (
str
) – Can be ‘cart’ or ‘spher’, specifies whether the vectors are provided in cartesian or spherical coordinates.case (
str
) – Can be ‘matrix’ or ‘alphabet’. If ‘matrix’, the function returns the coupling tensor as a 3x3 matrix. If ‘alphabet’, the dipolar alphabet is returned as a dictionary.
- Returns:
The dipolar coupling tensor, either a 3x3 matrix or a dictionary with keys ‘A’,’B’,’C’,’D’,’E’,’F’.
- interaction_hamiltonian(system, spin1, A, approx='None', frame='lab', mode='cart', **kwargs)[source]
Hamiltonian of a coherent spin-spin or spin-field interaction.
- Parameters:
system (System) – An instance of the System class.
spin1 (str) – Name of the (first) spin of the interaction.
A – Spatial part of the interaction. Can be an instance of the AnisotropicCoupling class, a scalar or a 3x3 matrix. If a 3x3 matrix is provided, it is assumed that the latter specifies the interaction in the laboratory frame of reference.
- Keyword Arguments:
approx (`` str`` ) – Specifies the approximation. Can be “None”, “Secular”, “Pseudosecular”, “Hfi” or any letter “a”-“f” and combinations thereoff for spin-spin interactions and “None” or “Secular” for spin-field interactions.
frame (
str
) – Can be ‘pas’ or ‘lab’, specifies whether the Hamiltonian is returned in the principal axis system of the interaction or the laboratory frame of reference.spin2 (`` str`` ) – Specifies the name of the 2nd spin in spin-spin interactions.
field – Specifies the magnetic field for spin-field interactions.
mode (
str
) – Can be ‘cart’ or ‘spher’, specifies whether the field is provided in cartesian or spherical coordinates.
- Returns:
Hamiltonian of the spin-spin or spin-field interaction, a 3x3 matrix.
- quad_interaction(system, spin, QUAD, **kwargs)[source]
Returns the quadrupole coupling Hamiltonian.
- Parameters:
system (System) – An instance of the System class.
spin (str) – Name of the spin for which the interaction is defined.
QUAD – Spatial part of the quadrupole interaction, can be a 3x3 matrix or an instance of the AnisotropicCoupling class or a tuple/list with 2 (or 5) entries which specify anisotropy and assymetry of the interaction (and 3 euler angles).
- Returns:
The quadrupole Hamiltonian, a 3x3 matrix.
- zeeman_interaction(system, spin, y, *args, mode='cart', **kwargs)[source]
Zeeman Hamiltonian of a single spin.
- Parameters:
system (System) – An instance of the System class.
spin (str) – Name of the selected spin.
y – Spatial part of the interaction, can be a scalar , a 3x3 matrix, an instance of the AnisotropicCoupling class or a tuple/list with 3 (or 6) entries specifing isotropic chemical shift, span and skew (and 3 euler angles).
*args –
Magnetic field, specified as a single argument [x,y,z] or three separate arguments x,y,z.
- Keyword Arguments:
mode (
str
) – Can be ‘cart’ or ‘spher’, specifies whether the field is provided in cartesian or spherical coordinates.approx (`` str`` ) – Specifies the approximation. Can be “None” or “Secular”.
- Returns:
Hamiltonian of the Zeeman interaction, a 3x3 matrix.
- zfs_interaction(system, spin, ZFS, **kwargs)[source]
Returns the zero-field-splitting (ZFS) Hamiltonian.
- Parameters:
system (System) – An instance of the System class.
spin (str) – Name of the spin for which the interaction is defined.
ZFS – Spatial part of the ZFS interaction, can be a 3x3 matrix or an instance of the AnisotropicCoupling class or a tuple/list with 2 (or 5) entries which specify D and E (and 3 euler angles).
- Returns:
The zero-field-splitting Hamiltonian, a 3x3 matrix.