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,1139 @@
1
+ """Parametric-amplifier cells (agent ``amplifiers``, design decision #45): Quantcore re-drawings of the open JPA / TWPA
2
+ layouts listed in ``components/Open Superconducting Device Layouts.md`` ("Parametric amplifiers"), on the PDK stack
3
+ (negative mask: the etch is drawn on ``base_metal_gap_wo_grid``, PDK 1/0) with Nb trilayer junctions.
4
+
5
+ * :class:`SquidTermination` — QPDK ``qpdk/cells/parametric_amplifier.py::squid_termination`` (+ the pump line of
6
+ ``cpw_jpa``): a CPW lead that ends in an etched pocket bridged by a trilayer SQUID to ground, and a shorted CPW
7
+ pump / flux line running past the ground side of the SQUID (Yamamoto et al. 2008; Pogorzalek et al. 2017).
8
+ * :class:`LumpedJpa` — the lumped JPAs of twpa-sim (``src/twpa/layout/generate.py``, families ``jpa`` and
9
+ ``squid_jpa``, MIT): one junction or SQUID shunted by a capacitor, here a planar interdigital capacitor (IDC)
10
+ between an island and the ground (the PDK has no MIM layer). ``coupling="capacitive"``: the island's CPW lead is
11
+ the port (put a coupling capacitor cell in front); ``coupling="inductive"``: a tapped-inductor coupling (the
12
+ junction's ground side lands on a narrow strip shared with the signal line; twpa-sim draws a pickup loop).
13
+ * :class:`JtwpaChain` — the 4WM JTWPA of twpa-sim (``jtwpa4wm``) and the resonantly phase-matched JTWPA of the QPDK
14
+ JosephsonCircuits notebook (O'Brien et al. 2014): a series chain of trilayer junctions between CPW centre-line
15
+ islands, each island shunted to ground by interdigital fingers, a lumped LC resonator on every
16
+ ``resonator_every``-th node (coupling IDC, pad, meander inductor to ground).
17
+ * :class:`KiTwpaSerpentine` — the KI-TWPA serpentine of twpa-sim ``src/twpa/layout/kit.py`` (a port of the NY CREATES
18
+ research geometry, NbN): a 0.58 µm spine with 75.5 µm capacitive fingers (27.5 µm on the loaded cells), straight
19
+ rows joined by U-turns whose spine width is matched in sheet squares, tapered launches to the chip CPW.
20
+
21
+ Sources were read, never imported or run (``build/external/twpa-sim``, ``build/external/quantum-rf-pdk``).
22
+
23
+ LOM (``qcc_lom`` on each class): the SQUID termination enters the λ/4 line as its inductive equivalent length (as
24
+ :class:`~quantcore_circuits.layouts.others.qpdk_cells.NeckTermination`); the lumped JPA is an island with its IDC
25
+ capacitance, the junction / SQUID and the coupling; the JTWPA chain is one node per island (junctions in series,
26
+ shunt C, resonators); the KI serpentine is one conductor (a wire between its ports) with its electrical ladder from
27
+ :meth:`KiTwpaSerpentine.qcc_ladder` (PDK film kinetic inductance via :mod:`quantcore_circuits.circuit.kinetic`).
28
+ """
29
+
30
+ from __future__ import annotations
31
+
32
+ import json
33
+ import math
34
+
35
+ from kqcircuits.elements.element import Element
36
+ from kqcircuits.pya_resolver import pya
37
+ from kqcircuits.util.parameters import Param, pdt
38
+
39
+ PHI0 = 2.067833848e-15 # Wb
40
+ _JUNCTIONS = ["Quantcore Junction", "Quantcore Squid", "Trilayer Junction", "Trilayer Squid", "Sim", "No Squid"]
41
+
42
+
43
+ # ---- shared helpers ------------------------------------------------------------------------------------------------
44
+ def _box(dbu, x0, y0, x1, y1) -> pya.Box:
45
+ return pya.DBox(min(x0, x1), min(y0, y1), max(x0, x1), max(y0, y1)).to_itype(dbu)
46
+
47
+
48
+ def _region(dbu, *boxes) -> pya.Region:
49
+ out = pya.Region()
50
+ for b in boxes:
51
+ out.insert(_box(dbu, *b))
52
+ return out
53
+
54
+
55
+ def _json_params(params: dict) -> dict:
56
+ """design.json params → PCell params: a ``junction_params`` dict becomes its JSON string (validated)."""
57
+ from quantcore_circuits.layouts.junctions.trilayer import _json_dict # pylint: disable=import-outside-toplevel
58
+
59
+ params = dict(params)
60
+ jp = params.get("junction_params")
61
+ if isinstance(jp, dict):
62
+ params["junction_params"] = json.dumps(jp, sort_keys=True)
63
+ elif isinstance(jp, str):
64
+ _json_dict(jp)
65
+ return params
66
+
67
+
68
+ def _has_junction(jtype: str) -> bool:
69
+ return str(jtype or "") not in ("", "No Squid", "Sim")
70
+
71
+
72
+ def _place_junction(element, jtype, gap: pya.Region, island: pya.DPoint, ground: pya.DPoint, params) -> None:
73
+ from quantcore_circuits.layouts.junctions.trilayer import place_trilayer # pylint: disable=import-outside-toplevel
74
+
75
+ try:
76
+ place_trilayer(element, jtype, gap, island, ground, params)
77
+ except ValueError as e:
78
+ element.raise_error_on_cell(f"{type(element).__name__}: {e}")
79
+
80
+
81
+ def cpw_gaps(dbu, x0, x1, a, b, axis="x", at=0.0) -> pya.Region:
82
+ """The two gap strips of a straight CPW (centre ``a``, gaps ``b``) from ``x0`` to ``x1`` along ``axis`` (dbu)."""
83
+ lo, hi = min(x0, x1), max(x0, x1)
84
+ if axis == "x":
85
+ return _region(dbu, (lo, at + a / 2, hi, at + a / 2 + b), (lo, at - a / 2 - b, hi, at - a / 2))
86
+ return _region(dbu, (at + a / 2, lo, at + a / 2 + b, hi), (at - a / 2 - b, lo, at - a / 2, hi))
87
+
88
+
89
+ def shorted_line(dbu, x_axis, y_short, length, a, b) -> pya.Region:
90
+ """Etch of a vertical CPW that arrives from −y and is shorted at ``y_short`` (its gaps stop there): the pump /
91
+ flux line of QPDK's ``cpw_jpa`` (``straight_shorted``)."""
92
+ return cpw_gaps(dbu, y_short - length, y_short, a, b, axis="y", at=x_axis)
93
+
94
+
95
+ def interdigital(dbu, x0, n, wf, gf, y_root_a, y_root_b) -> tuple[pya.Region, float]:
96
+ """Fingers of an interdigital capacitor between two electrodes along y: electrode A's fingers rise from
97
+ ``y_root_a`` to ``y_root_b − gf``, B's hang from ``y_root_b`` to ``y_root_a + gf`` (either order of the roots),
98
+ alternating along +x from ``x0`` (A first, ``n`` fingers in all, pitch ``wf + gf``). Returns (A ∪ B fingers as
99
+ metal, x of the last finger's far edge)."""
100
+ out = pya.Region()
101
+ s = 1.0 if y_root_b > y_root_a else -1.0
102
+ x = x0
103
+ for i in range(int(n)):
104
+ if i % 2 == 0:
105
+ out.insert(_box(dbu, x, y_root_a, x + wf, y_root_b - s * gf))
106
+ else:
107
+ out.insert(_box(dbu, x, y_root_b, x + wf, y_root_a + s * gf))
108
+ x += wf + gf
109
+ return out, x - gf
110
+
111
+
112
+ def meander_strip(dbu, x0, x1, y0, y1, width, turns) -> tuple[pya.Region, float]:
113
+ """A strip of ``width`` from (centre x, ``y0``) to (centre x, ``y1``) meandering ``turns`` times across
114
+ [x0, x1] (vertical runs, horizontal legs): the lumped inductors. Returns (metal, developed centre-line length)."""
115
+ turns = max(int(turns), 0)
116
+ if turns == 0:
117
+ xm = (x0 + x1) / 2
118
+ path = [pya.DPoint(xm, y0), pya.DPoint(xm, y1)]
119
+ else:
120
+ lo, hi = x0 + width / 2, x1 - width / 2
121
+ step = (y1 - y0) / (turns + 1)
122
+ x = lo
123
+ path = [pya.DPoint(x, y0)]
124
+ for k in range(turns): # rise one step, cross to the other side
125
+ y = y0 + (k + 1) * step
126
+ path.append(pya.DPoint(x, y))
127
+ x = hi if x == lo else lo
128
+ path.append(pya.DPoint(x, y))
129
+ path.append(pya.DPoint(x, y1))
130
+ length = sum((path[i + 1] - path[i]).length() for i in range(len(path) - 1))
131
+ dpath = pya.DPath(path, width, width / 2, width / 2)
132
+ return pya.Region(dpath.polygon().to_itype(dbu)), length
133
+
134
+
135
+ def drawn_junction_values(jtype: str, junction_params) -> tuple[float | None, float, str]:
136
+ """(L_J nH, C_J fF, source) of the trilayer cell ``jtype`` drawn with ``junction_params`` (PDK junction rule;
137
+ SQUID: the parallel total at zero flux); (None, 0, …) for ``Sim`` / no junction."""
138
+ from quantcore_circuits.layouts.junctions.trilayer import ( # pylint: disable=import-outside-toplevel
139
+ _json_dict,
140
+ trilayer_junction_values,
141
+ )
142
+
143
+ if not _has_junction(jtype):
144
+ return None, 0.0, f"no junction drawn ({jtype!r})"
145
+ values = trilayer_junction_values(str(jtype), _json_dict(junction_params))
146
+ if values is None:
147
+ return None, 0.0, f"{jtype!r} is not a trilayer cell"
148
+ return round(values.lj_nH, 5), round(values.cj_fF, 3), f"drawn {jtype} (PDK junction rule)"
149
+
150
+
151
+ def instance_junction(inst, p: dict) -> tuple[float | None, float, str]:
152
+ """(L_J nH, C_J fF, source): the design's ``junction`` (first entry of a list) wins over the drawn values."""
153
+ j = getattr(inst, "junction", None)
154
+ if j is not None and j.Lj_nH is not None:
155
+ lj = j.Lj_nH[0] if isinstance(j.Lj_nH, list) else j.Lj_nH
156
+ cj = (j.Cj_fF[0] if isinstance(j.Cj_fF, list) else j.Cj_fF) or 0.0
157
+ return float(lj), float(cj), "design"
158
+ return drawn_junction_values(p.get("junction_type"), p.get("junction_params") or "{}")
159
+
160
+
161
+ def _pdk_obj(pdk):
162
+ if pdk is None or isinstance(pdk, str):
163
+ from quantcore_circuits.pdk import DEFAULT_PDK, get_pdk # pylint: disable=import-outside-toplevel
164
+
165
+ return get_pdk(pdk or DEFAULT_PDK)
166
+ return pdk
167
+
168
+
169
+ def cpw_inductance_per_m(a_um: float, b_um: float, pdk=None, f_GHz: float = 6.5) -> float:
170
+ """L' (H/m) of a CPW on the PDK stack, geometric + the film's kinetic inductance (``cpw_properties``)."""
171
+ from quantcore_circuits.analysis.synthesis import cpw_properties # pylint: disable=import-outside-toplevel
172
+
173
+ q = cpw_properties(f_GHz, a_um, b_um, _pdk_obj(pdk).name)
174
+ return q["Z0_ohm"] / q["vp_m_s"]
175
+
176
+
177
+ def _f(x, default=0.0) -> float:
178
+ try:
179
+ return float(x)
180
+ except (TypeError, ValueError):
181
+ return float(default)
182
+
183
+
184
+ # ---- SQUID termination (QPDK) ---------------------------------------------------------------------------------------
185
+ class SquidTermination(Element):
186
+ """CPW lead shorted to ground through a trilayer SQUID, with a shorted pump / flux line (QPDK ``squid_termination``
187
+ and the pump of ``cpw_jpa``).
188
+
189
+ Port ``a`` at the origin faces −x (CPW ``a``/``b``); the lead runs to x = ``lead_length`` and ends on a landing
190
+ ``head`` in an etched pocket ``pocket_width`` wide; a head wider than the CPW (``a`` + 2 ``b``) gets ``b`` of pocket
191
+ before it as well (the pocket then starts at ``lead_length`` − ``b`` around the centre conductor), so the lead
192
+ reaches ground only through the junction. The junction gap ``junction_gap`` beyond the head is bridged by the
193
+ junction cell ``junction_type`` (default
194
+ the PDK ``Quantcore Squid``; its island side lands on the lead end, its ground side on the far pocket edge;
195
+ refpoints ``port_squid_a`` / ``port_squid_b``). With ``pump_line`` a CPW (``a``/``b``) runs along +y past the
196
+ ground side of the SQUID, ``pump_gap`` of ground between the pocket and its gap, shorted ``pump_offset`` beyond the
197
+ SQUID axis; its port ``pump`` is ``pump_length`` below the short and faces −y. The pump current and its return
198
+ through that ground strip thread the SQUID loop (mutual M: extract it by EM; QPDK's SAX model has none either).
199
+
200
+ LOM: the SQUID is the λ/4 line's shorted end at its inductive equivalent length ℓ_eq = lead + L_s(Φ)/L' (L' of the
201
+ a/b CPW incl. the film's kinetic inductance), so f_r = f_λ/4 / (1 + L_s/L'ℓ) (Yamamoto 2008; QPDK); L_s(Φ) =
202
+ L_s0/|cos πΦ/Φ0| at the static bias ``flux_phi0``. The Kerr / 3WM nonlinearity is not in the lumped circuit:
203
+ :mod:`quantcore_circuits.analysis.amplifiers` takes it from the same values.
204
+ """
205
+
206
+ lead_length = Param(pdt.TypeDouble, "CPW lead length", 10, unit="μm")
207
+ head = Param(pdt.TypeList, "Landing head at the lead end in the pocket (length, width), µm", [6, 28])
208
+ junction_gap = Param(pdt.TypeDouble, "Pocket length along the lead (the junction window height)", 20, unit="μm")
209
+ pocket_width = Param(pdt.TypeDouble, "Pocket width across the lead", 34, unit="μm")
210
+ junction_type = Param(
211
+ pdt.TypeString, "Junction across the pocket (trilayer cell)", "Quantcore Squid", choices=_JUNCTIONS
212
+ )
213
+ junction_params = Param(pdt.TypeString, "Trilayer junction cell parameters (JSON dict)", "{}")
214
+ flux_phi0 = Param(pdt.TypeDouble, "Static flux bias of the SQUID (LOM)", 0.0, unit="Φ0")
215
+ pump_line = Param(pdt.TypeBoolean, "Draw the shorted pump / flux line", True)
216
+ pump_length = Param(pdt.TypeDouble, "Pump line length (port to short)", 200, unit="μm")
217
+ pump_gap = Param(pdt.TypeDouble, "Ground strip between the pocket and the pump line gap", 2, unit="μm")
218
+ pump_offset = Param(pdt.TypeDouble, "Pump short beyond the SQUID axis", 20, unit="μm")
219
+
220
+ qcc_category = "termination"
221
+
222
+ @classmethod
223
+ def qcc_params(cls, params: dict) -> dict:
224
+ return _json_params(params)
225
+
226
+ def _pump_axis(self) -> float:
227
+ return self._far() + self.pump_gap + self.b + self.a / 2
228
+
229
+ def _far(self) -> float:
230
+ return self.lead_length + _f(list(self.head)[0]) + self.junction_gap
231
+
232
+ def build(self):
233
+ dbu = self.layout.dbu
234
+ a, b, lead, g = self.a, self.b, self.lead_length, self.junction_gap
235
+ w = max(self.pocket_width, a + 2 * b)
236
+ if lead < 0 or g <= 0:
237
+ self.raise_error_on_cell("SquidTermination: lead_length must be >= 0 and junction_gap > 0")
238
+ etch = cpw_gaps(dbu, 0, lead, a, b) if lead > 0 else pya.Region()
239
+ h_len, h_w = (_f(v) for v in list(self.head)[:2])
240
+ if h_w > w - 2 or h_len < 0:
241
+ self.raise_error_on_cell("SquidTermination: head must fit the pocket (width <= pocket_width - 2)")
242
+ x_j = lead + h_len # island side of the junction gap
243
+ # A head wider than the CPW (a + 2b) would touch the ground beside the lead at x = lead and short the lead past
244
+ # the SQUID: the pocket then starts b before the head, around the lead's centre conductor, so the head is
245
+ # surrounded by etch and the lead reaches ground only through the junction.
246
+ x_back = lead - b if h_w > a + 2 * b else lead
247
+ pocket = _region(dbu, (x_back, -w / 2, x_j + g, w / 2))
248
+ etch += pocket - _region(dbu, (lead, -h_w / 2, x_j, h_w / 2), (x_back, -a / 2, lead, a / 2))
249
+ pocket = _region(dbu, (x_j, -w / 2, x_j + g, w / 2)) # the junction gap
250
+ if self.pump_line:
251
+ if self.pump_length <= self.pump_offset + w / 2:
252
+ self.raise_error_on_cell("SquidTermination: pump_length must reach below the pocket")
253
+ x_p = self._pump_axis()
254
+ etch += shorted_line(dbu, x_p, self.pump_offset, self.pump_length, a, b)
255
+ self.add_port("pump", pya.DPoint(x_p, self.pump_offset - self.pump_length), pya.DVector(0, -1))
256
+ self.refpoints["short"] = pya.DPoint(x_p, self.pump_offset)
257
+ etch.merge()
258
+ self.cell.shapes(self.get_layer("base_metal_gap_wo_grid")).insert(etch)
259
+ self.add_protection(pya.Region(etch.bbox()).sized(self.margin / dbu))
260
+ self.add_port("a", pya.DPoint(0, 0), pya.DVector(-1, 0))
261
+ island, ground = pya.DPoint(x_j, 0), pya.DPoint(x_j + g, 0)
262
+ self.refpoints["port_squid_a"], self.refpoints["port_squid_b"] = island, ground
263
+ self.refpoints["squid"] = pya.DPoint(x_j + g / 2, 0)
264
+ if _has_junction(self.junction_type):
265
+ _place_junction(self, self.junction_type, pocket, island, ground, self.junction_params)
266
+
267
+ @classmethod
268
+ def qcc_squid(cls, params: dict, inst=None) -> dict:
269
+ """{L_s0 nH (zero flux), L_s nH (at ``flux_phi0``), C_J fF, source}: the termination's SQUID."""
270
+ from quantcore_circuits.layouts.others.keepout import full_params # pylint: disable=import-outside-toplevel
271
+
272
+ p = full_params(cls, params)
273
+ lj, cj, source = (
274
+ instance_junction(inst, p)
275
+ if inst is not None
276
+ else drawn_junction_values(p["junction_type"], p["junction_params"])
277
+ )
278
+ squid = "squid" in str(p["junction_type"]).lower()
279
+ phi = _f(p.get("flux_phi0"))
280
+ ls = None if lj is None else (lj / max(abs(math.cos(math.pi * phi)), 1e-6) if squid else lj)
281
+ return {"Ls0_nH": lj, "Ls_nH": ls, "Cj_fF": cj, "flux_phi0": phi, "squid": squid, "source": source}
282
+
283
+ @classmethod
284
+ def qcc_lom(cls, name: str, inst, pdk):
285
+ """The lead is the routed line's last section; the SQUID adds L_s/L' of electrical length (shorted end)."""
286
+ from quantcore_circuits.lom.fragment import Fragment, Line, cell_params # pylint: disable=C0415
287
+
288
+ p = cell_params(inst)
289
+ a, b = _f(p.get("a"), 10), _f(p.get("b"), 6)
290
+ sq = cls.qcc_squid(p, inst)
291
+ l_per_m = cpw_inductance_per_m(a, b, pdk)
292
+ extra = (sq["Ls_nH"] or 0.0) * 1e-9 / l_per_m * 1e6
293
+ frag = Fragment(nodes={"lead": {"island": f"{name}.lead"}}, port_nodes={"a": "lead"})
294
+ if p.get("pump_line", True):
295
+ frag.port_nodes["pump"] = "control:flux"
296
+ length = _f(p.get("lead_length"), 10) + _f(list(p.get("head") or [6])[0]) + extra
297
+ frag.lines.append(Line(name, "lead", ("a", None), length, a, b, ("short", "short"), through=True))
298
+ if sq["squid"]:
299
+ frag.knobs[f"{name}.flux_phi0"] = (0.0, 0.45)
300
+ frag.notes.append(
301
+ f"{name}: SQUID L_s = {sq['Ls_nH'] or 0:.4g} nH at Φ = {sq['flux_phi0']:g} Φ0 ({sq['source']}) → "
302
+ f"{extra:.0f} µm of {a:g}/{b:g} µm CPW at the shorted end (L' {l_per_m * 1e9:.0f} nH/m incl. kinetic); the "
303
+ "SQUID's Kerr / three-wave mixing is not in the lumped circuit (analysis.amplifiers)"
304
+ )
305
+ return frag
306
+
307
+
308
+ # ---- lumped JPA (twpa-sim jpa / squid_jpa) --------------------------------------------------------------------------
309
+ class LumpedJpa(Element):
310
+ """Lumped JPA: a trilayer junction or SQUID to ground, shunted by an interdigital capacitor (twpa-sim ``jpa`` /
311
+ ``squid_jpa``, MIM shunt → planar IDC on the PDK).
312
+
313
+ Port ``signal`` at the origin faces −x (CPW ``a``/``b``, ``lead_length`` long) into a pocket holding the island: a
314
+ spine (``spine_width``) with ``shunt_fingers`` fingers on each side interleaved with ground fingers hanging from
315
+ the pocket walls (``finger_length`` / ``finger_width`` / ``finger_gap``; one gap everywhere).
316
+
317
+ * ``coupling="capacitive"``: the lead joins the island (the port *is* the island conductor; put a coupling
318
+ capacitor, e.g. KQC ``FingerCapacitorSquare``, between the feed and ``signal``). The junction bridges a
319
+ ``junction_gap`` between the island's far end and the pocket wall; with ``flux_line`` a shorted CPW (port
320
+ ``flux``) runs past it (SQUID flux bias / pump), as :class:`SquidTermination`.
321
+ * ``coupling="inductive"``: the lead ends on a tap pad tied to the pocket floor by a strip (``tap_width``) — the
322
+ coupling inductance shared by the signal line and the JPA loop; the junction bridges the tap pad and the island.
323
+
324
+ LOM: ``island`` with the IDC shunt C to ground (Igreja–Dias IDC + the spine, analytic), the junction / SQUID
325
+ (drawn values on the PDK rule unless the design gives ``junction``); capacitive: ``signal`` → island;
326
+ inductive: ``tap`` node (small pad C) with the strip inductance to ground (geometric + kinetic,
327
+ :func:`quantcore_circuits.circuit.kinetic.wire_inductance`), ``signal`` → tap.
328
+ """
329
+
330
+ coupling = Param(pdt.TypeString, "Coupling to the signal line", "capacitive", choices=["capacitive", "inductive"])
331
+ junction_type = Param(pdt.TypeString, "Junction (trilayer cell)", "Quantcore Junction", choices=_JUNCTIONS)
332
+ junction_params = Param(pdt.TypeString, "Trilayer junction cell parameters (JSON dict)", "{}")
333
+ lead_length = Param(pdt.TypeDouble, "CPW lead from the port to the pocket", 50, unit="μm")
334
+ spine_width = Param(pdt.TypeDouble, "Island spine width", 20, unit="μm")
335
+ shunt_fingers = Param(pdt.TypeInt, "Island fingers per side", 20)
336
+ finger_length = Param(pdt.TypeDouble, "Finger length", 100, unit="μm")
337
+ finger_width = Param(pdt.TypeDouble, "Finger width", 4, unit="μm")
338
+ finger_gap = Param(pdt.TypeDouble, "Gap between fingers (and all island clearances)", 4, unit="μm")
339
+ junction_gap = Param(pdt.TypeDouble, "Junction gap (window height)", 16, unit="μm")
340
+ tap_width = Param(pdt.TypeDouble, "Inductive coupling strip width", 4, unit="μm")
341
+ tap_pad = Param(pdt.TypeList, "Inductive coupling tap pad (length along x, width), µm", [20, 24])
342
+ flux_line = Param(pdt.TypeBoolean, "Draw a shorted flux / pump line past the junction (capacitive)", False)
343
+ flux_length = Param(pdt.TypeDouble, "Flux line length (port to short)", 200, unit="μm")
344
+ flux_gap = Param(pdt.TypeDouble, "Ground strip between the pocket and the flux line gap", 2, unit="μm")
345
+ flux_offset = Param(pdt.TypeDouble, "Flux short beyond the junction axis", 20, unit="μm")
346
+ flux_phi0 = Param(pdt.TypeDouble, "Static flux bias of a SQUID (LOM)", 0.0, unit="Φ0")
347
+
348
+ qcc_category = "resonator"
349
+
350
+ @classmethod
351
+ def qcc_params(cls, params: dict) -> dict:
352
+ return _json_params(params)
353
+
354
+ @classmethod
355
+ def qcc_geometry(cls, params: dict) -> dict:
356
+ """Key coordinates (µm, local frame) of the drawing: pocket, island span, junction gap, tap."""
357
+ from quantcore_circuits.layouts.others.keepout import full_params # pylint: disable=import-outside-toplevel
358
+
359
+ p = full_params(cls, params)
360
+ wf, gf, lf, ws = (_f(p[k]) for k in ("finger_width", "finger_gap", "finger_length", "spine_width"))
361
+ n, hj, lead = int(p["shunt_fingers"]), _f(p["junction_gap"]), _f(p["lead_length"])
362
+ tap_len, tap_w = (_f(v) for v in list(p["tap_pad"])[:2])
363
+ half_h = ws / 2 + lf + gf
364
+ x_p0 = lead
365
+ inductive = p["coupling"] == "inductive"
366
+ x_i0 = x_p0 + tap_len + hj if inductive else x_p0 + gf
367
+ margin = gf + 2.0 # spine beyond the outer ground fingers: they stay clear of the junction window
368
+ x_f0 = x_i0 + margin
369
+ x_i1 = x_f0 + n * 2 * (wf + gf) + wf + margin
370
+ x_r = x_i1 + (gf if inductive else hj)
371
+ return {
372
+ "x_p0": x_p0,
373
+ "x_i0": x_i0,
374
+ "x_f0": x_f0,
375
+ "x_i1": x_i1,
376
+ "x_r": x_r,
377
+ "half_h": half_h,
378
+ "tap_len": tap_len,
379
+ "tap_w": tap_w,
380
+ "tap_strip_um": half_h - tap_w / 2,
381
+ "inductive": inductive,
382
+ }
383
+
384
+ def build(self):
385
+ dbu = self.layout.dbu
386
+ geo = self.qcc_geometry({k: getattr(self, k) for k in type(self).get_schema()})
387
+ a, b = self.a, self.b
388
+ wf, gf, lf, ws = self.finger_width, self.finger_gap, self.finger_length, self.spine_width
389
+ n = int(self.shunt_fingers)
390
+ x_p0, x_i0, x_i1, x_r, hh = geo["x_p0"], geo["x_i0"], geo["x_i1"], geo["x_r"], geo["half_h"]
391
+ if min(wf, gf, ws) <= 0 or lf <= gf or n < 1:
392
+ self.raise_error_on_cell("LumpedJpa: finger/spine sizes must be positive, finger_length > finger_gap")
393
+ if hh < 17:
394
+ self.raise_error_on_cell("LumpedJpa: the pocket must be at least 34 µm high (the junction window)")
395
+ etch = cpw_gaps(dbu, 0, x_p0, a, b) if x_p0 > 0 else pya.Region()
396
+ pocket = _region(dbu, (x_p0, -hh, x_r, hh))
397
+ metal = _region(dbu, (x_i0, -ws / 2, x_i1, ws / 2))
398
+ hw = ws / 2 + gf / 2 # landing head at the junction end (a SQUID's fingers sit at ±8 µm)
399
+ x_h = x_i0 if geo["inductive"] else x_i1 - 2.0
400
+ metal += _region(dbu, (x_h, -max(hw, 13.0), x_h + 2.0, max(hw, 13.0)))
401
+ pitch = 2 * (wf + gf)
402
+ x_f0 = geo["x_f0"]
403
+ for k in range(n): # island fingers, both sides
404
+ xc = x_f0 + wf / 2 + (wf + gf) + k * pitch
405
+ metal += _region(
406
+ dbu, (xc - wf / 2, ws / 2, xc + wf / 2, ws / 2 + lf), (xc - wf / 2, -ws / 2 - lf, xc + wf / 2, -ws / 2)
407
+ )
408
+ for j in range(n + 1): # ground fingers from the pocket walls
409
+ xc = x_f0 + wf / 2 + j * pitch
410
+ metal += _region(
411
+ dbu, (xc - wf / 2, ws / 2 + gf, xc + wf / 2, hh), (xc - wf / 2, -hh, xc + wf / 2, -ws / 2 - gf)
412
+ )
413
+ if geo["inductive"]:
414
+ tl, tw = geo["tap_len"], geo["tap_w"]
415
+ xt = x_p0 + tl / 2
416
+ metal += _region(
417
+ dbu,
418
+ (x_p0, -tw / 2, x_p0 + tl, tw / 2),
419
+ (xt - self.tap_width / 2, -hh, xt + self.tap_width / 2, -tw / 2),
420
+ )
421
+ jgap = _region(dbu, (x_p0 + tl, -17, x_i0, 17))
422
+ island, ground = pya.DPoint(x_i0, 0), pya.DPoint(x_p0 + tl, 0)
423
+ else:
424
+ metal += _region(dbu, (x_p0, -a / 2, x_i0, a / 2)) # the lead crosses the pocket gap into the island
425
+ jgap = _region(dbu, (x_i1, -17, x_r, 17))
426
+ island, ground = pya.DPoint(x_i1, 0), pya.DPoint(x_r, 0)
427
+ if self.flux_line:
428
+ x_f = x_r + self.flux_gap + b + a / 2
429
+ etch += shorted_line(dbu, x_f, self.flux_offset, self.flux_length, a, b)
430
+ self.add_port("flux", pya.DPoint(x_f, self.flux_offset - self.flux_length), pya.DVector(0, -1))
431
+ etch += pocket - metal
432
+ etch.merge()
433
+ self.cell.shapes(self.get_layer("base_metal_gap_wo_grid")).insert(etch)
434
+ self.add_protection(pya.Region(etch.bbox()).sized(self.margin / dbu))
435
+ self.add_port("signal", pya.DPoint(0, 0), pya.DVector(-1, 0))
436
+ self.refpoints["port_squid_a"], self.refpoints["port_squid_b"] = island, ground
437
+ self.refpoints["island_center"] = pya.DPoint((x_i0 + x_i1) / 2, 0)
438
+ if _has_junction(self.junction_type):
439
+ _place_junction(self, self.junction_type, jgap, island, ground, self.junction_params)
440
+
441
+ @classmethod
442
+ def qcc_values(cls, params: dict, pdk=None) -> dict:
443
+ """Analytic circuit values of the drawing: C_shunt (fF), the tap strip inductance (nH), tap pad C (fF)."""
444
+ from quantcore_circuits.circuit.kinetic import wire_inductance # pylint: disable=import-outside-toplevel
445
+ from quantcore_circuits.layouts.others.keepout import full_params # pylint: disable=import-outside-toplevel
446
+ from quantcore_circuits.lom import estimates as est # pylint: disable=import-outside-toplevel
447
+
448
+ p = full_params(cls, params)
449
+ pdk = _pdk_obj(pdk)
450
+ eps = est.substrate_eps(pdk)
451
+ geo = cls.qcc_geometry(p)
452
+ wf, gf, lf, ws = (_f(p[k]) for k in ("finger_width", "finger_gap", "finger_length", "spine_width"))
453
+ n = int(p["shunt_fingers"])
454
+ idc = 2 * est.interdigital(2 * n + 1, wf, gf, lf - gf, eps) # both sides
455
+ span = geo["x_i1"] - geo["x_i0"]
456
+ ends = 2 * est.coplanar_coupling(ws, ws, ws, gf, eps) # spine end faces (rough)
457
+ out = {
458
+ "C_shunt_fF": idc + ends,
459
+ "C_idc_fF": idc,
460
+ "island_length_um": span,
461
+ "formula": f"2 × IDC ({2 * n + 1} fingers {wf:g}/{gf:g} µm, overlap {lf - gf:g} µm, Igreja–Dias)"
462
+ " + spine ends",
463
+ }
464
+ if geo["inductive"]:
465
+ w = wire_inductance(geo["tap_strip_um"], _f(p["tap_width"]), pdk)
466
+ out |= {
467
+ "L_tap_nH": w["L_nH"],
468
+ "L_tap_geo_nH": w["L_geo_nH"],
469
+ "L_tap_k_nH": w["L_k_nH"],
470
+ "C_tap_fF": est.pad_to_ground(geo["tap_len"], geo["tap_w"], gf, gf, eps),
471
+ }
472
+ return out
473
+
474
+ @classmethod
475
+ def qcc_lom(cls, name: str, inst, pdk):
476
+ from quantcore_circuits.lom import estimates as est # pylint: disable=import-outside-toplevel
477
+ from quantcore_circuits.lom.fragment import Element as Branch # pylint: disable=import-outside-toplevel
478
+ from quantcore_circuits.lom.fragment import Fragment, cell_params # pylint: disable=import-outside-toplevel
479
+
480
+ p = cell_params(inst)
481
+ v = cls.qcc_values(p, pdk)
482
+ lj, cj, source = instance_junction(inst, p)
483
+ squid = "squid" in str(p.get("junction_type", "")).lower()
484
+ inductive = p.get("coupling") == "inductive"
485
+ frag = Fragment(nodes={"island": {"island": f"{name}.island"}})
486
+ frag.elements.append(
487
+ Branch(
488
+ f"C_{name}",
489
+ "C",
490
+ ("island", "gnd"),
491
+ est.cap(v["C_shunt_fF"], "analytic", v["formula"]),
492
+ {"param": f"{name}.shunt_fingers"},
493
+ )
494
+ )
495
+ other = "gnd"
496
+ if inductive:
497
+ frag.nodes["tap"] = {"island": f"{name}.tap"}
498
+ frag.port_nodes["signal"] = "tap"
499
+ other = "tap"
500
+ frag.elements.append(
501
+ Branch(
502
+ f"Ltap_{name}",
503
+ "L",
504
+ ("tap", "gnd"),
505
+ {
506
+ "L_nH": round(v["L_tap_nH"], 5),
507
+ "L_k_nH": round(v["L_tap_k_nH"], 5),
508
+ "source": "analytic: strip (Grover) + film kinetic inductance",
509
+ },
510
+ {"param": f"{name}.tap_width"},
511
+ )
512
+ )
513
+ frag.elements.append(
514
+ Branch(
515
+ f"Ctap_{name}", "C", ("tap", "gnd"), est.cap(v["C_tap_fF"], "rough", "tap pad to the pocket walls")
516
+ )
517
+ )
518
+ else:
519
+ frag.port_nodes["signal"] = "island"
520
+ if p.get("flux_line"):
521
+ frag.port_nodes["flux"] = "control:flux"
522
+ value = {"Lj_nH": lj, "Cj_fF": cj, "source": source}
523
+ if squid:
524
+ # the static bias is applied here (L_s(Φ) = L_s0/|cos πΦ|): the LOM simulation takes Lj_nH as given
525
+ phi = _f(p.get("flux_phi0"))
526
+ if lj:
527
+ value["Lj_nH"] = round(lj / max(abs(math.cos(math.pi * phi)), 1e-6), 6)
528
+ value |= {"asym": 0.0, "flux_phi0": 0.0, "Lj0_nH": lj, "bias_phi0": phi}
529
+ frag.elements.append(
530
+ Branch(
531
+ f"J_{name}", "SQUID" if squid else "JJ", ("island", other), value, {"param": f"{name}.junction.Lj_nH"}
532
+ )
533
+ )
534
+ if lj:
535
+ frag.knobs[f"{name}.junction.Lj_nH"] = (round(lj * 0.5, 4), round(lj * 1.5, 4))
536
+ else:
537
+ frag.notes.append(f"{name}: no junction L_J ({source}); give the instance a junction to simulate it")
538
+ frag.notes.append(f"{name}: lumped JPA, C_shunt ≈ {v['C_shunt_fF']:.0f} fF (analytic IDC)")
539
+ return frag
540
+
541
+
542
+ # ---- 4WM JTWPA chain ------------------------------------------------------------------------------------------------
543
+ class JtwpaChain(Element):
544
+ """Series chain of ``cells`` trilayer junctions along +x (4WM JTWPA; twpa-sim ``jtwpa4wm``; QPDK resonantly
545
+ phase-matched JTWPA): ports ``a`` (origin, faces −x) and ``b`` (x = 2·lead + cells·cell_pitch, faces +x), CPW
546
+ ``a``/``b`` leads of ``lead_length``.
547
+
548
+ Between the leads the centre line is cut into ``cells + 1`` islands (``island_width``; the end islands are half
549
+ islands, so the end shunts are halved, as the finite-chain convention) separated by ``junction_gap``; each cut is
550
+ bridged by the junction cell ``junction_type`` (default ``Quantcore Junction``). Each island is shunted to ground
551
+ by ``shunt_fingers`` fingers per side interleaved with ground fingers hanging from the trench walls (the chain's
552
+ ground capacitance C_g). With ``resonator_every`` = M > 0, every M-th node (``resonator_offset``, M, 2M, …) loses
553
+ its top or bottom fingers (alternating) and gets a lumped LC resonator beyond the trench wall: a lead through a slot
554
+ to an interdigital coupling capacitor (``coupling_fingers``), a pad (``resonator_pad``) and a meander inductor
555
+ (``inductor_turns``, ``inductor_width``) to the pocket wall — O'Brien et al. 2014 resonant phase matching.
556
+
557
+ LOM: nodes ``n0`` … ``n<cells>`` (``a`` → n0, ``b`` → n<cells>), a JJ between neighbours (drawn L_J / C_J, or the
558
+ design's ``junction``), C_g to ground per node (analytic IDC), and per resonator ``r<k>``: C_c, C_r, L_r
559
+ (geometric + kinetic meander). Long chains exceed QuCat: :mod:`quantcore_circuits.analysis.amplifiers` solves
560
+ the linear ladder (ABCD) and the coupled-mode gain from the same values.
561
+ """
562
+
563
+ cells = Param(pdt.TypeInt, "Junctions in the chain", 16)
564
+ cell_pitch = Param(pdt.TypeDouble, "Junction pitch", 60, unit="μm")
565
+ lead_length = Param(pdt.TypeDouble, "CPW lead at each end", 30, unit="μm")
566
+ island_width = Param(pdt.TypeDouble, "Island (centre line) width", 20, unit="μm")
567
+ junction_gap = Param(pdt.TypeDouble, "Cut between islands (junction window height)", 12, unit="μm")
568
+ junction_type = Param(pdt.TypeString, "Junction (trilayer cell)", "Quantcore Junction", choices=_JUNCTIONS)
569
+ junction_params = Param(pdt.TypeString, "Trilayer junction cell parameters (JSON dict)", "{}")
570
+ shunt_fingers = Param(pdt.TypeInt, "Island fingers per side per full island", 4)
571
+ shunt_finger_length = Param(pdt.TypeDouble, "Shunt finger length", 40, unit="μm")
572
+ shunt_finger_width = Param(pdt.TypeDouble, "Shunt finger width", 2, unit="μm")
573
+ shunt_gap = Param(pdt.TypeDouble, "Gap between shunt fingers / to the walls", 2, unit="μm")
574
+ resonator_every = Param(pdt.TypeInt, "A resonator on every M-th node (0 = none)", 4)
575
+ resonator_offset = Param(pdt.TypeInt, "First resonator node", 2)
576
+ wall = Param(pdt.TypeDouble, "Ground wall between the trench and a resonator pocket", 10, unit="μm")
577
+ coupling_fingers = Param(pdt.TypeInt, "Coupling capacitor fingers", 10)
578
+ coupling_finger_length = Param(pdt.TypeDouble, "Coupling finger length", 40, unit="μm")
579
+ resonator_pad = Param(pdt.TypeList, "Resonator pad (width along x, height), µm", [160, 120])
580
+ resonator_gap = Param(pdt.TypeDouble, "Pad / inductor clearance in the resonator pocket", 10, unit="μm")
581
+ inductor_width = Param(pdt.TypeDouble, "Meander inductor strip width", 2, unit="μm")
582
+ inductor_turns = Param(pdt.TypeInt, "Meander inductor turns", 10)
583
+ inductor_height = Param(pdt.TypeDouble, "Meander inductor height (pad to wall)", 120, unit="μm")
584
+
585
+ qcc_category = "waveguide"
586
+
587
+ @classmethod
588
+ def qcc_params(cls, params: dict) -> dict:
589
+ return _json_params(params)
590
+
591
+ @classmethod
592
+ def qcc_layout(cls, params: dict) -> dict:
593
+ """Chain coordinates (µm): junction x positions, island spans, resonator nodes / sides, trench half-width."""
594
+ from quantcore_circuits.layouts.others.keepout import full_params # pylint: disable=import-outside-toplevel
595
+
596
+ p = full_params(cls, params)
597
+ n, pitch, lead = int(p["cells"]), _f(p["cell_pitch"]), _f(p["lead_length"])
598
+ gj = _f(p["junction_gap"])
599
+ xj = [lead + (j + 0.5) * pitch for j in range(n)]
600
+ x_end = lead + n * pitch
601
+ islands = [(lead if k == 0 else xj[k - 1] + gj / 2, x_end if k == n else xj[k] - gj / 2) for k in range(n + 1)]
602
+ m, off = int(p["resonator_every"]), int(p["resonator_offset"])
603
+ res = [k for k in range(1, n) if m > 0 and k >= off and (k - off) % m == 0]
604
+ sides = {k: (1 if i % 2 == 0 else -1) for i, k in enumerate(res)}
605
+ half = _f(p["island_width"]) / 2 + _f(p["shunt_gap"]) + _f(p["shunt_finger_length"])
606
+ return {"xj": xj, "islands": islands, "x_end": x_end + lead, "resonators": sides, "trench": half}
607
+
608
+ @classmethod
609
+ def qcc_probes(cls, params: dict) -> dict:
610
+ """LOM node → a point on its island (µm, cell frame) for naming the FEM nets: ``n<k>`` at the middle of island
611
+ k on the centre line (the simulation export probes them; no port touches the inner islands)."""
612
+ return {f"n{k}": ((xa + xb) / 2, 0.0) for k, (xa, xb) in enumerate(cls.qcc_layout(params)["islands"])}
613
+
614
+ def build(self):
615
+ dbu = self.layout.dbu
616
+ lay = self.qcc_layout({k: getattr(self, k) for k in type(self).get_schema()})
617
+ a, b = self.a, self.b
618
+ wi, gs, lsf, wsf = self.island_width, self.shunt_gap, self.shunt_finger_length, self.shunt_finger_width
619
+ n, gj, lead = int(self.cells), self.junction_gap, self.lead_length
620
+ half = lay["trench"]
621
+ x0, x1 = lead, lay["x_end"] - lead
622
+ if n < 1 or self.cell_pitch <= gj or min(wi, gs, wsf) <= 0:
623
+ self.raise_error_on_cell("JtwpaChain: need cells >= 1, cell_pitch > junction_gap, positive widths")
624
+ etch = cpw_gaps(dbu, 0, lead, a, b) + cpw_gaps(dbu, x1, x1 + lead, a, b)
625
+ trench = _region(dbu, (x0, -half, x1, half))
626
+ metal = pya.Region()
627
+ pitch_f = 2 * (wsf + gs)
628
+ res = lay["resonators"]
629
+ pad_w, pad_h = (_f(v) for v in list(self.resonator_pad)[:2])
630
+ for k, (xa, xb) in enumerate(lay["islands"]):
631
+ metal += _region(dbu, (xa, -wi / 2, xb, wi / 2)) # the end islands meet the leads' centre lines
632
+ span = xb - xa
633
+ nf = int(self.shunt_fingers) if 0 < k < n else max(int(self.shunt_fingers) // 2, 1)
634
+ used = nf * pitch_f + wsf
635
+ if used > span:
636
+ nf = max(int((span - wsf) // pitch_f), 0)
637
+ used = nf * pitch_f + wsf
638
+ start = xa + (span - used) / 2
639
+ for side in (1, -1):
640
+ if res.get(k) == side or nf == 0:
641
+ continue
642
+ y_root, y_wall = side * wi / 2, side * half
643
+ for f in range(nf): # island fingers
644
+ xc = start + wsf / 2 + (wsf + gs) + f * pitch_f
645
+ metal += _region(dbu, (xc - wsf / 2, y_root, xc + wsf / 2, y_root + side * lsf))
646
+ for g in range(nf + 1): # ground fingers
647
+ xc = start + wsf / 2 + g * pitch_f
648
+ metal += _region(dbu, (xc - wsf / 2, y_wall, xc + wsf / 2, y_root + side * gs))
649
+ for k, side in res.items(): # a resonator's lead keeps its metal through the trench (island to the slot)
650
+ xa, xb = lay["islands"][k]
651
+ lead_w = max(wsf * 2, 4.0)
652
+ xc = (xa + xb) / 2
653
+ y0, y1 = sorted((side * wi / 2, side * (half + gs)))
654
+ metal += _region(dbu, (xc - lead_w / 2, y0, xc + lead_w / 2, y1))
655
+ etch += trench - metal
656
+ for xc in lay["xj"]:
657
+ cut = _region(dbu, (xc - gj / 2, -wi / 2, xc + gj / 2, wi / 2))
658
+ if _has_junction(self.junction_type):
659
+ _place_junction(
660
+ self,
661
+ self.junction_type,
662
+ cut,
663
+ pya.DPoint(xc + gj / 2, 0),
664
+ pya.DPoint(xc - gj / 2, 0),
665
+ self.junction_params,
666
+ )
667
+ for i, (k, side) in enumerate(sorted(res.items())):
668
+ xa, xb = lay["islands"][k]
669
+ xc = (xa + xb) / 2
670
+ etch += self._resonator(dbu, xc, side, half, pad_w, pad_h)
671
+ self.refpoints[f"resonator_{i}"] = pya.DPoint(xc, side * (half + self.wall))
672
+ etch.merge()
673
+ self.cell.shapes(self.get_layer("base_metal_gap_wo_grid")).insert(etch)
674
+ self.add_protection(pya.Region(etch.bbox()).sized(self.margin / dbu))
675
+ self.add_port("a", pya.DPoint(0, 0), pya.DVector(-1, 0))
676
+ self.add_port("b", pya.DPoint(lay["x_end"], 0), pya.DVector(1, 0))
677
+
678
+ def _resonator(self, dbu, xc, side, half, pad_w, pad_h) -> pya.Region:
679
+ """Etch of one loading resonator above (side +1) / below (−1) the trench at x = xc."""
680
+ wi, gs, gr = self.island_width, self.shunt_gap, self.resonator_gap
681
+ wl, wsf = max(self.inductor_width, 0.5), self.shunt_finger_width
682
+ nc, lc = max(int(self.coupling_fingers), 2), self.coupling_finger_length
683
+ bus_w = max(nc * (wsf + gs) - gs, 2 * gs + wsf)
684
+ lead_w = max(wsf * 2, 4.0)
685
+ y_wall0 = half # trench wall (|y|), wall up to half + wall
686
+ y_p0 = half + self.wall # pocket floor
687
+ y_bus0 = y_p0 + gr # coupling bus
688
+ y_bus1 = y_bus0 + gs * 2
689
+ y_pad0 = y_bus1 + lc + gs
690
+ y_pad1 = y_pad0 + pad_h
691
+ y_ind1 = y_pad1 + self.inductor_height
692
+ y_top = y_ind1 # pocket ceiling (the inductor lands on it)
693
+ w_pocket = max(pad_w, bus_w) + 2 * gr
694
+ pocket = [(xc - w_pocket / 2, y_p0, xc + w_pocket / 2, y_top)]
695
+ slot = [(xc - lead_w / 2 - gs, y_wall0 - gs, xc + lead_w / 2 + gs, y_p0)] # through the trench wall
696
+ metal = [
697
+ (xc - lead_w / 2, wi / 2, xc + lead_w / 2, y_bus0), # lead from the island through the slot
698
+ (xc - bus_w / 2, y_bus0, xc + bus_w / 2, y_bus1), # coupling bus
699
+ (xc - pad_w / 2, y_pad0, xc + pad_w / 2, y_pad1),
700
+ ] # resonator pad
701
+
702
+ def flip(box):
703
+ x0, y0, x1, y1 = box
704
+ return (x0, side * y0, x1, side * y1)
705
+
706
+ etch = _region(dbu, *(flip(bx) for bx in pocket + slot))
707
+ met = _region(dbu, *(flip(bx) for bx in metal))
708
+ fingers, _ = interdigital(dbu, xc - bus_w / 2, nc, wsf, gs, y_bus1, y_pad0)
709
+ if side < 0:
710
+ fingers.transform(pya.Trans(pya.Trans.M0))
711
+ met += fingers
712
+ ind, _ = meander_strip(dbu, xc - pad_w / 2, xc + pad_w / 2, y_pad1, y_ind1 + wl, wl, int(self.inductor_turns))
713
+ if side < 0:
714
+ ind.transform(pya.Trans(pya.Trans.M0))
715
+ met += ind
716
+ return etch - met
717
+
718
+ @classmethod
719
+ def qcc_values(cls, params: dict, pdk=None) -> dict:
720
+ """Per-cell analytic values: C_g (fF, full / end island), C_c, C_r (fF), L_r (nH, geometric + kinetic),
721
+ the meander length, and the drawn junction."""
722
+ from quantcore_circuits.circuit.kinetic import wire_inductance # pylint: disable=import-outside-toplevel
723
+ from quantcore_circuits.layouts.others.keepout import full_params # pylint: disable=import-outside-toplevel
724
+ from quantcore_circuits.lom import estimates as est # pylint: disable=import-outside-toplevel
725
+
726
+ p = full_params(cls, params)
727
+ pdk = _pdk_obj(pdk)
728
+ eps = est.substrate_eps(pdk)
729
+ lay = cls.qcc_layout(p)
730
+ wi, gs, lsf, wsf = (
731
+ _f(p[k]) for k in ("island_width", "shunt_gap", "shunt_finger_length", "shunt_finger_width")
732
+ )
733
+ nf = int(p["shunt_fingers"])
734
+
735
+ def shunt(n_fingers: int, sides: int) -> float:
736
+ if n_fingers <= 0:
737
+ return 0.0
738
+ return sides * est.interdigital(2 * n_fingers + 1, wsf, gs, lsf - gs, eps)
739
+
740
+ span = lay["islands"][1][1] - lay["islands"][1][0] if len(lay["islands"]) > 2 else _f(p["cell_pitch"])
741
+ c_line = span * est.cpw_c_per_um(wi, gs, eps) * 0.0 # the spine edges face the ground fingers' roots: in IDC
742
+ nc, lc = max(int(p["coupling_fingers"]), 2), _f(p["coupling_finger_length"])
743
+ pad_w, pad_h = (_f(v) for v in list(p["resonator_pad"])[:2])
744
+ gr = _f(p["resonator_gap"])
745
+ c_c = est.interdigital(nc, wsf, gs, lc - gs, eps)
746
+ c_r = est.pad_to_ground(pad_w, pad_h, gr, gr, eps)
747
+ wl = max(_f(p["inductor_width"]), 0.5)
748
+ y0, y1 = 0.0, _f(p["inductor_height"]) + wl
749
+ _, length = meander_strip(0.001, -pad_w / 2, pad_w / 2, y0, y1, wl, int(p["inductor_turns"]))
750
+ ind = wire_inductance(length, wl, pdk)
751
+ lj, cj, source = drawn_junction_values(p["junction_type"], p["junction_params"])
752
+ return {
753
+ "Cg_fF": shunt(nf, 2) + c_line,
754
+ "Cg_loaded_fF": shunt(nf, 1) + c_line,
755
+ "Cg_end_fF": shunt(max(nf // 2, 1), 2),
756
+ "Cc_fF": c_c,
757
+ "Cr_fF": c_r,
758
+ "Lr_nH": ind["L_nH"],
759
+ "Lr_k_nH": ind["L_k_nH"],
760
+ "inductor_length_um": length,
761
+ "Lj_nH": lj,
762
+ "Cj_fF": cj,
763
+ "junction_source": source,
764
+ "resonators": sorted(lay["resonators"]),
765
+ }
766
+
767
+ @classmethod
768
+ def qcc_lom(cls, name: str, inst, pdk):
769
+ from quantcore_circuits.lom import estimates as est # pylint: disable=import-outside-toplevel
770
+ from quantcore_circuits.lom.fragment import Element as Branch # pylint: disable=import-outside-toplevel
771
+ from quantcore_circuits.lom.fragment import Fragment, cell_params # pylint: disable=import-outside-toplevel
772
+
773
+ p = cell_params(inst)
774
+ v = cls.qcc_values(p, pdk)
775
+ n = int(p["cells"])
776
+ lj, cj, source = instance_junction(inst, p)
777
+ frag = Fragment(
778
+ nodes={f"n{k}": {"island": f"{name}.n{k}"} for k in range(n + 1)}, port_nodes={"a": "n0", "b": f"n{n}"}
779
+ )
780
+ res = set(v["resonators"])
781
+ for k in range(n + 1):
782
+ cg = v["Cg_end_fF"] if k in (0, n) else (v["Cg_loaded_fF"] if k in res else v["Cg_fF"])
783
+ frag.elements.append(
784
+ Branch(
785
+ f"Cg_{name}_{k}",
786
+ "C",
787
+ (f"n{k}", "gnd"),
788
+ est.cap(max(cg, 0.01), "analytic", "shunt fingers (IDC, Igreja–Dias)"),
789
+ )
790
+ )
791
+ for j in range(n):
792
+ frag.elements.append(
793
+ Branch(
794
+ f"J_{name}_{j}",
795
+ "JJ",
796
+ (f"n{j}", f"n{j + 1}"),
797
+ {"Lj_nH": lj, "Cj_fF": cj, "source": source},
798
+ {"param": f"{name}.junction.Lj_nH"},
799
+ )
800
+ )
801
+ for k in sorted(res):
802
+ frag.nodes[f"r{k}"] = {"island": f"{name}.r{k}"}
803
+ frag.elements.append(
804
+ Branch(
805
+ f"Cc_{name}_{k}",
806
+ "C",
807
+ (f"n{k}", f"r{k}"),
808
+ est.cap(v["Cc_fF"], "analytic", "coupling IDC (Igreja–Dias)"),
809
+ )
810
+ )
811
+ frag.elements.append(
812
+ Branch(
813
+ f"Cr_{name}_{k}", "C", (f"r{k}", "gnd"), est.cap(v["Cr_fF"], "rough", "resonator pad to its pocket")
814
+ )
815
+ )
816
+ frag.elements.append(
817
+ Branch(
818
+ f"Lr_{name}_{k}",
819
+ "L",
820
+ (f"r{k}", "gnd"),
821
+ {
822
+ "L_nH": round(v["Lr_nH"], 5),
823
+ "L_k_nH": round(v["Lr_k_nH"], 5),
824
+ "source": "analytic: meander strip (Grover) + film kinetic inductance",
825
+ },
826
+ )
827
+ )
828
+ if lj:
829
+ frag.knobs[f"{name}.junction.Lj_nH"] = (round(lj * 0.5, 4), round(lj * 1.5, 4))
830
+ frag.notes.append(
831
+ f"{name}: JTWPA chain of {n} junctions (L_J {lj} nH, {source}), {len(res)} loading resonators; "
832
+ "simulate the ladder with analysis.amplifiers (QuCat is limited to a few junctions)"
833
+ )
834
+ return frag
835
+
836
+
837
+ # ---- KI-TWPA serpentine (twpa-sim / NY CREATES) ---------------------------------------------------------------------
838
+ def _smooth(alpha):
839
+ return alpha * alpha * (3.0 - 2.0 * alpha)
840
+
841
+
842
+ def _radial_rect(dbu, theta, u0, u1, hw) -> pya.Polygon:
843
+ """A rectangle from radius ``u0`` to ``u1`` along the direction ``theta``, half-width ``hw`` across it (dbu)."""
844
+ ux, uy, tx, ty = math.cos(theta), math.sin(theta), -math.sin(theta), math.cos(theta)
845
+ return pya.DPolygon(
846
+ [
847
+ pya.DPoint(u0 * ux - hw * tx, u0 * uy - hw * ty),
848
+ pya.DPoint(u1 * ux - hw * tx, u1 * uy - hw * ty),
849
+ pya.DPoint(u1 * ux + hw * tx, u1 * uy + hw * ty),
850
+ pya.DPoint(u0 * ux + hw * tx, u0 * uy + hw * ty),
851
+ ]
852
+ ).to_itype(dbu)
853
+
854
+
855
+ class KiTwpaSerpentine(Element):
856
+ """Kinetic-inductance TWPA serpentine (twpa-sim ``KITLayout`` / ``kit.primitives``, the NY CREATES research
857
+ geometry; MIT): ``rows`` straight rows of ``periods_per_row`` supercells (``unloaded_cells`` + ``loaded_cells``
858
+ cells of ``pitch``; the loaded cells, in the middle of each supercell, have ``loaded_finger_length`` fingers) joined
859
+ by U-turns of ``turn_radius`` with ``turn_periods`` supercells of radial fingers each. The turn spine is widened
860
+ with a smooth-step profile (``taper_cells``) so its biased sheet-square count matches the straight rows
861
+ (twpa-sim's approximation, ``bias_ratio``).
862
+
863
+ Negative mask: the etch is the spine gap (``spine_gap``) and each finger's slot (``finger_gap`` around it); the
864
+ ground between rows is the chip ground plane (twpa-sim's two separate ground combs need package grounding; here
865
+ they are one plane). Launches: the spine tapers to the chip CPW (``a``/``b``) over ``launch_taper_length`` and runs
866
+ ``launch_length`` straight to the ports ``a`` (row 0, input) and ``b`` (last row), both facing away from the rows.
867
+ Rows run along x centred on the origin; row r is at y = (rows − 1 − 2r)·turn_radius.
868
+ """
869
+
870
+ rows = Param(pdt.TypeInt, "Rows", 2)
871
+ periods_per_row = Param(pdt.TypeInt, "Supercells per row", 2)
872
+ unloaded_cells = Param(pdt.TypeInt, "Unloaded cells per supercell (even)", 48)
873
+ loaded_cells = Param(pdt.TypeInt, "Loaded cells per supercell", 6)
874
+ turn_periods = Param(pdt.TypeInt, "Supercells per U-turn", 3)
875
+ pitch = Param(pdt.TypeDouble, "Cell pitch", 1.5, unit="μm")
876
+ spine_width = Param(pdt.TypeDouble, "Spine width", 0.58, unit="μm")
877
+ spine_gap = Param(pdt.TypeDouble, "Spine gap", 0.5, unit="μm")
878
+ finger_width = Param(pdt.TypeDouble, "Finger width", 0.5, unit="μm")
879
+ finger_gap = Param(pdt.TypeDouble, "Finger gap", 0.25, unit="μm")
880
+ finger_length = Param(pdt.TypeDouble, "Finger length", 75.5, unit="μm")
881
+ loaded_finger_length = Param(pdt.TypeDouble, "Loaded finger length", 27.5, unit="μm")
882
+ turn_radius = Param(pdt.TypeDouble, "Turn radius (row spacing / 2)", 154, unit="μm")
883
+ bias_ratio = Param(pdt.TypeDouble, "Turn sheet-square bias ratio", 0.2)
884
+ taper_cells = Param(pdt.TypeInt, "Turn taper cells", 6)
885
+ arc_points = Param(pdt.TypeInt, "Points on a turn arc", 513)
886
+ launch_taper_length = Param(pdt.TypeDouble, "Launch taper (spine → a/b)", 88, unit="μm")
887
+ launch_length = Param(pdt.TypeDouble, "Launch straight (a/b) to the port", 155, unit="μm")
888
+ sheet_inductance_pH_sq = Param(pdt.TypeDouble, "Film sheet kinetic inductance for the ladder (0 = PDK film)", 0.0)
889
+
890
+ qcc_category = "waveguide"
891
+
892
+ def _check(self) -> str:
893
+ if self.rows < 2 or self.unloaded_cells % 2 or self.arc_points < 33:
894
+ return "need rows >= 2, even unloaded_cells, arc_points >= 33"
895
+ if self.pitch <= self.finger_width + 2 * self.finger_gap:
896
+ return "finger slots leave no ground between cells"
897
+ if self.loaded_finger_length > self.finger_length or self.turn_radius <= self.finger_length + 5:
898
+ return "loaded fingers longer than fingers, or turn radius too small"
899
+ if self.taper_cells * 2 >= (self.unloaded_cells + self.loaded_cells) * self.turn_periods:
900
+ return "the turn tapers occupy the whole turn"
901
+ return ""
902
+
903
+ def _nc(self) -> int:
904
+ return int(self.unloaded_cells + self.loaded_cells)
905
+
906
+ def _loaded(self, c: int) -> bool:
907
+ u = int(self.unloaded_cells)
908
+ return u // 2 <= c % self._nc() < u // 2 + int(self.loaded_cells)
909
+
910
+ def _turn_width(self):
911
+ """(max turn spine width, width profile function) solving twpa-sim's biased sheet-square match."""
912
+ import numpy as np # pylint: disable=import-outside-toplevel
913
+ from scipy.optimize import brentq # pylint: disable=import-outside-toplevel
914
+
915
+ w0, nturn = self.spine_width, int(self.turn_periods) * self._nc()
916
+ dtheta = math.pi / nturn
917
+ th = math.pi / 2 - (np.arange(nturn) + 0.5) * dtheta
918
+ p_turn = math.pi * self.turn_radius / nturn
919
+
920
+ def profile(theta, wmax):
921
+ d_end = np.minimum(math.pi / 2 - theta, theta + math.pi / 2)
922
+ return w0 + (wmax - w0) * _smooth(np.clip(d_end / (self.taper_cells * dtheta), 0.0, 1.0))
923
+
924
+ target = nturn * (self.pitch / w0) * (1.0 + self.bias_ratio**2)
925
+
926
+ def err(wm):
927
+ w = profile(th, wm)
928
+ return float(np.sum((p_turn / w) * (1.0 + self.bias_ratio**2 * (w0 / w) ** 2)) - target)
929
+
930
+ return brentq(err, w0 / 10, 10 * w0), profile, th
931
+
932
+ def _supercell_etch(self, dbu) -> pya.Region:
933
+ """Etch of one straight supercell starting at x = 0 on the row axis y = 0."""
934
+ w, s, wf, sf, lf = self.spine_width, self.spine_gap, self.finger_width, self.finger_gap, self.finger_length
935
+ p = self.pitch
936
+ nc = self._nc()
937
+ etch = _region(dbu, (0, w / 2, nc * p, w / 2 + s), (0, -w / 2 - s, nc * p, -w / 2))
938
+ fingers = pya.Region()
939
+ for c in range(nc):
940
+ xm = (c + 0.5) * p
941
+ lc = self.loaded_finger_length if self._loaded(c) else lf
942
+ etch += _region(
943
+ dbu,
944
+ (xm - wf / 2 - sf, w / 2 + s, xm + wf / 2 + sf, w / 2 + s + lf),
945
+ (xm - wf / 2 - sf, -w / 2 - s - lf, xm + wf / 2 + sf, -w / 2 - s),
946
+ )
947
+ fingers += _region(
948
+ dbu, (xm - wf / 2, w / 2, xm + wf / 2, w / 2 + lc), (xm - wf / 2, -w / 2 - lc, xm + wf / 2, -w / 2)
949
+ )
950
+ return (etch - fingers).merged()
951
+
952
+ def _turn_etch(self, dbu) -> pya.Region:
953
+ """Etch of a right-hand U-turn centred at the origin (rows at y = ±turn_radius, x ≥ 0)."""
954
+ import numpy as np # pylint: disable=import-outside-toplevel
955
+
956
+ wm, profile, th_k = self._turn_width()
957
+ r_t, s, wf, sf, lf = self.turn_radius, self.spine_gap, self.finger_width, self.finger_gap, self.finger_length
958
+ thetas = np.linspace(-math.pi / 2, math.pi / 2, int(self.arc_points))
959
+ w_th = profile(thetas, wm)
960
+ r_in, r_out = r_t - 0.5 * w_th, r_t + 0.5 * w_th
961
+
962
+ def poly(radii_a, radii_b):
963
+ pts = [pya.DPoint(r * math.cos(t), r * math.sin(t)) for r, t in zip(radii_a, thetas)]
964
+ pts += [pya.DPoint(r * math.cos(t), r * math.sin(t)) for r, t in zip(radii_b[::-1], thetas[::-1])]
965
+ return pya.Region(pya.DPolygon(pts).to_itype(dbu))
966
+
967
+ ring = poly(r_out + s, r_in - s)
968
+ signal = poly(r_out, r_in)
969
+ slots, fingers = pya.Region(), pya.Region()
970
+ nc = self._nc()
971
+ for k, th in enumerate(th_k):
972
+ lc = self.loaded_finger_length if self._loaded(k % nc) else lf
973
+ w_loc = float(profile(np.array([th]), wm)[0])
974
+ rik, rok = r_t - 0.5 * w_loc, r_t + 0.5 * w_loc
975
+ fingers.insert(_radial_rect(dbu, th, rok - 0.1, rok + lc, wf / 2))
976
+ fingers.insert(_radial_rect(dbu, th, rik - lc, rik + 0.1, wf / 2))
977
+ slots.insert(_radial_rect(dbu, th, r_t, rok + lf + s, wf / 2 + sf))
978
+ slots.insert(_radial_rect(dbu, th, rik - lf - s, r_t, wf / 2 + sf))
979
+ return ((ring + slots).merged() - (signal + fingers).merged()).merged()
980
+
981
+ def _launch_etch(self, dbu) -> pya.Region:
982
+ """Etch of a launch at the origin going −x: spine taper to (a, b), then a straight to the port."""
983
+ w, s, a, b = self.spine_width, self.spine_gap, self.a, self.b
984
+ lt, ls = self.launch_taper_length, self.launch_length
985
+ out = pya.Region()
986
+ for sgn in (1, -1):
987
+ pts = [
988
+ pya.DPoint(0, sgn * w / 2),
989
+ pya.DPoint(0, sgn * (w / 2 + s)),
990
+ pya.DPoint(-lt, sgn * (a / 2 + b)),
991
+ pya.DPoint(-lt, sgn * a / 2),
992
+ ]
993
+ out.insert(pya.DPolygon(pts).to_itype(dbu))
994
+ out += cpw_gaps(dbu, -lt - ls, -lt, a, b)
995
+ return out.merged()
996
+
997
+ @classmethod
998
+ def qcc_keepout(cls, params: dict) -> list:
999
+ """3/0 keep-out (local µm): filled boxes over each row band, each U-turn and each launch, grown by the PDK
1000
+ component margin — cheap to evaluate, unlike growing the 100 k-polygon etch itself."""
1001
+ from quantcore_circuits.layouts.others.keepout import as_cell # pylint: disable=import-outside-toplevel
1002
+
1003
+ s = as_cell(cls, params)
1004
+ m = 20.0
1005
+ ys, xl, xr = s.qcc_rows()
1006
+ half = s.spine_width / 2 + s.spine_gap + s.finger_length + m
1007
+ reach = s.turn_radius + s.spine_width * 2 + s.spine_gap + s.finger_length + m
1008
+ boxes = [pya.DBox(xl, y - half, xr, y + half) for y in ys]
1009
+ for i in range(len(ys) - 1):
1010
+ yc = (ys[i] + ys[i + 1]) / 2
1011
+ x0 = xr if i % 2 == 0 else xl - reach
1012
+ boxes.append(pya.DBox(x0, yc - reach, x0 + reach, yc + reach))
1013
+ lr = s.launch_taper_length + s.launch_length
1014
+ lw = s.a / 2 + s.b + m
1015
+ boxes.append(pya.DBox(xl - lr - m, ys[0] - lw, xl, ys[0] + lw))
1016
+ if (len(ys) - 1) % 2 == 1:
1017
+ boxes.append(pya.DBox(xl - lr - m, ys[-1] - lw, xl, ys[-1] + lw))
1018
+ else:
1019
+ boxes.append(pya.DBox(xr, ys[-1] - lw, xr + lr + m, ys[-1] + lw))
1020
+ return boxes
1021
+
1022
+ def qcc_rows(self) -> tuple[list[float], float, float]:
1023
+ length = int(self.periods_per_row) * self._nc() * self.pitch
1024
+ ys = [(int(self.rows) - 1 - 2 * r) * self.turn_radius for r in range(int(self.rows))]
1025
+ return ys, -length / 2, length / 2
1026
+
1027
+ def build(self):
1028
+ problem = self._check()
1029
+ if problem:
1030
+ self.raise_error_on_cell(f"KiTwpaSerpentine: {problem}")
1031
+ dbu = self.layout.dbu
1032
+ ys, xl, xr = self.qcc_rows()
1033
+ nc, p = self._nc(), self.pitch
1034
+ layer = self.get_layer("base_metal_gap_wo_grid")
1035
+ shapes = self.cell.shapes(layer)
1036
+ sc = self._supercell_etch(dbu)
1037
+ for y in ys:
1038
+ for j in range(int(self.periods_per_row)):
1039
+ shapes.insert(sc.transformed(pya.Trans(int(round((xl + j * nc * p) / dbu)), int(round(y / dbu)))))
1040
+ right = self._turn_etch(dbu)
1041
+ left = right.transformed(pya.Trans(pya.Trans.M90))
1042
+ for i in range(len(ys) - 1):
1043
+ x = xr if i % 2 == 0 else xl
1044
+ shapes.insert(
1045
+ (right if i % 2 == 0 else left).transformed(
1046
+ pya.Trans(int(round(x / dbu)), int(round((ys[i] + ys[i + 1]) / 2 / dbu)))
1047
+ )
1048
+ )
1049
+ launch = self._launch_etch(dbu)
1050
+ reach = self.launch_taper_length + self.launch_length
1051
+ last_left = (len(ys) - 1) % 2 == 1
1052
+ shapes.insert(launch.transformed(pya.Trans(int(round(xl / dbu)), int(round(ys[0] / dbu)))))
1053
+ if last_left:
1054
+ shapes.insert(launch.transformed(pya.Trans(int(round(xl / dbu)), int(round(ys[-1] / dbu)))))
1055
+ pb, db = pya.DPoint(xl - reach, ys[-1]), pya.DVector(-1, 0)
1056
+ else:
1057
+ mirrored = launch.transformed(pya.Trans(pya.Trans.M90))
1058
+ shapes.insert(mirrored.transformed(pya.Trans(int(round(xr / dbu)), int(round(ys[-1] / dbu)))))
1059
+ pb, db = pya.DPoint(xr + reach, ys[-1]), pya.DVector(1, 0)
1060
+ box = pya.Region(self.cell.bbox_per_layer(layer))
1061
+ self.add_protection(box.sized(self.margin / dbu))
1062
+ self.add_port("a", pya.DPoint(xl - reach, ys[0]), pya.DVector(-1, 0))
1063
+ self.add_port("b", pb, db)
1064
+
1065
+ @classmethod
1066
+ def qcc_ladder(
1067
+ cls,
1068
+ params: dict,
1069
+ pdk=None,
1070
+ sheet_pH_sq: float | None = None,
1071
+ thickness_um: float | None = None,
1072
+ eps_r: float | None = None,
1073
+ ) -> dict:
1074
+ """Electrical ladder of the drawing (one cell = series L + shunt C to ground; twpa-sim ``Cell``):
1075
+
1076
+ * L_cell = L'_geo·pitch (Metal's CPW formula for the bare spine) + L_s·(pitch/spine_width) (sheet squares of
1077
+ the film: the PDK's L_s, or ``sheet_pH_sq``) — the twpa-sim cell has 20 pH/□ × 1.5/0.58 × 1.04;
1078
+ * C_cell = two fingers, each a strip in its slot (CPW C' of finger_width / finger_gap × finger length) + the
1079
+ spine to ground over the pitch outside the slots; loaded cells with ``loaded_finger_length``;
1080
+ * the counts: cells per supercell, supercells per row / turn, total cells.
1081
+ """
1082
+ from quantcore_circuits.analysis.synthesis import cpw_properties # pylint: disable=import-outside-toplevel
1083
+ from quantcore_circuits.circuit.kinetic import sheet_inductance_pH_sq # pylint: disable=C0415
1084
+ from quantcore_circuits.layouts.others.keepout import full_params # pylint: disable=import-outside-toplevel
1085
+ from quantcore_circuits.lom import estimates as est # pylint: disable=import-outside-toplevel
1086
+
1087
+ p = full_params(cls, params)
1088
+ pdk = _pdk_obj(pdk)
1089
+ eps = est.substrate_eps(pdk) if eps_r is None else float(eps_r)
1090
+ w, s, wf, sf = (_f(p[k]) for k in ("spine_width", "spine_gap", "finger_width", "finger_gap"))
1091
+ pitch, lf, llf = _f(p["pitch"]), _f(p["finger_length"]), _f(p["loaded_finger_length"])
1092
+ ls = (
1093
+ sheet_pH_sq
1094
+ if sheet_pH_sq is not None
1095
+ else (_f(p.get("sheet_inductance_pH_sq")) or sheet_inductance_pH_sq(pdk))
1096
+ )
1097
+ q = cpw_properties(7.0, w, s, pdk.name, kinetic=False)
1098
+ l_geo = q["Z0_ohm"] / q["vp_m_s"] * pitch * 1e-6 * 1e12 # pH per cell
1099
+ l_k = ls * (pitch / w)
1100
+ c_f = est.cpw_c_per_um(wf, sf, eps)
1101
+ c_sp = est.cpw_c_per_um(w, s, eps) * max(pitch - wf - 2 * sf, 0.0)
1102
+ nc = int(p["unloaded_cells"]) + int(p["loaded_cells"])
1103
+ rows, per, turns = int(p["rows"]), int(p["periods_per_row"]), int(p["turn_periods"])
1104
+ n_total = rows * per * nc + (rows - 1) * turns * nc
1105
+ return {
1106
+ "L_cell_pH": l_geo + l_k,
1107
+ "L_geo_pH": l_geo,
1108
+ "L_k_pH": l_k,
1109
+ "alpha_k": l_k / (l_geo + l_k),
1110
+ "sheet_pH_sq": ls,
1111
+ "C_cell_fF": 2 * c_f * lf + c_sp,
1112
+ "C_loaded_fF": 2 * c_f * llf + c_sp,
1113
+ "Z_cell_ohm": math.sqrt((l_geo + l_k) * 1e-12 / ((2 * c_f * lf + c_sp) * 1e-15)),
1114
+ "cells_per_supercell": nc,
1115
+ "unloaded_cells": int(p["unloaded_cells"]),
1116
+ "loaded_cells": int(p["loaded_cells"]),
1117
+ "supercells": rows * per + (rows - 1) * turns,
1118
+ "cells": n_total,
1119
+ "length_um": n_total * pitch,
1120
+ "eps_r": eps,
1121
+ }
1122
+
1123
+ @classmethod
1124
+ def qcc_lom(cls, name: str, inst, pdk):
1125
+ """One conductor between ``a`` and ``b`` (a wire when both meet pads); the ladder values ride in the notes."""
1126
+ from quantcore_circuits.lom.fragment import Fragment, Line, cell_params # pylint: disable=C0415
1127
+
1128
+ p = cell_params(inst)
1129
+ lad = cls.qcc_ladder(p, pdk)
1130
+ frag = Fragment(nodes={"line": {"island": f"{name}.line"}}, port_nodes={"a": "line", "b": "line"})
1131
+ frag.lines.append(
1132
+ Line(name, "line", ("a", "b"), lad["length_um"], _f(p["spine_width"]), _f(p["spine_gap"]), ("open", "open"))
1133
+ )
1134
+ frag.notes.append(
1135
+ f"{name}: KI-TWPA ladder of {lad['cells']} cells, L {lad['L_cell_pH']:.3g} pH/cell (kinetic "
1136
+ f"{lad['alpha_k']:.1%} at {lad['sheet_pH_sq']:.3g} pH/□), C {lad['C_cell_fF']:.3g} fF/cell, Z ≈ "
1137
+ f"{lad['Z_cell_ohm']:.0f} Ω (analysis.amplifiers for dispersion and gain)"
1138
+ )
1139
+ return frag