qtcad.qubit.dynamics module

Class related to simulating dynamics (EDSR)

class qtcad.qubit.dynamics.Dynamics

Bases: Dynamics

Useful tools for simulating dynamics of two-level systems.

H_RF(H0, delta_V, omega)

Write the full Hamiltonian \(H(t) = H_0 + \delta V \cos(\omega t)\) in a frame rotating at frequency \(\omega\) around the \(z\) axis.

  • H0 (2D array) – Diagonalized system Hamiltonian.

  • delta_V (2D array) – Drive that can initiate transitions between eigenstates of H0.

  • omega (float) – Frequency of the drive and of the rotating frame.


qutip Qobj – Hamiltonian matrix in the rotating frame.


The operators H0 and delta_V should be input in units where \(\hbar\) = 1.

fidelity(U, res, H0=None)

Computes the fidelity of a gate.

At time \(t\), the fidelity \(F(t)\) of the quantum-logic gate that is represented by the unitary operator \(U\) in an ideal setting is given by:

\[F(t) = |\langle\psi(t)|U|\psi(0)\rangle|^2,\]

where \(|\psi(0)\rangle\) is the initial state of the system (before application of the gate), and \(|\psi(t)\rangle\) is the time-dependent state of the system under a (potentially) non-ideal implementation of the quantum-logic gate, e.g., realistic driving in the presence of a stochastic time-dependent field.

The above equation gives the fidelity in the laboratory frame. In a frame that rotates with a free Hamiltonian \(H_0\), the fidelity output by this function is, instead, given by [WM08]

\[F(t) = |\langle\psi(t)|\mathrm e^{iH_0t}U|\psi(0)\rangle|^2.\]
  • U (2D array/Qobj) – The gate that is ideally implemented.

  • res (QuTiP Result object) – A Result object that contains information about the dynamics of the system, as output by the mesolve function of QuTiP.

  • H0 (2D array/Qobj) – If None, the output fidelity will be given in the lab frame. If not None, the output fidelity will be given in the rotating frame with respect to H0.


1D array – Fidelity of the gate U for the times specified by res.


For the fidelity, we use the definition of Eq. (16.8) in Ref. [WM08] by Walls and Milburn. We remark that this fidelity is the square of the (square-root) fidelity defined by Nielssen and Chuang [NC10].


Produces a plot of the probability to be in the up and down states as a function of time from the simulation of a two-level system dynamics.


result (qutip result object) – The result object obtained from simulating the dynamics of a two-level system.


This function can work in conjunction with ‘transition_2_levels’ to visualize the results of a simple EDSR simulation.


Generate operators (qutip Qobj) that project a ket onto a specific basis state.


n_states (integer) – Dimensionality of the subspace under consideration, i.e. number of basis states that span the Hilbert space.


list of Qobj objects – Proj, a list containing the projectors for each basis state.

transition_2_levels(i, j, H0, delta_V, omega=None, T=None, npts=1000, plot=False)

Project system and drive Hamiltonians onto a relevant 2 level subspace.

  • i (integer) – Index of the up state. The convention chosen for the Pauli z operator for this qubit is the same one as qutip: sigma_z = |up><up| - |down><down|

  • j (integer) – Index of down state. This state is taken to be the initial state in the simulation.

  • H0 (2D array) – System Hamiltonian.

  • delta_V (2D array) – EDSR perturbation.

  • omega (float) – Driving frequency of the perturbation.

  • T (float) – Time over which the dynamics will be evaluated.

  • npts (integer) – Number of points in the simulation.

  • plot (boolean) – Whether or not a plot should be produced at the end of the calculation of the probability to be in the initial and final states as a function of time.


tuple – a tuple (result, h0, u, omega0, omega_rabi) where result (qutip mesolve) is the result of the simulation of the dynamics of the two level system by qutip h0 (qutip Qobj) is the projected system Hamiltonian, u (qutip Qobj) is the projected perturbation, omega0 (float) is the resonance frequency of the transition, and omega_rabi (float) is the Rabi frequency of the transition.


This function can be used to get a rough understanding of the relevant frequencies of a transition that is being investigated. The calculation performed by this function is a simplified version of a more accurate calculation may be required to adequately investigate EDSR for a given system.


This function may only be useful when the perturbing potential, delta_V, is a linear function of the the voltage applied to the gate generating the perturbation.


In the situation where a higher energy state is the down state and a lower energy state is the up state, the output resonance frequency will be negative.