quantcore-circuits 0.0.1__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (272) hide show
  1. quantcore_circuits/__init__.py +57 -0
  2. quantcore_circuits/analysis/__init__.py +12 -0
  3. quantcore_circuits/analysis/_metal.py +70 -0
  4. quantcore_circuits/analysis/amplifiers.py +263 -0
  5. quantcore_circuits/analysis/circuits.py +117 -0
  6. quantcore_circuits/analysis/epr.py +231 -0
  7. quantcore_circuits/analysis/epr_lumped.py +372 -0
  8. quantcore_circuits/analysis/extract.py +119 -0
  9. quantcore_circuits/analysis/lom.py +80 -0
  10. quantcore_circuits/analysis/results.py +549 -0
  11. quantcore_circuits/analysis/store.py +81 -0
  12. quantcore_circuits/analysis/synthesis.py +118 -0
  13. quantcore_circuits/analysis/transmon.py +126 -0
  14. quantcore_circuits/assembly/__init__.py +17 -0
  15. quantcore_circuits/assembly/builder.py +127 -0
  16. quantcore_circuits/assembly/drc.py +683 -0
  17. quantcore_circuits/assembly/last_good.py +137 -0
  18. quantcore_circuits/assembly/netlist.py +174 -0
  19. quantcore_circuits/assembly/plan.py +605 -0
  20. quantcore_circuits/assembly/sidecar.py +270 -0
  21. quantcore_circuits/autotrack.py +605 -0
  22. quantcore_circuits/cards.py +878 -0
  23. quantcore_circuits/circuit/__init__.py +14 -0
  24. quantcore_circuits/circuit/adapters.py +305 -0
  25. quantcore_circuits/circuit/bridges.py +353 -0
  26. quantcore_circuits/circuit/consensus.py +158 -0
  27. quantcore_circuits/circuit/derive.py +28 -0
  28. quantcore_circuits/circuit/draw.py +198 -0
  29. quantcore_circuits/circuit/fill.py +828 -0
  30. quantcore_circuits/circuit/hamiltonian.py +193 -0
  31. quantcore_circuits/circuit/kinetic.py +102 -0
  32. quantcore_circuits/circuit/schema.py +139 -0
  33. quantcore_circuits/cli.py +1085 -0
  34. quantcore_circuits/codesign.py +1038 -0
  35. quantcore_circuits/data/selftest_q1_r1.json +44 -0
  36. quantcore_circuits/design/__init__.py +44 -0
  37. quantcore_circuits/design/io.py +98 -0
  38. quantcore_circuits/design/pyscript.py +395 -0
  39. quantcore_circuits/design/schema.py +398 -0
  40. quantcore_circuits/designer.py +625 -0
  41. quantcore_circuits/guiflow.py +991 -0
  42. quantcore_circuits/kqc_files.py +208 -0
  43. quantcore_circuits/layouts/__init__.py +118 -0
  44. quantcore_circuits/layouts/catalog.py +520 -0
  45. quantcore_circuits/layouts/chips/__init__.py +0 -0
  46. quantcore_circuits/layouts/chips/design_chip.py +325 -0
  47. quantcore_circuits/layouts/chips/frame.py +235 -0
  48. quantcore_circuits/layouts/junctions/__init__.py +0 -0
  49. quantcore_circuits/layouts/junctions/jj_fingers.py +99 -0
  50. quantcore_circuits/layouts/junctions/legacy_junctions.py +237 -0
  51. quantcore_circuits/layouts/junctions/sim_gap.py +48 -0
  52. quantcore_circuits/layouts/junctions/trilayer.py +541 -0
  53. quantcore_circuits/layouts/metal/__init__.py +105 -0
  54. quantcore_circuits/layouts/metal/component.py +332 -0
  55. quantcore_circuits/layouts/metal/geometry.py +462 -0
  56. quantcore_circuits/layouts/others/__init__.py +0 -0
  57. quantcore_circuits/layouts/others/amplifiers.py +1139 -0
  58. quantcore_circuits/layouts/others/bond_pad.py +119 -0
  59. quantcore_circuits/layouts/others/connector_pads.py +190 -0
  60. quantcore_circuits/layouts/others/couplers.py +21 -0
  61. quantcore_circuits/layouts/others/cpw_segment.py +131 -0
  62. quantcore_circuits/layouts/others/cpwe.py +661 -0
  63. quantcore_circuits/layouts/others/keepout.py +66 -0
  64. quantcore_circuits/layouts/others/legacy_resonators.py +645 -0
  65. quantcore_circuits/layouts/others/markers.py +201 -0
  66. quantcore_circuits/layouts/others/qpdk_cells.py +263 -0
  67. quantcore_circuits/layouts/others/shapes.py +114 -0
  68. quantcore_circuits/layouts/others/spirals.py +140 -0
  69. quantcore_circuits/layouts/others/sqdmetal_cells.py +90 -0
  70. quantcore_circuits/layouts/others/test_pads.py +461 -0
  71. quantcore_circuits/layouts/ports.py +119 -0
  72. quantcore_circuits/layouts/qubits/__init__.py +0 -0
  73. quantcore_circuits/layouts/qubits/legacy_transmon.py +124 -0
  74. quantcore_circuits/layouts/qubits/qpdk_cells.py +374 -0
  75. quantcore_circuits/layouts/qubits/sqdmetal_cells.py +376 -0
  76. quantcore_circuits/layouts/qubits/trilayer_concentric.py +65 -0
  77. quantcore_circuits/layouts/qubits/xmon.py +375 -0
  78. quantcore_circuits/layouts/registry.py +418 -0
  79. quantcore_circuits/layouts/wafers/__init__.py +0 -0
  80. quantcore_circuits/layouts/wafers/fab_export.py +454 -0
  81. quantcore_circuits/layouts/wafers/legacy_wafer.py +111 -0
  82. quantcore_circuits/layouts/wafers/wafer.py +469 -0
  83. quantcore_circuits/live/__init__.py +6 -0
  84. quantcore_circuits/live/klayout.py +225 -0
  85. quantcore_circuits/live/klive.py +61 -0
  86. quantcore_circuits/live/snapshot.py +185 -0
  87. quantcore_circuits/live/watch.py +93 -0
  88. quantcore_circuits/lom/__init__.py +15 -0
  89. quantcore_circuits/lom/builder.py +932 -0
  90. quantcore_circuits/lom/calibration.py +82 -0
  91. quantcore_circuits/lom/estimates.py +235 -0
  92. quantcore_circuits/lom/fragment.py +421 -0
  93. quantcore_circuits/lom/kqc_models.py +734 -0
  94. quantcore_circuits/lom/metal_models.py +917 -0
  95. quantcore_circuits/lom/quantcore_models.py +784 -0
  96. quantcore_circuits/lom/simulate.py +636 -0
  97. quantcore_circuits/lom/synthesize.py +189 -0
  98. quantcore_circuits/loop.py +610 -0
  99. quantcore_circuits/optimise.py +423 -0
  100. quantcore_circuits/pdk/__init__.py +451 -0
  101. quantcore_circuits/plots.py +876 -0
  102. quantcore_circuits/plugins.py +69 -0
  103. quantcore_circuits/review/__init__.py +57 -0
  104. quantcore_circuits/review/server.py +251 -0
  105. quantcore_circuits/review/static/assets/KaTeX_AMS-Regular-BQhdFMY1.woff2 +0 -0
  106. quantcore_circuits/review/static/assets/KaTeX_AMS-Regular-DMm9YOAa.woff +0 -0
  107. quantcore_circuits/review/static/assets/KaTeX_AMS-Regular-DRggAlZN.ttf +0 -0
  108. quantcore_circuits/review/static/assets/KaTeX_Caligraphic-Bold-ATXxdsX0.ttf +0 -0
  109. quantcore_circuits/review/static/assets/KaTeX_Caligraphic-Bold-BEiXGLvX.woff +0 -0
  110. quantcore_circuits/review/static/assets/KaTeX_Caligraphic-Bold-Dq_IR9rO.woff2 +0 -0
  111. quantcore_circuits/review/static/assets/KaTeX_Caligraphic-Regular-CTRA-rTL.woff +0 -0
  112. quantcore_circuits/review/static/assets/KaTeX_Caligraphic-Regular-Di6jR-x-.woff2 +0 -0
  113. quantcore_circuits/review/static/assets/KaTeX_Caligraphic-Regular-wX97UBjC.ttf +0 -0
  114. quantcore_circuits/review/static/assets/KaTeX_Fraktur-Bold-BdnERNNW.ttf +0 -0
  115. quantcore_circuits/review/static/assets/KaTeX_Fraktur-Bold-BsDP51OF.woff +0 -0
  116. quantcore_circuits/review/static/assets/KaTeX_Fraktur-Bold-CL6g_b3V.woff2 +0 -0
  117. quantcore_circuits/review/static/assets/KaTeX_Fraktur-Regular-CB_wures.ttf +0 -0
  118. quantcore_circuits/review/static/assets/KaTeX_Fraktur-Regular-CTYiF6lA.woff2 +0 -0
  119. quantcore_circuits/review/static/assets/KaTeX_Fraktur-Regular-Dxdc4cR9.woff +0 -0
  120. quantcore_circuits/review/static/assets/KaTeX_Main-Bold-Cx986IdX.woff2 +0 -0
  121. quantcore_circuits/review/static/assets/KaTeX_Main-Bold-Jm3AIy58.woff +0 -0
  122. quantcore_circuits/review/static/assets/KaTeX_Main-Bold-waoOVXN0.ttf +0 -0
  123. quantcore_circuits/review/static/assets/KaTeX_Main-BoldItalic-DxDJ3AOS.woff2 +0 -0
  124. quantcore_circuits/review/static/assets/KaTeX_Main-BoldItalic-DzxPMmG6.ttf +0 -0
  125. quantcore_circuits/review/static/assets/KaTeX_Main-BoldItalic-SpSLRI95.woff +0 -0
  126. quantcore_circuits/review/static/assets/KaTeX_Main-Italic-3WenGoN9.ttf +0 -0
  127. quantcore_circuits/review/static/assets/KaTeX_Main-Italic-BMLOBm91.woff +0 -0
  128. quantcore_circuits/review/static/assets/KaTeX_Main-Italic-NWA7e6Wa.woff2 +0 -0
  129. quantcore_circuits/review/static/assets/KaTeX_Main-Regular-B22Nviop.woff2 +0 -0
  130. quantcore_circuits/review/static/assets/KaTeX_Main-Regular-Dr94JaBh.woff +0 -0
  131. quantcore_circuits/review/static/assets/KaTeX_Main-Regular-ypZvNtVU.ttf +0 -0
  132. quantcore_circuits/review/static/assets/KaTeX_Math-BoldItalic-B3XSjfu4.ttf +0 -0
  133. quantcore_circuits/review/static/assets/KaTeX_Math-BoldItalic-CZnvNsCZ.woff2 +0 -0
  134. quantcore_circuits/review/static/assets/KaTeX_Math-BoldItalic-iY-2wyZ7.woff +0 -0
  135. quantcore_circuits/review/static/assets/KaTeX_Math-Italic-DA0__PXp.woff +0 -0
  136. quantcore_circuits/review/static/assets/KaTeX_Math-Italic-flOr_0UB.ttf +0 -0
  137. quantcore_circuits/review/static/assets/KaTeX_Math-Italic-t53AETM-.woff2 +0 -0
  138. quantcore_circuits/review/static/assets/KaTeX_SansSerif-Bold-CFMepnvq.ttf +0 -0
  139. quantcore_circuits/review/static/assets/KaTeX_SansSerif-Bold-D1sUS0GD.woff2 +0 -0
  140. quantcore_circuits/review/static/assets/KaTeX_SansSerif-Bold-DbIhKOiC.woff +0 -0
  141. quantcore_circuits/review/static/assets/KaTeX_SansSerif-Italic-C3H0VqGB.woff2 +0 -0
  142. quantcore_circuits/review/static/assets/KaTeX_SansSerif-Italic-DN2j7dab.woff +0 -0
  143. quantcore_circuits/review/static/assets/KaTeX_SansSerif-Italic-YYjJ1zSn.ttf +0 -0
  144. quantcore_circuits/review/static/assets/KaTeX_SansSerif-Regular-BNo7hRIc.ttf +0 -0
  145. quantcore_circuits/review/static/assets/KaTeX_SansSerif-Regular-CS6fqUqJ.woff +0 -0
  146. quantcore_circuits/review/static/assets/KaTeX_SansSerif-Regular-DDBCnlJ7.woff2 +0 -0
  147. quantcore_circuits/review/static/assets/KaTeX_Script-Regular-C5JkGWo-.ttf +0 -0
  148. quantcore_circuits/review/static/assets/KaTeX_Script-Regular-D3wIWfF6.woff2 +0 -0
  149. quantcore_circuits/review/static/assets/KaTeX_Script-Regular-D5yQViql.woff +0 -0
  150. quantcore_circuits/review/static/assets/KaTeX_Size1-Regular-C195tn64.woff +0 -0
  151. quantcore_circuits/review/static/assets/KaTeX_Size1-Regular-Dbsnue_I.ttf +0 -0
  152. quantcore_circuits/review/static/assets/KaTeX_Size1-Regular-mCD8mA8B.woff2 +0 -0
  153. quantcore_circuits/review/static/assets/KaTeX_Size2-Regular-B7gKUWhC.ttf +0 -0
  154. quantcore_circuits/review/static/assets/KaTeX_Size2-Regular-Dy4dx90m.woff2 +0 -0
  155. quantcore_circuits/review/static/assets/KaTeX_Size2-Regular-oD1tc_U0.woff +0 -0
  156. quantcore_circuits/review/static/assets/KaTeX_Size3-Regular-CTq5MqoE.woff +0 -0
  157. quantcore_circuits/review/static/assets/KaTeX_Size3-Regular-DgpXs0kz.ttf +0 -0
  158. quantcore_circuits/review/static/assets/KaTeX_Size4-Regular-BF-4gkZK.woff +0 -0
  159. quantcore_circuits/review/static/assets/KaTeX_Size4-Regular-DWFBv043.ttf +0 -0
  160. quantcore_circuits/review/static/assets/KaTeX_Size4-Regular-Dl5lxZxV.woff2 +0 -0
  161. quantcore_circuits/review/static/assets/KaTeX_Typewriter-Regular-C0xS9mPB.woff +0 -0
  162. quantcore_circuits/review/static/assets/KaTeX_Typewriter-Regular-CO6r4hn1.woff2 +0 -0
  163. quantcore_circuits/review/static/assets/KaTeX_Typewriter-Regular-D3Ib7_Hf.ttf +0 -0
  164. quantcore_circuits/review/static/assets/index-CDHdrFyA.css +1 -0
  165. quantcore_circuits/review/static/assets/index-CSx05Og4.js +409 -0
  166. quantcore_circuits/review/static/assets/inter-cyrillic-400-normal-HOLc17fK.woff +0 -0
  167. quantcore_circuits/review/static/assets/inter-cyrillic-400-normal-obahsSVq.woff2 +0 -0
  168. quantcore_circuits/review/static/assets/inter-cyrillic-500-normal-BasfLYem.woff2 +0 -0
  169. quantcore_circuits/review/static/assets/inter-cyrillic-500-normal-CxZf_p3X.woff +0 -0
  170. quantcore_circuits/review/static/assets/inter-cyrillic-600-normal-4D_pXhcN.woff +0 -0
  171. quantcore_circuits/review/static/assets/inter-cyrillic-600-normal-CWCymEST.woff2 +0 -0
  172. quantcore_circuits/review/static/assets/inter-cyrillic-700-normal-CjBOestx.woff2 +0 -0
  173. quantcore_circuits/review/static/assets/inter-cyrillic-700-normal-DrXBdSj3.woff +0 -0
  174. quantcore_circuits/review/static/assets/inter-cyrillic-ext-400-normal-BQZuk6qB.woff2 +0 -0
  175. quantcore_circuits/review/static/assets/inter-cyrillic-ext-400-normal-DQukG94-.woff +0 -0
  176. quantcore_circuits/review/static/assets/inter-cyrillic-ext-500-normal-B0yAr1jD.woff2 +0 -0
  177. quantcore_circuits/review/static/assets/inter-cyrillic-ext-500-normal-BmqWE9Dz.woff +0 -0
  178. quantcore_circuits/review/static/assets/inter-cyrillic-ext-600-normal-Bcila6Z-.woff +0 -0
  179. quantcore_circuits/review/static/assets/inter-cyrillic-ext-600-normal-Dfes3d0z.woff2 +0 -0
  180. quantcore_circuits/review/static/assets/inter-cyrillic-ext-700-normal-BjwYoWNd.woff2 +0 -0
  181. quantcore_circuits/review/static/assets/inter-cyrillic-ext-700-normal-LO58E6JB.woff +0 -0
  182. quantcore_circuits/review/static/assets/inter-greek-400-normal-B4URO6DV.woff2 +0 -0
  183. quantcore_circuits/review/static/assets/inter-greek-400-normal-q2sYcFCs.woff +0 -0
  184. quantcore_circuits/review/static/assets/inter-greek-500-normal-BIZE56-Y.woff2 +0 -0
  185. quantcore_circuits/review/static/assets/inter-greek-500-normal-Xzm54t5V.woff +0 -0
  186. quantcore_circuits/review/static/assets/inter-greek-600-normal-BZpKdvQh.woff +0 -0
  187. quantcore_circuits/review/static/assets/inter-greek-600-normal-plRanbMR.woff2 +0 -0
  188. quantcore_circuits/review/static/assets/inter-greek-700-normal-BUv2fZ6O.woff +0 -0
  189. quantcore_circuits/review/static/assets/inter-greek-700-normal-C3JjAnD8.woff2 +0 -0
  190. quantcore_circuits/review/static/assets/inter-greek-ext-400-normal-DGGRlc-M.woff2 +0 -0
  191. quantcore_circuits/review/static/assets/inter-greek-ext-400-normal-KugGGMne.woff +0 -0
  192. quantcore_circuits/review/static/assets/inter-greek-ext-500-normal-2j5mBUwD.woff +0 -0
  193. quantcore_circuits/review/static/assets/inter-greek-ext-500-normal-C4iEst2y.woff2 +0 -0
  194. quantcore_circuits/review/static/assets/inter-greek-ext-600-normal-B8X0CLgF.woff +0 -0
  195. quantcore_circuits/review/static/assets/inter-greek-ext-600-normal-DRtmH8MT.woff2 +0 -0
  196. quantcore_circuits/review/static/assets/inter-greek-ext-700-normal-BoQ6DsYi.woff +0 -0
  197. quantcore_circuits/review/static/assets/inter-greek-ext-700-normal-qfdV9bQt.woff2 +0 -0
  198. quantcore_circuits/review/static/assets/inter-latin-400-normal-C38fXH4l.woff2 +0 -0
  199. quantcore_circuits/review/static/assets/inter-latin-400-normal-CyCys3Eg.woff +0 -0
  200. quantcore_circuits/review/static/assets/inter-latin-500-normal-BL9OpVg8.woff +0 -0
  201. quantcore_circuits/review/static/assets/inter-latin-500-normal-Cerq10X2.woff2 +0 -0
  202. quantcore_circuits/review/static/assets/inter-latin-600-normal-CiBQ2DWP.woff +0 -0
  203. quantcore_circuits/review/static/assets/inter-latin-600-normal-LgqL8muc.woff2 +0 -0
  204. quantcore_circuits/review/static/assets/inter-latin-700-normal-BLAVimhd.woff +0 -0
  205. quantcore_circuits/review/static/assets/inter-latin-700-normal-Yt3aPRUw.woff2 +0 -0
  206. quantcore_circuits/review/static/assets/inter-latin-ext-400-normal-77YHD8bZ.woff +0 -0
  207. quantcore_circuits/review/static/assets/inter-latin-ext-400-normal-C1nco2VV.woff2 +0 -0
  208. quantcore_circuits/review/static/assets/inter-latin-ext-500-normal-BxGbmqWO.woff +0 -0
  209. quantcore_circuits/review/static/assets/inter-latin-ext-500-normal-CV4jyFjo.woff2 +0 -0
  210. quantcore_circuits/review/static/assets/inter-latin-ext-600-normal-CIVaiw4L.woff +0 -0
  211. quantcore_circuits/review/static/assets/inter-latin-ext-600-normal-D2bJ5OIk.woff2 +0 -0
  212. quantcore_circuits/review/static/assets/inter-latin-ext-700-normal-Ca8adRJv.woff2 +0 -0
  213. quantcore_circuits/review/static/assets/inter-latin-ext-700-normal-TidjK2hL.woff +0 -0
  214. quantcore_circuits/review/static/assets/inter-vietnamese-400-normal-Bbgyi5SW.woff +0 -0
  215. quantcore_circuits/review/static/assets/inter-vietnamese-400-normal-DMkecbls.woff2 +0 -0
  216. quantcore_circuits/review/static/assets/inter-vietnamese-500-normal-DOriooB6.woff2 +0 -0
  217. quantcore_circuits/review/static/assets/inter-vietnamese-500-normal-mJboJaSs.woff +0 -0
  218. quantcore_circuits/review/static/assets/inter-vietnamese-600-normal-BuLX-rYi.woff +0 -0
  219. quantcore_circuits/review/static/assets/inter-vietnamese-600-normal-Cc8MFFhd.woff2 +0 -0
  220. quantcore_circuits/review/static/assets/inter-vietnamese-700-normal-BZaoP0fm.woff +0 -0
  221. quantcore_circuits/review/static/assets/inter-vietnamese-700-normal-DlLaEgI2.woff2 +0 -0
  222. quantcore_circuits/review/static/assets/jetbrains-mono-cyrillic-400-normal-BEIGL1Tu.woff2 +0 -0
  223. quantcore_circuits/review/static/assets/jetbrains-mono-cyrillic-400-normal-ugxPyKxw.woff +0 -0
  224. quantcore_circuits/review/static/assets/jetbrains-mono-cyrillic-500-normal-DJqRU3vO.woff +0 -0
  225. quantcore_circuits/review/static/assets/jetbrains-mono-cyrillic-500-normal-DmUKJPL_.woff2 +0 -0
  226. quantcore_circuits/review/static/assets/jetbrains-mono-greek-400-normal-B9oWc5Lo.woff +0 -0
  227. quantcore_circuits/review/static/assets/jetbrains-mono-greek-400-normal-C190GLew.woff2 +0 -0
  228. quantcore_circuits/review/static/assets/jetbrains-mono-greek-500-normal-D7SFKleX.woff +0 -0
  229. quantcore_circuits/review/static/assets/jetbrains-mono-greek-500-normal-JpySY46c.woff2 +0 -0
  230. quantcore_circuits/review/static/assets/jetbrains-mono-latin-400-normal-6-qcROiO.woff +0 -0
  231. quantcore_circuits/review/static/assets/jetbrains-mono-latin-400-normal-V6pRDFza.woff2 +0 -0
  232. quantcore_circuits/review/static/assets/jetbrains-mono-latin-500-normal-BWZEU5yA.woff2 +0 -0
  233. quantcore_circuits/review/static/assets/jetbrains-mono-latin-500-normal-CJOVTJB7.woff +0 -0
  234. quantcore_circuits/review/static/assets/jetbrains-mono-latin-ext-400-normal-Bc8Ftmh3.woff2 +0 -0
  235. quantcore_circuits/review/static/assets/jetbrains-mono-latin-ext-400-normal-fXTG6kC5.woff +0 -0
  236. quantcore_circuits/review/static/assets/jetbrains-mono-latin-ext-500-normal-Cut-4mMH.woff2 +0 -0
  237. quantcore_circuits/review/static/assets/jetbrains-mono-latin-ext-500-normal-ckzbgY84.woff +0 -0
  238. quantcore_circuits/review/static/assets/jetbrains-mono-vietnamese-400-normal-CqNFfHCs.woff +0 -0
  239. quantcore_circuits/review/static/assets/jetbrains-mono-vietnamese-500-normal-DNRqzVM1.woff +0 -0
  240. quantcore_circuits/review/static/index.html +14 -0
  241. quantcore_circuits/review/static/logo-quantcore-black.png +0 -0
  242. quantcore_circuits/review/static/logo-quantcore-white.png +0 -0
  243. quantcore_circuits/review/static/sample/chip.png +0 -0
  244. quantcore_circuits/review/static/sample/chip_rev1.png +0 -0
  245. quantcore_circuits/review/static/sample/q1.png +0 -0
  246. quantcore_circuits/review/static/sample/q2.png +0 -0
  247. quantcore_circuits/review/static/sample-state.json +3747 -0
  248. quantcore_circuits/route/__init__.py +5 -0
  249. quantcore_circuits/route/router.py +694 -0
  250. quantcore_circuits/route/waveguide.py +187 -0
  251. quantcore_circuits/selftest.py +224 -0
  252. quantcore_circuits/sim_tools/__init__.py +6 -0
  253. quantcore_circuits/sim_tools/aedt_attach.py +66 -0
  254. quantcore_circuits/sim_tools/aedt_progress.py +224 -0
  255. quantcore_circuits/sim_tools/aedt_project.py +302 -0
  256. quantcore_circuits/sim_tools/aedt_scripts.py +397 -0
  257. quantcore_circuits/sim_tools/aedt_session.py +275 -0
  258. quantcore_circuits/sim_tools/ansys.py +90 -0
  259. quantcore_circuits/sim_tools/builder.py +1690 -0
  260. quantcore_circuits/sim_tools/export.py +470 -0
  261. quantcore_circuits/sim_tools/geometry_check.py +342 -0
  262. quantcore_circuits/sim_tools/hfss.py +583 -0
  263. quantcore_circuits/sim_tools/palace.py +197 -0
  264. quantcore_circuits/sim_tools/runner.py +179 -0
  265. quantcore_circuits/sim_tools/subset.py +364 -0
  266. quantcore_circuits/track.py +671 -0
  267. quantcore_circuits-0.0.1.dist-info/METADATA +204 -0
  268. quantcore_circuits-0.0.1.dist-info/RECORD +272 -0
  269. quantcore_circuits-0.0.1.dist-info/WHEEL +5 -0
  270. quantcore_circuits-0.0.1.dist-info/entry_points.txt +2 -0
  271. quantcore_circuits-0.0.1.dist-info/licenses/LICENSE +674 -0
  272. quantcore_circuits-0.0.1.dist-info/top_level.txt +1 -0
