quantcore_circuits.sim_tools.builder

Design sim-group → KQC Simulation.

For a sim_groups entry the builder:

  1. derives a simulation design: junctions of the selected qubits become KQC "Sim" junctions; for capacitance analyses, selected routes attached to selected instances are cut (removed) and replaced by a short waveguide-to-port stub at that port, so the coupler becomes its own net (the resonator itself is modelled as a transmission line in LOM); no ground grid, no chip frame;

  2. builds it and cuts out the box spanned by the selected instances/routes plus margin_um;

  3. adds ports: junction InternalPort (eigenmode / driven: L at the design flux and C_J as the LOM takes them, lumped_junction(); capacitance: a placeholder L, the gap stays open), waveguide-to-port stubs, and one port per route crossing the box edge — an EdgePort for capacitance analyses; for eigenmode, where KQC forbids edge ports, a 50 Ω lumped InternalPort next to the edge (KQC’s use_internal_ports="at_edge" geometry), so the crossing line is terminated and the eigenmode Q gives κ / Purcell. Where a straight line crosses the box edge at an angle, that port sits on the line’s own axis just inside the box, its cut square to the line (line_port(); driven: the same lumped port instead of a wave port);

  4. passes the PDK stack (substrate, permittivity, box heights).

The group name "chip" (unless the design defines its own) means the whole chip: every instance and route is kept uncut, the box is the chip box, and each cell exposing lumped_signal/lumped_ground refpoints (bond pads) gets a 50 Ω lumped port. In other groups, the selected pads get that port, and so do the pads that terminate the selection (snapped to a selected instance, or at an end of a selected route): a selected feedline is never floating.

The returned SimSetup records the port number → design name mapping used later to label C-matrices.

Attributes

Classes

FaceMetal

The metal of face inside box as KQC's Simulation builds it: box − (gap − addition), plus etch

LinePort

The 50 Ω port of a straight line the box edge crosses at an angle, on the line's own axis (line_port()).

SimPortInfo

SimSetup

Functions

analysis_kind(analysis) → str

"capacitance", "eigenmode", "driven" or a plugin's kind (see quantcore_circuits.plugins).

build_simulation(source, group, analysis[, ...]) → SimSetup

Create the KQC Simulation for group/analysis (see module docstring).

crossing_port(path, spines, lith, box, pos, a, b, dbu)

How the 50 Ω port of the line crossing the box edge at pos is built (C6): "edge" — a square crossing

crossing_square(path, box, pos, a, b, dbu) → bool

The route's centre conductor (path) crosses the box edge at pos roughly at 90°: inside a band as deep as

drawn_faces(layout, cell, names) → set[str]

KQC faces on which cell (with its sub-cells) has shapes on one of the KQC layers names.

edge_midpoint_locations(p) → dict

A port polygon KQC built on slanted edges (C6b): its corners are the found edges' end points on the database

edge_port_ok(lith, box, pos, a, b, dbu) → bool

