spinguin.core.propagation

spinguin.core.propagation#

This module is responsible for calculating time propagators.

propagator_to_rotframe(sop_P: ndarray | csc_array, sop_H0: ndarray | csc_array, t: float, zero_value: float = 1e-18) ndarray | csc_array[source]#

Transforms the time propagator to the rotating frame.

Parameters:
  • sop_P (ndarray or csc_array) – Time propagator.

  • sop_H0 (ndarray or csc_array) – Hamiltonian superoperator representing the interaction used to define the rotating frame transformation.

  • t (float) – Time step of the simulation in seconds.

  • zero_value (float, default=1e-18) – Calculating the rotating frame transformation involves a matrix exponential, which is calculated using the scaling and squaring method together with Taylor series. This threshold is used to estimate the convergence of the Taylor series and to eliminate small values during the squaring step.

Returns:

sop_P – The time propagator transformed into the rotating frame.

Return type:

ndarray or csc_array

sop_propagator(L: ndarray | csc_array, t: float, zero_value: float = 1e-18, density_threshold: float = 0.5) csc_array | ndarray[source]#

Constructs the time propagator exp(L*t).

Parameters:
  • L (ndarray or csc_array) – Liouvillian superoperator, L = -iH - R + K.

  • t (float) – Time step of the simulation in seconds.

  • zero_value (float, default=1e-18) – Calculating the propagator involves a matrix exponential, which is calculated using the scaling and squaring method together with Taylor series. This threshold is used to estimate the convergence of the Taylor series and to eliminate small values during the squaring step.

  • density_threshold (float, default=0.5) – Sparse matrix is returned if the density is less than this threshold. Otherwise dense matrix is returned.

Returns:

expm_Lt – Time propagator exp(L*t).

Return type:

csc_array or ndarray

sop_pulse(basis: ndarray, spins: ndarray, operator: str, angle: float, sparse: bool = True, zero_value: float = 1e-18) ndarray | csc_array[source]#

Generates a superoperator corresponding to the pulse described by the given operator and angle.

Parameters:
  • basis (ndarray) – A 2-dimensional array containing the basis set that contains sequences of integers describing the Kronecker products of irreducible spherical tensors.

  • spins (ndarray) – A 1-dimensional array containing the spin quantum numbers of each spin.

  • operator (str) –

    Defines the pulse to be generated. The operator string must follow the rules below:

    • Cartesian and ladder operators: I(component,index) or I(component). Examples:

      • I(x,4) –> Creates x-operator for spin at index 4.

      • I(x)–> Creates x-operator for all spins.

    • Spherical tensor operators: T(l,q,index) or T(l,q). Examples:

      • T(1,-1,3) –> Creates operator with l=1, q=-1 for spin at index 3.

      • T(1, -1) –> Creates operator with l=1, q=-1 for all spins.

    • Product operators have * in between the single-spin operators: I(z,0) * I(z,1)

    • Sums of operators have + in between the operators: I(x,0) + I(x,1)

    • Unit operators are ignored in the input. Interpretation of these two is identical: E * I(z,1), I(z,1)

    Special case: An empty operator string is considered as unit operator.

    Whitespace will be ignored in the input.

    NOTE: Indexing starts from 0!

  • angle (float) – Pulse angle in degrees.

  • sparse (bool, default=True) – Specifies whether to construct the pulse superoperator as sparse or dense array.

  • zero_value (float, default=1e-18) – Calculating the pulse superoperator involves a matrix exponential, which is calculated using the scaling and squaring method together with Taylor series. This threshold is used to estimate the convergence of the Taylor series and to eliminate small values during the squaring step.

Returns:

pul – Superoperator corresponding to the applied pulse.

Return type:

ndarray or csc_array