1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61
|
import math
import meep as mp
from meep import mpb
# Dielectric spheres in a diamond (fcc) lattice. This file is used in
# the "Data Analysis Tutorial" section of the MPB manual.
sqrt_half = math.sqrt(0.5)
geometry_lattice = mp.Lattice(
basis_size=mp.Vector3(sqrt_half, sqrt_half, sqrt_half),
basis1=mp.Vector3(0, 1, 1),
basis2=mp.Vector3(1, 0, 1),
basis3=mp.Vector3(1, 1)
)
# Corners of the irreducible Brillouin zone for the fcc lattice,
# in a canonical order:
vlist = [
mp.Vector3(0, 0.5, 0.5), # X
mp.Vector3(0, 0.625, 0.375), # U
mp.Vector3(0, 0.5, 0), # L
mp.Vector3(0, 0, 0), # Gamma
mp.Vector3(0, 0.5, 0.5), # X
mp.Vector3(0.25, 0.75, 0.5), # W
mp.Vector3(0.375, 0.75, 0.375) # K
]
k_points = mp.interpolate(4, vlist)
# define a couple of parameters (which we can set from the command_line)
eps = 11.56 # the dielectric constant of the spheres
r = 0.25 # the radius of the spheres
diel = mp.Medium(epsilon=eps)
# A diamond lattice has two "atoms" per unit cell:
geometry = [mp.Sphere(r, center=mp.Vector3(0.125, 0.125, 0.125), material=diel),
mp.Sphere(r, center=mp.Vector3(-0.125, -0.125, -0.125), material=diel)]
# (A simple fcc lattice would have only one sphere/object at the origin.)
resolution = 16 # use a 16x16x16 grid
mesh_size = 5
num_bands = 5
ms = mpb.ModeSolver(
geometry_lattice=geometry_lattice,
k_points=k_points,
geometry=geometry,
resolution=resolution,
num_bands=num_bands,
mesh_size=mesh_size
)
def main():
# run calculation, outputting electric_field energy density at the U point:
ms.run(mpb.output_at_kpoint(mp.Vector3(0, 0.625, 0.375), mpb.output_dpwr))
if __name__ == '__main__':
main()
|