Home Forums Nazca Photonic crystal line-defect waveguide – Remove holes Reply To: Photonic crystal line-defect waveguide – Remove holes

#6292
Ronald
Keymaster

Dear Dagi,

If you makes cells of the holes, as in cell ‘hole’, the work would need to be done on the cell instances in your pxtal. This is possible via the cell_iter(), but here there may be a simpler solution by placing hole polygon objects directly in the pxtal cell. This is not something I have used before a lot, but you can scan and update directly on the polygon attribute in the cell object and filter it based on e.g. x-position of a hole, as demonstrated in the example below.
I also added pins to make it a circuit type waveguide.

``````import nazca as nd
import numpy as np

# Add layer
nd.add_layer(name="ebeam", layer=1, overwrite=(True), fill_color=("red"))

# Define PhC parameters
hole_radius = 0.125
PhC_ax = 0.425
PhC_ay = 0.5 * PhC_ax * np.sqrt(3)
hole_polygon = 20
nx = 20
ny = 10

# Define hole shape and geometry
hole_shape = nd.geometries.circle(radius=hole_radius, N=hole_polygon)
hole1 = nd.Polygon(points=hole_shape, layer="ebeam")

# ================================
# make triangular lattice of holes
# ================================
with nd.Cell('pxtal', instantiate=False) as pxtal:
hole_reference = []
for ix in np.arange(-np.floor(nx / 2), np.floor(nx / 2)):
for iy in np.arange(-np.floor(ny / 2), np.floor(ny / 2) + 1):
x = (ix + np.mod(iy, 2) * 0.5) * PhC_ax
y = iy * PhC_ay
if ix != -np.floor(nx / 2) or np.mod(iy, 2) != 0:
hole1.put(x, y)
nd.Pin('a0').put(0, 2, 90)
nd.Pin('b0').put(0, -2, -90)
nd.put_stub()

# =============================
# Add line-defect PhC waveguide
# =============================
pgons_new = []
for pgon in pxtal.polygons:
node, Poly = pgon
x, y, a = node.xya()
if abs(x) > 0.2:
pgons_new.append((node, Poly))
pxtal.polygons = pgons_new

pxtal.put(0, 0, 90)

# Export gds file
nd.export_gds(filename="PhC.gds")``````

Ronald