0
# Qubit Models
1
2
Comprehensive implementations of superconducting qubit circuits with customizable parameters and built-in analysis capabilities. Each qubit model provides methods for eigenvalue calculations, Hamiltonian construction, and visualization.
3
4
## Capabilities
5
6
### Transmon Qubit
7
8
Cooper-pair box implementation optimized for the transmon regime where charging energy is much smaller than Josephson energy, providing protection against charge noise.
9
10
```python { .api }
11
class Transmon:
12
def __init__(self, EJ: float, EC: float, ng: float, ncut: int,
13
truncated_dim: int = 6, id_str: str = None,
14
evals_method: str = None, evals_method_options: dict = None,
15
esys_method: str = None, esys_method_options: dict = None):
16
"""
17
Cooper-pair box / transmon qubit.
18
19
Parameters:
20
- EJ (float): Josephson energy in system units
21
- EC (float): Charging energy in system units
22
- ng (float): Offset charge in units of 2e
23
- ncut (int): Charge basis cutoff, should be >= 5 for convergence
24
- truncated_dim (int): Truncated Hilbert space dimension (default: 6)
25
- id_str (str): Optional identifier string
26
- evals_method (str): Method for eigenvalue calculations
27
- evals_method_options (dict): Options for eigenvalue method
28
- esys_method (str): Method for eigensystem calculations
29
- esys_method_options (dict): Options for eigensystem method
30
"""
31
32
def hamiltonian(self) -> np.ndarray:
33
"""Return Hamiltonian matrix in charge basis."""
34
35
def eigenvals(self, evals_count: int = 6) -> np.ndarray:
36
"""Calculate eigenvalues (energy levels)."""
37
38
def eigensys(self, evals_count: int = 6) -> tuple:
39
"""Calculate eigenvalues and eigenvectors."""
40
41
def plot_evals_vs_paramvals(self, param_name: str, param_vals: np.ndarray,
42
evals_count: int = 6, **kwargs):
43
"""Plot energy levels vs parameter values."""
44
45
def wavefunction(self, esys: tuple = None, which: int = 0,
46
mode: str = 'abs_sqr') -> WaveFunction:
47
"""Return wavefunction for specified eigenstate."""
48
49
@property
50
def n_operator(self) -> np.ndarray:
51
"""Number operator matrix in charge basis."""
52
53
@property
54
def exp_i_phi_operator(self) -> np.ndarray:
55
"""Exponential of i*phi operator matrix."""
56
57
@property
58
def cos_phi_operator(self) -> np.ndarray:
59
"""Cosine phi operator matrix."""
60
61
@property
62
def sin_phi_operator(self) -> np.ndarray:
63
"""Sine phi operator matrix."""
64
```
65
66
### Tunable Transmon
67
68
Transmon with flux-tunable Josephson energy for frequency control and sweet spot operation.
69
70
```python { .api }
71
class TunableTransmon:
72
def __init__(self, EJmax: float, EC: float, d: float, flux: float,
73
ng: float, ncut: int, truncated_dim: int = 6,
74
id_str: str = None, evals_method: str = None):
75
"""
76
Tunable transmon with flux control.
77
78
Parameters:
79
- EJmax (float): Maximum Josephson energy
80
- EC (float): Charging energy
81
- d (float): Junction asymmetry parameter
82
- flux (float): External flux in units of flux quantum
83
- ng (float): Offset charge
84
- ncut (int): Charge basis cutoff
85
- truncated_dim (int): Truncated dimension (default: 6)
86
- id_str (str): Optional identifier string
87
- evals_method (str): Method for eigenvalue calculations
88
"""
89
90
def effective_EJ(self) -> float:
91
"""Calculate effective Josephson energy at current flux."""
92
```
93
94
### Fluxonium Qubit
95
96
Heavy fluxonium implementation with large superinductance, providing protection against flux noise in certain parameter regimes.
97
98
```python { .api }
99
class Fluxonium:
100
def __init__(self, EJ: float, EC: float, EL: float, flux: float,
101
cutoff: int = 110, truncated_dim: int = None):
102
"""
103
Fluxonium qubit with superinductance.
104
105
Parameters:
106
- EJ (float): Josephson energy
107
- EC (float): Charging energy
108
- EL (float): Inductive energy
109
- flux (float): External flux in units of flux quantum
110
- cutoff (int): Phi basis cutoff for discretization
111
- truncated_dim (int): Truncated dimension
112
"""
113
114
def phi_osc(self) -> float:
115
"""Oscillator length scale for phi coordinate."""
116
117
def E_plasma(self) -> float:
118
"""Plasma frequency."""
119
120
def plot_potential(self, phi_grid: np.ndarray = None, contour_vals: np.ndarray = None):
121
"""Plot effective potential energy."""
122
```
123
124
### Flux Qubit
125
126
Three-junction flux qubit implementation supporting both symmetric and asymmetric designs with C-shunt configuration.
127
128
```python { .api }
129
class FluxQubit:
130
def __init__(self, EJ1: float, EJ2: float, EJ3: float, ECJ1: float, ECJ2: float, ECJ3: float,
131
ECg1: float, ECg2: float, ng1: float = 0.0, ng2: float = 0.0, flux: float = 0.0,
132
ncut: int = 10, truncated_dim: int = None):
133
"""
134
Three-junction flux qubit.
135
136
Parameters:
137
- EJ1, EJ2, EJ3 (float): Josephson energies of three junctions
138
- ECJ1, ECJ2, ECJ3 (float): Junction charging energies
139
- ECg1, ECg2 (float): Gate coupling energies
140
- ng1, ng2 (float): Offset charges
141
- flux (float): External flux threading the loop
142
- ncut (int): Charge basis cutoff
143
- truncated_dim (int): Truncated dimension
144
"""
145
146
def hamiltonian(self) -> np.ndarray:
147
"""Hamiltonian matrix in charge basis."""
148
149
def potential(self, phi1: float, phi2: float) -> float:
150
"""Potential energy at given phase coordinates."""
151
```
152
153
### Zero-Pi Qubit
154
155
Implementation of the 0-π qubit design with charge protection through large charging energy.
156
157
```python { .api }
158
class ZeroPi:
159
def __init__(self, EJ: float, EL: float, ECJ: float, EC: float, ng: float = 0.0,
160
flux: float = 0.0, grid: Grid1d = None, ncut: int = 30, truncated_dim: int = None):
161
"""
162
Zero-pi qubit with charge protection.
163
164
Parameters:
165
- EJ (float): Josephson energy
166
- EL (float): Inductive energy
167
- ECJ (float): Junction charging energy
168
- EC (float): Island charging energy
169
- ng (float): Offset charge
170
- flux (float): External flux
171
- grid (Grid1d): Discretization grid for phi variable
172
- ncut (int): Charge basis cutoff
173
- truncated_dim (int): Truncated dimension
174
"""
175
176
def hilbertdim(self) -> int:
177
"""Dimension of Hilbert space."""
178
179
def potential(self, phi: float, theta: float) -> float:
180
"""Potential energy at phase coordinates."""
181
```
182
183
### Full Zero-Pi Qubit
184
185
Extended 0-π qubit model with complete parameter set for detailed modeling.
186
187
```python { .api }
188
class FullZeroPi:
189
def __init__(self, EJ: float, EL: float, ECJ: float, EC: float, dEJ: float = 0.0,
190
dEL: float = 0.0, flux: float = 0.0, ng: float = 0.0, zeropi_cutoff: int = 10,
191
zeta_cutoff: int = 10, truncated_dim: int = None):
192
"""
193
Full zero-pi qubit model.
194
195
Parameters:
196
- EJ (float): Josephson energy
197
- EL (float): Inductive energy
198
- ECJ (float): Junction charging energy
199
- EC (float): Island charging energy
200
- dEJ (float): Junction energy disorder
201
- dEL (float): Inductance disorder
202
- flux (float): External flux
203
- ng (float): Offset charge
204
- zeropi_cutoff (int): Cutoff for zero-pi mode
205
- zeta_cutoff (int): Cutoff for zeta mode
206
- truncated_dim (int): Truncated dimension
207
"""
208
```
209
210
### Cos(2φ) Qubit
211
212
Protected qubit design using cos(2φ) potential for enhanced coherence.
213
214
```python { .api }
215
class Cos2PhiQubit:
216
def __init__(self, EJ: float, EC: float, ECJ: float, ng: float = 0.0, flux: float = 0.0,
217
grid: Grid1d = None, ncut: int = 30, truncated_dim: int = None):
218
"""
219
Cos(2φ) protected qubit.
220
221
Parameters:
222
- EJ (float): Josephson energy of junctions
223
- EC (float): Charging energy of island
224
- ECJ (float): Junction charging energy
225
- ng (float): Offset charge
226
- flux (float): External flux
227
- grid (Grid1d): Discretization grid for phi
228
- ncut (int): Charge basis cutoff
229
- truncated_dim (int): Truncated dimension
230
"""
231
232
def n_theta_operator(self) -> np.ndarray:
233
"""Charge operator conjugate to theta."""
234
235
def phi_operator(self) -> np.ndarray:
236
"""Phi phase operator matrix."""
237
```
238
239
### Generic Qubit
240
241
Custom qubit class for user-provided Hamiltonians and energy eigenvalue data.
242
243
```python { .api }
244
class GenericQubit:
245
def __init__(self, hamiltonian: np.ndarray = None, truncated_dim: int = None,
246
energy_esys: tuple = None):
247
"""
248
Generic qubit from user-defined Hamiltonian.
249
250
Parameters:
251
- hamiltonian (np.ndarray): User-provided Hamiltonian matrix
252
- truncated_dim (int): Truncated Hilbert space dimension
253
- energy_esys (tuple): Pre-computed (eigenvals, eigenvecs) tuple
254
"""
255
256
def eigenvals(self, evals_count: int = 6) -> np.ndarray:
257
"""Calculate or return stored eigenvalues."""
258
259
def eigensys(self, evals_count: int = 6) -> tuple:
260
"""Calculate or return stored eigensystem."""
261
```
262
263
## Usage Examples
264
265
### Basic Transmon Analysis
266
267
```python
268
import scqubits as scq
269
import numpy as np
270
271
# Create transmon with typical parameters
272
transmon = scq.Transmon(EJ=25.0, EC=0.2, ng=0.0, ncut=30)
273
274
# Calculate first 6 energy levels
275
energies = transmon.eigenvals(evals_count=6)
276
print("Energy levels:", energies)
277
278
# Get full eigensystem
279
evals, evecs = transmon.eigensys(evals_count=6)
280
281
# Plot spectrum vs offset charge
282
ng_vals = np.linspace(-2, 2, 100)
283
transmon.plot_evals_vs_paramvals('ng', ng_vals, evals_count=4)
284
285
# Calculate matrix elements
286
n_matrix = transmon.matrix_elements(transmon.n_operator)
287
```
288
289
### Flux-Dependent Analysis
290
291
```python
292
# Create fluxonium
293
fluxonium = scq.Fluxonium(EJ=2.0, EC=0.5, EL=0.8, flux=0.0)
294
295
# Sweep external flux
296
flux_vals = np.linspace(0, 1, 101)
297
param_sweep = scq.ParameterSweep(
298
hilbert_space=scq.HilbertSpace([fluxonium]),
299
paramvals_by_name={'flux': flux_vals},
300
evals_count=8
301
)
302
param_sweep.run()
303
param_sweep.plot_evals_vs_paramvals()
304
```