Hamiltonian Functions
Base Class
- class Hamiltonian(dimensions, vectors=None)
Class containing properties of the Hamiltonian.
Essentially wrapper for ndarray with additional attributes of
dimensions
andspins
.Usual methods (e.g.
__setitem__
or__getitem__
) access thedata
attribute.Note
Algebraic operations with Hamiltonian will return ndarray instance.
- Parameters
dimensions (array-like) – array of the dimensions for each spin in the Hilbert space of the Hamiltonian.
- dimensions
array of the dimensions for each spin in the Hilbert space of the Hamiltonian.
- Type
ndarray
- spins
array of the spins, spanning the Hilbert space of the Hamiltonian.
- Type
ndarray
- vectors
list with spin vectors of form
[[Ix, Iy, Iz], [Ix, Iy, Iz], ...]
.- Type
list
- data
matrix representation of the Hamiltonian.
- Type
ndarray
Total Hamiltonian
- hamiltonian_wrapper(_func=None, *, projected=False)
Wrapper with the general structure for the cluster Hamiltonian. Adds several additional arguments to the wrapped function.
Additional parameters:
central_spin (float) – value of the central spin.
- Parameters
_func (func) – Function to be wrapped.
projected (bool) – True if return two projected Hamiltonians, False if remove single not projected one.
- Returns
Wrapped function.
- Return type
func
- projected_hamiltonian(bath, vectors, projections_alpha, projections_beta, mfield, others=None, other_states=None, energy_alpha=None, energy_beta=None, energies=None, projections_alpha_all=None, projections_beta_all=None)
Compute projected hamiltonian on state and beta qubit states. Wrapped function so the actual call does not follow the one above!
- Parameters
bath (BathArray) – array of all bath spins in the cluster.
projections_alpha (ndarray with shape (3,)) – Projections of the central spin level alpha \([\braket{\hat{S}_x}, \braket{\hat{S}_y}, \braket{\hat{S}_z}]\).
projections_beta (ndarray with shape (3,)) – Projections of the central spin level beta. \([\braket{\hat{S}_x}, \braket{\hat{S}_y}, \braket{\hat{S}_z}]\)
mfield (ndarray with shape (3,)) – Magnetic field of type
mfield = np.array([Bx, By, Bz])
.others (BathArray with shape (m,)) – array of all bath spins outside the cluster
other_states (ndarray with shape (m,) or (m, 3)) – Array of Iz projections for each bath spin outside of the given cluster.
energy_alpha (float) – Energy of the alpha state
energy_beta (float) – Energy of the beta state
energies (ndarray with shape (2s-1,)) – Array of energies of all states of the central spin.
projections_alpha_all (ndarray with shape (2s-1, 3)) –
Array of vectors of the central spin matrix elements of form:
\[[\bra{\alpha}\hat{S}_x\ket{j}, \bra{\alpha}\hat{S}_y\ket{j}, \bra{\alpha}\hat{S}_z\ket{j}],\]where \(\ket{\alpha}\) is the alpha qubit state, and \(\ket{\j}\) are all states.
projections_beta_all (ndarray with shape (2s-1, 3)) –
Array of vectors of the central spin matrix elements of form:
\[[\bra{\beta}\hat{S}_x\ket{j}, \bra{\beta}\hat{S}_y\ket{j}, \bra{\beta}\hat{S}_z\ket{j}],\]where \(\ket{\beta}\) is the beta qubit state, and \(\ket{\j}\) are all states.
- Returns
tuple containing:
Hamiltonian: Hamiltonian of the given cluster, conditioned on the alpha qubit state.
Hamiltonian: Hamiltonian of the given cluster, conditioned on the beta qubit state.
- Return type
tuple
- total_hamiltonian(bath, vectors, mfield, zfs=None, others=None, other_states=None, central_gyro=- 17608.59705)
Compute total Hamiltonian for the given cluster including mean field effect of all bath spins. Wrapped function so the actual call does not follow the one above!
- Parameters
bath (BathArray) – array of all bath spins.
mfield (ndarray with shape (3,)) – Magnetic field of type
mfield = np.array([Bx, By, Bz])
.others (BathArray with shape (m,)) – array of all bath spins outside the cluster
other_states (ndarray with shape (m,) or (m, 3)) – Array of Iz projections for each bath spin outside of the given cluster.
zfs (ndarray with shape (3,3)) – Zero Field Splitting tensor of the central spin.
central_gyro (float or ndarray with shape (3,3)) – gyromagnetic ratio of the central spin OR tensor corresponding to interaction between magnetic field and central spin.
central_spin (float) – value of the central spin.
- Returns
hamiltonian of the given cluster, including central spin.
- Return type
Separate Terms
Documentation for the functions used to generate spin Hamiltonian for each cluster.
- expanded_single(ivec, gyro, mfield, self_tensor, detuning=0.0)
Function to compute the single bath spin term.
- Parameters
ivec (ndarray with shape (3, n, n)) – Spin vector of the bath spin in the full Hilbert space of the cluster.
gyro (float or ndarray with shape (3, 3)) –
mfield (ndarray wtih shape (3,) – Magnetic field of type
mfield = np.array([Bx, By, Bz])
.self_tensor (ndarray with shape (3, 3)) – tensor of self-interaction of type IPI where I is bath spin.
detuning (float) – Additional term of d*Iz allowing to simulate different energy splittings of bath spins.
- Returns
Single bath spin term.
- Return type
ndarray with shape (n, n)
- dipole_dipole(coord_1, coord_2, g1, g2, ivec_1, ivec_2)
Compute dipole_dipole interactions between two bath spins.
- Parameters
coord_1 (ndarray with shape (3,)) – Coordinates of the first spin.
coord_2 (ndarray with shape (3,)) – Coordinates of the second spin.
g1 (float) – Gyromagnetic ratio of the first spin.
g2 (float) – Gyromagnetic ratio of the second spin.
ivec_1 (ndarray with shape (3, n, n)) – Spin vector of the first spin in the full Hilbert space of the cluster.
ivec_2 (ndarray with shape (3, n, n)) – Spin vector of the second spin in the full Hilbert space of the cluster.
- Returns
Dipole-dipole interactions.
- Return type
ndarray with shape (n, n)
- bath_interactions(nspin, ivectors)
Compute interactions between bath spins.
- Parameters
nspin (BathArray) – Array of the bath spins in the given cluster.
ivectors (array-like) – array of expanded spin vectors, each with shape (3, n, n).
- Returns
All intrabath interactions of bath spins in the cluster.
- Return type
ndarray with shape (n, n)
- bath_mediated(nspin, ivectors, energy_state, energies, projections)
Compute all hyperfine-mediated interactions between bath spins.
- Parameters
nspin (BathArray) – Array of the bath spins in the given cluster.
ivectors (array-like) – array of expanded spin vectors, each with shape (3,n,n).
energy_state (float) – Energy of the qubit state on which the interaction is conditioned.
energies (ndarray with shape (2s-1,)) – Array of energies of all states of the central spin.
projections (ndarray with shape (2s-1, 3)) –
Array of vectors of the central spin matrix elements of form:
\[[\bra{i}\hat{S}_x\ket{j}, \bra{i}\hat{S}_y\ket{j}, \bra{i}\hat{S}_z\ket{j}],\]where \(\ket{i}\) are different states of the central spin.
- Returns
Hyperfine-mediated interactions.
- Return type
ndarray with shape (n, n)
- conditional_hyperfine(hyperfine_tensor, ivec, projections)
Compute conditional hyperfine Hamiltonian.
- Parameters
hyperfine_tensor (ndarray with shape (3, 3)) – Tensor of hyperfine interactions of the bath spin.
ivec (ndarray with shape (3, n, n)) – Spin vector of the bath spin in the full Hilbert space of the cluster.
projections (ndarray with shape (3,)) –
Array of vectors of the central spin matrix elements of form:
\[[\bra{i}\hat{S}_x\ket{j}, \bra{i}\hat{S}_y\ket{j}, \bra{i}\hat{S}_z\ket{j}],\]where \(\ket{j}\) are different states of the central spin. If \(\ket{i} = \ket{j}\), produces the usual conditioned hyperfine interactions and just equal to projections of \(\hat{S}_z\) of the central spin state \([\braket{\hat{S}_x}, \braket{\hat{S}_y}, \braket{\hat{S}_z}]\).
If \(\ket{i} \neq \ket{j}\), gives second order perturbation.
- Returns
Conditional hyperfine interaction.
- Return type
ndarray with shape (n, n)
- hyperfine(hyperfine_tensor, svec, ivec)
Compute hyperfine interactions between central spin and bath spin.
- Parameters
hyperfine_tensor (ndarray with shape (3, 3)) – Tensor of hyperfine interactions of the bath spin.
svec (ndarray with shape (3, n, n)) – Spin vector of the central spin in the full Hilbert space of the cluster.
ivec (ndarray with shape (3, n, n)) – Spin vector of the bath spin in the full Hilbert space of the cluster.
- Returns
Hyperfine interaction.
- Return type
ndarray with shape (n, n)
- self_central(svec, mfield, zfs=None, gyro=- 17608.59705)
Function to compute the central spin term in the Hamiltonian.
- Parameters
svec (ndarray with shape (3, n, n)) – Spin vector of the central spin in the full Hilbert space of the cluster.
mfield (ndarray wtih shape (3,) – Magnetic field of type
mfield = np.array([Bx, By, Bz])
.zfs (ndarray with shape (3, 3)) – Zero Field Splitting tensor of the central spin.
gyro (float or ndarray with shape (3,3)) – gyromagnetic ratio of the central spin OR tensor corresponding to interaction between magnetic field and central spin.
- Returns
Central spin term.
- Return type
ndarray with shape (n, n)
- overhauser_central(svec, others_hyperfines, others_state)
Compute Overhauser field term on the central spin from all other spins, not included in the cluster.
- Parameters
svec (ndarray with shape (3, n, n)) – Spin vector of the central spin in the full Hilbert space of the cluster.
others_hyperfines (ndarray with shape (m, 3, 3)) – Array of hyperfine tensors for all bath spins not included in the cluster.
others_state (ndarray with shape (m,) or (m, 3)) – Array of Iz projections for each bath spin outside of the given cluster.
- Returns
Central spin Overhauser term.
- Return type
ndarray with shape (n, n)
- overhauser_bath(ivec, position, gyro, other_gyros, others_position, others_state)
Compute Overhauser field term on the bath spin in the cluster from all other spins, not included in the cluster.
- Parameters
ivec (ndarray with shape (3, n, n)) – Spin vector of the bath spin in the full Hilbert space of the cluster.
position (ndarray with shape (3,)) – Position of the bath spin.
gyro (float) – Gyromagnetic ratio of the bath spin.
other_gyros (ndarray with shape (m,)) – Array of the gyromagnetic ratios of the bath spins, not included in the cluster.
others_position (ndarray with shape (m, 3)) – Array of the positions of the bath spins, not included in the cluster.
others_state (ndarray with shape (m,) or (m, 3)) – Array of Iz projections for each bath spin outside of the given cluster.
- Returns
Bath spin Overhauser term.
- Return type
ndarray with shape (n, n)
- eta_hamiltonian(nspin, central_spin, alpha, beta, eta)
EXPERIMENTAL. Compute hamiltonian with eta-term - gradually turn off or turn on the secular interactions for alpha and beta qubit states.
- Parameters
nspin (BathArray) – Array of the bath spins in the given cluster.
central_spin (float) – central spin.
alpha (ndarray with shape (2s+1,)) – Vector representation of the alpha qubit state in Sz basis.
beta (ndarray with shape (2s+1,)) – Vector representation of the beta qubit state in Sz basis.
eta (float) – Value of dimensionless parameter eta (from 0 to 1).
- Returns
Eta term.
- Return type
ndarray with shape (n, n)