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,917 @@
1
+ """LOM models for Quantum Metal components placed through the ``"metal:<Class>"`` wrapper (:mod:`quantcore_circuits.
2
+ layouts.metal`): instance ``params`` are Metal options, ports are Metal pin names, junction ends ``squid_a/_b``.
3
+
4
+ ========================================= ===========================================================================
5
+ Metal class lumped model (local nodes → FEM labels ``<inst>.<node>``)
6
+ ========================================= ===========================================================================
7
+ TransmonPocket, …CL, …6, …Teeth floating: ``island1`` = pad_top, ``island2`` = pad_bot, JJ between; per
8
+ connection pad a coupler node (C_g to its pad, a small C to the far pad,
9
+ C to ground); CL: ``Charge_Line`` drive port
10
+ TransmonCross, TransmonCrossFL, grounded cross / star: island + JJ (FL: SQUID + ``flux_line`` control);
11
+ TransmonStar per claw a coupler node
12
+ TransmonConcentric, …Type2 floating: ``island1`` = outer ring, ``island2`` = inner disk, SQUID
13
+ (two JJs) between; readout coupler node; flux-bias pins → control
14
+ TransmonInterdigitated floating: island1 = top pad, island2 = bottom pad; readout (bottom),
15
+ bus1/bus2 (top)
16
+ StarQubit grounded centre island + JJ; 4 coupler pads + readout pad
17
+ TunableCoupler01 grounded coupler island + SQUID; ``Control`` claw node; ``Flux`` control
18
+ TunableCoupler02 floating pads + SQUID; bus line (pin1–pin2) coupled to both; ``fbl``
19
+ CapNInterdigital, Cap3Interdigital, π network between the two pins
20
+ CapFingerInFrame
21
+ CapNInterdigitalTee primary line (prime_start = prime_end) + IDC to ``second_end``
22
+ CoupledLineTee primary line + a coupled line (component line with a HANGER section to the
23
+ primary): continued by the route on ``second_end`` it becomes the
24
+ resonator (λ/4 for a shorted coupler end, λ/2 for an open one)
25
+ LineTee one conductor (T-junction)
26
+ ResonatorCoilRect, ReadoutResFC, a resonator line from the pin (the coil / the meander)
27
+ ResonatorLumped
28
+ LaunchpadWirebond(+Driven) 50 Ω port on ``tie`` (Driven: ``in`` is the pad itself)
29
+ LaunchpadWirebondCoupled 50 Ω pad + coupling C to ``tie``
30
+ OpenToGround / ShortToGround zero-length line ending open / shorted: a route into it is a λ/2 / λ/4
31
+ Airbridge wire
32
+ PolylineCPW a line (wire, or a stub resonator with a free end)
33
+ SNAIL JJ between a and b (linearised SNAIL inductance)
34
+ jj_dolan, jj_manhattan, SQUID_LOOP, no pins: a junction drawn into other metal; no circuit element (declare
35
+ BridgeFreeJunction it as part of the qubit)
36
+ NSquareSpiral (sample shape) a spiral trace from ``spiralPin`` to an open inner end (line)
37
+ ========================================= ===========================================================================
38
+
39
+ Metal-only cells (``METAL_ONLY``: TransmonConcentricType2, TunableCoupler02, ResonatorLumped, NSquareSpiral) draw no
40
+ pocket: the models above hold on a pocket (a subtracting Metal shape such as metal:Rectangle ``subtract: true``
41
+ covering the cell's origin); without one the builder grounds their ports and adds no elements (a note says so).
42
+
43
+ Estimates: TransmonPocket is the coupled-pad analytic model anchored on the Metal tutorial Q3D matrix of the default
44
+ pocket (``docs/tut/4-Analysis/Q1_TwoTransmon_CapMatrix.txt``); cross / star islands on the Xmon Q3D (CPW-arm
45
+ model); claws through a ground strip with the Xmon claw's screening. The rest is analytic or rough (see
46
+ :mod:`.estimates`). Junction Lj comes from the design's ``junction`` (else Metal's ``hfss_inductance`` option).
47
+ """
48
+
49
+ from __future__ import annotations
50
+
51
+ import json
52
+ import math
53
+ from functools import cache
54
+
55
+ from quantcore_circuits.lom import estimates as est
56
+ from quantcore_circuits.lom.calibration import estimate
57
+ from quantcore_circuits.lom.fragment import (
58
+ METAL_PREFIX,
59
+ EffectiveJunction,
60
+ Element,
61
+ Fragment,
62
+ Line,
63
+ effective_junction,
64
+ junction_kind,
65
+ junction_value,
66
+ metal_class,
67
+ port_resistor,
68
+ register_lom,
69
+ )
70
+
71
+ # Metal tutorial Q3D of the default TransmonPocket with two default connection pads (fF; any substrate: only the
72
+ # ratios to the analytic model at the same geometry are used)
73
+ POCKET_Q3D = {"C12": 30.61, "C_pad": 39.83, "Cg": 19.16, "Cg_far": 2.01, "Cc": 37.29}
74
+ POCKET_REF = "Metal tutorial Q3D, TransmonPocket defaults (Q1_TwoTransmon_CapMatrix)"
75
+
76
+
77
+ # ---- options --------------------------------------------------------------------------------------------------
78
+ class MetalOptions:
79
+ """A Metal component's options (defaults + the instance's), with µm / number accessors."""
80
+
81
+ def __init__(self, cls_name: str, params: dict):
82
+ from quantcore_circuits.layouts.metal import normalise_options, template_options # pylint: disable=C0415
83
+
84
+ tmpl = template_options(cls_name)
85
+ user = {k: v for k, v in params.items() if k in tmpl and not k.startswith("_")}
86
+ self.cls = cls_name
87
+ self.raw = {**tmpl, **normalise_options(cls_name, user)}
88
+ dflt = tmpl.get("_default_connection_pads") or {}
89
+ self.pads = {str(n): {**dflt, **(spec or {})} for n, spec in (self.raw.get("connection_pads") or {}).items()}
90
+
91
+ def um(self, key: str, default: float = 0.0, src: dict | None = None) -> float:
92
+ from quantcore_circuits.layouts.metal import parse_um # pylint: disable=import-outside-toplevel
93
+
94
+ v = (src if src is not None else self.raw).get(key)
95
+ if v is None or v == "":
96
+ return default
97
+ try:
98
+ return float(parse_um(v))
99
+ except Exception: # noqa: BLE001 (Metal's parser raises many types)
100
+ return default
101
+
102
+ def num(self, key: str, default: float = 0.0, src: dict | None = None) -> float:
103
+ v = (src if src is not None else self.raw).get(key)
104
+ try:
105
+ return float(str(v).strip())
106
+ except (TypeError, ValueError):
107
+ return default
108
+
109
+
110
+ def metal_mro(cls_name: str) -> list[str]:
111
+ """Metal class names of ``cls_name`` and its bases (for subclasses of qlibrary components)."""
112
+ from quantcore_circuits.layouts.metal.geometry import metal_class as _metal_cls # pylint: disable=C0415
113
+
114
+ try:
115
+ return [k.__name__ for k in _metal_cls(cls_name).__mro__]
116
+ except Exception: # noqa: BLE001
117
+ return [cls_name]
118
+
119
+
120
+ def _cls(inst) -> str:
121
+ from quantcore_circuits.layouts.metal import canonical_class_name # pylint: disable=import-outside-toplevel
122
+
123
+ return canonical_class_name(metal_class(inst.cell) or inst.cell)
124
+
125
+
126
+ def _opts(inst, cls_name: str | None = None) -> MetalOptions:
127
+ from quantcore_circuits.layouts.metal import flat_options # pylint: disable=import-outside-toplevel
128
+
129
+ return MetalOptions(cls_name or _cls(inst), flat_options(inst.params))
130
+
131
+
132
+ def _C(frag: Fragment, name: str, a: str, b: str, value: dict, knob: str | None = None) -> None:
133
+ frag.elements.append(Element(name, "C", (a, b), value, {"param": knob} if knob else None))
134
+
135
+
136
+ def _junction(
137
+ frag: Fragment, name: str, inst, o: MetalOptions, a: str, b: str, kind: str = "JJ", squid_ends: dict | None = None
138
+ ) -> None:
139
+ # the wrapper's junction_type (components-pdk): "No Squid" draws none; a trilayer cell sets JJ / SQUID and, with
140
+ # no design value, the drawn junction's L_J / C_J on the PDK rule (effective_junction)
141
+ jtype = str((inst.params or {}).get("junction_type") or "Metal")
142
+ if jtype == "No Squid":
143
+ frag.notes.append(f"{name}: junction_type 'No Squid' → no junction element")
144
+ return
145
+ drawn = {}
146
+ if jtype not in ("Metal", "Sim"):
147
+ from quantcore_circuits.layouts.metal.component import _json_dict # pylint: disable=C0415
148
+
149
+ kind = junction_kind(jtype) or kind
150
+ drawn = {"junction_type": jtype, "junction_params": _json_dict(inst.params.get("junction_params") or "{}")}
151
+ ej = effective_junction(inst, drawn, kind=kind)
152
+ lj, cj, source = ej.lj0_nH, ej.cj_fF, ej.source or "design"
153
+ if lj is None:
154
+ v = o.raw.get("hfss_inductance", o.raw.get("q3d_inductance"))
155
+ try:
156
+ lj = float(str(v).lower().replace("nh", "")) if isinstance(v, str) else float(v) * 1e9
157
+ source = "metal option hfss_inductance"
158
+ except (TypeError, ValueError):
159
+ lj = None
160
+ value = junction_value(EffectiveJunction(lj, cj, ej.flux_phi0, ej.asym, kind, source))
161
+ frag.elements.append(Element(f"J_{name}", kind, (a, b), value, {"param": f"{name}.junction.Lj_nH"}))
162
+ # junction ends (wrapper refpoints): squid_a is the island side of grounded qubits; for the two-pad pockets
163
+ # squid_a lies on pad_bot (island2) and squid_b on pad_top (island1)
164
+ ends = {"squid_a": a, "squid_b": b} if b == "gnd" else squid_ends or {"squid_a": a, "squid_b": b}
165
+ frag.port_nodes.update(ends)
166
+ if lj:
167
+ frag.knobs[f"{name}.junction.Lj_nH"] = (round(lj * 0.5, 3), round(lj * 1.5, 3))
168
+
169
+
170
+ # ---- anchors ----------------------------------------------------------------------------------------------------
171
+ def _pocket_parts(o: dict, pads: dict, eps: float) -> dict:
172
+ """Analytic pocket model: pads (two_pads) + connection pads (CPS C_g, pad in the pocket + CPW lead to ground)."""
173
+ pw, ph, pg, w_pk, h_pk, cpw = (o[k] for k in ("pad_width", "pad_height", "pad_gap", "pw", "ph", "cpw"))
174
+ c_pad, c12 = est.two_pads(pw, ph, pg, (w_pk - pw) / 2, h_pk / 2 - pg / 2 - ph, eps)
175
+ out = {"C_pad": c_pad, "C12": c12, "pads": {}}
176
+ for name, cp in pads.items():
177
+ cw, chh, cgap = cp["pad_width"], cp["pad_height"], cp["pad_gap"]
178
+ cg = est.coplanar_coupling(cw, chh, ph, cgap, eps)
179
+ top = max(h_pk / 2 - (pg / 2 + ph + cgap + chh), 1.0)
180
+ side = max((w_pk - pw) / 2, 1.0)
181
+ inside = math.hypot(max(side - cp["pocket_extent"] - cp["pad_cpw_extent"], 0.0), cp["pocket_rise"])
182
+ cc = est.pad_to_ground(cw, chh, side, top, eps, open_edges=1)
183
+ cc += est.cpw_line(inside + cp["pad_cpw_extent"], cpw[0], max(top / 2, cpw[1]), eps)
184
+ cc += est.cpw_line(cp["cpw_extend"], cpw[0], cpw[1], eps)
185
+ out["pads"][name] = {"Cg": cg, "Cc": cc}
186
+ return out
187
+
188
+
189
+ _POCKET_DEFAULT = {"pad_width": 455.0, "pad_height": 90.0, "pad_gap": 30.0, "pw": 650.0, "ph": 650.0, "cpw": (10, 6)}
190
+ _POCKET_PAD_DEFAULT = {
191
+ "pad_width": 125.0,
192
+ "pad_height": 30.0,
193
+ "pad_gap": 15.0,
194
+ "pocket_extent": 5.0,
195
+ "pad_cpw_extent": 25.0,
196
+ "pocket_rise": 65.0,
197
+ "cpw_extend": 100.0,
198
+ }
199
+
200
+
201
+ def _log_distance(geo: dict, ref: dict, keys) -> float:
202
+ """Σ |ln(x / x_ref)| over ``keys``: how far a geometry is from a calibration point (0 = the same)."""
203
+ return sum(abs(math.log(max(float(geo[k]), 1e-9) / float(ref[k]))) for k in keys if ref.get(k))
204
+
205
+
206
+ @cache
207
+ def _pocket_anchor() -> dict:
208
+ ref = _pocket_parts(_POCKET_DEFAULT, {"p": _POCKET_PAD_DEFAULT}, 11.45)
209
+ return {
210
+ "C12": POCKET_Q3D["C12"] / ref["C12"],
211
+ "C_pad": POCKET_Q3D["C_pad"] / ref["C_pad"],
212
+ "Cg": POCKET_Q3D["Cg"] / ref["pads"]["p"]["Cg"],
213
+ "Cc": POCKET_Q3D["Cc"] / ref["pads"]["p"]["Cc"],
214
+ "far": POCKET_Q3D["Cg_far"] / POCKET_Q3D["Cg"],
215
+ }
216
+
217
+
218
+ @cache
219
+ def _cross_anchor(pdk_name: str) -> float:
220
+ ref, _ = estimate("Xmon", "C_island", {"cross_length": 300.0}, pdk_name)
221
+ ana = est.cross_island([150.0] * 4, 25.0, 25.0, est.substrate_eps(pdk_name))
222
+ return ref / ana if ref else 1.0
223
+
224
+
225
+ @cache
226
+ def _claw_screening(pdk_name: str) -> float:
227
+ """Xmon claw Q3D C_g over the unscreened CPS model of the same claw (ground sliver between claw and arm)."""
228
+ cg, _ = estimate("Xmon", "Cg", {"claw_length": 100.0}, pdk_name)
229
+ eps = est.substrate_eps(pdk_name)
230
+ facing = 25.0 + 2 * 25.0 + 2 * 100.0 # arm tip (arm + gaps) + both fingers
231
+ return cg / est.coplanar_coupling(facing, 25.0, 25.0, 25.0 + 2.0 + 2.0, eps) if cg else 0.2
232
+
233
+
234
+ # ---- qubits -----------------------------------------------------------------------------------------------------
235
+ def _pocket_lom(name: str, inst, pdk, drive_pin: str | None = None) -> Fragment:
236
+ o = _opts(inst)
237
+ eps = est.substrate_eps(pdk)
238
+ geo = {
239
+ "pad_width": o.um("pad_width", 455),
240
+ "pad_height": o.um("pad_height", 90),
241
+ "pad_gap": o.um("pad_gap", 30),
242
+ "pw": o.um("pocket_width", 650),
243
+ "ph": o.um("pocket_height", 650),
244
+ }
245
+ pads, sides = {}, {}
246
+ for pname, cp in o.pads.items():
247
+ pads[pname] = {k: o.um(k, _POCKET_PAD_DEFAULT[k], cp) for k in _POCKET_PAD_DEFAULT}
248
+ sides[pname] = "island1" if o.num("loc_H", 1, cp) >= 0 else "island2"
249
+ geo["cpw"] = (o.um("cpw_width", 10, cp), o.um("cpw_gap", 6, cp))
250
+ geo.setdefault("cpw", (10.0, 6.0))
251
+ parts = _pocket_parts(geo, pads, eps)
252
+ k = _pocket_anchor()
253
+ # the anchor is exact at the calibration geometry; its weight decays with the log-distance from it
254
+ d_q = _log_distance(geo, _POCKET_DEFAULT, ("pad_width", "pad_height", "pad_gap", "pw", "ph"))
255
+ w_q = math.exp(-d_q)
256
+ frag = Fragment(nodes={"island1": {"island": f"{name}.island1"}, "island2": {"island": f"{name}.island2"}})
257
+ f = f"coupled pads in a pocket (analytic) × Q3D anchor^{w_q:.2f} ({POCKET_REF})"
258
+ c_pad = k["C_pad"] ** w_q * parts["C_pad"]
259
+ _C(frag, f"C_{name}_1", "island1", "gnd", est.cap(c_pad, "analytic", f), f"{name}.pad_width")
260
+ _C(frag, f"C_{name}_2", "island2", "gnd", est.cap(c_pad, "analytic", f), f"{name}.pad_width")
261
+ c12 = k["C12"] ** w_q * parts["C12"]
262
+ _C(frag, f"C_{name}_12", "island1", "island2", est.cap(c12, "analytic", f), f"{name}.pad_gap")
263
+ _junction(frag, name, inst, o, "island1", "island2", squid_ends={"squid_a": "island2", "squid_b": "island1"})
264
+ for pname, part in parts["pads"].items():
265
+ near = sides[pname]
266
+ far = "island2" if near == "island1" else "island1"
267
+ frag.nodes[pname] = {"island": f"{name}.{pname}"}
268
+ frag.port_nodes[pname] = pname
269
+ w_p = math.exp(-(d_q + _log_distance(pads[pname], _POCKET_PAD_DEFAULT, ("pad_width", "pad_height", "pad_gap"))))
270
+ cg = k["Cg"] ** w_p * part["Cg"]
271
+ fc = f"connection pad facing its qubit pad (CPS) × Q3D anchor^{w_p:.2f} ({POCKET_REF})"
272
+ _C(frag, f"Cg_{name}_{pname}", near, pname, est.cap(cg, "analytic", fc), f"{name}.connection_pads.{pname}")
273
+ _C(frag, f"Cf_{name}_{pname}", far, pname, est.cap(k["far"] * cg, "rough", "far-pad share of C_g (Q3D ratio)"))
274
+ fcc = f"connection pad + lead to ground × Q3D anchor^{w_p:.2f} ({POCKET_REF})"
275
+ _C(frag, f"Cc_{name}_{pname}", pname, "gnd", est.cap(k["Cc"] ** w_p * part["Cc"], "analytic", fcc))
276
+ if drive_pin:
277
+ frag.port_nodes[drive_pin] = "control:drive"
278
+ return frag
279
+
280
+
281
+ @register_lom(f"{METAL_PREFIX}TransmonPocket")
282
+ def transmon_pocket_lom(name, inst, pdk):
283
+ """Metal TransmonPocket: floating two-pad transmon with connection pads (see module table)."""
284
+ return _pocket_lom(name, inst, pdk)
285
+
286
+
287
+ @register_lom(f"{METAL_PREFIX}TransmonPocketCL")
288
+ def transmon_pocket_cl_lom(name, inst, pdk):
289
+ """Metal TransmonPocketCL: TransmonPocket + charge line (``Charge_Line`` → drive control)."""
290
+ return _pocket_lom(name, inst, pdk, drive_pin="Charge_Line")
291
+
292
+
293
+ @register_lom(f"{METAL_PREFIX}TransmonPocket6")
294
+ def transmon_pocket6_lom(name, inst, pdk):
295
+ """Metal TransmonPocket6: TransmonPocket with up to six connection pads (loc_H picks the pad)."""
296
+ return _pocket_lom(name, inst, pdk)
297
+
298
+
299
+ @register_lom(f"{METAL_PREFIX}TransmonPocketTeeth")
300
+ def transmon_pocket_teeth_lom(name, inst, pdk):
301
+ """Metal TransmonPocketTeeth: TransmonPocket with tooth-shaped connection pads (estimated as rectangles)."""
302
+ frag = _pocket_lom(name, inst, pdk)
303
+ frag.notes.append(f"{name}: tooth connection pads estimated as rectangles (rough)")
304
+ return frag
305
+
306
+
307
+ def _claws(frag, name, o: MetalOptions, eps, island: str, arm_w: float, arm_gap: float, pdk) -> None:
308
+ screen = _claw_screening(pdk.name)
309
+ for pname, cp in o.pads.items():
310
+ c_g, c_l, c_w = o.um("claw_gap", 6, cp), o.um("claw_length", 30, cp), o.um("claw_width", 10, cp)
311
+ g_s = o.um("ground_spacing", 5, cp)
312
+ c_c_l = o.um("claw_cpw_length", 40, cp)
313
+ frag.nodes[pname] = {"island": f"{name}.{pname}"}
314
+ frag.port_nodes[pname] = pname
315
+ s = arm_gap + g_s + c_g
316
+ if int(o.num("connector_type", 0, cp)) == 0:
317
+ height = 2 * c_g + 2 * c_w + 2 * g_s + 2 * arm_gap + arm_w
318
+ cg = est.coplanar_coupling(arm_w + 2 * arm_gap + 2 * c_l, c_w, arm_w, s, eps, screen)
319
+ cc = est.cpw_line(height + 2 * c_l + c_c_l, c_w, c_g, eps)
320
+ fg = f"claw around the arm tip (CPS) × {screen:.2f} ground-strip screening (Xmon claw Q3D)"
321
+ else:
322
+ cg = est.coplanar_coupling(c_w, c_w, arm_w, s, eps, screen)
323
+ cc = est.cpw_line(4 * c_w + c_c_l, c_w, c_g, eps)
324
+ fg = "gap connector facing the arm tip (CPS, screened)"
325
+ _C(frag, f"Cg_{name}_{pname}", island, pname, est.cap(cg, "rough", fg), f"{name}.connection_pads.{pname}")
326
+ _C(frag, f"Cc_{name}_{pname}", pname, "gnd", est.cap(cc, "analytic", "claw as CPW (claw width/gap) + stub"))
327
+
328
+
329
+ def _cross_lom(name, inst, pdk, flux_pin: str | None = None) -> Fragment:
330
+ o = _opts(inst)
331
+ eps = est.substrate_eps(pdk)
332
+ length, width, gap = o.um("cross_length", 200), o.um("cross_width", 20), o.um("cross_gap", 20)
333
+ anchor = _cross_anchor(pdk.name)
334
+ frag = Fragment(nodes={"island": {"island": f"{name}.island"}})
335
+ c = anchor * est.cross_island([length] * 4, width, gap, eps)
336
+ f = f"CPW-arm cross ({width:g}/{gap:g} µm) × {anchor:.3f} Xmon Q3D anchor"
337
+ _C(frag, f"C_{name}", "island", "gnd", est.cap(c, "analytic", f), f"{name}.cross_length")
338
+ _junction(frag, name, inst, o, "island", "gnd", "SQUID" if flux_pin else "JJ")
339
+ _claws(frag, name, o, eps, "island", width, gap, pdk)
340
+ if flux_pin:
341
+ frag.port_nodes[flux_pin] = "control:flux"
342
+ return frag
343
+
344
+
345
+ @register_lom(f"{METAL_PREFIX}TransmonCross")
346
+ def transmon_cross_lom(name, inst, pdk):
347
+ """Metal TransmonCross (Xmon-type): grounded cross, JJ on the south arm, claw connection pads."""
348
+ return _cross_lom(name, inst, pdk)
349
+
350
+
351
+ @register_lom(f"{METAL_PREFIX}TransmonCrossFL")
352
+ def transmon_cross_fl_lom(name, inst, pdk):
353
+ """Metal TransmonCrossFL: TransmonCross with a flux line (``flux_line`` control, junction as SQUID)."""
354
+ return _cross_lom(name, inst, pdk, flux_pin="flux_line")
355
+
356
+
357
+ @register_lom(f"{METAL_PREFIX}TransmonStar")
358
+ def transmon_star_lom(name, inst, pdk):
359
+ """Metal TransmonStar: grounded star (N arms as CPW sections), JJ on one arm, claw connection pads."""
360
+ o = _opts(inst)
361
+ eps = est.substrate_eps(pdk)
362
+ n = int(o.num("num_points", 6))
363
+ length, width, gap = o.um("arm_length", 150), o.um("arm_width", 20), o.um("arm_gap", 20)
364
+ anchor = _cross_anchor(pdk.name)
365
+ frag = Fragment(nodes={"island": {"island": f"{name}.island"}})
366
+ c = anchor * est.cross_island([length] * n, width, gap, eps)
367
+ f = f"{n} CPW arms ({width:g}/{gap:g} µm) × {anchor:.3f} Xmon Q3D anchor"
368
+ _C(frag, f"C_{name}", "island", "gnd", est.cap(c, "analytic", f), f"{name}.arm_length")
369
+ _junction(frag, name, inst, o, "island", "gnd")
370
+ _claws(frag, name, o, eps, "island", width, gap, pdk)
371
+ return frag
372
+
373
+
374
+ @register_lom(f"{METAL_PREFIX}TransmonConcentric")
375
+ def transmon_concentric_lom(name, inst, pdk):
376
+ """Metal TransmonConcentric: floating disk (rad_i) + ring (rad_i + gap … rad_o), two JJs = SQUID between;
377
+ ``pin1`` readout line over the ring (coupler node), ``pin2``/``pin3`` the flux-bias loop (controls)."""
378
+ o = _opts(inst)
379
+ eps = est.substrate_eps(pdk)
380
+ r_i, r_o, gap = o.um("rad_i", 115), o.um("rad_o", 170), o.um("gap", 35)
381
+ w_ring = max(r_o - r_i - gap, 1.0)
382
+ clear = max(min(o.um("pocket_h", 1000), o.um("pocket_w", 1500)) / 2 - r_o, 1.0)
383
+ frag = Fragment(nodes={"island1": {"island": f"{name}.island1"}, "island2": {"island": f"{name}.island2"}})
384
+ _C(frag, f"C_{name}_1", "island1", "gnd", est.cap(est.ring_to_ground(r_o, w_ring, clear, eps), "rough", "ring"))
385
+ c2 = est.disk_to_ground(r_i, clear + w_ring + gap, eps) * (gap / (gap + w_ring)) ** 2
386
+ _C(frag, f"C_{name}_2", "island2", "gnd", est.cap(c2, "rough", "disk to ground, screened by the ring"))
387
+ c12 = est.concentric_rings(r_i, r_i + gap, eps)
388
+ _C(frag, f"C_{name}_12", "island1", "island2", est.cap(c12, "rough", "disk–ring facing edges (CPS)"), f"{name}.gap")
389
+ _junction(frag, name, inst, o, "island1", "island2", "SQUID")
390
+ cpw = o.um("cpw_width", 10)
391
+ s = o.um("res_s", 100)
392
+ frag.nodes["pin1"] = {"island": f"{name}.pin1"}
393
+ frag.port_nodes["pin1"] = "pin1"
394
+ run = o.um("pocket_w", 1500) / 2 + o.um("res_ext", 100)
395
+ cg = est.coplanar_coupling(2 * r_o, cpw, w_ring, s, eps)
396
+ _C(frag, f"Cg_{name}_pin1", "island1", "pin1", est.cap(cg, "rough", "readout line over the ring (CPS)"))
397
+ cc = est.cpw_line(run, cpw, clear / 2, eps)
398
+ _C(frag, f"Cc_{name}_pin1", "pin1", "gnd", est.cap(cc, "rough", "readout line in the pocket (wide-gap CPW)"))
399
+ frag.port_nodes["pin2"] = "control:flux"
400
+ frag.port_nodes["pin3"] = "control:flux"
401
+ return frag
402
+
403
+
404
+ @register_lom(f"{METAL_PREFIX}TransmonConcentricType2")
405
+ def transmon_concentric2_lom(name, inst, pdk):
406
+ """Metal TransmonConcentricType2: floating disk (rad_inner) + ring (… rad_outer), SQUID between; pins pin1–3
407
+ are coupler fingers on the ring (rough)."""
408
+ o = _opts(inst)
409
+ eps = est.substrate_eps(pdk)
410
+ r_in, r_out, gap = o.um("rad_inner", 1000), o.um("rad_outer", 2000), o.um("gap", 500)
411
+ clear = max(min(o.um("pocket_w", 10000), o.um("pocket_h", 10000)) / 2 - r_out, 1.0)
412
+ frag = Fragment(nodes={"island1": {"island": f"{name}.island1"}, "island2": {"island": f"{name}.island2"}})
413
+ w_ring = max(r_out - r_in - gap, 1.0)
414
+ _C(frag, f"C_{name}_1", "island1", "gnd", est.cap(est.ring_to_ground(r_out, w_ring, clear, eps), "rough", "ring"))
415
+ c2 = est.disk_to_ground(r_in, clear + w_ring + gap, eps) * (gap / (gap + w_ring)) ** 2
416
+ _C(frag, f"C_{name}_2", "island2", "gnd", est.cap(c2, "rough", "disk to ground, screened by the ring"))
417
+ c12 = est.concentric_rings(r_in, r_in + gap, eps)
418
+ _C(frag, f"C_{name}_12", "island1", "island2", est.cap(c12, "rough", "disk–ring facing edges (CPS)"))
419
+ _junction(frag, name, inst, o, "island1", "island2", "SQUID")
420
+ for i, corner in enumerate(("NE", "NW", "SW"), start=1):
421
+ pin = f"pin{i}"
422
+ fl, fw = o.um(f"finger_{corner}_length", 500), o.um(f"finger_{corner}_width", 100)
423
+ cgap = o.um(f"coupler_{corner}_gap", 100)
424
+ frag.nodes[pin] = {"island": f"{name}.{pin}"}
425
+ frag.port_nodes[pin] = pin
426
+ cg = est.coplanar_coupling(fl, fw, w_ring, cgap, eps)
427
+ _C(frag, f"Cg_{name}_{pin}", "island1", pin, est.cap(cg, "rough", f"{corner} finger along the ring (CPS)"))
428
+ _C(frag, f"Cc_{name}_{pin}", pin, "gnd", est.cap(est.cpw_line(fl, fw, cgap, eps), "rough", "finger as CPW"))
429
+ return frag
430
+
431
+
432
+ @register_lom(f"{METAL_PREFIX}TransmonInterdigitated")
433
+ def transmon_interdigitated_lom(name, inst, pdk):
434
+ """Metal TransmonInterdigitated: floating pads (top = island1, bottom = island2) with 4 fingers each."""
435
+ o = _opts(inst)
436
+ eps = est.substrate_eps(pdk)
437
+ pw, ph = o.um("pad_width", 1000), o.um("pad_height", 300)
438
+ fw, fh, fs = o.um("finger_width", 50), o.um("finger_height", 100), o.um("finger_space", 50)
439
+ frag = Fragment(nodes={"island1": {"island": f"{name}.island1"}, "island2": {"island": f"{name}.island2"}})
440
+ c12 = est.interdigital(8, fw, fs, fh, eps) + est.coplanar_coupling(pw, ph, ph, fh + fs, eps)
441
+ cpad = est.pad_to_ground(pw, ph, fh, fh, eps, open_edges=1)
442
+ f = "4 + 4 interdigital fingers (Igreja & Dias) + pad edges (CPS)"
443
+ _C(frag, f"C_{name}_12", "island1", "island2", est.cap(c12, "rough", f), f"{name}.finger_height")
444
+ _C(frag, f"C_{name}_1", "island1", "gnd", est.cap(cpad, "rough", "pad in its pocket"))
445
+ _C(frag, f"C_{name}_2", "island2", "gnd", est.cap(cpad, "rough", "pad in its pocket"))
446
+ _junction(frag, name, inst, o, "island1", "island2")
447
+ for pin, isl, pre in (
448
+ ("readout", "island2", "cc"),
449
+ ("bus1", "island1", "cc_topleft"),
450
+ ("bus2", "island1", "cc_topright"),
451
+ ):
452
+ w, h, s = o.um(f"{pre}_width", 100), o.um(f"{pre}_height", 100), o.um(f"{pre}_space", 50)
453
+ frag.nodes[pin] = {"island": f"{name}.{pin}"}
454
+ frag.port_nodes[pin] = pin
455
+ _C(frag, f"Cg_{name}_{pin}", isl, pin, est.cap(est.coplanar_coupling(w, h, ph, s, eps), "rough", "CPS"))
456
+ _C(frag, f"Cc_{name}_{pin}", pin, "gnd", est.cap(est.pad_to_ground(w, h, s, s, eps, 1), "rough", "pad"))
457
+ return frag
458
+
459
+
460
+ @register_lom(f"{METAL_PREFIX}StarQubit")
461
+ def star_qubit_lom(name, inst, pdk):
462
+ """Metal StarQubit: grounded star-shaped centre island + JJ, four coupler pads and a readout pad around it."""
463
+ o = _opts(inst)
464
+ eps = est.substrate_eps(pdk)
465
+ r, rc = o.um("radius", 300), o.um("center_radius", 100)
466
+ g_c, g_r = o.um("gap_couplers", 25), o.um("gap_readout", 10)
467
+ n = int(o.num("number_of_connectors", 4))
468
+ frag = Fragment(nodes={"island": {"island": f"{name}.island"}})
469
+ c_is = est.disk_to_ground(rc, (r - rc) / 2, eps)
470
+ _C(frag, f"C_{name}", "island", "gnd", est.cap(c_is, "rough", "centre island as a disk (star arms neglected)"))
471
+ _junction(frag, name, inst, o, "island", "gnd")
472
+ pins = [f"pin_cpl{i + 1}" for i in range(n)] + ["pin_rdout"]
473
+ arc = 2 * math.pi * (rc + (r - rc) / 2) / max(len(pins), 1)
474
+ for pin in pins:
475
+ s = g_r if pin == "pin_rdout" else g_c
476
+ frag.nodes[pin] = {"island": f"{name}.{pin}"}
477
+ frag.port_nodes[pin] = pin
478
+ cg = est.coplanar_coupling(arc, (r - rc) / 2, rc, s, eps)
479
+ _C(frag, f"Cg_{name}_{pin}", "island", pin, est.cap(cg, "rough", "pad sector facing the island (CPS)"))
480
+ cc = arc * est.cpw_c_per_um((r - rc) / 2, s, eps) / 2
481
+ _C(frag, f"Cc_{name}_{pin}", pin, "gnd", est.cap(cc, "rough", "pad outer edge (half CPW)"))
482
+ return frag
483
+
484
+
485
+ @register_lom(f"{METAL_PREFIX}TunableCoupler01")
486
+ def tunable_coupler01_lom(name, inst, pdk):
487
+ """Metal TunableCoupler01: grounded coupler island (interdigitated C to ground) + SQUID to ground; ``Control`` is
488
+ the coupler claw (circuit node), ``Flux`` the flux line."""
489
+ o = _opts(inst)
490
+ eps = est.substrate_eps(pdk)
491
+ cw, lw, lg, ah = o.um("c_width", 400), o.um("l_width", 20), o.um("l_gap", 10), o.um("a_height", 60)
492
+ frag = Fragment(nodes={"island": {"island": f"{name}.island"}})
493
+ n = max(int(cw / (2 * (lw + lg))), 2)
494
+ c_is = est.interdigital(n, lw, lg, ah, eps)
495
+ _C(frag, f"C_{name}", "island", "gnd", est.cap(c_is, "rough", f"{n}-finger comb to ground (Igreja & Dias)"))
496
+ _junction(frag, name, inst, o, "island", "gnd", "SQUID")
497
+ arm, aw, gap = o.um("cp_arm_length", 30), o.um("cp_arm_width", 6), o.um("cp_gap", 6)
498
+ frag.nodes["Control"] = {"island": f"{name}.Control"}
499
+ frag.port_nodes["Control"] = "Control"
500
+ cg = est.coplanar_coupling(2 * arm + o.um("cp_height", 15), aw, lw, gap + o.um("cp_gspace", 3), eps)
501
+ _C(frag, f"Cg_{name}_Control", "island", "Control", est.cap(cg, "rough", "coupler arm (CPS)"))
502
+ _C(frag, f"Cc_{name}_Control", "Control", "gnd", est.cap(est.cpw_line(2 * arm, aw, gap, eps), "rough", "arm"))
503
+ frag.port_nodes["Flux"] = "control:flux"
504
+ return frag
505
+
506
+
507
+ @register_lom(f"{METAL_PREFIX}TunableCoupler02")
508
+ def tunable_coupler02_lom(name, inst, pdk):
509
+ """Metal TunableCoupler02: two circular pads (floating) + SQUID; a bus CPW (pin1–pin2) passes both pads."""
510
+ o = _opts(inst)
511
+ eps = est.substrate_eps(pdk)
512
+ r = o.um("pad_radius", 300)
513
+ clear = max(min(o.um("pocket_width", 3000), o.um("pocket_height", 2000)) / 2 - r, 1.0)
514
+ jl = o.um("JJ_length", 400)
515
+ frag = Fragment(
516
+ nodes={
517
+ "island1": {"island": f"{name}.island1"},
518
+ "island2": {"island": f"{name}.island2"},
519
+ "bus": {"island": f"{name}.bus"},
520
+ },
521
+ port_nodes={"pin1": "bus", "pin2": "bus", "fbl": "control:flux"},
522
+ )
523
+ for i in (1, 2):
524
+ c = est.disk_to_ground(r, clear, eps)
525
+ _C(frag, f"C_{name}_{i}", f"island{i}", "gnd", est.cap(c, "rough", "pad as a disk in the pocket"))
526
+ bw = o.um("bus_width", 100)
527
+ cg = est.coplanar_coupling(o.um("bus_inner_length", 500), bw, r, o.um("bus_JJ_height", 500) / 4, eps)
528
+ _C(frag, f"Cb_{name}_{i}", f"island{i}", "bus", est.cap(cg, "rough", "bus line past the pad (CPS)"))
529
+ c12 = est.coplanar_coupling(2 * r, r, r, jl, eps)
530
+ _C(frag, f"C_{name}_12", "island1", "island2", est.cap(c12, "rough", "pads across the junction gap (CPS)"))
531
+ _C(
532
+ frag,
533
+ f"Cc_{name}_bus",
534
+ "bus",
535
+ "gnd",
536
+ est.cap(est.cpw_line(2 * o.um("bus_outer_length", 500), o.um("bus_width", 100), 50, eps), "rough", "bus"),
537
+ )
538
+ _junction(frag, name, inst, o, "island1", "island2", "SQUID")
539
+ return frag
540
+
541
+
542
+ # ---- capacitors, tees -------------------------------------------------------------------------------------------
543
+ def _pi(name, pa, pb, cab, ca, cb, kind, formula, kind_g="rough", formula_g="pads to ground") -> Fragment:
544
+ frag = Fragment(
545
+ nodes={"a": {"island": f"{name}.{pa}"}, "b": {"island": f"{name}.{pb}"}}, port_nodes={pa: "a", pb: "b"}
546
+ )
547
+ _C(frag, f"C_{name}", "a", "b", est.cap(cab, kind, formula))
548
+ _C(frag, f"C_{name}_a", "a", "gnd", est.cap(ca, kind_g, formula_g))
549
+ _C(frag, f"C_{name}_b", "b", "gnd", est.cap(cb, kind_g, formula_g))
550
+ return frag
551
+
552
+
553
+ @register_lom(f"{METAL_PREFIX}CapNInterdigital")
554
+ def cap_n_interdigital_lom(name, inst, pdk):
555
+ """Metal CapNInterdigital: N-finger IDC between ``north_end`` and ``south_end``."""
556
+ o = _opts(inst)
557
+ eps = est.substrate_eps(pdk)
558
+ n, w, g, fl = int(o.num("finger_count", 5)), o.um("cap_width", 10), o.um("cap_gap", 6), o.um("finger_length", 20)
559
+ area = n * w + (n - 1) * g
560
+ cab = est.interdigital(n, w, g, fl, eps) if fl > 0 else est.coplanar_coupling(area, w, w, g, eps)
561
+ cg = est.pad_to_ground(area, fl / 2 + w, o.um("cap_gap_ground", 6), o.um("cap_gap_ground", 6), eps, 1)
562
+ cg += est.cpw_line(o.um("cap_distance", 50), o.um("north_width", 10), o.um("north_gap", 6), eps)
563
+ kind, formula = (
564
+ ("analytic", "interdigital (Igreja & Dias 2004)") if fl > 0 else ("rough", "plates facing across cap_gap (CPS)")
565
+ )
566
+ return _pi(name, "north_end", "south_end", cab, cg, cg, kind, formula)
567
+
568
+
569
+ @register_lom(f"{METAL_PREFIX}Cap3Interdigital")
570
+ def cap3_interdigital_lom(name, inst, pdk):
571
+ """Metal Cap3Interdigital: three-finger IDC (finger width = gap = trace width) between ``a`` and ``b``."""
572
+ o = _opts(inst)
573
+ eps = est.substrate_eps(pdk)
574
+ w, fl = o.um("trace_width", 10), o.um("finger_length", 65)
575
+ cab = est.interdigital(3, w, w, fl, eps)
576
+ cg = est.pad_to_ground(
577
+ 3 * w + 2 * w, fl / 2, o.um("pocket_buffer_width_x", 10), o.um("pocket_buffer_width_y", 30), eps
578
+ )
579
+ return _pi(name, "a", "b", cab, cg / 2, cg / 2, "analytic", "3-finger interdigital (Igreja & Dias 2004)")
580
+
581
+
582
+ @register_lom(f"{METAL_PREFIX}CapFingerInFrame")
583
+ def cap_finger_in_frame_lom(name, inst, pdk):
584
+ """Metal CapFingerInFrame: a finger (pin ``finger``) inside a U frame (pin ``frame``): C along both sides."""
585
+ o = _opts(inst)
586
+ eps = est.substrate_eps(pdk)
587
+ length, width, trace, gap = (
588
+ o.um(k, d) for k, d in (("frame_length", 245), ("frame_width", 72), ("frame_trace", 16), ("cap_gap", 10))
589
+ )
590
+ finger_w = max(width - 2 * trace - 2 * gap, 1.0)
591
+ cab = est.coplanar_coupling(2 * length, finger_w, trace, gap, eps)
592
+ cg = est.cpw_line(2 * length + width, trace, o.um("ground_gap", 10), eps) / 2
593
+ return _pi(name, "frame", "finger", cab, cg, 0.1 * cg, "analytic", "finger sides facing the frame (CPS)")
594
+
595
+
596
+ @register_lom(f"{METAL_PREFIX}CapNInterdigitalTee")
597
+ def cap_n_interdigital_tee_lom(name, inst, pdk):
598
+ """Metal CapNInterdigitalTee: primary CPW (prime_start = prime_end, one conductor) + IDC to ``second_end``."""
599
+ o = _opts(inst)
600
+ eps = est.substrate_eps(pdk)
601
+ n, w, g, fl = int(o.num("finger_count", 5)), o.um("cap_width", 10), o.um("cap_gap", 6), o.um("finger_length", 20)
602
+ frag = Fragment(
603
+ nodes={"prime": {"island": f"{name}.prime"}, "second": {"island": f"{name}.second_end"}},
604
+ port_nodes={"prime_start": "prime", "prime_end": "prime", "second_end": "second"},
605
+ )
606
+ if fl > 0:
607
+ c_ps = est.cap(est.interdigital(n, w, g, fl, eps), "analytic", "IDC")
608
+ else: # no fingers: Metal still draws the two plates (n·w + (n−1)·g wide) facing across cap_gap
609
+ plate = n * w + (n - 1) * g
610
+ c_ps = est.cap(est.coplanar_coupling(plate, w, w, g, eps), "rough", "plates facing across cap_gap (CPS)")
611
+ _C(frag, f"C_{name}", "prime", "second", c_ps)
612
+ cc = est.cpw_line(o.um("cap_distance", 50), o.um("second_width", 10), o.um("second_gap", 6), eps)
613
+ _C(frag, f"C_{name}_second", "second", "gnd", est.cap(cc, "rough", "second-line stub to ground"))
614
+ return frag
615
+
616
+
617
+ @register_lom(f"{METAL_PREFIX}CoupledLineTee")
618
+ def coupled_line_tee_lom(name, inst, pdk): # noqa: ARG001
619
+ """Metal CoupledLineTee: primary CPW + a parallel coupled line (``coupling_length`` at ``coupling_space``) whose
620
+ coupler end is open (``open_termination``) or shorted; the route on ``second_end`` continues it as a resonator."""
621
+ o = _opts(inst)
622
+ open_end = str(o.raw.get("open_termination", True)).lower() in ("true", "1")
623
+ frag = Fragment(
624
+ nodes={"prime": {"island": f"{name}.prime"}, "second": {"island": f"{name}.second_end"}},
625
+ port_nodes={"prime_start": "prime", "prime_end": "prime", "second_end": "second"},
626
+ )
627
+ lc = o.um("coupling_length", 100)
628
+ frag.lines.append(
629
+ Line(
630
+ name,
631
+ "second",
632
+ (None, "second_end"),
633
+ lc + o.um("down_length", 100),
634
+ o.um("second_width", 10),
635
+ o.um("second_gap", 6),
636
+ ("open" if open_end else "short", "open"),
637
+ True,
638
+ [{"node": "prime", "coupling_length_um": lc, "ground_gap_um": o.um("coupling_space", 3)}],
639
+ )
640
+ )
641
+ frag.notes.append(f"{name}: coupled-line κ uses the hanger k for a {o.um('coupling_space', 3):g} µm gap (rough)")
642
+ return frag
643
+
644
+
645
+ @register_lom(f"{METAL_PREFIX}LineTee")
646
+ def line_tee_lom(name, inst, pdk): # noqa: ARG001
647
+ """Metal LineTee: a T-junction, all three pins one conductor."""
648
+ return Fragment(
649
+ nodes={"t": {"island": f"{name}.t"}}, port_nodes={"prime_start": "t", "prime_end": "t", "second_end": "t"}
650
+ )
651
+
652
+
653
+ # ---- resonators -------------------------------------------------------------------------------------------------
654
+ @register_lom(f"{METAL_PREFIX}ResonatorCoilRect")
655
+ def resonator_coil_lom(name, inst, pdk): # noqa: ARG001
656
+ """Metal ResonatorCoilRect: a rectangular-spiral resonator of ``length`` (``line_width``/``gap``) from
657
+ ``spiralPin``; its inner end is open."""
658
+ o = _opts(inst)
659
+ frag = Fragment(nodes={"res": {"island": f"{name}.res"}}, port_nodes={"spiralPin": "res"})
660
+ frag.lines.append(
661
+ Line(
662
+ name,
663
+ "res",
664
+ ("spiralPin", None),
665
+ o.um("length", 2000),
666
+ o.um("line_width", 1),
667
+ o.um("gap", 4),
668
+ ("open", "open"),
669
+ True,
670
+ )
671
+ )
672
+ return frag
673
+
674
+
675
+ @register_lom(f"{METAL_PREFIX}ReadoutResFC")
676
+ def readout_res_fc_lom(name, inst, pdk): # noqa: ARG001
677
+ """Metal ReadoutResFC: a CPW resonator from the fork/circle coupler (open) through l1 … 5 × l5 to ``readout``."""
678
+ o = _opts(inst)
679
+ r = o.um("readout_cpw_turnradius", 50)
680
+ length = (
681
+ o.um("readout_l1", 400)
682
+ + o.um("readout_l2", 400)
683
+ + o.um("readout_l3", 400)
684
+ + o.um("readout_l4", 250)
685
+ + 5 * o.um("readout_l5", 400)
686
+ + r * math.pi * (0.25 + 0.5 + 1 + 4)
687
+ )
688
+ frag = Fragment(nodes={"res": {"island": f"{name}.res"}}, port_nodes={"readout": "res"})
689
+ frag.lines.append(
690
+ Line(
691
+ name,
692
+ "res",
693
+ (None, "readout"),
694
+ length,
695
+ o.um("readout_cpw_width", 5),
696
+ o.um("readout_cpw_gap", 5),
697
+ ("open", "open"),
698
+ True,
699
+ )
700
+ )
701
+ return frag
702
+
703
+
704
+ @register_lom(f"{METAL_PREFIX}ResonatorLumped")
705
+ def resonator_lumped_lom(name, inst, pdk): # noqa: ARG001
706
+ """Metal ResonatorLumped: a meandered trace shorted to the (grounded) perimeter, open at ``pin_n``: λ/4."""
707
+ o = _opts(inst)
708
+ w = o.um("box_width", 5000)
709
+ n = o.num("n_turns", 14)
710
+ length = o.um("initial", 100) + n * (w - 2 * o.um("outer_space", 100)) + o.um("final", 2500)
711
+ frag = Fragment(nodes={"res": {"island": f"{name}.res"}}, port_nodes={"pin_n": "res"})
712
+ for pin in ("pin_east", "pin_west", "pin_s", "pin_ne", "pin_nw", "pin_se", "pin_sw"):
713
+ frag.port_nodes[pin] = "gnd"
714
+ frag.lines.append(
715
+ Line(
716
+ name,
717
+ "res",
718
+ ("pin_n", None),
719
+ length,
720
+ o.um("res_width", 10),
721
+ o.um("inner_space", 190) / 2,
722
+ ("open", "short"),
723
+ True,
724
+ )
725
+ )
726
+ frag.notes.append(f"{name}: lumped resonator estimated as a λ/4 line of its trace length (rough)")
727
+ return frag
728
+
729
+
730
+ # ---- ports, terminations, wires, junctions ----------------------------------------------------------------------
731
+ @register_lom(f"{METAL_PREFIX}LaunchpadWirebond")
732
+ def launchpad_lom(name, inst, pdk): # noqa: ARG001
733
+ """Metal LaunchpadWirebond: a 50 Ω port on its ``tie`` conductor."""
734
+ return Fragment(nodes={"pad": {"island": f"{name}.pad"}}, elements=[port_resistor(name)], port_nodes={"tie": "pad"})
735
+
736
+
737
+ @register_lom(f"{METAL_PREFIX}LaunchpadWirebondDriven")
738
+ def launchpad_driven_lom(name, inst, pdk): # noqa: ARG001
739
+ """Metal LaunchpadWirebondDriven: a 50 Ω port; ``in`` (the driven pad) and ``tie`` are one conductor."""
740
+ return Fragment(
741
+ nodes={"pad": {"island": f"{name}.pad"}}, elements=[port_resistor(name)], port_nodes={"tie": "pad", "in": "pad"}
742
+ )
743
+
744
+
745
+ @register_lom(f"{METAL_PREFIX}LaunchpadWirebondCoupled")
746
+ def launchpad_coupled_lom(name, inst, pdk):
747
+ """Metal LaunchpadWirebondCoupled: a 50 Ω pad coupled to the ``tie`` line through a coupler section (rough C)."""
748
+ o = _opts(inst)
749
+ eps = est.substrate_eps(pdk)
750
+ tw, tg = o.um("trace_width", 10), o.um("trace_gap", 6)
751
+ ck = est.coplanar_coupling(2 * o.um("coupler_length", 62.5), tw, tw, tg, eps)
752
+ frag = Fragment(
753
+ nodes={"pad": {"island": f"{name}.pad"}, "tie": {"island": f"{name}.tie"}},
754
+ elements=[port_resistor(name)],
755
+ port_nodes={"tie": "tie"},
756
+ )
757
+ _C(frag, f"Ck_{name}", "pad", "tie", est.cap(ck, "rough", "coupler section (CPS)"))
758
+ _C(
759
+ frag,
760
+ f"C_{name}_tie",
761
+ "tie",
762
+ "gnd",
763
+ est.cap(est.cpw_line(o.um("lead_length", 25), tw, tg, eps), "rough", "lead"),
764
+ )
765
+ return frag
766
+
767
+
768
+ @register_lom(f"{METAL_PREFIX}OpenToGround")
769
+ def open_to_ground_lom(name, inst, pdk): # noqa: ARG001
770
+ """Metal OpenToGround: an open end; a route into it becomes an open-ended (λ/2 or λ/4) resonator."""
771
+ o = _opts(inst)
772
+ frag = Fragment(nodes={"end": {"island": f"{name}.end"}}, port_nodes={"open": "end"})
773
+ frag.lines.append(Line(name, "end", ("open", None), 0.0, o.um("width", 10), o.um("gap", 6), ("open", "open")))
774
+ return frag
775
+
776
+
777
+ @register_lom(f"{METAL_PREFIX}ShortToGround")
778
+ def short_to_ground_lom(name, inst, pdk): # noqa: ARG001
779
+ """Metal ShortToGround: a shorted end; a route into it becomes a shorted (λ/4) resonator end."""
780
+ o = _opts(inst)
781
+ frag = Fragment(nodes={"end": {"island": f"{name}.end"}}, port_nodes={"short": "end"})
782
+ frag.lines.append(Line(name, "end", ("short", None), 0.0, o.um("width", 10), 6.0, ("short", "short")))
783
+ return frag
784
+
785
+
786
+ @register_lom(f"{METAL_PREFIX}Airbridge")
787
+ def airbridge_lom(name, inst, pdk): # noqa: ARG001
788
+ """Metal Airbridge: a wire between its two landing pads; with no port joined, a ground strap (ports → gnd)."""
789
+ return Fragment(nodes={"w": {"island": f"{name}.w"}}, port_nodes={"a": "w", "b": "w"}, straps=["w"])
790
+
791
+
792
+ @register_lom(f"{METAL_PREFIX}PolylineCPW")
793
+ def polyline_cpw_lom(name, inst, pdk): # noqa: ARG001
794
+ """Metal PolylineCPW: a CPW line along ``points`` (wire between connected pins, stub resonator otherwise)."""
795
+ o = _opts(inst)
796
+ pts = o.raw.get("points") or [[0, 0], [0.5, 0]]
797
+ length = 1000.0 * sum(math.dist(p, q) for p, q in zip(pts, pts[1:])) # Metal bare numbers are mm
798
+ frag = Fragment(nodes={"line": {"island": f"{name}.line"}}, port_nodes={"start": "line", "end": "line"})
799
+ frag.lines.append(
800
+ Line(name, "line", ("start", "end"), length, o.um("trace_width", 10), o.um("trace_gap", 6), ("open", "open"))
801
+ )
802
+ taps = o.raw.get("taps") or {}
803
+ if isinstance(taps, str):
804
+ try:
805
+ taps = json.loads(taps)
806
+ except ValueError:
807
+ taps = {}
808
+ for tap in taps if isinstance(taps, dict) else []:
809
+ frag.port_nodes[str(tap)] = "line" # a tap pin on the line: the same conductor (its position is not a line end)
810
+ if taps:
811
+ frag.notes.append(
812
+ f"{name}: tap pin(s) {sorted(map(str, taps))} on the line's conductor (not split at the taps)"
813
+ )
814
+ return frag
815
+
816
+
817
+ @register_lom(f"{METAL_PREFIX}SNAIL")
818
+ def snail_lom(name, inst, pdk): # noqa: ARG001
819
+ """Metal SNAIL: a JJ between pins a and b with the SNAIL's linear inductance (3 Lj in series ∥ Lj_small) unless
820
+ the design gives ``junction.Lj_nH`` (the SNAIL's third-order nonlinearity is not modelled)."""
821
+ o = _opts(inst)
822
+ frag = Fragment(
823
+ nodes={"a": {"island": f"{name}.a"}, "b": {"island": f"{name}.b"}},
824
+ port_nodes={"a": "a", "b": "b", "squid_a": "a", "squid_b": "b"},
825
+ )
826
+ ej = effective_junction(inst, {}, kind="JJ")
827
+ lj, cj, source = ej.lj0_nH, ej.cj_fF, ej.source or "design"
828
+ if lj is None:
829
+ big = float(str(o.raw.get("Lj", "0.046nH")).lower().replace("nh", ""))
830
+ small = float(str(o.raw.get("Lj_small", "0.165nH")).lower().replace("nh", ""))
831
+ lj, source = 3 * big * small / (3 * big + small), "SNAIL options: 3 Lj ∥ Lj_small"
832
+ frag.elements.append(Element(f"J_{name}", "JJ", ("a", "b"), {"Lj_nH": lj, "Cj_fF": cj, "source": source}))
833
+ frag.notes.append(f"{name}: SNAIL as a single JJ (linear inductance only)")
834
+ return frag
835
+
836
+
837
+ def _bare_junction(name, inst, pdk): # noqa: ARG001
838
+ return Fragment(notes=[f"{name} ({inst.cell}): junction without pins; model it as part of its qubit"])
839
+
840
+
841
+ for _jj in ("jj_dolan", "jj_manhattan", "SQUID_LOOP", "BridgeFreeJunction"):
842
+ register_lom(f"{METAL_PREFIX}{_jj}")(_bare_junction)
843
+
844
+
845
+ # ---- metal-only cells (no pocket) ---------------------------------------------------------------------------------
846
+ # Metal draws these as metal only: without a pocket under them they merge into the ground plane (empty in the
847
+ # negative mask, as in Metal's own GDS). Their models describe the cell *on a pocket* (catalog recipe: a
848
+ # metal:Rectangle with subtract: true); the builder grounds their ports when no pocket covers them.
849
+ METAL_ONLY = {
850
+ "TransmonConcentricType2": "Metal leaves its pocket commented out",
851
+ "TunableCoupler02": "Metal computes its pocket but never adds it",
852
+ "ResonatorLumped": "perimeter and trace are both metal",
853
+ "NSquareSpiral": "a metal spiral path",
854
+ }
855
+
856
+
857
+ def _truthy(v) -> bool:
858
+ return v is True or str(v).strip().lower() in ("true", "1", "yes")
859
+
860
+
861
+ def metal_only_without_pocket(design, plan, iname: str) -> str | None:
862
+ """A note when ``iname`` is a metal-only Metal cell that no subtracting Metal shape (a pocket) covers: its metal
863
+ is part of the ground plane, so it has no circuit elements; else None."""
864
+ import klayout.db as pya # pylint: disable=import-outside-toplevel
865
+
866
+ inst = design.instances[iname]
867
+ cls = inst.cell[len(METAL_PREFIX) :] if inst.cell.startswith(METAL_PREFIX) else None
868
+ if cls not in METAL_ONLY:
869
+ return None
870
+ if cls == "NSquareSpiral" and _truthy(_opts(inst).raw.get("subtract")):
871
+ return f"{iname}: etched spiral slot (subtract) in the ground plane: no conductor, its pin is ground"
872
+ placed = plan.instances.get(iname)
873
+ if placed is None:
874
+ return None
875
+ origin = placed.trans * pya.DPoint(0, 0)
876
+ for pname, other in design.instances.items():
877
+ if pname == iname or not other.cell.startswith(METAL_PREFIX) or pname not in plan.instances:
878
+ continue
879
+ o = _opts(other)
880
+ if not _truthy(o.raw.get("subtract")):
881
+ continue
882
+ w, h, r = o.um("width", 0.0), o.um("height", 0.0), o.um("radius", 0.0)
883
+ if w > 0 and h > 0:
884
+ box = pya.DBox(-w / 2, -h / 2, w / 2, h / 2)
885
+ elif r > 0:
886
+ box = pya.DBox(-r, -r, r, r)
887
+ else:
888
+ continue
889
+ if (plan.instances[pname].trans * box).contains(origin):
890
+ return None
891
+ return (
892
+ f"{iname} ({inst.cell}): draws metal only ({METAL_ONLY[cls]}) and no pocket (a subtracting Metal shape, e.g. "
893
+ "metal:Rectangle subtract: true) covers it: its metal is ground plane, so its ports are grounded and it has "
894
+ "no elements"
895
+ )
896
+
897
+
898
+ @register_lom(f"{METAL_PREFIX}NSquareSpiral")
899
+ def n_square_spiral_lom(name, inst, pdk): # noqa: ARG001
900
+ """Metal NSquareSpiral (sample shape) on a pocket: a spiral trace from ``spiralPin`` (outer end) to an open inner
901
+ end, as a line (a route into it ends in a stub of the spiral's length). Rough: the CPW formula with a = width,
902
+ b = gap ignores the turns' mutual coupling. Without a pocket the builder grounds the pin (see METAL_ONLY)."""
903
+ o = _opts(inst)
904
+ n, w, g, r = int(o.num("n", 3)), o.um("width", 1), o.um("gap", 4), o.um("radius", 40)
905
+ pts = [] # Metal's polyline (NSquareSpiral.make)
906
+ for k in range(max(n, 1)):
907
+ v = r / 2 + k * (w + g)
908
+ pts += [(-v, -v), (v, -v), (v, v), (-v - (w + g), v)]
909
+ v = r / 2 + max(n, 1) * (w + g)
910
+ pts.append((-v, -v))
911
+ length = sum(math.dist(a, b) for a, b in zip(pts, pts[1:]))
912
+ frag = Fragment(nodes={"spiral": {"island": f"{name}.spiral"}}, port_nodes={"spiralPin": "spiral"})
913
+ frag.lines.append(Line(name, "spiral", ("spiralPin", None), length, w, g, ("open", "open")))
914
+ frag.notes.append(
915
+ f"{name}: spiral trace of {length:.0f} µm as an open-ended line (rough: turns' mutual coupling not included)"
916
+ )
917
+ return frag