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,541 @@
1
+ """Nb trilayer cross junctions with HSQ sidewall protection (ported from QWri ``JJ_finger Top/Bottom`` and
2
+ ``xjc_junction_TL_mod.py`` / ``xjc_squid_TL_mod.py``).
3
+
4
+ Two finger exposures cross over each other:
5
+
6
+ * the *straight* finger (legacy layer 2/0, KQC ``SIS_junction``) connects to the island (``port_common`` side),
7
+ * the *bent* finger (legacy layer 4/0, KQC ``SIS_junction_2``) connects to ground (``origin_squid`` side).
8
+
9
+ Both are drawn as negative-tone windows (window minus finger), exactly as the legacy fab output. HSQ boxes go to the
10
+ Quantcore ``hsq`` layer (PDK v2 spacer, 50/0; the legacy scripts drew them on 500/0). The geometry is computed in
11
+ database units with the same pya calls as the legacy code (including its float→int truncation), so it XORs clean
12
+ against the legacy cells. The scripts set the finger PCells' parameters, so KLayout first runs the legacy
13
+ ``coerce_parameters_impl`` (:func:`coerce_straight` / :func:`coerce_bent`: e.g. a 0.6 µm bent finger widens its
14
+ 1 µm lead to 1.26 µm); the cells apply the same rules.
15
+
16
+ Spacer gradient (PDK 51–53/0, design decision #4): the three shades are three dose levels of the 50/0 spacer. A
17
+ rectangular spacer (the HSQ sidewall boxes) is split across its width into three nested strips of width / 3;
18
+ windows (spacers with a hole) and concentric spacers are split into three rings (:func:`spacer_gradient_levels`).
19
+ ``spacer_1`` (51/0) is the level nearest the junction (legacy ``hsqi``, inner), ``spacer_3`` (53/0) the farthest
20
+ (``hsqo``, outer). On by default where a spacer is drawn (PDK switch ``JunctionProcess.spacer_gradient``); the legacy
21
+ XOR tests compare 2/0, 4/0 and 50/0 only.
22
+
23
+ Sizing (design decisions #1 / #21): ``lj_nH`` > 0 sizes the straight finger from the PDK junction rule
24
+ (:func:`quantcore_circuits.circuit.bridges.fingers_for_lj`: Δ = 1.4 meV, R_n·A of
25
+ :class:`quantcore_circuits.pdk.JunctionProcess`; SQUID cells: ``lj_nH`` is the parallel total, each junction gets
26
+ twice it), keeping ``second_finger_width`` (0 → the PDK bent finger, 0.6 µm). Otherwise KQC's ``junction_width``
27
+ (what a KQC qubit passes to its junction) sets the straight finger when it is at least the PDK minimum finger
28
+ (0.1 µm; KQC's 0.02 µm default is ignored), else ``finger_width`` is used as given.
29
+
30
+ ``clearer`` draws the legacy CLEARER: a ``base_metal_addition`` box (window − ``clearer_inset`` on each side, full
31
+ window height) so the 1/0 etch leaves base metal in the junction gap and the 2/0 / 4/0 windows cut the fingers from
32
+ it. The ``Quantcore*`` cells (:class:`QuantcoreJunction`, :class:`QuantcoreSquid`) are the PDK junctions for any
33
+ qubit: TrilayerJunction / TrilayerSquid geometry with the PDK nominal fingers (0.5 × 0.6 µm → R_n = 45 kΩ), the
34
+ clearer and the gradient on (``junction_type: "Quantcore Junction"`` / ``"Quantcore Squid"``). Simulation builds
35
+ replace every ``junction_type`` by ``"Sim"``, so the clearer never shorts a FEM model.
36
+
37
+ Frame: KQC junction convention. ``origin_squid`` = (0, 0) at the centre of the window's ground-side edge,
38
+ ``port_common`` = (0, window_height) on the island side; the legacy junction cell is centred on the window, so its
39
+ geometry is shifted up by ``window_height / 2``.
40
+ """
41
+
42
+ import json
43
+ import math
44
+
45
+ from kqcircuits.junctions.squid import Squid
46
+ from kqcircuits.pya_resolver import pya
47
+ from kqcircuits.util.parameters import Param, pdt
48
+
49
+ from quantcore_circuits.pdk import DEFAULT_PDK, QCC_LAYERS, get_pdk
50
+
51
+ _PROCESS = get_pdk(DEFAULT_PDK).junction
52
+
53
+
54
+ def straight_finger(dbu, pad_width, pad_height, finger_width, finger_length, width, height, x, y, negative=True):
55
+ """Legacy ``JJ_finger_top`` (the straight finger), in dbu. Returns a Region."""
56
+ pw, ph, fw, fl = pad_width / dbu, pad_height / dbu, finger_width / dbu, finger_length / dbu
57
+ pt1 = pya.Point(pya.DPoint(-pw / 2, 0))
58
+ pt2 = pya.Point(pya.DPoint(pw / 2, 0))
59
+ pt4 = pya.Point(pya.DPoint(-fw / 2, fl / 3))
60
+ pt3 = pya.Point(pya.DPoint(fw / 2, fl / 3))
61
+ jpad = pya.Region()
62
+ jpad.insert(pya.Box(-pw / 2, -ph, pw / 2, 0))
63
+ jpad.insert(pya.Box(-fw / 2, 0, fw / 2, (fl / 4 + fl)))
64
+ jpad.insert(pya.Polygon([pt1, pt2, pt3, pt4]))
65
+ if not negative:
66
+ return jpad
67
+ k, lead_w = (0, 1) if x == 0 else (1, 2)
68
+ move = pya.DTrans(x / dbu, y / dbu)
69
+ origin = pya.Point(pya.DPoint(0, -height / dbu / 2))
70
+ mid = pya.Point(pya.DPoint(0, y / dbu - ph))
71
+ end = pya.Point(pya.DPoint(x / dbu, y / dbu - ph))
72
+ path1 = pya.Path([origin, mid], lead_w * pw, 0, pw / 2)
73
+ path2 = pya.Path([mid, end], k * pw, pw, pw / 2)
74
+ box = pya.Region().insert(pya.Box(-width / dbu / 2, -height / dbu / 2, width / dbu / 2, height / dbu / 2))
75
+ finger = pya.Region().insert(jpad.transformed(move))
76
+ return box - finger - pya.Region().insert(path1) - pya.Region().insert(path2)
77
+
78
+
79
+ def bent_finger(
80
+ dbu, pad_width, pad_height, finger_width, finger_length, conn_height, width, height, x, y, invert, negative=True
81
+ ):
82
+ """Legacy ``JJ_finger Bottom`` (the bent finger), in dbu. Returns a Region."""
83
+ pw, ph, fw, fl, ch = pad_width / dbu, pad_height / dbu, finger_width / dbu, finger_length / dbu, conn_height / dbu
84
+ ch = fl / 3 if pw < fl else abs(ch)
85
+ pts = [
86
+ pya.Point(pya.DPoint(0, 0)),
87
+ pya.Point(pya.DPoint(fl / 2, ch)),
88
+ pya.Point(pya.DPoint(fl / 2, ch + (2 / 3) * fl)),
89
+ pya.Point(pya.DPoint(-fl / 2, ch + (2 / 3) * fl)),
90
+ ]
91
+ finger = pya.Path(pts, fw)
92
+ p3y = finger.polygon().to_simple_polygon().point(3).y
93
+ hw = pw / 2
94
+ holder = pya.Polygon(
95
+ [
96
+ pya.Point(pya.DPoint(-pw / 2, 0)),
97
+ pya.Point(pya.DPoint(pw / 2, -pw / 2)),
98
+ pya.Point(pya.DPoint(fl / 2 + hw / 2, ch + -hw / 2)),
99
+ pya.Point(pya.DPoint(fl / 2 + hw / 2, p3y + fw)),
100
+ pya.Point(pya.DPoint(fl / 2 - hw / 2, p3y + fw)),
101
+ pya.Point(pya.DPoint(fl / 2 - hw / 2, ch + hw / 2)),
102
+ ]
103
+ )
104
+ jpad = pya.Region().insert(holder)
105
+ jpad.insert(finger)
106
+ jpad.insert(pya.Box(-pw / 2, -ph, pw / 2, 0))
107
+ if invert:
108
+ jpad.transform(pya.Trans(2, True))
109
+ if not negative:
110
+ return jpad
111
+ move = pya.DTrans(x / dbu, y / dbu)
112
+ origin = pya.Point(pya.DPoint(x / dbu, -height / dbu / 2))
113
+ mid = pya.Point(pya.DPoint(x / dbu, y / dbu - ph))
114
+ path1 = pya.Path([origin, mid], pw)
115
+ box = pya.Region().insert(pya.Box(-width / dbu / 2, -height / dbu / 2, width / dbu / 2, height / dbu / 2))
116
+ return box - pya.Region().insert(jpad.transformed(move)) - pya.Region().insert(path1)
117
+
118
+
119
+ def coerce_straight(pad_width: float, pad_height: float, finger_width: float) -> tuple[float, float]:
120
+ """Legacy ``JJ_finger Top.coerce_parameters_impl``: (pad_width, pad_height)."""
121
+ if pad_width < 2 * finger_width + finger_width / 10:
122
+ pad_width = 2 * finger_width + finger_width / 10
123
+ if pad_height < pad_width / 2:
124
+ pad_height = pad_width / 2
125
+ return pad_width, pad_height
126
+
127
+
128
+ def coerce_bent(pad_width, conn_height, finger_width, finger_length, x, y, width, height) -> tuple[float, float, float]:
129
+ """Legacy ``JJ_finger Bottom.coerce_parameters_impl``: (pad_width, conn_height, x), including its quirk of
130
+ resetting ``x`` (not ``y``) when ``y`` is out of the window."""
131
+ if pad_width <= (2 * finger_width) + finger_width / 10:
132
+ pad_width = 2 * finger_width + finger_width / 10
133
+ if conn_height <= finger_length / 3:
134
+ conn_height = finger_length / 3
135
+ if finger_width > pad_width:
136
+ pad_width = 2 * finger_width + finger_width / 10
137
+ if abs(x) > (width / 2 - pad_width):
138
+ x = width / 2 - pad_width
139
+ if abs(y) > (height / 2 - pad_width):
140
+ x = height / 2 - pad_width
141
+ return pad_width, conn_height, x
142
+
143
+
144
+ def coerced_straight_finger(dbu, pad_width, pad_height, finger_width, finger_length, width, height, x, y):
145
+ """:func:`straight_finger` after the legacy parameter coercion."""
146
+ pad_width, pad_height = coerce_straight(pad_width, pad_height, finger_width)
147
+ return straight_finger(dbu, pad_width, pad_height, finger_width, finger_length, width, height, x, y)
148
+
149
+
150
+ def coerced_bent_finger(dbu, pad_width, finger_width, finger_length, conn_height, width, height, x, y, invert):
151
+ """:func:`bent_finger` (pad height 2, read-only in the legacy cell) after the legacy coercion."""
152
+ pad_width, conn_height, x = coerce_bent(pad_width, conn_height, finger_width, finger_length, x, y, width, height)
153
+ return bent_finger(dbu, pad_width, 2, finger_width, finger_length, conn_height, width, height, x, y, invert)
154
+
155
+
156
+ def _strips(poly: pya.Polygon, shades: int, centres: list) -> list:
157
+ """A rectangle split across its short side into ``shades`` strips, nearest a junction centre first."""
158
+ box = poly.bbox()
159
+ along_x = box.width() <= box.height() # strips run along the long side
160
+ lo, size = (box.left, box.width()) if along_x else (box.bottom, box.height())
161
+ cuts = [lo + round(k * size / shades) for k in range(shades + 1)]
162
+ strips = []
163
+ for k in range(shades):
164
+ if along_x:
165
+ b = pya.Box(cuts[k], box.bottom, cuts[k + 1], box.top)
166
+ else:
167
+ b = pya.Box(box.left, cuts[k], box.right, cuts[k + 1])
168
+ strips.append(pya.Region(b) & pya.Region(poly))
169
+ if centres:
170
+ strips.sort(key=lambda r: min(r.bbox().center().distance(c) for c in centres))
171
+ return strips
172
+
173
+
174
+ def _depth(region: pya.Region, inside: pya.Region | None = None) -> int:
175
+ """Smallest d (dbu) at which ``region`` sized by −d is empty, or (``inside`` given) at which ``inside`` minus
176
+ ``region`` grown by d is empty (bisection)."""
177
+ lo, hi = 0, max(region.bbox().width(), region.bbox().height(), 1)
178
+ if inside is not None:
179
+ hi = max(hi, inside.bbox().width(), inside.bbox().height())
180
+ while hi - lo > 1:
181
+ mid = (lo + hi) // 2
182
+ rest = (inside - region.sized(mid)) if inside is not None else region.sized(-mid)
183
+ if rest.is_empty():
184
+ hi = mid
185
+ else:
186
+ lo = mid
187
+ return hi
188
+
189
+
190
+ def spacer_gradient_levels(spacer: pya.Region, dbu: float, shades: int = 3, centres: list | None = None) -> list:
191
+ """The spacer gradient (PDK ``spacer_1`` … ``spacer_<shades>``) of a spacer region, inner level first.
192
+
193
+ * rectangles: ``shades`` nested strips of width / ``shades`` across the short side; the strip nearest one of
194
+ ``centres`` (junction centres, ``DPoint`` µm or ``Point`` dbu; default: the spacer's own centre) is level 1;
195
+ * windows (a polygon with holes): ``shades`` rings of equal width from the hole outwards (level 1 at the hole);
196
+ * other (concentric / round) spacers: ``shades`` rings of equal width from the outside in, level 1 the core.
197
+
198
+ The levels lie inside the spacer and tile it (disjoint, union = spacer)."""
199
+ pts = []
200
+ for c in centres or []:
201
+ pts.append(c if isinstance(c, pya.Point) else pya.Point(round(c.x / dbu), round(c.y / dbu)))
202
+ if not pts and not spacer.is_empty():
203
+ pts = [spacer.bbox().center()]
204
+ levels = [pya.Region() for _ in range(shades)]
205
+ for poly in spacer.merged().each():
206
+ if poly.holes() == 0 and poly.is_box():
207
+ for k, strip in enumerate(_strips(poly, shades, pts)):
208
+ levels[k] += strip
209
+ continue
210
+ p = pya.Region(poly)
211
+ if poly.holes() > 0:
212
+ hull = pya.Region(pya.Polygon(list(poly.each_point_hull())))
213
+ holes = hull - p
214
+ t = _depth(holes, p)
215
+ grown = [holes.sized(round(k * t / shades)) for k in range(shades)] + [hull]
216
+ rings = [(grown[k + 1] - grown[k]) & p for k in range(shades)]
217
+ else:
218
+ t = _depth(p)
219
+ shrunk = [p] + [p.sized(-round(k * t / shades)) for k in range(1, shades)] + [pya.Region()]
220
+ rings = [shrunk[k] - shrunk[k + 1] for k in range(shades)][::-1] # core first, outer ring last
221
+ for k, ring in enumerate(rings):
222
+ levels[k] += ring
223
+ return [lev.merged() for lev in levels]
224
+
225
+
226
+ def spacer_gradient_rings(hsq: pya.Region, step: float, dbu: float, shades: int = 3) -> list:
227
+ """Earlier (pre-#4) gradient: nested rings *around* the spacer, ``step`` µm wide each, inner first. Kept for
228
+ reference only; the cells draw :func:`spacer_gradient_levels`."""
229
+ d = int(round(step / dbu))
230
+ grown = [hsq.sized(k * d).merged() for k in range(shades + 1)]
231
+ return [grown[k + 1] - grown[k] for k in range(shades)]
232
+
233
+
234
+ def insert_spacer(cell: pya.Cell, layout: pya.Layout, spacer: pya.Region, gradient: bool, centres=None) -> None:
235
+ """Draw a spacer on qcc ``hsq`` (50/0) and, with ``gradient``, its dose levels on ``spacer_1..3`` (51–53/0)."""
236
+ if spacer.is_empty():
237
+ return
238
+ spacer = spacer.merged()
239
+ cell.shapes(layout.layer(QCC_LAYERS["hsq"])).insert(spacer)
240
+ if gradient:
241
+ levels = spacer_gradient_levels(spacer, layout.dbu, _PROCESS.spacer_shades, centres)
242
+ for shade, level in enumerate(levels, 1):
243
+ if not level.is_empty():
244
+ cell.shapes(layout.layer(QCC_LAYERS[f"spacer_{shade}"])).insert(level)
245
+
246
+
247
+ class _TrilayerBase(Squid):
248
+ """Shared parameters of trilayer junctions (µm)."""
249
+
250
+ qcc_category = "junction"
251
+
252
+ finger_width = Param(pdt.TypeDouble, "Straight finger width (junction size)", 0.1, unit="μm")
253
+ second_finger_width = Param(pdt.TypeDouble, "Bent finger width (0 = same as straight)", 0.0, unit="μm")
254
+ window_width = Param(pdt.TypeDouble, "Exposure window width", 32.0, unit="μm")
255
+ window_height = Param(pdt.TypeDouble, "Exposure window height (= qubit gap it spans)", 20.0, unit="μm")
256
+ straight_finger_length = Param(pdt.TypeDouble, "Straight finger length", 3.2, unit="μm")
257
+ straight_finger_y = Param(pdt.TypeDouble, "Straight finger offset (legacy y)", -3.6, unit="μm")
258
+ bent_finger_length = Param(pdt.TypeDouble, "Bent finger length", 3.0, unit="μm")
259
+ bent_finger_y = Param(pdt.TypeDouble, "Bent finger offset (legacy y)", -2.5, unit="μm")
260
+ bent_pad_width = Param(pdt.TypeDouble, "Bent finger lead width", 1.0, unit="μm")
261
+ bent_shift = Param(pdt.TypeDouble, "Bent finger cell shift in y", 0.5, unit="μm")
262
+ with_hsq = Param(pdt.TypeBoolean, "Draw HSQ sidewall boxes", True)
263
+ hsq_width = Param(pdt.TypeDouble, "HSQ box width", 0.2, unit="μm")
264
+ hsq_extra = Param(pdt.TypeDouble, "HSQ box extra length", 0.2, unit="μm")
265
+ spacer_gradient = Param(
266
+ pdt.TypeBoolean,
267
+ "Spacer gradient: 51–53/0 dose levels inside the 50/0 spacer (width / 3 strips; rings for windows)",
268
+ _PROCESS.spacer_gradient,
269
+ )
270
+ lj_nH = Param(
271
+ pdt.TypeDouble,
272
+ "Size by the PDK junction rule for this L_J (SQUID: parallel total; 0 = use the finger widths)",
273
+ 0.0,
274
+ unit="nH",
275
+ )
276
+ clearer = Param(pdt.TypeBoolean, "Draw the CLEARER metal box under the windows (base_metal_addition)", False)
277
+ clearer_inset = Param(pdt.TypeDouble, "CLEARER inset from the window sides", 1.0, unit="μm")
278
+
279
+ def _fingers(self, n: int = 1) -> tuple[float, float]:
280
+ """(straight, bent) finger widths after the sizing rules (``lj_nH``, KQC ``junction_width``)."""
281
+ fw, sfw = self.finger_width, self.second_finger_width or self.finger_width
282
+ if self.lj_nH > 0:
283
+ from quantcore_circuits.circuit.bridges import fingers_for_lj # pylint: disable=import-outside-toplevel
284
+
285
+ fw, sfw, _ = fingers_for_lj(self.lj_nH, n, _PROCESS, self.second_finger_width or None)
286
+ elif self.junction_width >= _PROCESS.finger_range_um[0]:
287
+ fw = self.junction_width
288
+ sfw = self.second_finger_width or fw
289
+ return fw, sfw
290
+
291
+ def _widths(self, n: int = 1):
292
+ fw, sfw = self._fingers(n)
293
+ pad_width = 0.5 if fw <= 0.25 else 2 * fw + fw / 10
294
+ return fw, sfw, pad_width
295
+
296
+ def _insert_layers(self, straight, bent, hsq, centres=None):
297
+ """Fingers, spacer (+ gradient), CLEARER, protection and the frame refpoints. ``centres``: junction centres
298
+ (µm, final frame) that order the gradient levels."""
299
+ shift = pya.Trans(0, False, 0, int(round(self.window_height / 2 / self.layout.dbu)))
300
+ self.cell.shapes(self.get_layer("SIS_junction")).insert(straight.transformed(shift))
301
+ self.cell.shapes(self.get_layer("SIS_junction_2")).insert(bent.transformed(shift))
302
+ if self.with_hsq and not hsq.is_empty():
303
+ insert_spacer(self.cell, self.layout, hsq.transformed(shift), self.spacer_gradient, centres)
304
+ w, h = self.window_width, self.window_height
305
+ if self.clearer:
306
+ ci = min(self.clearer_inset, w / 2 - 0.5)
307
+ box = pya.DBox(-w / 2 + ci, 0, w / 2 - ci, h)
308
+ self.cell.shapes(self.get_layer("base_metal_addition")).insert(box.to_itype(self.layout.dbu))
309
+ self.add_protection(pya.DBox(-w / 2 - self.margin, -self.margin, w / 2 + self.margin, h + self.margin))
310
+ self.refpoints["origin_squid"] = pya.DPoint(0, 0)
311
+ self.refpoints["port_common"] = pya.DPoint(0, h)
312
+
313
+ @staticmethod
314
+ def _hsq_boxes(dbu, fw, sfw, y_off, overlap, hsq_width, extra):
315
+ lx = -fw / 2 - hsq_width + overlap
316
+ rx = fw / 2 - overlap
317
+ y0 = (-sfw + y_off - extra) / dbu / 2 # the legacy "/2" centres the box on the junction
318
+ y1 = (sfw + y_off + extra) / dbu / 2
319
+ return pya.Box(lx / dbu, y0, (lx + hsq_width) / dbu, y1), pya.Box(rx / dbu, y0, (rx + hsq_width) / dbu, y1)
320
+
321
+
322
+ class TrilayerJunction(_TrilayerBase):
323
+ """Single Nb trilayer cross junction (legacy ``xjc_junction_TL_mod.create_junction``)."""
324
+
325
+ hsq_overlap = Param(pdt.TypeDouble, "HSQ overlap onto the finger", 0.045, unit="μm")
326
+ bent_conn_height = Param(pdt.TypeDouble, "Bent finger connection height", 1.0, unit="μm")
327
+ bent_finger_x = Param(pdt.TypeDouble, "Bent finger offset (legacy x)", 0.2, unit="μm")
328
+
329
+ def build(self):
330
+ dbu = self.layout.dbu
331
+ fw, sfw, pad_width = self._widths()
332
+ w, h = self.window_width, self.window_height
333
+ straight = coerced_straight_finger(
334
+ dbu, pad_width, 3, fw, self.straight_finger_length, w, h, 0, self.straight_finger_y
335
+ )
336
+ straight.transform(pya.Trans(0, True, 0, 0)) # legacy inserts the straight finger mirrored
337
+ bent = coerced_bent_finger(
338
+ dbu,
339
+ self.bent_pad_width,
340
+ sfw,
341
+ self.bent_finger_length,
342
+ self.bent_conn_height,
343
+ w,
344
+ h - 1,
345
+ self.bent_finger_x,
346
+ self.bent_finger_y,
347
+ False,
348
+ )
349
+ bent.transform(pya.Trans(0, False, 0 / dbu, self.bent_shift / dbu))
350
+ hsq = pya.Region()
351
+ y_off = 2 * self.bent_finger_length / 3 + self.bent_conn_height + (self.bent_finger_y / 2) + 0.25
352
+ for box in self._hsq_boxes(dbu, fw, sfw, y_off, self.hsq_overlap, self.hsq_width, self.hsq_extra):
353
+ hsq.insert(box)
354
+ # junction overlap centre (for markers / DRC), legacy (0, 1.0) in the centred frame
355
+ centre = pya.DPoint(0, y_off / 2 + h / 2)
356
+ self._insert_layers(straight, bent, hsq, [centre])
357
+ self.refpoints["junction_1"] = centre
358
+
359
+
360
+ class TrilayerSquid(_TrilayerBase):
361
+ """Two trilayer junctions forming a SQUID (legacy ``xjc_squid_TL_mod.create_squid``)."""
362
+
363
+ junction_spacing = Param(pdt.TypeDouble, "Distance of each junction from the axis", 8.0, unit="μm")
364
+ hsq_overlap = Param(pdt.TypeDouble, "HSQ overlap onto the finger", 0.03, unit="μm")
365
+ lead_length = Param(pdt.TypeDouble, "Lead (pad) length of the straight fingers", 10.0, unit="μm")
366
+
367
+ def build(self):
368
+ dbu = self.layout.dbu
369
+ fw, sfw, pad_width = self._widths(2)
370
+ w, h, xs, ch = self.window_width, self.window_height, self.junction_spacing, self.lead_length
371
+ mirror = pya.Trans(0, True, 0, 0)
372
+ sargs = (dbu, pad_width, ch, fw, self.straight_finger_length, w, h)
373
+ s1 = coerced_straight_finger(*sargs, xs, self.straight_finger_y)
374
+ s2 = coerced_straight_finger(*sargs, -xs, self.straight_finger_y)
375
+ straight = s1.transformed(mirror) & s2.transformed(mirror) # legacy intersects the two negative windows
376
+ shift = pya.Trans(0, False, 0, self.bent_shift / dbu)
377
+ bargs = (dbu, self.bent_pad_width, sfw, self.bent_finger_length, ch, w, h - 1)
378
+ b1 = coerced_bent_finger(*bargs, xs, self.bent_finger_y, False)
379
+ b2 = coerced_bent_finger(*bargs, -xs, self.bent_finger_y, True)
380
+ bent = b1.transformed(shift) & b2.transformed(shift)
381
+ hsq = pya.Region()
382
+ y_off = 2 * self.bent_finger_length / 3 + self.bent_finger_y + ch / 4
383
+ for box in self._hsq_boxes(dbu, fw, sfw, y_off, self.hsq_overlap, self.hsq_width, self.hsq_extra):
384
+ hsq.insert(box.transformed(pya.Trans(0, False, xs / dbu, 0)))
385
+ hsq.insert(box.transformed(pya.Trans(0, False, -xs / dbu, 0)))
386
+ centres = [pya.DPoint(xs, y_off / 2 + h / 2), pya.DPoint(-xs, y_off / 2 + h / 2)]
387
+ self._insert_layers(straight, bent, hsq, centres)
388
+ self.refpoints["junction_1"], self.refpoints["junction_2"] = centres
389
+
390
+
391
+ _NOMINAL = _PROCESS.nominal_fingers_um
392
+
393
+
394
+ def _squid_nominal() -> tuple[float, float]:
395
+ """Fingers of each junction of the PDK nominal SQUID. The R_n window applies to the whole SQUID
396
+ (2026-11-13), so a symmetric SQUID of R_n = ``rn_nominal_kohm`` has two junctions of twice that (90 kΩ each:
397
+ 0.25 × 0.6 µm on the default rule)."""
398
+ from quantcore_circuits.circuit.bridges import fingers_for_lj, lj_from_rn # pylint: disable=C0415
399
+
400
+ straight, bent, _ = fingers_for_lj(lj_from_rn(_PROCESS.rn_nominal_kohm * 1e3, _PROCESS.gap_meV), 2, _PROCESS)
401
+ return straight, bent
402
+
403
+
404
+ _SQUID_NOMINAL = _squid_nominal()
405
+
406
+
407
+ class QuantcoreJunction(TrilayerJunction):
408
+ """The Quantcore PDK junction (``junction_type: "Quantcore Junction"`` in any KQC / Quantcore qubit): a
409
+ TrilayerJunction with the PDK nominal fingers (straight 0.5 × bent 0.6 µm → R_n = 45 kΩ, L_J ≈ 6.7 nH on the
410
+ default rule), the CLEARER box and the spacer gradient on. Size it with ``lj_nH`` or, from a KQC qubit, with the
411
+ qubit's ``junction_width`` (straight finger, µm)."""
412
+
413
+ qcc_category = "junction"
414
+
415
+ finger_width = Param(pdt.TypeDouble, "Straight finger width (junction size)", _NOMINAL[0], unit="μm")
416
+ second_finger_width = Param(pdt.TypeDouble, "Bent finger width (0 = same as straight)", _NOMINAL[1], unit="μm")
417
+ clearer = Param(pdt.TypeBoolean, "Draw the CLEARER metal box under the windows (base_metal_addition)", True)
418
+
419
+
420
+ class QuantcoreSquid(TrilayerSquid):
421
+ """The Quantcore PDK SQUID (``junction_type: "Quantcore Squid"``): a symmetric TrilayerSquid whose **whole SQUID**
422
+ sits at the PDK nominal R_n (2026-11-13: the 40–50 kΩ window is for the SQUID; its junctions are higher):
423
+ two junctions of 90 kΩ each (0.25 × 0.6 µm), parallel 45 kΩ, L_J ≈ 6.7 nH at zero flux. CLEARER and gradient on.
424
+ ``lj_nH`` sizes the parallel total."""
425
+
426
+ qcc_category = "junction"
427
+
428
+ finger_width = Param(pdt.TypeDouble, "Straight finger width (junction size)", _SQUID_NOMINAL[0], unit="μm")
429
+ second_finger_width = Param(
430
+ pdt.TypeDouble, "Bent finger width (0 = same as straight)", _SQUID_NOMINAL[1], unit="μm"
431
+ )
432
+ clearer = Param(pdt.TypeBoolean, "Draw the CLEARER metal box under the windows (base_metal_addition)", True)
433
+
434
+
435
+ def trilayer_classes() -> dict:
436
+ """KQC junction-library name → class, for the trilayer junction cells (``"Quantcore Junction"`` → ...)."""
437
+ from kqcircuits.util.library_helper import to_library_name # pylint: disable=import-outside-toplevel
438
+
439
+ from quantcore_circuits.layouts.junctions import legacy_junctions # pylint: disable=import-outside-toplevel
440
+
441
+ classes = [TrilayerJunction, TrilayerSquid, QuantcoreJunction, QuantcoreSquid]
442
+ classes += [legacy_junctions.TrilayerJunctionHSQ, legacy_junctions.TrilayerSquidHSQ, legacy_junctions.SquidV0]
443
+ classes += [legacy_junctions.TrilayerJunctionCompact]
444
+ return {to_library_name(c.__name__): c for c in classes}
445
+
446
+
447
+ def is_squid_class(cls) -> bool:
448
+ return issubclass(cls, TrilayerSquid) or cls.__name__ == "SquidV0"
449
+
450
+
451
+ def trilayer_junction_values(junction_type: str, params: dict | None = None, pdk=None):
452
+ """Electrical values (:class:`~quantcore_circuits.circuit.bridges.JunctionValues`) of the junction a trilayer
453
+ cell draws for ``params`` (``lj_nH``, ``finger_width``, ``second_finger_width``, KQC ``junction_width``), on the
454
+ PDK rule; None when ``junction_type`` is not a trilayer cell."""
455
+ from quantcore_circuits.circuit.bridges import ( # pylint: disable=import-outside-toplevel
456
+ fingers_for_lj,
457
+ junction_from_fingers,
458
+ )
459
+
460
+ cls = trilayer_classes().get(str(junction_type))
461
+ if cls is None:
462
+ return None
463
+ schema = cls.get_schema()
464
+ p = {k: v.default for k, v in schema.items()} | dict(params or {})
465
+ n = 2 if is_squid_class(cls) else 1
466
+ fw, sfw = float(p["finger_width"]), float(p["second_finger_width"] or p["finger_width"])
467
+ if float(p.get("lj_nH") or 0) > 0:
468
+ fw, sfw, _ = fingers_for_lj(float(p["lj_nH"]), n, pdk or _PROCESS, float(p["second_finger_width"]) or None)
469
+ elif float(p.get("junction_width") or 0) >= _PROCESS.finger_range_um[0]:
470
+ fw = float(p["junction_width"])
471
+ sfw = float(p["second_finger_width"] or fw)
472
+ return junction_from_fingers(fw, sfw, n, pdk or _PROCESS)
473
+
474
+
475
+ # ---- placing a trilayer junction across a gap (Metal junction lines, TwoPadTransmon) -----------------------------
476
+ MAX_WINDOW_WIDTH = 32.0 # µm, the trilayer cells' default window width
477
+
478
+
479
+ def _json_dict(text) -> dict:
480
+ if isinstance(text, dict):
481
+ return dict(text)
482
+ value = json.loads(str(text or "").strip() or "{}")
483
+ if not isinstance(value, dict):
484
+ raise ValueError(f"junction_params must be a JSON dict, got {value!r}")
485
+ return value
486
+
487
+
488
+ def _span(gap: pya.Region, origin: pya.DPoint, u: pya.DVector, t0: float, t1: float, at: float, dbu: float):
489
+ """Extent (t_lo, t_hi) along unit vector ``u`` from ``origin`` of the piece of ``gap`` that a thin probe from
490
+ ``t0`` to ``t1`` crosses at ``t = at``; None when ``at`` is not in the gap."""
491
+ probe = pya.DPath([origin + u * t0, origin + u * t1], 2 * dbu, 0, 0).polygon().to_itype(dbu)
492
+ best = None
493
+ for poly in (gap & pya.Region(probe)).each():
494
+ ts = [((pt.x * dbu - origin.x) * u.x + (pt.y * dbu - origin.y) * u.y) for pt in poly.each_point_hull()]
495
+ lo, hi = min(ts), max(ts)
496
+ if lo - 2 * dbu <= at <= hi + 2 * dbu:
497
+ best = (lo, hi)
498
+ return best
499
+
500
+
501
+ def trilayer_on_line(gap: pya.Region, a: pya.DPoint, b: pya.DPoint, dbu: float) -> tuple[pya.DCplxTrans, float, float]:
502
+ """(transformation, window height, window width) of a trilayer junction cell bridging the gap that the
503
+ junction line ``a`` (island side) → ``b`` crosses: ``origin_squid`` on the ``b``-side gap edge, ``port_common`` on
504
+ the ``a``-side edge, the window as wide as fits (≤ 32 µm, 1 µm inside the gap on both sides)."""
505
+ d = a - b
506
+ length = d.length()
507
+ if length <= 0:
508
+ raise ValueError("junction line has zero length")
509
+ u = d / length
510
+ reach = length + 100.0
511
+ span = _span(gap, b, u, -reach, reach, length / 2, dbu)
512
+ t_lo, t_hi = span if span is not None else (0.0, length)
513
+ origin = b + u * t_lo
514
+ height = t_hi - t_lo
515
+ v = pya.DVector(-u.y, u.x)
516
+ mid = origin + u * (height / 2)
517
+ side = _span(gap, mid, v, -100.0, 100.0, 0.0, dbu)
518
+ width = MAX_WINDOW_WIDTH if side is None else min(MAX_WINDOW_WIDTH, 2 * min(-side[0], side[1]) - 2.0)
519
+ angle = math.degrees(math.atan2(u.y, u.x)) - 90.0
520
+ return pya.DCplxTrans(1, angle, False, origin.x, origin.y), height, width
521
+
522
+
523
+ def place_trilayer(element, jtype: str, gap: pya.Region, a: pya.DPoint, b: pya.DPoint, junction_params="{}"):
524
+ """Insert the trilayer cell ``jtype`` (a Junction Library name, e.g. ``"Quantcore Junction"``) into
525
+ ``element`` across the gap of the junction line a (island side, ``port_common``) → b (``origin_squid``), with
526
+ the CLEARER on and ``junction_params`` (JSON / dict) passed on; returns the window footprint (dbu region).
527
+ Raises ``ValueError`` for an unknown type or parameter."""
528
+ cls = trilayer_classes().get(jtype)
529
+ if cls is None:
530
+ raise ValueError(
531
+ f"junction_type {jtype!r} is not a trilayer junction cell; use one of {sorted(trilayer_classes())}"
532
+ )
533
+ trans, height, width = trilayer_on_line(gap, a, b, element.layout.dbu)
534
+ params = {"window_height": height, "window_width": width, "clearer": True, **_json_dict(junction_params)}
535
+ unknown = sorted(set(params) - set(cls.get_schema()))
536
+ if unknown:
537
+ raise ValueError(f"junction_params: unknown parameter(s) {unknown} for {cls.__name__}")
538
+ cell = cls.create(element.layout, face_ids=element.face_ids, **params)
539
+ element.insert_cell(cell, trans)
540
+ box = pya.DBox(-width / 2, 0, width / 2, height)
541
+ return pya.Region((trans * pya.DPolygon(box)).to_itype(element.layout.dbu))
@@ -0,0 +1,105 @@
1
+ """Quantum Metal components as Quantcore/KQC cells: ``cell: "metal:<Class>"``.
2
+
3
+ >>> d.add("Q1", "metal:TransmonPocket", at=(2000, 2000), pad_width=455,
4
+ ... connection_pads={"a": {"loc_W": 1, "loc_H": 1}, "b": {"loc_W": -1, "loc_H": -1}})
5
+ >>> d.add("L1", "metal:LaunchpadWirebond", at=(500, 2000), rot=180) # port "tie"
6
+
7
+ * ``params`` are the Metal options (flat, nested dicts allowed); bare numbers on length options are µm, strings
8
+ with units (``"0.455mm"``) and Metal design variables (``"cpw_width"``) pass through. ``pos_x``/``pos_y``/
9
+ ``orientation`` are rejected: components are built at the origin, the placement rotates them.
10
+ * Ports are the Metal pins (name, middle, outward normal, width/gap); junction lines give ``port_squid_a/b``.
11
+ * :func:`metal_cell` returns the per-class subclass (``MetalTransmonPocket``, an attribute of this module, so the
12
+ plan's ``cell_ref`` re-imports); all of them build the one registered ``Metal Component`` PCell
13
+ (``metal_class`` + ``options`` JSON), which is also usable directly in the KLayout GUI.
14
+ * Metal routes (``RouteStraight``, ``RouteMeander``, ...) are not cells; :data:`ROUTE_MAPPING` gives the qcc route
15
+ to use instead.
16
+ """
17
+
18
+ from __future__ import annotations
19
+
20
+ import sys
21
+
22
+ from kqcircuits.util.parameters import Param, pdt
23
+
24
+ from quantcore_circuits.layouts.metal.component import JUNCTION_CLASSES, MetalComponent
25
+ from quantcore_circuits.layouts.metal.geometry import (
26
+ ROUTE_MAPPING,
27
+ canonical_class_name,
28
+ find_class_info,
29
+ flat_options,
30
+ metal_geometry,
31
+ normalise_options,
32
+ parse_um,
33
+ qlibrary_index,
34
+ template_options,
35
+ user_options,
36
+ )
37
+
38
+ PREFIX = "metal:"
39
+ _CLASSES: dict[str, type] = {}
40
+
41
+
42
+ def class_attr_name(metal_class: str) -> str:
43
+ """Name of the generated subclass for a Metal class (``TransmonPocket`` → ``MetalTransmonPocket``)."""
44
+ base = metal_class.rsplit(".", 1)[-1]
45
+ return f"Metal{base[:1].upper()}{base[1:]}"
46
+
47
+
48
+ def metal_cell(metal_class: str) -> type[MetalComponent]:
49
+ """The (cached) MetalComponent subclass for a Metal class name (``"TransmonPocket"``) or dotted path."""
50
+ name = canonical_class_name(metal_class)
51
+ if name in _CLASSES:
52
+ return _CLASSES[name]
53
+ info = find_class_info(name)
54
+ if info is not None and info.is_route:
55
+ raise ValueError(f"metal:{name} is a Metal route, not a cell: use a qcc {ROUTE_MAPPING.get(name, 'route')}")
56
+ attr = class_attr_name(name)
57
+ namespace = {
58
+ "__module__": __name__,
59
+ "__qualname__": attr,
60
+ "__doc__": f"Quantum Metal ``{name}`` as a KQC element. {info.description if info else ''}".strip(),
61
+ "qcc_metal_class": name,
62
+ "qcc_category": info.category if info else "other",
63
+ "metal_class": Param(pdt.TypeString, "Quantum Metal component", name, hidden=True),
64
+ }
65
+ cls = type(attr, (MetalComponent,), namespace)
66
+ _CLASSES[name] = cls
67
+ setattr(sys.modules[__name__], attr, cls)
68
+ return cls
69
+
70
+
71
+ def resolve(ref: str) -> type[MetalComponent]:
72
+ """``"metal:<Class>"`` → its MetalComponent subclass."""
73
+ if not ref.startswith(PREFIX):
74
+ raise ValueError(f"not a Metal cell reference: {ref!r}")
75
+ return metal_cell(ref[len(PREFIX) :])
76
+
77
+
78
+ def __getattr__(attr: str):
79
+ """``MetalTransmonPocket`` etc. resolve on first access (the plan stores ``cell_ref`` = this module + name)."""
80
+ if attr.startswith("Metal") and len(attr) > 5:
81
+ base = attr[5:]
82
+ for candidate in (base, base[:1].lower() + base[1:]):
83
+ info = find_class_info(candidate)
84
+ if info is not None and class_attr_name(info.name) == attr:
85
+ return metal_cell(info.name)
86
+ raise AttributeError(f"module {__name__!r} has no attribute {attr!r}")
87
+
88
+
89
+ __all__ = [
90
+ "JUNCTION_CLASSES",
91
+ "PREFIX",
92
+ "ROUTE_MAPPING",
93
+ "MetalComponent",
94
+ "class_attr_name",
95
+ "find_class_info",
96
+ "flat_options",
97
+ "metal_cell",
98
+ "metal_geometry",
99
+ "normalise_options",
100
+ "parse_um",
101
+ "qlibrary_index",
102
+ "resolve",
103
+ "template_options",
104
+ "user_options",
105
+ ]