Skip to content

Commit

Permalink
slab bounds works?
Browse files Browse the repository at this point in the history
  • Loading branch information
tylerflex committed Nov 12, 2024
1 parent e721e9b commit c60437d
Showing 1 changed file with 1 addition and 15 deletions.
16 changes: 1 addition & 15 deletions tidy3d/components/geometry/primitives.py
Original file line number Diff line number Diff line change
Expand Up @@ -319,27 +319,13 @@ def compute_derivatives(self, derivative_info: DerivativeInfo) -> AutogradFieldM

elif "center" in path:
_, center_index = path
if center_index == self.axis:
raise NotImplementedError(
"Currently cannot differentiate Cylinder with respect to its 'center' along"
" the axis. If you would like this feature added, please feel free to raise"
" an issue on the tidy3d front end repository."
)

_, (index_x, index_y) = self.pop_axis((0, 1, 2), axis=self.axis)
if center_index == index_x:
vjps[path] = np.sum(vjps_vertices_xs)
elif center_index == index_y:
vjps[path] = np.sum(vjps_vertices_ys)
else:
raise ValueError(
"Something unexpected happened. Was asked to differentiate "
f"with respect to 'Cylinder.center[{center_index}]', but this was not "
"detected as being one of the parallel axis with "
f"'Cylinder.axis' of '{self.axis}'. If you received this error, please raise "
"an issue on the tidy3d front end repository with details about how you "
"defined your 'Cylinder' in the objective function."
)
vjps[path] = vjp_top + vjp_bot

else:
raise NotImplementedError(
Expand Down

0 comments on commit c60437d

Please sign in to comment.