Hcpb

class Hcpb(nlevels: int = 15, Ej: float = None, Ec: float = None, ng: float = 0.5)[source]

Hamiltonian-model Cooper pair box (Hcpb) class.

Used to model analytically the CPB Hamiltonian quickly and efficiently. Solves in charge basis tridiagonal eigenvalue problem for arbitrary Ej, Ec, ng values.

As long as nlevels remains fixed the number of charge states considered does not change and it does not recreate the arrays, just recomputes the properties

Returns all properties of interest for the CPB.

Generate a Cooper-pair box (CPB) model.

Parameters:
  • nlevels (int) – Number of charge states of the CPB [-nlevels, nlevels+1]

  • Ej (float) – Josephson energy of the JJ

  • Ec (float) – Charging energy of the CPB

  • ng (float) – Offset charge of the CPB (ng=0.5 is the sweet spot). ng only needs to run between -0.5 and 0.5. ng is defined in units of cooper pairs (2e)

Example use:

H = Hcpb(nlevels=15, Ej=13971.3, Ec=295.2, ng=0.001)

print(f'''
Transmon frequencies
ω01/2π = {H.fij(0,1): 6.0f} MHz
  α/2π = {H.anharm(): 6.0f} MHz
''')
import matplotlib.pyplot as plt
for k in range (3):
    ψ, θ = H.psi_k(k)
    plt.plot(θ, ψ.real+ψ.imag, label=f"|{k}>") # it's in either quadrature, but not both
plt.xlabel("Junction phase θ (wrapped in the interval [-π, π])")
plt.ylabel("Re(ψ(θ))")
plt.legend(title="Level")

Attributes

Ec

Return Ec.

Ej

Returns Ej.

ng

Return ng.

nlevels

Return the number of levels.

Methods

anharm()[source]

Compute the anharmonicity of the CPB.

Returns:

Anharmonicty defined as E12-E01

Return type:

float

evalue_k(k: int)[source]

Return the eigenvalue of the Hamiltonian for level k.

Parameters:

k (int) – Index of the eigenvalue

Returns:

eigenvalue of the Hamiltonian

Return type:

float

evec_k(k: int)[source]

Return the eigenvector of the CPB Hamiltonian for level k.

Parameters:

k (int) – Index of eigenvector

Returns:

Eigenvector of the |k> level of the CPB Hamiltonian, in the charge basis n = -nlevels ... nlevels. Real, with the sign convention <k|n|k+1> > 0 (the ground state has its largest-magnitude component positive).

Return type:

array

fij(i: int, j: int)[source]

Compute the transition energy (or frequency) between states.

|i> and |j>.

Parameters:
  • i (int) – Index of state |i>

  • j (int) – Index of state |j>

Returns:

Eij, the transition energy

Return type:

float

h0_to_qutip(n_transmon: int)[source]

Wrapper around Qutip to output the diagonalized Hamiltonian truncated up to n levels of the transmon for modeling.

Parameters:

n_transmon (int) – Truncate up to n levels of the Transmon Hamiltonian

Returns:

Returns a Qutip Qobj for the diagonalized transmon

Return type:

Qobj

n_ij(i: int, j: int)[source]

Compute the value of the number operator for coupling elements together in the energy eigen-basis.

The eigenvectors are real (the Hamiltonian is real symmetric for every ng), and their signs follow a fixed convention: n_ij(k, k+1) > 0 for every k (see evec_k). The other elements carry the sign that follows, so n_ij(j, i) == n_ij(i, j) and gauge-invariant products such as n_ij(0, 1) * n_ij(1, 2) * n_ij(2, 0) (negative at ng = 0.25) come out right. Up to 0.9.0 this returned |<i|n|j>|, which is gauge-equivalent to the signed matrix only at ng = 0 or ng = 1/2.

Parameters:
  • i (int) – |i> Index of the transmon

  • j (int) – |j> Index of the transmon

Returns:

Matrix element corresponding to the number operator in the transmon basis n_ij = <i|n|j> (real, signed)

Return type:

float

n_to_qutip(n_transmon: int, thresh=None)[source]

Wrapper around Qutip to output the number operator (charge) for the Transmon Hamiltonian in the energy eigen-basis. Used for computing the coupling between other elements in the system.

Parameters:
  • n_transmon (int) – Number of energy levels to consider

  • thresh (float) – Threshold for keeping small values in the number operator i.e n_{i,i+2} terms drop off exponentially. Elements with |n_ij| < thresh are set to zero. If None retain all terms. Defaults to None

Returns:

Returns a Qutip Qobj corresponding to the number operator for defining couplings in the energy eigen-basis. The off-diagonal elements are the signed n_ij (real symmetric matrix); the diagonal is set to zero.

Return type:

Qobj

params_from_freq_fixEC(f01: float, Ec: float, **kwargs)[source]

Find transmon Ej given a fixed EC and frequency.

Solves fij(0, 1) == f01 for Ej at the given Ec (and the current ng). With Ec fixed the anharmonicity is not a free parameter, so only the frequency enters the fit.

Parameters:
  • f01 (float) – Desired qubit frequency

  • Ec (float) – Qubit EC (4ECn^2) in same units as f01

Keyword Arguments:

scipy.optimize.least_squares. (Passed to)

Returns:

Ej in same units

Return type:

float

Warns:
  • UserWarning – if the solver does not reproduce f01 (for

  • instance, the target is outside the search bounds).

params_from_spectrum(f01: float, anharm: float, **kwargs)[source]

Method to work backwards from a desired transmon frequency and anharmonicty to extract the target Ej and Ec for design and fabrication. Updates the class to include these Ej and Ec as the new values for extracting properties.

Parameters:
  • f01 (float) – Desired qubit frequency

  • anharm (float) – Desired qubit anharmonicity (should be negative)

Keyword Arguments:

least_squares (Passed to)

Returns:

Ej and Ec of the transmon Hamiltonian corresponding to the f01 and anharmonicty of the device

Return type:

(float, float)

Warns:
  • UserWarning – if the returned (Ej, Ec) do not reproduce

  • (f01, anharm), for instance when the target is outside the

  • search bounds.

psi_k(k: int, pts: int = 1001)[source]

Return the wavevector of the CPB Hamiltonian in the flux basis. Made compact over the interval of [-pi, pi].

Parameters:
  • k (int) – index of wavevector corresponding to the |k> eigenstate

  • pts (int) – Number of points to approximate the wavevector in the interval [-pi, pi]. Defaults to 1001.

Returns:

Wavevector corresponding the |k> eigenstate

Return type:

array