Whether KQC builds the polygon of the 50 Ω edge port at crossing pos (see build_simulation(): signal

face_stack_of(faces) → list[str]

KQC face_stack for faces: the run of FACE_ORDER from the lowest to the highest of them. A face in

galvanic_routes(fm, islands, crossings) → tuple[set[str], set[int]]

Routes whose box crossing lies on a junction island (a galvanic lead line leaving the box: the island would be

grounded_routes(design) → set[str]

Routes whose centre conductor is galvanically grounded (they must not become C-matrix nets).

group_spec(design, group) → quantcore_circuits.design.schema.SimGroup

The sim group group of design; "chip" defaults to the whole chip with nothing cut.

is_face_connector(cell_ref) → bool

A KQC element that joins two faces: a TSV (Tsv subclasses) or a flip-chip bump connector

is_junction_cell(cell_ref) → bool

A junction cell — KQC Junction subclasses (Manhattan, NoSquid, Sim, SuperInductor, …), the Quantcore

junction_gap(fm, a, b[, reach])

(signal point, ground point) on the facing edges of the two conductors a junction drawn from a (island

junction_nets(name, inst, pdk) → tuple[str, str | None]

FEM net labels on the two sides of a qubit's junction: (squid_a side, squid_b side or None = ground).

junction_sheet(fm, sig, gnd[, width, min_width, clearance])

(polygon points, width): the junction's lumped sheet between gnd and sig (points on the two metal

label_unnamed(sim, nets, result, select, design[, faces]) → dict[int, str]

Labels for signal conductors no probe named (C7): a piece of a selected cell's own line (its waveguide path;

lead_open_ends(fm, ports, islands, connected, default_ab) → list[tuple[str, kqcircuits.pya_resolver.pya.DPolygon]]

[(port key, etch polygon)]: an open end (b long, a + 2b wide) beyond each unconnected port of a

line_port(spines, box, pos, a, b) → LinePort | None

The 50 Ω port of the line crossing the box edge at pos, on the line's own axis (C6b). KQC's at-edge port

line_port_ok(lith, box, edge, signal, ground, ...) → bool

Whether KQC builds the polygon of the 50 Ω port cut from signal to ground, etch_width wide (both

lumped_junction(name, inst, pdk[, notes]) → tuple[float, float]

(L nH, C_J fF) of a qubit's junction as a lumped RLC sheet (eigenmode, driven): the values its LOM takes

multiface_params(pdk, face_stack[, chip_distance]) → dict

KQC Simulation stack parameters for a multi-face face_stack on the PDK stack: both substrates are the

narrow_junction_port(p[, width, max_edge]) → dict

The junction port sheet as a width-wide rectangle on the junction line (signal → ground location).

net_names(sim, probes[, near, reach]) → dict[int, str]

Label KQC's signal excitations by probing points: the first probe inside an excitation's metal names it.

own_face(inst, default) → str

The face an instance is placed on: the first of its face_ids (default if it sets none).

port_face(result, p, faces, main, default_ab) → str

The face the CPW at plan port p is drawn on: the first of faces (main first) with etch on both sides

selection_faces(design, result, names, pdk) → set[str]

The KQC faces a sim group's lines run on (always with the PDK face): each selected route's centre line (a

sheet_junction_port(p, polygon, width) → dict

Port data with the builder's junction sheet (junction_sheet()): polygon replaces KQC's; the signal /

sim_face_stack(design, g, result, pdk, sim_params) → tuple[list, dict, str]

(face_stack, stack parameters, how) of a sim group: face_stack from the call (sim_params), else the

simulation_design(design, group, analysis) → tuple[quantcore_circuits.design.Design, list[tuple[str, str]]]

Copy of design prepared for simulating group; also returns the cut (instance, port) pairs.

split_large_gds_polygons(path[, limit, overlap_um]) → int

Rewrite each polygon of the simulation GDS path with more than limit points (a GDS XY record holds at

straighten_box(result, box, exclude, route_ab, ...[, ...]) → tuple[kqcircuits.pya_resolver.pya.DBox, list[str]]

Move box edges so every line that leaves the box is cut on a straight section (C6): the eigenmode / driven

strip_layers(result[, airbridges, bumps]) → dict

Remove geometry a simulation must not contain from a built layout, in place.

strip_unpaired_joins(result, face_stack, lower_box_height) → dict[str, int]

Remove the TSVs and bumps that have no face to land on in face_stack (KQC's rule: a face's TSVs go to the

vertex_contact_patches(result, box, faces[, size]) → dict[str, list[kqcircuits.pya_resolver.pya.DBox]]

{face: [patch boxes]} joining metal pieces that touch at a single point inside box.

Module Contents

class quantcore_circuits.sim_tools.builder.FaceMetal(result, box: kqcircuits.pya_resolver.pya.DBox, face: str, etch=(), metal=(), smooth: float = 0.0)

The metal of face inside box as KQC’s Simulation builds it: box − (gap − addition), plus etch boxes (on the gap layer) and metal boxes (addition), optionally with the etch smooth-ed (µm, the sim-only bend simplification). pieces are its conductors; boxed[k]: piece k touches the box edge (ground).

classmethod from_etch(etch: kqcircuits.pya_resolver.pya.Region, box: kqcircuits.pya_resolver.pya.DBox, dbu: float = 0.001) → FaceMetal

A FaceMetal of a plain etch region (dbu units): synthetic geometry for tests.

max_points() → int

Most points of one metal or gap polygon as a GDS writer stores it (holes keyholed into the hull).

on_edge(p: kqcircuits.pya_resolver.pya.DPoint, tol: float = KQC_EDGE_TOL_UM) → bool

p lies on a metal edge (where KQC’s find_edge_from_point_in_polygons finds one).

piece_at(p: kqcircuits.pya_resolver.pya.DPoint) → int | None

The conductor at p (None in etch); a point on an edge belongs to the piece it touches.

class quantcore_circuits.sim_tools.builder.LinePort

The 50 Ω port of a straight line the box edge crosses at an angle, on the line’s own axis (line_port()). The cut runs from signal along direction (a − 2·over_etching long, a + b wide, square to the line); the stub from signal out to the box edge stays metal, as the at-edge port’s 1 µm stub.

angle: float
direction: kqcircuits.pya_resolver.pya.DVector
edge: kqcircuits.pya_resolver.pya.DPoint
signal: kqcircuits.pya_resolver.pya.DPoint
class quantcore_circuits.sim_tools.builder.SimPortInfo
excitation: str | None = None
kind: str
name: str
number: int
class quantcore_circuits.sim_tools.builder.SimSetup
port_labels() → dict[int, str]
analysis: str
box: kqcircuits.pya_resolver.pya.DBox | None = None
design: quantcore_circuits.design.Design
geometry: dict
group: str
nets: dict[int, str]
notes: list[str] = []
ports: list[SimPortInfo] = []
routes: list[str] = []
simulation: kqcircuits.simulations.simulation.Simulation
waveguide_length: float = 100.0
quantcore_circuits.sim_tools.builder.analysis_kind(analysis: str) → str

“capacitance”, “eigenmode”, “driven” or a plugin’s kind (see quantcore_circuits.plugins).

quantcore_circuits.sim_tools.builder.build_simulation(source, group: str, analysis: str, waveguide_length: float = 100.0, airbridges: bool | None = None, **sim_params) → SimSetup

Create the KQC Simulation for group/analysis (see module docstring).

The simulated geometry never has the ground grid (cheese). Airbridges are dropped for speed unless airbridges=True (or the group’s settings["airbridges"]); a note flags crossing bridges whose line is then open at the crossing.

Faces: a group whose lines run on more than the PDK face (a route through a bump connector onto 2b1, a TSV to 1b1, an instance placed on another face) is simulated with all the faces it needs (sim_face_stack()): bumps and TSVs stay as KQC’s PEC pillars joining the faces, lines leaving the box on another face get their port on that face. settings["face_stack"] (a KQC face stack) and settings["chip_distance"] (µm) override it.

quantcore_circuits.sim_tools.builder.crossing_port(path: kqcircuits.pya_resolver.pya.Region, spines: list[list[kqcircuits.pya_resolver.pya.DPoint]], lith: kqcircuits.pya_resolver.pya.Region, box: kqcircuits.pya_resolver.pya.DBox, pos: kqcircuits.pya_resolver.pya.DPoint, a: float, b: float, dbu: float, over_etching: float = 0.0)

How the 50 Ω port of the line crossing the box edge at pos is built (C6): "edge" — a square crossing where KQC’s at-edge port works (edge_port_ok(), crossing_square(); the port as it always was); a LinePort — a straight line crossing at an angle, the port on its own axis (line_port(), line_port_ok()); None — neither (a bend, a taper: straighten_box() moves the edge; if the edge stays, the port has no polygon). path: the route’s centre conductor, spines: its centre lines.

quantcore_circuits.sim_tools.builder.crossing_square(path: kqcircuits.pya_resolver.pya.Region, box: kqcircuits.pya_resolver.pya.DBox, pos: kqcircuits.pya_resolver.pya.DPoint, a: float, b: float, dbu: float) → bool

The route’s centre conductor (path) crosses the box edge at pos roughly at 90°: inside a band as deep as the 50 Ω edge port (1 + a + b) it is one piece, a to a + b/2 wide along the edge, reaching across the band. Rules out an edge that runs along the line (a bend tangent to the edge) or a diagonal crossing, where KQC may still find edges but the port and the cut are skewed (a straight one gets a line_port()).

quantcore_circuits.sim_tools.builder.drawn_faces(layout, cell, names) → set[str]

KQC faces on which cell (with its sub-cells) has shapes on one of the KQC layers names.

quantcore_circuits.sim_tools.builder.edge_midpoint_locations(p: dict) → dict

A port polygon KQC built on slanted edges (C6b): its corners are the found edges’ end points on the database grid, so the drawn signal / ground points (off the grid) can lie a fraction of a nm off the polygon’s slanted sides, and AEDT then refuses the port’s current line (“Both endpoints of the directed line must lie on the boundary face”). The exported locations become the midpoints of KQC’s own signal and ground edges, which lie on the polygon; KQC’s nets were assigned from the drawn points already. Without a polygon nothing changes.

quantcore_circuits.sim_tools.builder.edge_port_ok(lith: kqcircuits.pya_resolver.pya.Region, box: kqcircuits.pya_resolver.pya.DBox, pos: kqcircuits.pya_resolver.pya.DPoint, a: float, b: float, dbu: float) → bool

Whether KQC builds the polygon of the 50 Ω edge port at crossing pos (see build_simulation(): signal 1 µm inside the box edge, ground a further in, the line etched between them a + b wide): after that etch both points must lie on a metal edge. On a bend, a taper or a diagonal they do not and AEDT skips the port (C6; a straight diagonal gets its port on its own axis instead, line_port()). lith: the face’s etch (gap − addition), uncut by the box.

quantcore_circuits.sim_tools.builder.face_stack_of(faces) → list[str]

KQC face_stack for faces: the run of FACE_ORDER from the lowest to the highest of them. A face in between is simulated too, as KQC models every face in the stack: metal wherever the design does not etch it.

quantcore_circuits.sim_tools.builder.galvanic_routes(fm: FaceMetal, islands: set[int], crossings) → tuple[set[str], set[int]]

Routes whose box crossing lies on a junction island (a galvanic lead line leaving the box: the island would be joined to the box edge = ground) and the islands still on the box edge without such a route (C4).

quantcore_circuits.sim_tools.builder.grounded_routes(design: quantcore_circuits.design.Design) → set[str]

Routes whose centre conductor is galvanically grounded (they must not become C-matrix nets).

A route is grounded if an end is a short: a free end with term == 0, a hanger with end == "short", or a port that the cell class lists in qcc_shorted_ports (e.g. the Xmon flux-line tip).

quantcore_circuits.sim_tools.builder.group_spec(design: quantcore_circuits.design.Design, group: str) → quantcore_circuits.design.schema.SimGroup

The sim group group of design; "chip" defaults to the whole chip with nothing cut.

quantcore_circuits.sim_tools.builder.is_face_connector(cell_ref: str) → bool

A KQC element that joins two faces: a TSV (Tsv subclasses) or a flip-chip bump connector (FlipChipConnector subclasses, FlipChipConnectorRf).

quantcore_circuits.sim_tools.builder.is_junction_cell(cell_ref: str) → bool

A junction cell — KQC Junction subclasses (Manhattan, NoSquid, Sim, SuperInductor, …), the Quantcore trilayer cells, Metal junctions (metal:SNAIL, …: category junction). They belong in a qubit’s gap (or a code-built layout’s): placed on their own they are not a qubit, so the export gives them no qubit treatment (see build_simulation(): a junction port only where the cell bridges two different conductors).

quantcore_circuits.sim_tools.builder.junction_gap(fm: FaceMetal, a: kqcircuits.pya_resolver.pya.DPoint, b: kqcircuits.pya_resolver.pya.DPoint, reach: float = JJ_AXIS_REACH_UM)

(signal point, ground point) on the facing edges of the two conductors a junction drawn from a (island side) to b bridges, found along its axis — wherever its pins sit: on the edges, inside the metal (a junction overlapping into the islands) or short of them (a pin in a cut-out, StarQubit’s line ending between its two leads). Among the gaps between two different conductors on the axis (not two box-edge grounds) the one overlapping the pins’ span, nearest its middle, wins. None if there is none (both ends on one conductor, a zero-length junction).

quantcore_circuits.sim_tools.builder.junction_nets(name: str, inst, pdk) → tuple[str, str | None]

FEM net labels on the two sides of a qubit’s junction: (squid_a side, squid_b side or None = ground).

Taken from the component’s LOM model (island labels such as Q1.island, or Q1.island1/Q1.island2 for a floating transmon, whose junction connects two islands); <name>.island when there is no model.

quantcore_circuits.sim_tools.builder.junction_sheet(fm: FaceMetal, sig: kqcircuits.pya_resolver.pya.DPoint, gnd: kqcircuits.pya_resolver.pya.DPoint, width: float = 10.0, min_width: float = 0.5, clearance: float = JJ_SHEET_CLEARANCE_UM)

(polygon points, width): the junction’s lumped sheet between gnd and sig (points on the two metal edges): a strip on the axis, width wide or narrower until no metal lies within clearance of it away from its ends (metal along its long sides would short the lumped element), cut to the gap (its ends follow the metal edges, so nothing of the sheet lies on metal and both ends touch a conductor). None if not even min_width fits.

quantcore_circuits.sim_tools.builder.label_unnamed(sim, nets: dict[int, str], result, select: list[str], design: quantcore_circuits.design.Design, faces: list[str] | None = None) → dict[int, str]

Labels for signal conductors no probe named (C7): a piece of a selected cell’s own line (its waveguide path; a spiral cut where a dropped airbridge crossed) → the cell’s LOM island when it has exactly one (X.res#2), a piece of a route’s line → the route; any other conductor inside a selected cell → <cell>.floating[k] (floating parts such as a coupler’s cross, ground enclosed by the cell); else floating<k>. faces: route lines on each of these faces (a multi-face group); default 1t1.

quantcore_circuits.sim_tools.builder.lead_open_ends(fm: FaceMetal, ports: dict, islands: dict[str, set[int]], connected: set[str], default_ab: tuple) → list[tuple[str, kqcircuits.pya_resolver.pya.DPolygon]]

[(port key, etch polygon)]: an open end (b long, a + 2b wide) beyond each unconnected port of a simulated qubit whose own junction island (islands: qubit → its island pieces) runs through the port into the ground plane (the island piece reaches the box edge) — a galvanic lead left unrouted (TwoPadTransmon’s left lead ends on the pocket edge). Unetched, it joins the island to the ground plane; the fab cell is unchanged, the etch goes into the simulation only (C4).

quantcore_circuits.sim_tools.builder.line_port(spines: list[list[kqcircuits.pya_resolver.pya.DPoint]], box: kqcircuits.pya_resolver.pya.DBox, pos: kqcircuits.pya_resolver.pya.DPoint, a: float, b: float) → LinePort | None

The 50 Ω port of the line crossing the box edge at pos, on the line’s own axis (C6b). KQC’s at-edge port cuts along the box normal: where the line crosses at an angle its points miss the metal edges, the port has no polygon and AEDT skips it. Here the cut is square to the line, a + b wide, with its corner nearest the box edge 1 µm inside it (the at-edge port’s signal point); the line must run straight from the edge to b past the cut. At 90° this is the at-edge geometry. spines: the route’s centre lines (_route_spines()). None on a bend or a taper (straighten_box() moves the edge) and for a line within 90° − LINE_PORT_MAX_ANGLE_DEG of the edge.

quantcore_circuits.sim_tools.builder.line_port_ok(lith: kqcircuits.pya_resolver.pya.Region, box: kqcircuits.pya_resolver.pya.DBox, edge: kqcircuits.pya_resolver.pya.DPoint, signal: kqcircuits.pya_resolver.pya.DPoint, ground: kqcircuits.pya_resolver.pya.DPoint, etch_width: float, dbu: float) → bool

Whether KQC builds the polygon of the 50 Ω port cut from signal to ground, etch_width wide (both points on a metal edge after the cut, as edge_port_ok() checks), and the cut parts the line: the stub beyond the signal side is not the line beyond the ground side, and it reaches the box edge (edge: where the line crosses it) like the at-edge port’s stub. lith: the face’s etch (gap − addition), uncut by the box.

quantcore_circuits.sim_tools.builder.lumped_junction(name: str, inst, pdk, notes: list | None = None) → tuple[float, float]

(L nH, C_J fF) of a qubit’s junction as a lumped RLC sheet (eigenmode, driven): the values its LOM takes (instance_junction(): the design’s junction, else the drawn trilayer junction on the PDK rule), L at the design flux. notes gets the source; raises when there is no L, saying where to set it.

quantcore_circuits.sim_tools.builder.multiface_params(pdk, face_stack, chip_distance: float | None = None) → dict

KQC Simulation stack parameters for a multi-face face_stack on the PDK stack: both substrates are the PDK substrate (thickness, material), the vacuum gap between 1t1 and 2b1 is chip_distance (default the PDK’s chip_distance), and a stack that starts on a bottom face (1b1) gets a vacuum box below it (lower_box_height: the PDK’s, or upper_box_height where the PDK has none).

quantcore_circuits.sim_tools.builder.narrow_junction_port(p: dict, width: float = JJ_PORT_WIDTH_UM, max_edge: float = JJ_PORT_MAX_EDGE_UM) → dict

The junction port sheet as a width-wide rectangle on the junction line (signal → ground location).

KQC spans the port polygon between the whole metal edges nearest the signal and ground points. With a junction drawn on lead stubs (KQC qubits, Xmon + Quantcore Junction) those are short (≈ 8 µm) and kept. Where the junction bridges a plain gap they are the island’s and the ground’s whole edges: chip 12’s TransmonCrossFL (signal 50 µm, ground 90–1145 µm: a skewed trapezoid sheet, no qubit eigenmode), IBM pocket pads (750 µm both), and a diagonal StarQubit line has no edge at all (no polygon, AEDT skips the port). Those get the rectangle instead; the ends sit on the metal boundary (etched_line), the current line is unchanged.

quantcore_circuits.sim_tools.builder.net_names(sim: kqcircuits.simulations.simulation.Simulation, probes: list[tuple[str, kqcircuits.pya_resolver.pya.DPoint]], near: list[tuple[str, kqcircuits.pya_resolver.pya.DPoint]] | None = None, reach: float = 100.0) → dict[int, str]

Label KQC’s signal excitations by probing points: the first probe inside an excitation’s metal names it.

KQC numbers signals by conductor (Simulation.split_metal_layers_by_excitation): ports sharing a conductor share one excitation, and floating conductors follow in arbitrary order, so port k is not always net k. near probes that land in ground name the nearest unnamed conductor within reach µm (bounding-box distance), e.g. a floating claw whose port tail is joined to a grounded resonator.

quantcore_circuits.sim_tools.builder.own_face(inst, default: str) → str

The face an instance is placed on: the first of its face_ids (default if it sets none).

quantcore_circuits.sim_tools.builder.port_face(result, p, faces: list[str], main: str, default_ab: tuple) → str

The face the CPW at plan port p is drawn on: the first of faces (main first) with etch on both sides of the centre conductor just behind the port; main if none has.

quantcore_circuits.sim_tools.builder.selection_faces(design: quantcore_circuits.design.Design, result, names, pdk) → set[str]

The KQC faces a sim group’s lines run on (always with the PDK face): each selected route’s centre line (a route’s face_ids, or a face_id waypoint, where KQC puts a bump connector and continues on that face), the faces each selected TSV or bump connector draws on (is_face_connector(), or any other cell that draws TSVs or bumps and is not a qubit: _draws_joins()), and the face of each selected instance placed on another face (face_ids[0]). A qubit on the PDK face that also draws a little on another face (a Flipmon’s top-chip disc and bump) does not add that face: set face_stack in the group’s settings for it.

quantcore_circuits.sim_tools.builder.sheet_junction_port(p: dict, polygon, width: float) → dict

Port data with the builder’s junction sheet (junction_sheet()): polygon replaces KQC’s; the signal / ground edges are width long across the junction axis at the port’s signal / ground points.

quantcore_circuits.sim_tools.builder.sim_face_stack(design: quantcore_circuits.design.Design, g: quantcore_circuits.design.schema.SimGroup, result, pdk, sim_params: dict) → tuple[list, dict, str]

(face_stack, stack parameters, how) of a sim group: face_stack from the call (sim_params), else the group’s settings["face_stack"] (a list; "auto" = not set), else the faces its lines run on (selection_faces(), face_stack_of()). One face: the PDK’s simulation_params() face stack with no stack parameters (the export as before); several: multiface_params() (chip_distance from the call, the group’s settings or the PDK). how: "set" or "auto".

quantcore_circuits.sim_tools.builder.simulation_design(design: quantcore_circuits.design.Design, group: str, analysis: str) → tuple[quantcore_circuits.design.Design, list[tuple[str, str]]]

Copy of design prepared for simulating group; also returns the cut (instance, port) pairs.

quantcore_circuits.sim_tools.builder.split_large_gds_polygons(path, limit: int = GDS_MAX_POINTS, overlap_um: float = 0.01) → int

Rewrite each polygon of the simulation GDS path with more than limit points (a GDS XY record holds at most 4095) as pieces of the same conductor that overlap by overlap_um along the cuts, inside the original outline (a layer’s pieces that KLayout’s writer split at 8000 points, edge to edge, are rejoined first). For HFSS jobs only: every metal sheet is PEC there, so the pieces act as one conductor; Q3D’s AutoIdentifyNets keeps overlapping objects as separate nets (AEDT 2024 R1 render). Used where simplifying bends is not enough (many holes, e.g. flux-trap rows); done on the written file, after KQC built the port polygons from the whole outlines. Layers without such a polygon are not touched; returns the number of polygons rewritten (0: file unchanged).

quantcore_circuits.sim_tools.builder.straighten_box(result, box: kqcircuits.pya_resolver.pya.DBox, exclude: set[str], route_ab: dict, default_ab: tuple, inner: kqcircuits.pya_resolver.pya.DBox, limit: kqcircuits.pya_resolver.pya.DBox, max_out: float, max_in: float, lith: kqcircuits.pya_resolver.pya.Region, over_etching: float = 0.0) → tuple[kqcircuits.pya_resolver.pya.DBox, list[str]]

Move box edges so every line that leaves the box is cut on a straight section (C6): the eigenmode / driven 50 Ω edge port needs that — at 90° KQC’s at-edge port, at an angle a port on the line’s own axis (crossing_port()); on a bend or a taper KQC finds no edges and AEDT skips the port. An edge with a bad crossing moves out (up to max_out µm from where it was, inside limit) or in (up to max_in, never into inner) by the smallest step that leaves no bad crossing on it and no more elsewhere; a line whose crossing then moves to the next edge (a bend at a corner of the box) is handled on that edge in the next round. The original box is kept when nothing improves. Returns (box, notes).

quantcore_circuits.sim_tools.builder.strip_layers(result, airbridges: bool = False, bumps: bool = True) → dict

Remove geometry a simulation must not contain from a built layout, in place.

  • the ground grid (cheese) — always: FEM exports are never cheesed;

  • airbridges (*airbridge_pads / *airbridge_flyover, which KQC’s Simulation would insert as PEC pads and bridges) — unless airbridges=True;

  • indium bumps (*indium_bump) when bumps=False (a one-face simulation): with no opposite face KQC extends a bump as PEC from the face to the top of the simulation box, a pillar that shorts its island to the outer boundary (HFSS) or adds its capacitance (Q3D).

Returns {"ground_grid_shapes", "airbridge_shapes", "airbridges"} (shape counts removed), plus "indium_bump_shapes" when bumps were removed.

quantcore_circuits.sim_tools.builder.strip_unpaired_joins(result, face_stack, lower_box_height: float) → dict[str, int]

Remove the TSVs and bumps that have no face to land on in face_stack (KQC’s rule: a face’s TSVs go to the other side of its substrate, its bumps across the vacuum gap): KQC would run them as PEC to the top or bottom of the simulation box, a short to the outer boundary. Returns {"<face>_<layer>": shapes removed}.

quantcore_circuits.sim_tools.builder.vertex_contact_patches(result, box: kqcircuits.pya_resolver.pya.DBox, faces, size: float = CONTACT_PATCH_UM) → dict[str, list[kqcircuits.pya_resolver.pya.DBox]]

{face: [patch boxes]} joining metal pieces that touch at a single point inside box.

KQC decides nets with Region.interacting, which counts a point contact (a polygon vertex on another piece’s boundary) as connected; Q3D’s AutoIdentifyNets does not, splits the KQC net and stops with “Object … in Net ‘Net1’ and object … in Net ‘…’ are touching”. Typical source: junction metal (a Sim pad, a fab junction window) drawn exactly up to a curved island edge, e.g. a neighbour Flipmon’s trilayer window on its disc. A size µm square of base_metal_addition centred on the contact makes the join an overlap, so AEDT agrees with KQC’s nets (it only adds metal where KQC already counted the pieces as one conductor). A patch that would also touch a third piece is left out.

quantcore_circuits.sim_tools.builder.ALL_ANALYSES
quantcore_circuits.sim_tools.builder.CAPACITANCE_ANALYSES
quantcore_circuits.sim_tools.builder.CHIP_GROUP = 'chip'
quantcore_circuits.sim_tools.builder.CONTACT_PATCH_UM = 0.5
quantcore_circuits.sim_tools.builder.DRIVEN_ANALYSES
quantcore_circuits.sim_tools.builder.EDGE_GAP_EXTENSION_UM = 1.0
quantcore_circuits.sim_tools.builder.EDGE_SHIFT_STEP_UM = 2.0
quantcore_circuits.sim_tools.builder.EIGENMODE_ANALYSES
quantcore_circuits.sim_tools.builder.FACE_METAL_MARGIN_UM = 400.0
quantcore_circuits.sim_tools.builder.FACE_ORDER = ('1b1', '1t1', '2b1', '2t1')
quantcore_circuits.sim_tools.builder.GDS_MAX_POINTS = 4000
quantcore_circuits.sim_tools.builder.JJ_AXIS_REACH_UM = 120.0
quantcore_circuits.sim_tools.builder.JJ_PORT_MAX_EDGE_UM = 20.0
quantcore_circuits.sim_tools.builder.JJ_PORT_WIDTH_UM = 10.0
quantcore_circuits.sim_tools.builder.JJ_SHEET_CLEARANCE_UM = 1.0
quantcore_circuits.sim_tools.builder.KQC_EDGE_TOL_UM = 0.007
quantcore_circuits.sim_tools.builder.LINE_PORT_MAX_ANGLE_DEG = 80.0
quantcore_circuits.sim_tools.builder.LINE_PORT_STRAIGHT_SIN = 0.002
quantcore_circuits.sim_tools.builder.LINE_PORT_WALK_UM = 500.0
quantcore_circuits.sim_tools.builder.SIM_SMOOTH_UM = 0.05
quantcore_circuits.sim_tools.builder.TSV_JOIN_OVERLAP_UM = 0.5