Circuit Class

Circuit

class SQcircuit.Circuit(elements, flux_dist='junctions', random=False)[source]

Class that contains the circuit properties and uses the theory discussed in the original paper of the SQcircuit to calculate:

  • Eigenvalues and eigenvectors

  • Phase coordinate representation of eigenvectors

  • Coupling operators

  • Matrix elements

  • Decoherence rates

  • Robustness analysis

Parameters
  • elements (Dict[Tuple[int, int], List[Union[Capacitor, Inductor, Junction]]]) – A dictionary that contains the circuit’s elements at each branch of the circuit.

  • random (bool) – If True, each element of the circuit is a random number due to fabrication error. This is necessary for robustness analysis.

  • flux_dist (str) – Provide the method of distributing the external fluxes. If flux_dist is "all", SQcircuit assign the external fluxes based on the capacitor of each inductive element (This option is necessary for time-dependent external fluxes). If flux_dist is "inductor" SQcircuit finds the external flux distribution by assuming the capacitor of the inductors are much smaller than the junction capacitors, If flux_dist is "junction" it is the other way around.

alpha(i, j)[source]

Return the alpha, amount of displacement, for the bosonic displacement operator for junction i and mode j.

Parameters
  • i (Union[int, range]) – Index of the Junction. (starts from zero for the first mode)

  • j (int) – Index of the mode. (starts from zero for the first mode)

Return type

float

charge_op(mode, basis='FC')[source]

Return charge operator for specific mode in the Fock/Charge basis or the eigenbasis.

Parameters
  • mode (int) – Integer that specifies the mode number.

  • basis (str) – String that specifies the basis. It can be either "FC" for original Fock/Charge basis or "eig" for eigenbasis.

Return type

Qobj

coord_transform(var_type)[source]

Return the transformation of the coordinates as ndarray for each type of variables, either charge or flux.

Parameters

var_type (str) – The type of the variables that can be either "charge" or "flux".

Return type

ndarray

coupling_op(ctype, nodes)[source]

Return the capacitive or inductive coupling operator related to the specified nodes. The output has the qutip.Qobj format.

Parameters
  • ctype (str) – Coupling type which is either "capacitive" or "inductive".

  • nodes (Tuple[int, int]) – A tuple of circuit nodes to which we want to couple.

Return type

Qobj

dec_rate(dec_type, states, total=True)[source]

Return the decoherence rate in [1/s] between each two eigenstates for different types of depolarization and dephasing.

Parameters
  • dec_type (str) – decoherence type that can be: "capacitive" for capacitive loss; "inductive" for inductive loss; “quasiparticle” for quasiparticle loss; "charge" for charge noise, "flux" for flux noise; and "cc" for critical current noise.

  • states (Tuple[int, int]) – A tuple of eigenstate indices, for which we want to calculate the decoherence rate. For example, for states=(0, 1), we calculate the decoherence rate between the ground state and the first excited state.

  • total (bool) – if False return a decoherence rate associated with a transition from state m to state n for states=(m, n). if True return a decoherence rate associated with both m to n and n to m transitions.

Return type

float

description(tp=None, _test=False)[source]

Print out Hamiltonian and a listing of the modes (whether they are harmonic or charge modes with the frequency for each harmonic mode), Hamiltonian parameters, and external flux values.

Parameters
  • tp (Optional[str]) – If None prints out the output as Latex if SQcircuit is running in a Jupyter notebook and as text if SQcircuit is running in Python terminal. If tp is "ltx", the output is in Latex format if tp is "txt" the output is in text format.

  • _test (bool) – if True, return the entire description as string text. (use only for testing the function)

Return type

Optional[str]

diag(n_eig)[source]

Diagonalize the Hamiltonian of the circuit and return the eigenfrequencies and eigenvectors of the circuit up to specified number of eigenvalues.

Parameters

n_eig (int) – Number of eigenvalues to output. The lower n_eig, the faster SQcircuit finds the eigenvalues.

Return type

Tuple[ndarray, List[Qobj]]

Returns

  • efreq – ndarray of eigenfrequencies in frequency unit of SQcircuit (gigahertz by default)

  • evecs – List of eigenvectors in qutip.Qobj format.

eig_phase_coord(k, grid)[source]

Return the phase coordinate representations of the eigenvectors as ndarray.

Parameters
  • k (int) – The eigenvector index. For example, we set it to 0 for the ground state and 1 for the first excited state.

  • grid (Sequence[ndarray]) – A list that contains the range of values of phase φ for which we want to evaluate the wavefunction.

Return type

ndarray

hamiltonian()[source]

Returns the transformed hamiltonian of the circuit as qutip.Qobj format.

Return type

Qobj

loop_description(_test=False)[source]

Print out the external flux distribution over inductive elements.

Parameters

_test (bool) – if True, return the entire description as string text. (use only for testing the function)

Return type

Optional[str]

matrix_elements(ctype, nodes, states)[source]

Return the matrix element of two eigenstates for either capacitive or inductive coupling.

Parameters
  • ctype (str) – Coupling type which is either "capacitive" or "inductive".

  • nodes (Tuple[int, int]) – A tuple of circuit nodes to which we want to couple.

  • states (Tuple[int, int]) – A tuple of indices of eigenstates for which we want to calculate the matrix element.

Return type

float

set_charge_noise(mode, A)[source]

set the charge noise for each charge mode.

Parameters
  • mode (int) – An integer that specifies the charge mode. To see which mode is a charge mode, we can use description() method.

  • A (float) – The charge noise.

Return type

None

set_charge_offset(mode, ng)[source]

set the charge offset for each charge mode.

Parameters
  • mode (int) – An integer that specifies the charge mode. To see, which mode is a charge mode, one can use description() method.

  • ng (float) – The charge offset.

Return type

None

set_trunc_nums(nums)[source]

Set the truncation numbers for each mode.

Parameters

nums (List[int]) – A list that contains the truncation numbers for each mode. Harmonic modes with truncation number N are 0, 1 , …, (N-1), and charge modes with truncation number N are -(N-1), …, 0, …, (N-1).

Return type

None