import meep as mp
from meep import mpb

resolution = 20  # pixels/a

a = 0.43         # units of um
r = 0.12         # units of um
h = 0.22         # units of um
w = 0.50         # units of um

r = r/a          # units of "a"
h = h/a          # units of "a"
w = w/a          # units of "a"

nSi = 3.5
Si = mp.Medium(index=nSi)

geometry_lattice = mp.Lattice(size=mp.Vector3(1,4,4))

geometry = [ mp.Block(center=mp.Vector3(), size=mp.Vector3(mp.inf,w,h), material=Si),
             mp.Cylinder(center=mp.Vector3(), radius=r, height=mp.inf, material=mp.air) ]

num_k = 20
k_points = mp.interpolate(num_k, [mp.Vector3(0,0,0), mp.Vector3(0.5,0,0)])

num_bands = 5

ms = mpb.ModeSolver(
    geometry_lattice=geometry_lattice,
    geometry=geometry,
    k_points=k_points,
    resolution=resolution,
    num_bands=num_bands)

ms.run_yodd_zeven()
