Photonic Crystal

Photonic Crystal#

import matplotlib.pyplot as plt
import numpy as np
import treams
k0s = 2 * np.pi * np.linspace(0.01, 1, 200)
materials = [treams.Material(12.4), treams.Material()]
lmax = 3
radius = 0.2
lattice = treams.Lattice.cubic(0.5)
kpar = [0, 0, 0]
res = []
for k0 in k0s:
    sphere = treams.TMatrix.sphere(lmax, k0, radius, materials)
    svd = np.linalg.svd(sphere.latticeinteraction(lattice, kpar), compute_uv=False)
    res.append(svd[-1])
fig, ax = plt.subplots()
ax.set_xlabel("Frequency (THz)")
ax.set_ylabel("Smallest singular value")
ax.semilogy(299.792458 * k0s / (2 * np.pi), res)
fig.show()
../_images/48f12a5dbaadc3017cc2dee5e6d9159604cfe03feef8832066da1bb939c3b889.png