Skip to content

Commit

Permalink
Pyaedt renderer (#935)
Browse files Browse the repository at this point in the history
* Add the pyaedt renderers

* Tutorials for renderers.

* Typos

* A sample of a layer stack file.

* Fix typos.

* Add files.

* Update imports due to changing repos.

* Add new renderers to config file.

* Looks like yapf linting has been changed, so needed to re-save these files.

* Add new  renderers to test import.

* Update the import paths.

* Reduce the errors in test cases.

* Use same name as in renderers.

* Update the files for new repo and documentation generation.

* Remove duplicate.

* Add full path.

* Check to see if this pyaedt API works.

* Give up on trying to find the type for pyaedt. Just use quotes.

* Try this edit.

* For documentation, stop the circular import.

* Fix Typo

* Problem with registering the new renderers. The init has methods which assume the class has been instantiated.

* Move the method to render_design, this will repeat the calculation, but will allow for populating the qgeomtry tables.

* Add the renderers and see if they can pass CI.

* Revert the change.

* Fix the error while making columns for qgeometry table..

* Update test case to include additional renderers.

* Added disclaimer for student license

---------

Co-authored-by: Abeer Vaishnav <abeer.vaishnav13@gmail.com>
  • Loading branch information
priti-ashvin-shah-ibm and AbeerVaishnav13 authored Apr 26, 2023
1 parent 27d8542 commit ea1ca0e
Show file tree
Hide file tree
Showing 20 changed files with 4,782 additions and 36 deletions.
76 changes: 58 additions & 18 deletions qiskit_metal/analyses/quantization/lumped_capacitive.py
Original file line number Diff line number Diff line change
Expand Up @@ -263,8 +263,12 @@ def extract_transmon_coupled_Noscillator(capMatrix,

# sum of capacitances from each pad to ground
# this assumes the bus couplers are at "ground"
C1S = Cg[0] + np.sum(Cbus[0,])
C2S = Cg[1] + np.sum(Cbus[1,])
C1S = Cg[0] + np.sum(Cbus[
0,
])
C2S = Cg[1] + np.sum(Cbus[
1,
])

# total capacitance between pads
tCSq = Cs + C1S * C2S / (C1S + C2S) # Key equation
Expand All @@ -277,7 +281,11 @@ def extract_transmon_coupled_Noscillator(capMatrix,
(C1S+C2S) + np.sum(Cbus[:, ii]) + np.sum(Cbusbus[ii, :])

# qubit to coupling pad capacitance
tCqbus = (C2S * Cbus[0,] - Cbus[1,] * C1S) / (C1S + C2S)
tCqbus = (C2S * Cbus[
0,
] - Cbus[
1,
] * C1S) / (C1S + C2S)

# coupling pad to coupling pad capacitance
tCqbusbus = np.zeros([N, N])
Expand All @@ -287,7 +295,11 @@ def extract_transmon_coupled_Noscillator(capMatrix,
(Cbus[0, ii]+Cbus[1, ii])*(Cbus[0, jj]+Cbus[1, jj])/(C1S+C2S)

# voltage division ratio
bbus = (C2S * Cbus[0,] - Cbus[1,] * C1S) / ((C1S + C2S) * Cs + C1S * C2S)
bbus = (C2S * Cbus[
0,
] - Cbus[
1,
] * C1S) / ((C1S + C2S) * Cs + C1S * C2S)

# total qubit capacitance (including junction capacitance)
Cq = tCSq + CJ
Expand Down Expand Up @@ -471,16 +483,24 @@ def levels_vs_ng_real_units(Cq, IC, N=301, do_disp=0, do_plots=0):
plt.figure()
plt.subplot(1, 2, 1)
plt.plot(charge,
elvls[0,] / h / 1e9,
elvls[
0,
] / h / 1e9,
'k',
charge,
elvls[1,] / h / 1e9,
elvls[
1,
] / h / 1e9,
'b',
charge,
elvls[2,] / h / 1e9,
elvls[
2,
] / h / 1e9,
'r',
charge,
elvls[3,] / h / 1e9,
elvls[
3,
] / h / 1e9,
'g',
LineWidth=2)
plt.xlabel('Gate charge, n_g [2e]')
Expand All @@ -494,23 +514,43 @@ def levels_vs_ng_real_units(Cq, IC, N=301, do_disp=0, do_plots=0):
plt.figure(2)
plt.subplot(1, 2, 1)
plt.plot(
charge, 1000 * (elvls[2,] / h / 1e9 - elvls[0,] / h / 1e9 -
2 * elvls[1,] / h / 1e9 - elvls[0,] / h / 1e9),
charge, -charge * 0 - 1000 * Ec / h / 1e9)
charge, 1000 * (elvls[
2,
] / h / 1e9 - elvls[
0,
] / h / 1e9 - 2 * elvls[
1,
] / h / 1e9 - elvls[
0,
] / h / 1e9), charge, -charge * 0 - 1000 * Ec / h / 1e9)
plt.xlabel('Gate charge, n_g [2e]')
plt.ylabel('delta [MHZ] green theory, blue numerics ')
plt.subplot(1, 2, 2)
plt.plot(charge, elvls[1,] / h / 1e9 - elvls[0,] / h / 1e9, charge,
charge * 0 + (np.sqrt(8 * EJ * Ec) - Ec) / h / 1e9)
plt.plot(charge, elvls[
1,
] / h / 1e9 - elvls[
0,
] / h / 1e9, charge, charge * 0 + (np.sqrt(8 * EJ * Ec) - Ec) / h / 1e9)
plt.xlabel('Gate charge, n_g [2e]')
plt.ylabel('F01 [GHZ] green theory, blue numerics ')
plt.show()

fqubitGHz = np.mean(elvls[1,] / h / 1e9)
anharMHz = np.mean(1000 * (elvls[2,] / h / 1e9 - elvls[0,] / h / 1e9 -
2 * elvls[1,] / h / 1e9 - elvls[0,] / h / 1e9))

disp = np.max(-elvls[1,] / h + elvls[1, 0] / h)
fqubitGHz = np.mean(elvls[
1,
] / h / 1e9)
anharMHz = np.mean(1000 * (elvls[
2,
] / h / 1e9 - elvls[
0,
] / h / 1e9 - 2 * elvls[
1,
] / h / 1e9 - elvls[
0,
] / h / 1e9))

disp = np.max(-elvls[
1,
] / h + elvls[1, 0] / h)
tphi_ms = 2 / (2 * np.pi * disp * np.pi * 1e-4 * 1e-3)

if do_disp:
Expand Down
13 changes: 12 additions & 1 deletion qiskit_metal/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,18 @@
class_name='QGmshRenderer'),
elmer=Dict(path_name='qiskit_metal.renderers.renderer_elmer.elmer_renderer',
class_name='QElmerRenderer'),
)
aedt_q3d=Dict(
path_name=
'qiskit_metal.renderers.renderer_ansys_pyaedt.q3d_renderer_aedt',
class_name='QQ3DPyaedt'),
aedt_hfss_drivenmodal=Dict(
path_name=
'qiskit_metal.renderers.renderer_ansys_pyaedt.hfss_renderer_drivenmodal_aedt',
class_name='QHFSSDrivenmodalPyaedt'),
aedt_hfss_eigenmode=Dict(
path_name=
'qiskit_metal.renderers.renderer_ansys_pyaedt.hfss_renderer_eigenmode_aedt',
class_name='QHFSSEigenmodePyaedt'))
"""
Define the renderes to load. Just provide the module names here.
"""
Expand Down
4 changes: 2 additions & 2 deletions qiskit_metal/qgeometries/qgeometries_handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -605,8 +605,8 @@ def delete_component_id(self, component_id: int):
for table_name in self.tables:
df_table_name = self.tables[table_name]
# self.tables[table_name] = df_table_name.drop(df_table_name[df_table_name['component'] == component_id].index)
self.tables[table_name] = df_table_name[
df_table_name['component'] != component_id]
self.tables[table_name] = df_table_name[df_table_name['component']
!= component_id]

