josephson_circuit module¶
- class josephson_circuit.Circuit(graph: pyjjasim.embedded_graph.EmbeddedGraph, critical_current=1.0, resistance=1.0, capacitance=0.0, inductance=0.0, negative_Ic_allowed=False)[source]¶
Construct a Josephson Circuit, also called a Josephson Junction Array (JJA).
A JJA is an electric circuit that can include Josephson junctions, passive components, current sources and voltage sources. The network is required to be a planar embedding and single component, so junctions cannot intersect.
Defined with a graph of nodes and edges where each edge contains a junction. A junction is the basic 2-terminal element which contains one of each component, see the included user manual for the precise definition. To omit a component; set it’s value to zero.
Notes
All physical quantities are normalized in pyjjasim, see the user manual for details. For example the critical current of each junction in Ampere is \(\mathtt{critical\_current\} * I_0\), where \(I_0\) is the normalizing scalar for all current values.
Sources are specified at problems, not explicitly as part of the circuit.
- Attributes
- graph
embedded_graph.EmbeddedGraph
EmbeddedGraph instance with Nn nodes, Nj edges and Nf faces.
- critical_current=1.0(Nj,) array or scalar
Critical current factors of junctions. Same value for all junctions if scalar.
- resistance=1.0(Nj,) array or scalar
Resistance factors of junctions. Same value for all junctions if scalar.
- capacitance=0.0(Nj,) array or scalar
Capacitance factors of junctions. Same value for all junctions if scalar.
- inductance=0.0(Nj,) array or scalar
Self-inductance factors of junctions. Same value for all junctions if scalar.
- or inductance=0.0(Nj, Nj) matrix (dense or sparse)
L_ij coupling between junction i and j. L_ii self inductance. Must be symmetric positive definite.
- graph
Methods
Asq_solve
(b)Solves A @ A.T @ x = b (where A is self.get_cycle_matrix()).
Asq_solve_sandwich
(b, S)Solves A @ S @ A.T @ x = b (where A is self.get_cycle_matrix()).
Msq_solve
(b)Solves M @ M.T @ x = b (where M is self.get_cut_matrix()).
Msq_solve_sandwich
(b, S)Solves M @ S @ M.T @ x = b (where M is self.get_cut_matrix()).
add_nodes_and_junctions
(x, y, node1, node2)Add nodes to array and junctions to array.
approximate_inductance
(factor[, junc_L, ...])Approximate inductance in circuit.
copy
()Return copy of circuit.
Returns number of faces in the circuit (abbreviated Nf).
Returns capacitance factors assigned to each junction in the circuit.
Returns critical current factors of each junction in the circuit.
Returns cut matrix.
Returns cycle matrix.
Returns area of all faces in the circuit.
Returns coordinates of centroids of all faces in the circuit.
Returns a list of all faces.
Returns the inductance factors between each pair of junctions.
Get coordinates of nodes at endpoints of all junctions.
Get indices of nodes at endpoints of all junctions.
Returns coordinates of nodes in circuit.
Returns resistance factors assigned to each junction in the circuit.
Returns number of junctions in the circuit (abbreviated Nj).
locate_faces
(x, y)Get faces whose centroids are closest to queried coordinate.
Returns number of nodes in the circuit (abbreviated Nn).
plot
([show_node_ids, show_junction_ids, ...])Visualize array.
remove_junctions
(junctions_to_remove)Remove junctions from circuit.
remove_nodes
(nodes_to_remove)Remove nodes from circuit.
Modify capacitance factors of all junctions in the circuit.
Modify critical current factors of all junctions in the circuit.
set_inductance
(inductance)Modify the inductances factors of all junctions in the circuit.
Modify resistance factors of all junctions in the circuit.
load
save
- Asq_solve(b)[source]¶
Solves A @ A.T @ x = b (where A is self.get_cycle_matrix()).
- Parameters
- b(Nf,) or (Nf, W) array
Right-hand side of system
- Returns
- xshape of b
solution of system
- Asq_solve_sandwich(b, S)[source]¶
Solves A @ S @ A.T @ x = b (where A is self.get_cycle_matrix()).
- Parameters
- b(Nf,) or (Nf, W) array
Right-hand side of system.
- S(Nj, Nj) sparse array
Sandwich matrix.
- Returns
- xshape of b
Solution of system.
- Msq_solve(b)[source]¶
Solves M @ M.T @ x = b (where M is self.get_cut_matrix()).
- Parameters
- b(Nn,) or (Nn, W) array
Right-hand side of system
- Returns
- xshape of b
solution of system
- Msq_solve_sandwich(b, S)[source]¶
Solves M @ S @ M.T @ x = b (where M is self.get_cut_matrix()).
- Parameters
- b(Nn,) or (Nn, W) array
Right-hand side of system.
- S(Nj, Nj) sparse array
Sandwich matrix.
- Returns
- xshape of b
Solution of system.
- add_nodes_and_junctions(x, y, node1, node2, critical_current=1.0, resistance=1.0, capacitance=1.0, inductance=1.0) josephson_circuit.Circuit [source]¶
Add nodes to array and junctions to array.
- Returns
- new_circuit
Circuit
New Circuit object with nodes and junctions added.
- new_circuit
- Attributes
- x, y(Nn_new,) arrays
Coordinates of added nodes.
- node1, node2(Nj_new,) int arrays
Nodes at endpoints of added junctions.
- critical_currentscalar or (Nj_new,) array
Critical current factors of added junctions. Same value for all new junctions if scalar.
- resistancescalar or (Nj_new,) array
Resistance factors of added junctions. Same value for all new junctions if scalar.
- capacitancescalar or (Nj_new,) array
Capacitance factors of added junctions. Same value for all new junctions if scalar.
- inductancescalar or (Nj_new,) array
Self-inductance factors of added junctions. Same value for all new junctions if scalar.
- or inductance(Nj_new, Nj_new) array
Mutual inductance factors between new junctions.
- or inductance(Nj_new, Nj) array
Mutual inductance factors between new junctions and all junctions.
- approximate_inductance(factor, junc_L=1, junc_M=0, max_dist=3) josephson_circuit.Circuit [source]¶
Approximate inductance in circuit.
Computes a matrix L as an approximation for the inductance factors and does self.set_inductance(L).
L is computed using a crude approximation of Neumann’s formula for two wire segments.
Notes
The self and mutual inductance are respectively (in units of \(\mu_0 a_0\)):
\[L_i = \mathtt{junc\_L} * l_i\]\[M_{ij} = \mathtt{junc\_M} * l_i * l_j * cos( \gamma_{ij}) / d_{ij}\]Where \(l_i\) is junction length in units of \(a_0\), \(\gamma_{ij}\) is angle between junctions and \(d_{ij}\) is distance between centres of junctions in units of \(a_0\) and afterwards they are multiplied by the conversion factor \(\mathtt{factor}=\mu_0 a_0 / L_0\) to obain the required units of \(L_0\).
- Attributes
- factorscalar float
mu0 * a0 in units of L0.
- junc_Lscalar float
Self-inductance prefactor.
- junc_Mscalar float
Mutual-inductance prefactor (usually << junc_L).
- max_distscalar float
Cut-off distance between junctions included in L.
- get_cut_matrix()[source]¶
Returns cut matrix.
The cut matrix is a sparse matrix (shape (Nn, Nj), abbreviated M), which represents Kirchhoffs current law M @ I = 0.
It is +1 if node is node_2 of junction and -1 otherwise.
- get_cycle_matrix()[source]¶
Returns cycle matrix.
The cycle matrix is a sparse matrix (shape (Nf, Nj) abbreviated A), which represents Kirchhoffs voltage law A @ V = 0.
It is +1 if traversing a face counter-clockwise passes through a junction in its direction, and -1 otherwise.
- get_faces()[source]¶
Returns a list of all faces.
A face is defined as an array containing indices of nodes encountered when traversing the boundary of a face counter-clockwise.
- Returns
- facesList
List of faces.
- get_inductance()[source]¶
Returns the inductance factors between each pair of junctions.
- Returns
- inductance(Nj, Nj) array
Diagonal entries are self-inductance factors, off-diagonal entries are mutual.
- get_juncion_coordinates()[source]¶
Get coordinates of nodes at endpoints of all junctions.
- Returns
- x1, y1, x2, y2(Nj,) arrays
Coordinates of node1 and node2 respectively.
Notes
For all junctions node1 < node2, even if it was defined in reverse order.
- get_junction_nodes()[source]¶
Get indices of nodes at endpoints of all junctions.
- Returns
- node1, node2(Nj,) arrays
Endpoint node indices of all junctions.
Notes
For all junctions node1 < node2, even if it was defined in reverse order.
- get_node_coordinates()[source]¶
Returns coordinates of nodes in circuit.
- Returns
- x, y(Nn,) arrays
Coordinates of nodes in circuit.
- locate_faces(x, y)[source]¶
Get faces whose centroids are closest to queried coordinate.
- Returns
- face_idsint array with same size as x in range(Nf)
Indices of located faces.
- Attributes
- x, yarrays:
Coordinates at which one wants to locate faces.
- plot(show_node_ids=True, show_junction_ids=False, show_faces=True, show_face_ids=True, markersize=5, linewidth=1, face_shrink_factor=0.9, figsize=None, fig=None, ax=None, ax_position=None, title='')[source]¶
Visualize array.
Can show nodes, junctions and faces; and their respective indices.
For documentation see
embedded_graph.EmbeddedGraph.plot
- remove_junctions(junctions_to_remove) josephson_circuit.Circuit [source]¶
Remove junctions from circuit.
- Returns
- new_circuit
Circuit
New Circuit object with removed junctions.
- new_circuit
- Attributes
- junctions_to_removeint array in range(Nj)
Indices of junctions to remove from circuit.
- or junctions_to_remove(Nj,) mask
Mask selecting junctions to remove from circuit.
- remove_nodes(nodes_to_remove) josephson_circuit.Circuit [source]¶
Remove nodes from circuit.
- Returns
- new_circuit
Circuit
New Circuit object with removed nodes.
- new_circuit
Notes
Junctions whose endpoints are removed are also removed.
- Attributes
- nodes_to_removeint array in range(Nn)
Indices of nodes to remove from circuit.
- or nodes_to_remove(Nn,) mask
Mask selecting nodes to remove from circuit.
- set_capacitance(C) josephson_circuit.Circuit [source]¶
Modify capacitance factors of all junctions in the circuit.
- Attributes
- C(Nj,) array or scalar
New capacitance factors. Same for all junctions if scalar.
- set_critical_current(Ic) josephson_circuit.Circuit [source]¶
Modify critical current factors of all junctions in the circuit.
- Attributes
- Ic(Nj,) array or scalar
New critical current factors. Same for all junctions if scalar.
- set_inductance(inductance) josephson_circuit.Circuit [source]¶
Modify the inductances factors of all junctions in the circuit.
- set_resistance(R) josephson_circuit.Circuit [source]¶
Modify resistance factors of all junctions in the circuit.
- Attributes
- R(Nj,) array or scalar
New resistance factors. Same for all junctions if scalar.