quantcore_circuits.designer¶
Code-first chip design (Metal-style), drawn live in KLayout as you type.
>>> d = Designer("q1_r1", box=(0, 0, 7500, 7500), chip={"name_chip": "Q1R1"}, live=True) # opens KLayout
>>> pw = d.add("PAD_W", "BondPad", at=(1125, 3750), rot=270)
>>> pe = d.add("PAD_E", "BondPad", at=(6375, 3750), rot=90)
>>> fl = d.route("FL", pw.a, pe.a) # ports are attributes
>>> q1 = d.add("Q1", "Xmon", at=(2975, 2200), cross_length=300, junction={"Lj_nH": 12, "Cj_fF": 2})
>>> d.route("R1", q1.claw_n, fl.hanger(s=2000, length=300, side="right"), meander=4200)
>>> d.save("examples/my_chip.json"); d.lom().model # design.json and its lumped circuit
Every add/route/set validates immediately (unknown cells, parameters or ports raise with the list of
valid ones) and, with live=True, rebuilds the chip (≈0.1 s warm), writes build/<name>.oas + sidecar and
reloads KLayout through klive. A change that cannot be routed yet (e.g. a route to a component not placed yet) keeps
the last good layout and prints why. with d.batch(): groups changes into one rebuild. The result is an ordinary
design.json, so the KLayout plugin, qcc watch, simulation and analysis all work on it unchanged.
Classes¶
|
|
Module Contents¶
- class quantcore_circuits.designer.Designer(name: str, box=(0.0, 0.0, 10000.0, 10000.0), pdk: str = DEFAULT_PDK, chip: dict | None = None, launchers: str | dict | None = None, live: bool = False, out: str | pathlib.Path | None = None, delay: float = 0.0, open_klayout: bool | None = None, verbose: bool = True)¶
- add(name: str, cell, at=None, rot: float = 0.0, mirror: bool = False, snap: str | None = None, to: str | None = None, snap_gap: float = 0.0, junction: dict | None = None, edge: str | None = None, **params) InstanceHandle¶
Place a component:
cellis a class (Xmon) or name;paramsare its PCell parameters.Absolute placement with
at/rot, or port snap withsnap="port"(own port) andto=another instance’s port (q1.claw_n, optionalsnap_gap); the rebuild solves the rotation.edge(“n”, “s”, “e”, “w” or “auto”) applies the Quantcore pad rule to an absolute placement: the instance slides perpendicular to that die edge until the outer edge of its etch is the PDK pad distance (PDKframe.pad_edge, 100 µm) from it.junctionholds the lumped junction values for the LOM and the simulations:{"Lj_nH", "Cj_fF", "flux_phi0", "asym"}(L_J at zero flux, C_J, a SQUID’s flux Φ/Φ0 and asymmetry d; withoutLj_nHthe drawn trilayer junction’s PDK value is used). All other keyword arguments are cell parameters (e.g. the Xmon’sgap).
- array(name: str, cell, origin=(0.0, 0.0), pitch=(100.0, 100.0), shape=(1, 1), rot: float = 0.0, vary: dict | None = None, **params) list[InstanceHandle]¶
Place
shape = (columns, rows)copies of a cell on a grid (test-pad and junction arrays).Instances are named
<name>_<col>_<row>.varymaps a parameter to one value per copy (column-major, e.g. a junction-width sweep); the otherparamsare shared.
- batch()¶
Group several changes into one rebuild.
- couple(name: str, a: str, b: str, C_fF: float | None = None, L_nH: float | None = None, note: str = '', wire: bool = False) None¶
Declare a lumped coupling no route or snap carries (e.g. qubit arms facing each other).
a/bare"Q1"(main island),"Q1.<port>","Q1.<LOM node>"or a route name (its conductor, e.g. a hanger against a routed feedline:d.couple("K_R1", "R1", "FL")); giveC_fF(default C, value optional: a C-matrix fills it by island name) orL_nH.wire=Truedeclares a galvanic join of two ports instead (no element, no geometry): for overlapping metal, e.g. a legacy resonator end drawn inside a claw tail.
- drc()¶
- static free_end(at, dir: float | None = None, term: float = 0.0) dict¶
- classmethod load(source, autosave: bool | None = None, **kw) Designer¶
Open a saved design.
autosave(default: thelivesetting) writes every rebuild back tosource: on in a live KLayout session, so the plugin andqcc watchsee your edits; off in scripts, tests andQCC_LIVE=0notebooks, so loading a design never rewrites it by accident (d.save(path)still does).
- lom(select: list[str] | None = None)¶
Lumped circuit of this layout (component estimates; see
quantcore_circuits.lom).
- remove(name: str) None¶
- route(name: str, start, end, meander: float | None = None, type: str | None = None, nodes=None, a: float | None = None, b: float | None = None, r: float | None = None, airbridges=None, meander_direction: int | None = None, **params) RouteHandle¶
Connect two ports with a CPW (
meander=lengthfor a fixed-length meander).endmay be a port,other_route.hanger(...)orDesigner.free_end(...);nodesare waypoints (tuples orwaypoint()).meander_direction=-1mirrors the meander (its first turn goes the other way).
- save(path: str | pathlib.Path) pathlib.Path¶
- show(quiet_errors: bool = False)¶
Build, write
build/<name>.oas(+ sidecar) and reload KLayout (starting it if needed).
- sim_group(name: str, select: list[str], margin_um: float = 300.0, analyses=('eigenmode_epr', 'q3d_cmatrix'), ports: dict[str, str] | None = None, settings: dict | None = None) None¶
A FEM sub-problem.
portsmaps a selected route to"keep"(not cut for capacitance analyses),"edge"or"internal";"edge"on a grounded line the box cuts (e.g. a qubit’s λ/4 readout when only the qubit is selected) terminates it in 50 Ω there for eigenmode / driven runs.settingsare passed to the simulation (solver options).
- sim_subset(name: str, pairs=None, qubits=None, margin_um: float = 300.0, analyses=('eigenmode_epr', 'q3d_cmatrix'), settings: dict | None = None, split: str = 'auto', verbose: bool = False, readouts: bool = True) list[str]¶
Simulate a subset of the chip (
quantcore_circuits.sim_tools.subset):pairs=[("Q3", "R3"), ("Q5", "R5")](resonator None → the qubit’s readout) orqubits=["Q3", "Q5"]. Each chosen qubit comes with its readout chain; the feedline is always in the box and cut into 50 Ω ports by it; a bus between two chosen qubits comes in, a bus to a qubit outside the subset is cut (ports={bus: "cut"}: a 50 Ω stub at the chosen qubit’s pad). Disjoint pairs get one box each (split="auto";"one": one box). Adds one sim group per box and returns their names (nameitself when there is one box, else<name>_<qubits>). The netlist is not touched:fill(whole_chip_model, design, [jobs])fills only these components.readouts=False: the qubits alone (the box cuts their readouts into 50 Ω lines; an eigenmode box that fits a workstation).
- targets(**per_instance) None¶
- static waypoint(at, a: float | None = None, b: float | None = None, airbridge: bool = False, **params) dict¶
- property chip_ports: dict¶
Chip-level (launcher) ports, referenced as
"chip.<name>".
- data: dict¶
- property design¶
- history: list[str] = []¶
- out¶
- path: pathlib.Path | None = None¶
- result = None¶
- class quantcore_circuits.designer.InstanceHandle(designer: Designer, name: str)¶
- move(at=None, rot=None, edge: str | None = None) InstanceHandle¶
Move / rotate;
edge(“n”/”s”/”e”/”w”/”auto”) puts the outer edge of the etch at the PDK pad distance (frame.pad_edge, 100 µm) from that die edge.
- set(**params) InstanceHandle¶
Change cell parameters (
at=/rot=are accepted too;junction=replaces the junction dict, e.g.{"Lj_nH": 7.0, "flux_phi0": 0.2, "asym": 0.1}).
- property ports: dict¶
- property spec: dict¶
- class quantcore_circuits.designer.PortRef¶
Bases:
str"Q1.claw_n"with the port’s geometry attached (.pos,.dir,.a,.bin the local frame).
- class quantcore_circuits.designer.RouteHandle(designer: Designer, name: str)¶
- hanger(s: float | None = None, length: float = 300.0, side: str = 'left', ground_gap: float = 6.0, direction: str = 'forward', end: str = 'short', open_gap: float = 6.0, bend: bool = True, near=None, coupler_gap: float | None = None, line_gap: float | None = None) dict¶
End spec for a λ/4 coupler running along this route (use as another route’s
end).bend=Falseenters the coupler straight instead of with a 90° bend;directionflips which end is terminated.near=(x, y)instead ofscentres the coupler at the point of this route nearest to (x, y).coupler_gap/line_gapnarrow the two facing gaps along the coupler (closer, stronger coupling).
- set(**kw) RouteHandle¶
- property length: float | None¶
- property spec: dict¶