SymbolicCircuit#
- class scqubits.core.symbolic_circuit.SymbolicCircuit(nodes_list_without_ground, branches_list, branch_var_dict, basis_completion='heuristic', ground_node=None, initiate_sym_calc=True, input_string='')[source]#
Describes a circuit consisting of nodes and branches.
Examples
- For a transmon qubit, the input file reads:
` # file_name: transmon_num.inp nodes: 2 branches: C 1,2 1 JJ 1,2 1 10 `- The Circuit object can be initiated using:
Circuit.from_input_file(“transmon_num.inp”)
- Parameters:
nodes_list (List[Nodes]) – List of nodes in the circuit
branches_list (List[Branch]) – List of branches connecting the above set of nodes.
basis_completion (str) – choices are: “heuristic” (default) or “canonical”; selects type of basis for completing the transformation matrix.
ground_node (
Optional[Node]) – If the circuit is grounded, the ground node is treated separately and should be provided to this parameter.initiate_sym_calc (bool) – set to True by default. Initiates the object attributes by calling the function initiate_symboliccircuit method when set to True.
- Return type:
SerializableType
Methods
SymbolicCircuit.__init__(...[, ...])Determines whether two sets of branches are disconnected.
Method to identify the different modes in the transformation matrix provided by the user.
SymbolicCircuit.configure([...])Method to initialize the CustomQCircuit instance and initialize all the attributes needed before it can be passed on to AnalyzeQCircuit.
SymbolicCircuit.create_from_file(filename)Read initdata and spectral data from file, and use those to create a new SpectrumData object.
SymbolicCircuit.default_params()- rtype:
Dict[str,Any]
SymbolicCircuit.deserialize(io_data)Take the given IOData and return an instance of the described class, initialized with the data stored in io_data.
SymbolicCircuit.filewrite(filename)Convenience method bound to the class.
SymbolicCircuit.from_yaml(input_string[, ...])Constructs the instance of Circuit from an input string.
Returns the Hamiltonian of the circuit in terms of the new variables \(\theta_i\).
Returns four symbolic expressions: lagrangian_θ, potential_θ, lagrangian_φ, potential_φ, where θ represents the set of new variables and φ represents the set of node variables
SymbolicCircuit.is_any_branch_parameter_symbolic()SymbolicCircuit.purely_harmonic_transformation()- rtype:
Tuple[ndarray,ndarray]
SymbolicCircuit.round_symbolic_expr(expr, ...)- rtype:
Expr
Convert the content of the current class instance into IOData format.
Updates the param init val for param_name
Evaluates the boundary conditions and constructs the variable transformation matrix, which is returned along with the dictionary var_categories which classifies the types of variables present in the circuit.
- static are_branchsets_disconnected(branch_list1, branch_list2)[source]#
Determines whether two sets of branches are disconnected.
- check_transformation_matrix(transformation_matrix, enable_warnings=True)[source]#
Method to identify the different modes in the transformation matrix provided by the user.
- Parameters:
transformation_matrix (
ndarray) – numpy ndarray which is a square matrix having the dimensions of the number of nodes present in the circuit.warnings – If False, will not raise the warnings regarding any unidentified modes. It is set to True by default.
enable_warnings (bool) –
- Returns:
A dictionary of lists which has the variable indices classified with var indices corresponding to the rows of the transformation matrix
- configure(transformation_matrix=None, closure_branches=None)[source]#
Method to initialize the CustomQCircuit instance and initialize all the attributes needed before it can be passed on to AnalyzeQCircuit.
- Parameters:
transformation_matrix (
Optional[ndarray]) – array used to set a transformation matrix other than the one generated by the method variable_transformation_matrix.closure_branches (
Optional[List[Branch]]) – List of branches for which the external flux variables will be defined.
- classmethod create_from_file(filename)#
Read initdata and spectral data from file, and use those to create a new SpectrumData object.
- Returns:
new SpectrumData object, initialized with data read from file
- Return type:
- Parameters:
filename (str) –
- classmethod deserialize(io_data)#
Take the given IOData and return an instance of the described class, initialized with the data stored in io_data.
- Return type:
TypeVar(SerializableType, bound= Serializable)- Parameters:
io_data (IOData) –
- filewrite(filename)#
Convenience method bound to the class. Simply accesses the write function.
- Return type:
None- Parameters:
filename (str) –
- classmethod from_yaml(input_string, from_file=True, basis_completion='heuristic', initiate_sym_calc=True)[source]#
Constructs the instance of Circuit from an input string. Here is an example of an input string that is used to initiate an object of the class SymbolicCircuit:
` #zero-pi.yaml nodes : 4 # zero-pi branches: - [JJ, 1,2, EJ = 10, 20] - [JJ, 3,4, 10, 20] - [L, 2,3, 0.008] - [L, 4,1, 0.008] - [C, 1,3, 0.02] - [C, 2,4, 0.02] `- Parameters:
input_string (
str) – String describing the number of nodes and branches connecting then along with their parametersfrom_file (
bool) – Set to True by default, when a file name should be provided to input_string, else the circuit graph description in YAML should be provided as a string.basis_completion (
str) – choices: “heuristic” or “canonical”; used to choose a type of basis for completing the transformation matrix. Set to “heuristic” by default.initiate_sym_calc (
bool) – set to True by default. Initiates the object attributes by calling the function initiate_symboliccircuit method when set to True. Set to False for debugging.
- Returns:
Instance of the class SymbolicCircuit
- generate_symbolic_hamiltonian(substitute_params=False)[source]#
Returns the Hamiltonian of the circuit in terms of the new variables \(\theta_i\).
- Parameters:
substitute_params – When set to True, the symbols defined for branch parameters will be substituted with the numerical values in the respective Circuit attributes.
- Return type:
Expr
- generate_symbolic_lagrangian()[source]#
Returns four symbolic expressions: lagrangian_θ, potential_θ, lagrangian_φ, potential_φ, where θ represents the set of new variables and φ represents the set of node variables
- Return type:
Tuple[Expr,Expr,Expr,Expr]
- serialize()#
Convert the content of the current class instance into IOData format.
- Return type:
- variable_transformation_matrix()[source]#
Evaluates the boundary conditions and constructs the variable transformation matrix, which is returned along with the dictionary var_categories which classifies the types of variables present in the circuit.
- Return type:
Tuple[ndarray,Dict[str,List[int]]]- Returns:
tuple of transformation matrix for the node variables and var_categories dict which classifies the variable types for each variable index