scqubits.core.circuit_utils.assemble_circuit#

scqubits.core.circuit_utils.assemble_circuit(circuit_list, couplers, rename_parameters=False)[source]#

Assemble a yaml string for a large circuit that are made of smaller sub-circuits and coupling elements. This method takes a list of Sub-circuit yaml strings as the first argument, and a yaml string that characterize the coupler branches as the second argument. For example, if one wish to make a yaml string for a circuit consist of a grounded fluxonium capacitively coupled to another fluxonium, then one need to define:

circuit_1 = ‘’’ branches: - [C, 0, 1, EC = 1] - [JJ, 0, 1, EJ = 20, ECJ = 3] - [L, 0, 1, EL = 10] ‘’’ circuit_2 = ‘’’ branches: - [C, 0, 1, EC = 3] - [JJ, 0, 1, EJ = 1, ECJ = 2] - [L, 0, 1, EL = 0.5] ‘’’ circuit_list = [circuit_1, circuit_2] couplers = ‘’’ branches: - [C, 1: 1, 2: 1, E_coup = 1] ‘’’

If rename_parameters argument set to False, the resulting yaml string for the assembled composite circuit is: branches: - [C, 0, 1, EC = 1] - [JJ, 0, 1, EJ = 20, ECJ = 3] - [L, 0, 1, EL = 10] - [C, 0, 2, EC] - [JJ, 0, 2, EJ, ECJ] - [L, 0, 2, EL] - [C, 1, 2, E_coup = 1]

If rename_parameters argument set to True, the resulting yaml string for the assembled composite circuit is: branches: - [C, 0, 1, EC_1 = 1] - [JJ, 0, 1, EJ_1 = 20, ECJ_1 = 3] - [L, 0, 1, EL_1 = 10] - [C, 0, 2, EC_2 = 3] - [JJ, 0, 2, EJ_2 = 1, ECJ_2 = 2] - [L, 0, 2, EL_2 = 0.5] - [C, 1, 2, E_coup_12 = 1]

The yaml strings for each coupler circuit follow the syntax of input strings used in the custom circuit module, whereas the syntax for coupler branches is different. Each coupler branch is represented by: <branch-type>, <subcircuit-index>:<node-index-of-the-circuit>, <subcircuit-index>:<node-index-of-the-circuit>, <param-1> [, <param-2>]]

All the grounded sub-circuit share the same ground node in the composite circuit. The parameter symbols are global, i.e. the same parameter symbol that appears in different subcircuit yaml strings will be treated as one parameter in the composite circuit. The symbolic parameters are only initialized once, with the value specified at the first instance of appearance (notice the initial value for EC in the above example).

Parameters:
  • circuit_list (List[str]) – A list of yaml strings encoding branches of sub-circuits.

  • couplers (str) – A yaml string that encodes information of coupler branches

  • rename_parameters – If set to True, parameters in the sub-circuits will be renamed as <original-parameter-name>_<sub-circuit-index> parameters in the couplers will be renamed as <original-parameter-name>_<sub-circuit-1-index><sub-circuit-2-index>

Return type:

Tuple[str, List[Dict[int, int]]]

Returns:

A yaml string for the composite circuit, which can be used as the input for the custom circuit module, and a list of dictionaries which provides the mapping between the node indices of the sub-circuits (keys) and those of the composite circuit (values).