@@ -0,0 +1,734 @@
1
+ """LOM models for stock KQCircuits cells, registered from outside their classes (:func:`register_lom`).
2
+
3
+ This is the template for giving any third-party cell a lumped model: map its ports to nodes, add elements with
4
+ estimates (labelled ``calibration`` / ``analytic`` / ``rough``, see :mod:`.estimates`), and let FEM replace them
5
+ later by island name (``<inst>.island``, ``<inst>.island1``/``island2`` for floating qubits, ``<inst>.<port>`` for
6
+ coupler pads).
7
+
8
+ ============================================= ====================================================================
9
+ KQC cell lumped model
10
+ ============================================= ====================================================================
11
+ Swissmon grounded: island C (CPW-arm cross, anchored on the Xmon Q3D),
12
+ JJ/SQUID to ground; per coupler node C_g + C to ground
13
+ CircularTransmonSingleIsland grounded: disk C, JJ to ground; per arc coupler C_g + C to ground
14
+ DoublePads, DoublePadsSplines floating: island1 (coupler side) and island2, each C to ground,
15
+ C between them, JJ/SQUID between them; coupler node C_g to island1
16
+ ConcentricTransmon floating: island1 = outer ring, island2 = inner disk; arc couplers
17
+ on the ring
18
+ FingerCapacitorSquare/Taper, SmoothCapacitor, π network: C_ab between the ports, C to ground at each port
19
+ CircularCapacitor, SpiralCapacitor
20
+ QuarterWaveCpwResonator probe line ``pl`` (a, b) + coupling capacitor + λ/4 line
21
+ HangerResonator probe line ``pl`` (a, b) + resonator line (resonator_a/_b) with a
22
+ coupled-line section (HANGER) to ``pl``
23
+ SpiralResonatorPolygon resonator line between a and b
24
+ Launcher, LauncherDC 50 Ω port
25
+ WaveguideCoplanar, WaveguideComposite, a line: a wire between connected ports, a resonator when an end is
26
+ Meander, WaveguideCoplanarCurved free (Meander: always a resonator, λ/2 bus between two couplers;
27
+ Curved: r·|alpha|, ports from registry.KQC_EXTRA_PORTS)
28
+ WaveguideCoplanarTaper, AirbridgeConnection a pass-through section (``Line.through``) of the line it joins
29
+ WaveguideCoplanarSplitter one conductor (T-junction)
30
+ AirbridgeRectangular, AirbridgeMultiFace wire; nothing joined: a ground strap (ports → gnd)
31
+ junctions (Squid subclasses) JJ / SQUID from ``common`` to ground (``No Squid``: none)
32
+ Fluxline* flux control port
33
+ CapacitiveXCoupler arms p11..p41 (registry.KQC_EXTRA_PORTS), each C_ab (its finger
34
+ capacitor) to the floating centre ``c``; C to ground per arm/centre
35
+ ============================================= ====================================================================
36
+ """
37
+
38
+ from __future__ import annotations
39
+
40
+ import math
41
+ import re
42
+
43
+ from quantcore_circuits.lom import estimates as est
44
+ from quantcore_circuits.lom.calibration import estimate
45
+ from quantcore_circuits.lom.fragment import (
46
+ Element,
47
+ Fragment,
48
+ Line,
49
+ cell_params,
50
+ junction_element,
51
+ junction_kind,
52
+ port_resistor,
53
+ register_lom,
54
+ )
55
+
56
+
57
+ def _f(x, default=0.0) -> float:
58
+ try:
59
+ return float(x)
60
+ except (TypeError, ValueError):
61
+ return float(default)
62
+
63
+
64
+ def _lst(x, n=None, default=0.0) -> list[float]:
65
+ vals = [_f(v, default) for v in (x if isinstance(x, (list, tuple)) else [x])]
66
+ if n is not None and len(vals) < n:
67
+ vals += [vals[-1] if vals else default] * (n - len(vals))
68
+ return vals
69
+
70
+
71
+ def _C(frag: Fragment, name: str, a: str, b: str, value: dict, knob: str | None = None) -> None:
72
+ frag.elements.append(Element(name, "C", (a, b), value, {"param": knob} if knob else None))
73
+
74
+
75
+ def _junction(frag: Fragment, name: str, inst, params: dict, a: str, b: str) -> None:
76
+ kind = junction_kind(params.get("junction_type", "Manhattan"))
77
+ if params.get("with_squid", True) is False or kind is None:
78
+ frag.notes.append(f"{name}: no junction ({params.get('junction_type')!r}); the islands are not shunted")
79
+ return
80
+ frag.elements.append(junction_element(name, a, b, inst, kind, drawn_params=params))
81
+ lj = frag.elements[-1].value.get("Lj_nH")
82
+ if lj:
83
+ frag.knobs[f"{name}.junction.Lj_nH"] = (round(lj * 0.5, 3), round(lj * 1.5, 3))
84
+ else:
85
+ frag.notes.append(f"{name}: no junction.Lj_nH in the design; the qubit mode needs one to simulate")
86
+
87
+
88
+ def _cross_anchor(pdk) -> float:
89
+ """Q3D/analytic ratio of the Xmon island at its calibration geometry (applied to other cross islands)."""
90
+ ref, _ = estimate("Xmon", "C_island", {"cross_length": 300.0}, pdk.name)
91
+ ana = est.cross_island([150.0] * 4, 25.0, 25.0, est.substrate_eps(pdk))
92
+ return ref / ana if ref else 1.0
93
+
94
+
95
+ # ---- qubits -------------------------------------------------------------------------------------------------------
96
+ @register_lom("Swissmon")
97
+ def swissmon_lom(name: str, inst, pdk) -> Fragment:
98
+ """KQC Swissmon: grounded cross transmon (island + JJ/SQUID to ground) with up to three coupler horseshoes.
99
+
100
+ Island: the four arms as CPW sections (arm width / gap width, WNES), scaled by the Xmon Q3D/analytic ratio at the
101
+ Xmon calibration point. Couplers: C to ground = the horseshoe as a CPW of its width and ``cpl_b`` (+ the port
102
+ stub); C_g = the Xmon claw calibration at the coupler length (rough: the Swissmon coupler is screened by a
103
+ ground strip, the Xmon claw is not). Run a C-matrix of the cell (``q3d_cmatrix``) to replace them.
104
+ """
105
+ p = cell_params(inst)
106
+ eps = est.substrate_eps(pdk)
107
+ arms = _lst(p.get("arm_length", [150.0] * 4), 4, 150.0)
108
+ width = sum(_lst(p.get("arm_width", [24] * 4), 4, 24)) / 4
109
+ gap = sum(_lst(p.get("gap_width", [12] * 4), 4, 12)) / 4
110
+ anchor = _cross_anchor(pdk)
111
+ frag = Fragment(nodes={"island": {"island": f"{name}.island"}})
112
+ c_is = anchor * est.cross_island(arms, width, gap, eps)
113
+ _C(
114
+ frag,
115
+ f"C_{name}",
116
+ "island",
117
+ "gnd",
118
+ est.cap(c_is, "analytic", f"CPW-arm cross ({width:g}/{gap:g} µm) × {anchor:.3f} Xmon Q3D anchor"),
119
+ f"{name}.arm_length",
120
+ )
121
+ _junction(frag, name, inst, p, "island", "gnd")
122
+ lengths = _lst(p.get("cpl_length", [120] * 3), 3, 120)
123
+ widths = _lst(p.get("cpl_width", [24] * 3), 3, 24)
124
+ gaps = _lst(p.get("cpl_gap", [102] * 3), 3, 102)
125
+ cpl_b = _lst(p.get("cpl_b", [6] * 3), 3, 6)
126
+ for i, length in enumerate(lengths):
127
+ if length <= 0: # no horseshoe drawn: the port's CPW runs into the ground plane
128
+ frag.port_nodes[f"cplr{i}"] = "gnd"
129
+ frag.notes.append(f"{name}.cplr{i}: cpl_length 0 (no coupler), its port ends on ground")
130
+ continue
131
+ node = f"cplr{i}"
132
+ frag.nodes[node] = {"island": f"{name}.{node}"}
133
+ frag.port_nodes[node] = node
134
+ cg, _ = estimate("Xmon", "Cg", {"claw_length": length}, pdk.name)
135
+ horseshoe = 2 * length + gaps[i] + widths[i]
136
+ cc = est.cpw_line(horseshoe, widths[i], cpl_b[i], eps)
137
+ _C(
138
+ frag,
139
+ f"Cg_{name}_{node}",
140
+ "island",
141
+ node,
142
+ est.cap(cg, "rough", "Xmon claw calibration at the coupler length (screened coupler)"),
143
+ f"{name}.cpl_length",
144
+ )
145
+ _C(
146
+ frag,
147
+ f"Cc_{name}_{node}",
148
+ node,
149
+ "gnd",
150
+ est.cap(cc, "analytic", f"horseshoe as CPW {widths[i]:g}/{cpl_b[i]:g} µm × {horseshoe:g} µm"),
151
+ )
152
+ frag.port_nodes["drive"] = "control:drive"
153
+ frag.port_nodes["flux"] = "control:flux"
154
+ return frag
155
+
156
+
157
+ @register_lom("CircularTransmonSingleIsland")
158
+ def circular_single_island_lom(name: str, inst, pdk) -> Fragment:
159
+ """KQC circular single-island transmon: grounded disk + JJ to ground, arc couplers between disk and ground."""
160
+ p = cell_params(inst)
161
+ eps = est.substrate_eps(pdk)
162
+ r, gg = _f(p.get("r_island"), 120), _f(p.get("ground_gap"), 80)
163
+ frag = Fragment(nodes={"island": {"island": f"{name}.island"}})
164
+ _C(
165
+ frag,
166
+ f"C_{name}",
167
+ "island",
168
+ "gnd",
169
+ est.cap(est.disk_to_ground(r, gg, eps), "analytic", f"disk r={r:g} µm in a {gg:g} µm ground gap (bent CPW)"),
170
+ f"{name}.r_island",
171
+ )
172
+ _junction(frag, name, inst, p, "island", "gnd")
173
+ _arc_couplers(frag, name, p, eps, island="island", r_island_edge=r, island_width=r, r_ground=r + gg)
174
+ frag.port_nodes["drive"] = "control:drive"
175
+ return frag
176
+
177
+
178
+ def _arc_couplers(frag, name, p, eps, island, r_island_edge, island_width, r_ground):
179
+ """Arc couplers of the KQC circular/concentric qubits (ports ``coupler_1`` …): C_g to ``island``, C to ground."""
180
+ rc = _f(p.get("couplers_r"), 150)
181
+ widths = _lst(p.get("couplers_width", [10, 20, 30]))
182
+ amps = _lst(p.get("couplers_arc_amplitude", [35, 45, 15]), len(widths))
183
+ a_s = _lst(p.get("couplers_a", [10, 3, 4.5]), len(widths))
184
+ b_s = _lst(p.get("couplers_b", [6, 32, 20]), len(widths))
185
+ for i, w in enumerate(widths):
186
+ node = f"coupler_{i + 1}"
187
+ frag.nodes[node] = {"island": f"{name}.{node}"}
188
+ frag.port_nodes[node] = node
189
+ arc = rc * math.radians(amps[i])
190
+ s_in = max(rc - w / 2 - r_island_edge, 1.0)
191
+ s_out = max(r_ground - rc - w / 2, 1.0)
192
+ cg = est.coplanar_coupling(arc, w, island_width, s_in, eps)
193
+ cc = arc * est.cpw_c_per_um(w, s_out, eps) / 2 + est.cpw_line(s_out, a_s[i], b_s[i], eps)
194
+ _C(
195
+ frag,
196
+ f"Cg_{name}_{node}",
197
+ island,
198
+ node,
199
+ est.cap(cg, "rough", f"arc {arc:.0f} µm facing the island across {s_in:g} µm (CPS)"),
200
+ f"{name}.couplers_arc_amplitude",
201
+ )
202
+ _C(frag, f"Cc_{name}_{node}", node, "gnd", est.cap(cc, "rough", "arc outer edge (half CPW) + port lead"))
203
+
204
+
205
+ def _double_pads(name: str, inst, pdk, kind: str) -> Fragment:
206
+ p = cell_params(inst)
207
+ eps = est.substrate_eps(pdk)
208
+ gw, gh = _lst(p.get("ground_gap", [700, 700]), 2, 700)
209
+ w1, h1 = _lst(p.get("island1_extent", [500, 100]), 2, 100)
210
+ w2, h2 = _lst(p.get("island2_extent", [500, 100]), 2, 100)
211
+ s = _f(p.get("island_island_gap"), 70)
212
+ off = _f(p.get("squid_offset"), 0)
213
+ back1 = gh / 2 - (off + s / 2 + h1)
214
+ back2 = gh / 2 - (-off + s / 2 + h2)
215
+ w = (w1 + w2) / 2
216
+ c1, c12 = est.two_pads(w1, (h1 + h2) / 2, s, (gw - w1) / 2, back1, eps)
217
+ c2, _ = est.two_pads(w2, (h1 + h2) / 2, s, (gw - w2) / 2, back2, eps)
218
+ _, c12 = est.two_pads(w, (h1 + h2) / 2, s, (gw - w) / 2, (back1 + back2) / 2, eps)
219
+ frag = Fragment(
220
+ nodes={"island1": {"island": f"{name}.island1"}, "island2": {"island": f"{name}.island2"}},
221
+ notes=[] if kind == "DoublePads" else [f"{name}: spline islands estimated as their bounding rectangles"],
222
+ )
223
+ f = "coupled strips in a ground slot (Simons ch. 7) + short-edge CPW"
224
+ _C(frag, f"C_{name}_1", "island1", "gnd", est.cap(c1, "analytic", f), f"{name}.island1_extent")
225
+ _C(frag, f"C_{name}_2", "island2", "gnd", est.cap(c2, "analytic", f), f"{name}.island2_extent")
226
+ _C(frag, f"C_{name}_12", "island1", "island2", est.cap(c12, "analytic", f), f"{name}.island_island_gap")
227
+ _junction(frag, name, inst, p, "island1", "island2")
228
+ cw, ch = _lst(p.get("coupler_extent", [150, 20]), 2, 20)
229
+ c_off = _f(p.get("coupler_offset"), 20)
230
+ top = off + s / 2 + h1 + c_off + ch
231
+ cg = est.coplanar_coupling(cw, ch, h1, c_off, eps)
232
+ cc = est.pad_to_ground(cw, ch, (gw - cw) / 2, max(gh / 2 - top, 1.0), eps, open_edges=1)
233
+ frag.nodes["cplr"] = {"island": f"{name}.cplr"}
234
+ frag.port_nodes["cplr"] = "cplr"
235
+ _C(
236
+ frag,
237
+ f"Cg_{name}_cplr",
238
+ "island1",
239
+ "cplr",
240
+ est.cap(cg, "analytic", f"coupler {cw:g}×{ch:g} µm facing island1 across {c_off:g} µm (CPS)"),
241
+ f"{name}.coupler_extent",
242
+ )
243
+ _C(frag, f"Cc_{name}_cplr", "cplr", "gnd", est.cap(cc, "rough", "coupler pad in the qubit ground gap"))
244
+ frag.port_nodes["drive"] = "control:drive"
245
+ frag.notes.append(f"{name}: floating transmon; island2 ↔ coupler capacitance neglected (screened by island1)")
246
+ return frag
247
+
248
+
249
+ @register_lom("DoublePads")
250
+ def double_pads_lom(name: str, inst, pdk) -> Fragment:
251
+ """KQC DoublePads: floating transmon, two rectangular islands shunted by a SQUID/JJ, one coupler (``cplr``)."""
252
+ return _double_pads(name, inst, pdk, "DoublePads")
253
+
254
+
255
+ @register_lom("DoublePadsSplines")
256
+ def double_pads_splines_lom(name: str, inst, pdk) -> Fragment:
257
+ """KQC DoublePadsSplines: as DoublePads (spline islands approximated by their extents)."""
258
+ return _double_pads(name, inst, pdk, "DoublePadsSplines")
259
+
260
+
261
+ @register_lom("ConcentricTransmon")
262
+ def concentric_lom(name: str, inst, pdk) -> Fragment:
263
+ """KQC concentric transmon: floating; island1 = outer ring (couplers face it), island2 = inner disk."""
264
+ p = cell_params(inst)
265
+ eps = est.substrate_eps(pdk)
266
+ r_in, r_out = _f(p.get("r_inner"), 120), _f(p.get("r_outer"), 250)
267
+ w_out, gg = _f(p.get("outer_island_width"), 80), _f(p.get("ground_gap"), 80)
268
+ frag = Fragment(nodes={"island1": {"island": f"{name}.island1"}, "island2": {"island": f"{name}.island2"}})
269
+ c12 = est.concentric_rings(r_in, r_out - w_out, eps)
270
+ c1 = est.ring_to_ground(r_out, w_out, gg, eps)
271
+ _C(frag, f"C_{name}_1", "island1", "gnd", est.cap(c1, "analytic", "ring outer edge as half CPW"), f"{name}.r_outer")
272
+ _C(
273
+ frag,
274
+ f"C_{name}_12",
275
+ "island1",
276
+ "island2",
277
+ est.cap(c12, "rough", "disk–ring facing edges as coplanar strips along the mean circumference"),
278
+ f"{name}.r_inner",
279
+ )
280
+ # inner disk → ground through the ring: the disk in a ground ring at r_out + gg, times the open (non-metal)
281
+ # fraction of the radial span squared for the ring's screening (rough)
282
+ span = r_out + gg - r_in
283
+ c2 = est.disk_to_ground(r_in, span, eps) * ((span - w_out) / span) ** 2
284
+ _C(frag, f"C_{name}_2", "island2", "gnd", est.cap(c2, "rough", "disk to ground screened by the ring"))
285
+ _junction(frag, name, inst, p, "island1", "island2")
286
+ _arc_couplers(frag, name, p, eps, island="island1", r_island_edge=r_out, island_width=w_out, r_ground=r_out + gg)
287
+ frag.port_nodes["drive"] = "control:drive"
288
+ return frag
289
+
290
+
291
+ # ---- capacitors ---------------------------------------------------------------------------------------------------
292
+ def _pi_network(name, cab, ca, cb, kind_ab, formula_ab, kind_g, formula_g, knob=None) -> Fragment:
293
+ frag = Fragment(nodes={"a": {"island": f"{name}.a"}, "b": {"island": f"{name}.b"}}, port_nodes={"a": "a", "b": "b"})
294
+ _C(frag, f"C_{name}", "a", "b", est.cap(cab, kind_ab, formula_ab), knob)
295
+ _C(frag, f"C_{name}_a", "a", "gnd", est.cap(ca, kind_g, formula_g))
296
+ _C(frag, f"C_{name}_b", "b", "gnd", est.cap(cb, kind_g, formula_g))
297
+ return frag
298
+
299
+
300
+ def _fingers(p: dict, eps: float) -> tuple[float, float, float]:
301
+ n = int(_f(p.get("finger_number"), 5))
302
+ w, s = _f(p.get("finger_width"), 5), _f(p.get("finger_gap"), 3)
303
+ length, end = _f(p.get("finger_length"), 20), _f(p.get("finger_gap_end"), 3)
304
+ cab = est.interdigital(n, w, s, max(length - end, 0.0), eps) if length > 0 else 0.0
305
+ # finger tips facing the opposite bus bar (gap capacitor when finger_length = 0)
306
+ tips = (n * w + (n - 1) * s) if length <= 0 else n * w
307
+ cab += est.coplanar_coupling(tips, max(w, 10.0), max(w, 10.0), max(end, 0.5), eps)
308
+ area_w = n * w + (n - 1) * s
309
+ return cab, area_w, length + end
310
+
311
+
312
+ @register_lom("FingerCapacitorSquare")
313
+ def finger_capacitor_square_lom(name: str, inst, pdk) -> Fragment:
314
+ """KQC square finger capacitor: interdigital C_ab (Igreja–Dias) + tip gaps; C to ground across ground_padding."""
315
+ p = cell_params(inst)
316
+ eps = est.substrate_eps(pdk)
317
+ cab, area_w, area_l = _fingers(p, eps)
318
+ pad = _f(p.get("ground_padding"), 20)
319
+ cg = est.pad_to_ground(area_l / 2 + _f(p.get("finger_width"), 5), area_w, pad, pad, eps) / 2
320
+ return _pi_network(
321
+ name,
322
+ cab,
323
+ cg,
324
+ cg,
325
+ "analytic",
326
+ "interdigital (Igreja & Dias 2004) + finger-tip gaps",
327
+ "rough",
328
+ "half the finger area as a pad in the ground padding",
329
+ f"{name}.finger_number",
330
+ )
331
+
332
+
333
+ @register_lom("FingerCapacitorTaper")
334
+ def finger_capacitor_taper_lom(name: str, inst, pdk) -> Fragment:
335
+ """KQC tapered finger capacitor: interdigital C_ab; C to ground of each taper as a CPW section (gap b)."""
336
+ p = cell_params(inst)
337
+ eps = est.substrate_eps(pdk)
338
+ cab, area_w, _ = _fingers(p, eps)
339
+ taper = _f(p.get("taper_length"), 60)
340
+ a, b = _f(p.get("a"), 10), _f(p.get("b"), 6)
341
+ cg = est.cpw_line(taper, (area_w + a) / 2, b, eps)
342
+ return _pi_network(
343
+ name, cab, cg, cg, "analytic", "interdigital (Igreja & Dias 2004)", "rough", "taper as a CPW section"
344
+ )
345
+
346
+
347
+ @register_lom("SmoothCapacitor")
348
+ def smooth_capacitor_lom(name: str, inst, pdk) -> Fragment:
349
+ """KQC smooth capacitor: the meandering gap between the electrodes as coplanar strips (rough)."""
350
+ p = cell_params(inst)
351
+ eps = est.substrate_eps(pdk)
352
+ fc = _f(p.get("finger_control"), 2.1)
353
+ w, s = _f(p.get("finger_width"), 10), _f(p.get("finger_gap"), 5)
354
+ scale = w + s
355
+ f_len = max(scale * (2 * fc - 3), 0.0) + scale * math.pi # one finger: straight part + two quarter turns
356
+ gap_len = max(fc, 0.5) * f_len + 2 * w
357
+ cab = est.coplanar_coupling(gap_len, w, w, s, eps)
358
+ gg = _f(p.get("ground_gap"), 10)
359
+ cg = est.pad_to_ground(max(fc, 1.0) * scale, 2 * max(fc, 1.0) * scale, gg, gg, eps, open_edges=1) / 2
360
+ return _pi_network(
361
+ name,
362
+ cab,
363
+ cg,
364
+ cg,
365
+ "rough",
366
+ f"electrode gap ≈ {gap_len:.0f} µm of coplanar strips",
367
+ "rough",
368
+ "electrode as a pad in the ground gap",
369
+ f"{name}.finger_control",
370
+ )
371
+
372
+
373
+ @register_lom("CircularCapacitor")
374
+ def circular_capacitor_lom(name: str, inst, pdk) -> Fragment:
375
+ """KQC circular capacitor: centre disk (port a) and outer arc island (port b), C along the arc."""
376
+ p = cell_params(inst)
377
+ eps = est.substrate_eps(pdk)
378
+ r_in, r_out = _f(p.get("r_inner"), 20), _f(p.get("r_outer"), 80)
379
+ w, ang, gg = _f(p.get("outer_island_width"), 40), _f(p.get("swept_angle"), 180), _f(p.get("ground_gap"), 20)
380
+ s = max(r_out - w - r_in, 1.0)
381
+ arc = (r_in + s / 2) * math.radians(ang)
382
+ cab = est.coplanar_coupling(arc, r_in, w, s, eps)
383
+ ca = est.disk_to_ground(r_in, s, eps) * (1 - ang / 360) # the part of the disk edge not facing the arc
384
+ cb = r_out * math.radians(ang) * est.cpw_c_per_um(2 * w, gg, eps) / 2
385
+ return _pi_network(
386
+ name,
387
+ cab,
388
+ ca,
389
+ cb,
390
+ "rough",
391
+ f"disk–arc gap {s:g} µm over {arc:.0f} µm (CPS)",
392
+ "rough",
393
+ "free disk edge / arc outer edge (half CPW)",
394
+ f"{name}.swept_angle",
395
+ )
396
+
397
+
398
+ @register_lom("SpiralCapacitor")
399
+ def spiral_capacitor_lom(name: str, inst, pdk) -> Fragment:
400
+ """KQC spiral capacitor: two interleaved spiral fingers as coplanar strips along the spiral (rough)."""
401
+ p = cell_params(inst)
402
+ eps = est.substrate_eps(pdk)
403
+ w, s = _f(p.get("finger_width"), 10), _f(p.get("finger_gap"), 5)
404
+ ang = (_f(p.get("spiral_angle"), 180) + max(_f(p.get("spiral_angle2"), -1), 0.0)) / 2 or 180.0
405
+ a = _f(p.get("a"), 10)
406
+ pitch = 2 * (w + s)
407
+ r_mean = a / 2 + w + s + pitch * ang / 720 # Archimedean spiral, mean radius over the swept angle
408
+ coupled = 2 * r_mean * math.radians(ang)
409
+ cab = est.coplanar_coupling(coupled, w, w, s, eps)
410
+ gg = _f(p.get("ground_gap"), 10)
411
+ cg = r_mean * 2 * math.pi * est.cpw_c_per_um(w, gg, eps) / 4
412
+ return _pi_network(
413
+ name,
414
+ cab,
415
+ cg,
416
+ cg,
417
+ "rough",
418
+ f"spiral fingers ≈ {coupled:.0f} µm of coplanar strips",
419
+ "rough",
420
+ "outer spiral edge to ground",
421
+ f"{name}.spiral_angle",
422
+ )
423
+
424
+
425
+ @register_lom("CapacitiveXCoupler")
426
+ def x_coupler_lom(name: str, inst, pdk) -> Fragment:
427
+ """KQC capacitive X coupler: four CPW arms (ports ``p11``..``p41``, :data:`~quantcore_circuits.layouts.registry.
428
+ KQC_EXTRA_PORTS`) each coupled through its FingerCapacitorSquare (the element's finger parameters, KQC's default
429
+ finger_length, ground_padding = b) to a floating centre cross (node ``c``): a star of four C_ab, as
430
+ FingerCapacitorSquare's estimate. C to ground: each arm's CPW up to its capacitor, the centre's four inner CPW
431
+ sections, and half each capacitor's finger block per side (rough). ``remove_capacitors``: one conductor."""
432
+ from kqcircuits.elements.finger_capacitor_square import FingerCapacitorSquare # pylint: disable=C0415
433
+
434
+ from quantcore_circuits.layouts.registry import x_coupler_arms # pylint: disable=import-outside-toplevel
435
+
436
+ p = cell_params(inst)
437
+ eps = est.substrate_eps(pdk)
438
+ a, b = _f(p.get("a"), 10), _f(p.get("b"), 6)
439
+ arms = x_coupler_arms(p)
440
+ lengths = {k: sum(math.dist(u, v) for u, v in zip(pts, pts[1:])) for k, pts in arms.items()}
441
+ inner = {k: math.hypot(*pts[-1]) for k, pts in arms.items()}
442
+ if p.get("remove_capacitors"):
443
+ frag = Fragment(nodes={"c": {"island": f"{name}.c"}}, port_nodes=dict.fromkeys(arms, "c"))
444
+ total = sum(lengths.values()) + sum(inner.values())
445
+ _C(frag, f"C_{name}", "c", "gnd", est.cap(est.cpw_line(total, a, b, eps), "rough", f"{total:.0f} µm of CPW"))
446
+ frag.notes.append(f"{name}: CapacitiveXCoupler without capacitors: one conductor (a 4-way CPW junction)")
447
+ return frag
448
+ cap_p = {k: v.default for k, v in FingerCapacitorSquare.get_schema().items()}
449
+ cap_p |= {k: p[k] for k in ("finger_number", "finger_width", "finger_gap", "finger_gap_end") if k in p}
450
+ cab, area_w, area_l = _fingers(cap_p, eps)
451
+ fw = _f(cap_p.get("finger_width"), 10)
452
+ half = area_l / 2 + fw + b # capacitor centre → its port (KQC x_end, ground_padding = b)
453
+ cg = est.pad_to_ground(area_l / 2 + fw, area_w, b, b, eps) / 2 # as FingerCapacitorSquare's model, per side
454
+ f_ab = "interdigital (Igreja & Dias 2004) + finger-tip gaps, as FingerCapacitorSquare"
455
+ frag = Fragment(nodes={"c": {"island": f"{name}.c"}})
456
+ c_centre = 0.0
457
+ for arm in arms:
458
+ frag.nodes[arm] = {"island": f"{name}.{arm}"}
459
+ frag.port_nodes[arm] = arm
460
+ _C(frag, f"C_{name}_{arm}", arm, "c", est.cap(cab, "analytic", f_ab), f"{name}.finger_number")
461
+ out = max(lengths[arm] - half, 0.0)
462
+ f_g = f"{out:.0f} µm of arm CPW + half the finger block"
463
+ _C(frag, f"C_{name}_{arm}_g", arm, "gnd", est.cap(est.cpw_line(out, a, b, eps) + cg, "rough", f_g))
464
+ c_centre += est.cpw_line(max(inner[arm] - half, 0.0), a, b, eps) + cg
465
+ _C(frag, f"C_{name}_c", "c", "gnd", est.cap(c_centre, "rough", "inner arm CPW sections + half finger blocks"))
466
+ return frag
467
+
468
+
469
+ # ---- resonators ---------------------------------------------------------------------------------------------------
470
+ @register_lom("QuarterWaveCpwResonator")
471
+ def quarter_wave_lom(name: str, inst, pdk) -> Fragment:
472
+ """KQC λ/4 CPW resonator element: probe line ``pl`` (ports a, b), a coupling capacitor (``type_coupler``) and the
473
+ resonator line from the capacitor to ``resonator_b`` (galvanic termination = short)."""
474
+ p = cell_params(inst)
475
+ eps = est.substrate_eps(pdk)
476
+ kind = str(p.get("type_coupler", "smooth"))
477
+ nf, lf = _f(p.get("n_fingers"), 1), _f(p.get("l_fingers"), 1)
478
+ res_a, res_b = _f(p.get("res_a"), 10), _f(p.get("res_b"), 10)
479
+ if kind == "smooth": # KQC cap_params: SmoothCapacitor(finger_control=n_fingers, finger_width=10, finger_gap=5)
480
+ fc, w, s = nf, 10.0, 5.0
481
+ f_len = max((w + s) * (2 * fc - 3), 0.0) + (w + s) * math.pi
482
+ ck = est.coplanar_coupling(max(fc, 0.5) * f_len + 2 * w, w, w, s, eps)
483
+ src = ("rough", "SmoothCapacitor electrode gap (CPS)")
484
+ else:
485
+ cap_p = {"finger_number": int(nf), "finger_length": lf, "finger_gap_end": 5, "finger_gap": 5}
486
+ cap_p["finger_width"] = 15
487
+ if kind == "gap":
488
+ cap_p |= {"finger_length": 0, "finger_gap_end": lf, "finger_gap": 0, "finger_width": 10}
489
+ elif kind == "ground gap":
490
+ cap_p |= {"finger_length": 0, "finger_gap_end": lf, "finger_gap": 50 - lf / 2, "finger_width": 20}
491
+ ck, _, _ = _fingers(cap_p, eps)
492
+ src = ("analytic", f"{kind} finger capacitor (Igreja & Dias 2004)")
493
+ frag = Fragment(
494
+ nodes={"pl": {"island": f"{name}.pl"}, "res": {"island": f"{name}.res"}},
495
+ port_nodes={"a": "pl", "b": "pl", "resonator_b": "res"},
496
+ )
497
+ _C(frag, f"Ck_{name}", "pl", "res", est.cap(ck, *src), f"{name}.n_fingers")
498
+ # both KQC terminations end in the ground plane: "galvanic" (term 0) and "airbridge" (an AirbridgeConnection
499
+ # without its right waveguide, landing on ground)
500
+ term_end = "short"
501
+ length = _f(p.get("resonator_length"), 1000)
502
+ frag.lines.append(
503
+ Line(
504
+ name,
505
+ "res",
506
+ (None, "resonator_b"),
507
+ length,
508
+ res_a,
509
+ res_b,
510
+ ("open", term_end),
511
+ True,
512
+ knob=f"{name}.resonator_length",
513
+ )
514
+ )
515
+ frag.knobs[f"{name}.resonator_length"] = (round(length * 0.8, 1), round(length * 1.25, 1))
516
+ return frag
517
+
518
+
519
+ @register_lom("HangerResonator")
520
+ def hanger_resonator_lom(name: str, inst, pdk) -> Fragment: # noqa: ARG001
521
+ """KQC hanger resonator: probe line ``pl`` (a, b) and a resonator line (``resonator_a`` … ``resonator_b``,
522
+ unconnected KQC waveguide ends are grounded) coupled to it over ``coupling_length`` across ``ground_width``."""
523
+ p = cell_params(inst)
524
+ length = _f(p.get("resonator_length"), 1000)
525
+ frag = Fragment(
526
+ nodes={"pl": {"island": f"{name}.pl"}, "res": {"island": f"{name}.res"}},
527
+ port_nodes={"a": "pl", "b": "pl", "resonator_a": "res", "resonator_b": "res"},
528
+ )
529
+ frag.lines.append(
530
+ Line(
531
+ name,
532
+ "res",
533
+ ("resonator_a", "resonator_b"),
534
+ length,
535
+ _f(p.get("res_a"), 10),
536
+ _f(p.get("res_b"), 6),
537
+ ("short", "short"),
538
+ True,
539
+ [
540
+ {
541
+ "node": "pl",
542
+ "coupling_length_um": _f(p.get("coupling_length"), 500),
543
+ "ground_gap_um": _f(p.get("ground_width"), 10),
544
+ }
545
+ ],
546
+ knob=f"{name}.resonator_length",
547
+ )
548
+ )
549
+ frag.knobs[f"{name}.resonator_length"] = (round(length * 0.8, 1), round(length * 1.25, 1))
550
+ return frag
551
+
552
+
553
+ @register_lom("SpiralResonatorPolygon")
554
+ def spiral_resonator_lom(name: str, inst, pdk) -> Fragment: # noqa: ARG001
555
+ """KQC polygon spiral resonator: one resonator line from port a to port b (``term1``/``term2`` > 0 = open)."""
556
+ p = cell_params(inst)
557
+ length = _f(p.get("length"), 5000)
558
+ frag = Fragment(nodes={"res": {"island": f"{name}.res"}}, port_nodes={"a": "res", "b": "res"})
559
+ term = tuple("open" if _f(p.get(t), 0) > 0 else "short" for t in ("term1", "term2"))
560
+ frag.lines.append(
561
+ Line(name, "res", ("a", "b"), length, _f(p.get("a"), 10), _f(p.get("b"), 6), term, True, knob=f"{name}.length")
562
+ )
563
+ return frag
564
+
565
+
566
+ # ---- ports, waveguides, wires -------------------------------------------------------------------------------------
567
+ @register_lom("Launcher")
568
+ def launcher_lom(name: str, inst, pdk) -> Fragment: # noqa: ARG001
569
+ """KQC wire-bond launcher: a 50 Ω port on the conductor its port connects to."""
570
+ return Fragment(
571
+ nodes={"pad": {"island": f"{name}.pad"}}, elements=[port_resistor(name)], port_nodes={"port": "pad"}
572
+ )
573
+
574
+
575
+ @register_lom("LauncherDC")
576
+ def launcher_dc_lom(name: str, inst, pdk) -> Fragment: # noqa: ARG001
577
+ """KQC DC launcher: a pad to the outside world, modelled as a 50 Ω port (a DC bias source impedance)."""
578
+ return Fragment(
579
+ nodes={"pad": {"island": f"{name}.pad"}},
580
+ elements=[port_resistor(name, note="DC launcher (bias source, 50 Ω)")],
581
+ port_nodes={"port": "pad"},
582
+ )
583
+
584
+
585
+ def _path_length(points) -> float:
586
+ pts = [(float(x), float(y)) for x, y in points]
587
+ return sum(math.dist(p, q) for p, q in zip(pts, pts[1:]))
588
+
589
+
590
+ def _points(shape) -> list[tuple[float, float]]:
591
+ if hasattr(shape, "each_point"):
592
+ return [(p.x, p.y) for p in shape.each_point()]
593
+ if isinstance(shape, str):
594
+ nums = [float(v) for v in re.findall(r"-?\d+(?:\.\d+)?(?:e-?\d+)?", shape)]
595
+ return list(zip(nums[0::2], nums[1::2]))
596
+ return [tuple(p[:2]) for p in shape or []]
597
+
598
+
599
+ def _composite_points(nodes) -> list[tuple[float, float]]:
600
+ if isinstance(nodes, str):
601
+ return [(float(a), float(b)) for a, b in re.findall(r"\(\s*(-?[\d.]+)\s*,\s*(-?[\d.]+)", nodes)]
602
+ out = []
603
+ for n in nodes or []:
604
+ pos = getattr(n, "position", n)
605
+ out.append((pos.x, pos.y) if hasattr(pos, "x") else tuple(pos[:2]))
606
+ return out
607
+
608
+
609
+ def _line_fragment(name: str, p: dict, length: float, resonator: bool, knob: str | None = None) -> Fragment:
610
+ term = tuple("open" if _f(p.get(t), 0) > 0 else "short" for t in ("term1", "term2"))
611
+ frag = Fragment(nodes={"line": {"island": f"{name}.line"}}, port_nodes={"a": "line", "b": "line"})
612
+ frag.lines.append(
613
+ Line(name, "line", ("a", "b"), length, _f(p.get("a"), 10), _f(p.get("b"), 6), term, resonator, knob=knob)
614
+ )
615
+ return frag
616
+
617
+
618
+ @register_lom("WaveguideCoplanar")
619
+ def waveguide_coplanar_lom(name: str, inst, pdk) -> Fragment: # noqa: ARG001
620
+ """KQC CPW: a line along ``path`` (a wire between two connected ports, a stub resonator if an end is free)."""
621
+ p = cell_params(inst)
622
+ return _line_fragment(name, p, _path_length(_points(p.get("path"))), False)
623
+
624
+
625
+ @register_lom("WaveguideCoplanarCurved")
626
+ def waveguide_curved_lom(name: str, inst, pdk) -> Fragment: # noqa: ARG001
627
+ """KQC curved CPW segment: a line of r·|alpha| between its ends ``a`` (angle 0) and ``b`` (angle alpha; ports
628
+ from :data:`~quantcore_circuits.layouts.registry.KQC_EXTRA_PORTS`), as WaveguideCoplanar: a wire between
629
+ connected ports, a stub with a free end (no termination: the end runs into ground)."""
630
+ p = cell_params(inst)
631
+ return _line_fragment(name, p, _f(p.get("r"), 100) * abs(_f(p.get("alpha"), math.pi)), False)
632
+
633
+
634
+ @register_lom("WaveguideComposite")
635
+ def waveguide_composite_lom(name: str, inst, pdk) -> Fragment: # noqa: ARG001
636
+ """KQC composite waveguide: a line along its nodes (straight-segment length; inline elements are ignored)."""
637
+ p = cell_params(inst)
638
+ frag = _line_fragment(name, p, _path_length(_composite_points(p.get("nodes"))), False)
639
+ frag.notes.append(f"{name}: WaveguideComposite inline elements (capacitors, tapers) are not modelled")
640
+ return frag
641
+
642
+
643
+ def _through_line(name: str, length: float, a_um: float, b_um: float) -> Fragment:
644
+ """A pass-through CPW section (``Line.through``): part of the line or wire it joins (open ends: shorted, as KQC
645
+ waveguides without a termination)."""
646
+ frag = Fragment(nodes={"line": {"island": f"{name}.line"}}, port_nodes={"a": "line", "b": "line"})
647
+ frag.lines.append(Line(name, "line", ("a", "b"), length, a_um, b_um, ("short", "short"), through=True))
648
+ return frag
649
+
650
+
651
+ @register_lom("WaveguideCoplanarTaper")
652
+ def waveguide_taper_lom(name: str, inst, pdk) -> Fragment: # noqa: ARG001
653
+ """KQC CPW taper: a pass-through section of ``taper_length`` between a and b (inside a resonator it extends
654
+ the line; the width step is not modelled: mean a/b)."""
655
+ p = cell_params(inst)
656
+ a, b = _f(p.get("a"), 10), _f(p.get("b"), 6)
657
+ a2, b2 = _f(p.get("a2"), -1), _f(p.get("b2"), -1)
658
+ a2, b2 = a if a2 < 0 else a2, b if b2 < 0 else b2 # KQC eval_a2 / eval_b2
659
+ return _through_line(name, _f(p.get("taper_length"), 10 * math.pi), (a + a2) / 2, (b + b2) / 2)
660
+
661
+
662
+ @register_lom("Meander")
663
+ def meander_lom(name: str, inst, pdk) -> Fragment: # noqa: ARG001
664
+ """KQC meander: a resonator line of ``length`` (λ/2 bus between two couplers, λ/4 with one grounded end)."""
665
+ p = cell_params(inst)
666
+ length = _f(p.get("length"), 3000)
667
+ frag = _line_fragment(name, p, length, True, knob=f"{name}.length")
668
+ frag.knobs[f"{name}.length"] = (round(length * 0.8, 1), round(length * 1.25, 1))
669
+ return frag
670
+
671
+
672
+ @register_lom("WaveguideCoplanarSplitter")
673
+ def splitter_lom(name: str, inst, pdk) -> Fragment: # noqa: ARG001
674
+ """KQC CPW splitter (T / multiway junction): all ports are one conductor."""
675
+ p = cell_params(inst)
676
+ n = len(p.get("lengths") or [11, 11, 11])
677
+ ports = list(p.get("port_names") or "abcdefghij")[:n]
678
+ return Fragment(nodes={"t": {"island": f"{name}.t"}}, port_nodes={str(q): "t" for q in ports})
679
+
680
+
681
+ def _wire(name: str, ports=("a", "b")) -> Fragment:
682
+ return Fragment(nodes={"w": {"island": f"{name}.w"}}, port_nodes={q: "w" for q in ports})
683
+
684
+
685
+ @register_lom("AirbridgeConnection")
686
+ def airbridge_connection_lom(name: str, inst, pdk) -> Fragment: # noqa: ARG001
687
+ """KQC airbridge connection (CPW → bridge → CPW): a pass-through section (length: the builder takes the port
688
+ distance)."""
689
+ p = cell_params(inst)
690
+ return _through_line(name, 0.0, _f(p.get("a"), 10), _f(p.get("b"), 6))
691
+
692
+
693
+ @register_lom("Airbridge")
694
+ def airbridge_lom(name: str, inst, pdk) -> Fragment: # noqa: ARG001
695
+ """KQC airbridges (rectangular, multi-face): a wire between their two pads; with no port joined, a ground strap
696
+ (``Fragment.straps``: both pads on the ground plane, ports → gnd)."""
697
+ frag = _wire(name)
698
+ frag.straps.append("w")
699
+ return frag
700
+
701
+
702
+ # ---- junctions, flux lines ----------------------------------------------------------------------------------------
703
+ def _spaced(cls_name: str) -> str:
704
+ return re.sub(r"(?<!^)(?=[A-Z])", " ", cls_name).lower()
705
+
706
+
707
+ @register_lom("Junction")
708
+ def junction_lom(name: str, inst, pdk) -> Fragment: # noqa: ARG001
709
+ """A stand-alone junction cell (KQC/Quantcore ``Squid`` subclasses): JJ/SQUID from ``common`` to ground.
710
+
711
+ The junction's lower electrode is the ground plane edge (its ``origin_squid``); ``Sim`` junctions expose the
712
+ lumped-port ends ``squid_a`` (island side) and ``squid_b`` (ground side). ``NoSquid`` has no junction.
713
+ """
714
+ from quantcore_circuits.layouts.registry import resolve_cell # pylint: disable=import-outside-toplevel
715
+
716
+ cls_name = resolve_cell(inst.cell).__name__
717
+ kind = junction_kind(_spaced(cls_name))
718
+ frag = Fragment(nodes={"j": {"island": f"{name}.island"}}, port_nodes={"common": "j"})
719
+ if cls_name == "Sim": # the simulation junction's lumped-port ends
720
+ frag.port_nodes |= {"squid_a": "j", "squid_b": "gnd"}
721
+ if kind is None:
722
+ frag.notes.append(f"{name}: {cls_name} has no junction")
723
+ return frag
724
+ from kqcircuits.util.library_helper import to_library_name # pylint: disable=import-outside-toplevel
725
+
726
+ drawn = {"junction_type": to_library_name(cls_name), "junction_params": dict(inst.params or {})}
727
+ frag.elements.append(junction_element(name, "j", "gnd", inst, kind, drawn_params=drawn))
728
+ return frag
729
+
730
+
731
+ @register_lom("Fluxline")
732
+ def fluxline_lom(name: str, inst, pdk) -> Fragment: # noqa: ARG001
733
+ """KQC flux line: its ``flux`` port carries a flux-bias control (no circuit element)."""
734
+ return Fragment(port_nodes={"flux": "control:flux"}, notes=[f"{name}: flux line (control only)"])