def get_component(
self,
Expand Down
4 changes: 2 additions & 2 deletions qiskit_metal/qlibrary/core/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -249,8 +249,8 @@ def __init__(self,
short_name = prefix['short_name'][:name_trunc]
name_id = self.design._get_new_qcomponent_name_id(short_name)
# rename loop to make sure that no components manually named by the user conflicts
while self.design.rename_component(
self._id, short_name + "_" + str(name_id)) != 1:
while self.design.rename_component(self._id, short_name + "_" +
str(name_id)) != 1:
name_id = self.design._get_new_qcomponent_name_id(short_name)

# Add keys for each type of table. add_qgeometry() will update bool if the table is used.
Expand Down
8 changes: 4 additions & 4 deletions qiskit_metal/qlibrary/tlines/anchored_path.py
Original file line number Diff line number Diff line change
Expand Up @@ -314,13 +314,13 @@ def connect_simple(self, start_pt: QRoutePoint,
if (end_direction is None) or (mao.dot(end_direction,
corner2 - end) >= 0):
return np.expand_dims(corner2, axis=0)
if (mao.dot(start_direction, corner3 - start) >=
0) and startc3c4end:
if (mao.dot(start_direction, corner3 - start)
>= 0) and startc3c4end:
if (end_direction is None) or (mao.dot(end_direction,
corner4 - end) >= 0):
return np.vstack((corner3, corner4))
if (mao.dot(start_direction, corner5 - start) >=
0) and startc5c6end:
if (mao.dot(start_direction, corner5 - start)
>= 0) and startc5c6end:
if (end_direction is None) or (mao.dot(end_direction,
corner6 - end) >= 0):
return np.vstack((corner5, corner6))
Expand Down
12 changes: 11 additions & 1 deletion qiskit_metal/renderers/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,11 @@
QAnsysRenderer
QHFSSRenderer
QQ3DRenderer
QPyaedt
QQ3DPyaedt
QHFSSPyaedt
QHFSSDrivenmodalPyaedt
QHFSSEigenmodePyaedt
Expand Down Expand Up @@ -108,3 +112,9 @@

from .renderer_gmsh.gmsh_utils import Vec3DArray
from .renderer_gmsh.gmsh_renderer import QGmshRenderer

from .renderer_ansys_pyaedt.pyaedt_base import QPyaedt
from .renderer_ansys_pyaedt.q3d_renderer_aedt import QQ3DPyaedt
from .renderer_ansys_pyaedt.hfss_renderer_aedt import QHFSSPyaedt
from .renderer_ansys_pyaedt.hfss_renderer_drivenmodal_aedt import QHFSSDrivenmodalPyaedt
from .renderer_ansys_pyaedt.hfss_renderer_eigenmode_aedt import QHFSSEigenmodePyaedt
2 changes: 2 additions & 0 deletions qiskit_metal/renderers/renderer_ansys_pyaedt/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# -*- coding: utf-8 -*-
# """ Renderer using pyaedt and multiplanar using Ansys API."""
Loading

0 comments on commit ea1ca0e

Please sign in to comment.