Skip to content

Commit

Permalink
bug: fixed ansys simulation bugs!
Browse files Browse the repository at this point in the history
  • Loading branch information
shanto268 committed Oct 13, 2024
1 parent bdfa927 commit ce698c1
Show file tree
Hide file tree
Showing 9 changed files with 239 additions and 1,309 deletions.
1 change: 1 addition & 0 deletions docs/source/release_notes.rst
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ Version 0.3.4 (2024-10-11)

**New Features**

- Fixed bugs in the `AnsysSimulator` code
- Added methods to `Analysis` to retrieve design parameters easily from any dataframe with `design_options` column
- Added custom TransmonCross and JJ elements
- Minor bug fixes in string inconsistencies and better error messaging
Expand Down
4 changes: 2 additions & 2 deletions squadds/interpolations/physics.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ def get_design(self) -> pd.DataFrame:

# Scale resonator and coupling element dimensions
updated_resonator_length = string_to_float(closest_cavity_cpw_design["design_options_cavity_claw"].iloc[0]["cpw_opts"]['total_length']) * (closest_cavity_cpw_design['cavity_frequency_GHz'] / f_res_target).values[0]
updated_resonator_length = round(updated_resonator_length)

res_scaling = closest_f_cavity / f_res_target
res_scaling = closest_f_cavity / f_res_target
Expand Down Expand Up @@ -123,9 +124,8 @@ def get_design(self) -> pd.DataFrame:
qubit_design_options['hfss_inductance'] = required_Lj*1e-9
qubit_design_options["connection_pads"]["readout"]['Lj'] = f"{required_Lj}nH"

# setting the `claw_cpw_*` params to zero
# setting the `claw_cpw_length` params to zero
qubit_design_options["connection_pads"]['readout']['claw_cpw_length'] = "0um"
qubit_design_options["connection_pads"]['readout']['claw_cpw_width'] = "0um"

cavity_design_options = closest_cavity_cpw_design["design_options_cavity_claw"].iloc[0]
cavity_design_options["cpw_opts"]['total_length'] = f"{updated_resonator_length}um"
Expand Down
2 changes: 1 addition & 1 deletion squadds/interpolations/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ def get_design_from_ml_predictions(analyzer, test_data, y_pred_dnn):

# Set 'claw_cpw_*' parameters to zero
qubit_design_options["connection_pads"]['readout']['claw_cpw_length'] = "0um"
qubit_design_options["connection_pads"]['readout']['claw_cpw_width'] = "0um"
# qubit_design_options["connection_pads"]['readout']['claw_cpw_width'] = "0um"

# Update the cavity design options with predicted values
cavity_design_options["cpw_opts"]['total_length'] = f"{total_length_pred}um"
Expand Down
44 changes: 11 additions & 33 deletions squadds/simulations/ansys_simulator.py
Original file line number Diff line number Diff line change
Expand Up @@ -146,43 +146,21 @@ def simulate(self, device_dict):
None
"""
return_df = {}

if isinstance(self.analyzer.selected_system, list): # have a qubit_cavity object
device_dict = get_first_element_if_series(device_dict)
qubit_geoms = get_first_element_if_series(device_dict["design_options_qubit"])
cavity_geoms = get_first_element_if_series(device_dict["design_options_cavity_claw"])
qubit_setup = get_first_element_if_series(device_dict["setup_qubit"])
cavity_setup = get_first_element_if_series(device_dict["setup_cavity_claw"])

if isinstance(self.analyzer.selected_system, list): # have a qubit_cavity object
self.geom_dict = Dict(
qubit_geoms=qubit_geoms,
cavity_geoms=cavity_geoms
qubit_geoms = device_dict["design_options_qubit"],
cavity_geoms = device_dict["design_options_cavity_claw"]
)
self.setup_dict = Dict(
qubit_setup=qubit_setup,
cavity_setup=cavity_setup
)

return_df, self.lom_analysis_obj, self.epr_analysis_obj = simulate_whole_device(
design=self.design,
device_dict=device_dict,
LOM_options=self.setup_dict.qubit_setup,
eigenmode_options=self.setup_dict.cavity_setup
)

# Handle non-qubit_cavity object case
else: # have a non-qubit_cavity object
design_options = get_first_element_if_series(device_dict["design_options"])
setup = get_first_element_if_series(device_dict["setup"])

self.geom_dict = design_options
self.setup_dict = setup

return_df, self.lom_analysis_obj, self.epr_analysis_obj = simulate_single_design(
design=self.design,
device_dict=device_dict,
lom_options=self.setup_dict
qubit_setup = device_dict["setup_qubit"],
cavity_setup = device_dict["setup_cavity_claw"]
)
return_df, self.lom_analysis_obj, self.epr_analysis_obj = simulate_whole_device(design=self.design, device_dict=device_dict, LOM_options=self.setup_dict.qubit_setup, eigenmode_options=self.setup_dict.cavity_setup)

else: # have a non-qubit_cavity object
self.geom_dict = device_dict["design_options"]
self.setup_dict = device_dict["setup"]
return_df, self.lom_analysis_obj, self.epr_analysis_obj = simulate_single_design(design=self.design, device_dict=device_dict, lom_options=self.setup_dict)

return return_df

Expand Down
Loading

0 comments on commit ce698c1

Please sign in to comment.