Cylinder crystal¶
Infinite cylinders with permittivity 12.4 and radius 0.2 stand on a square lattice with period 0.3 in the xy plane. The lattice interaction matrix is I - T C, where T is the cylindrical T-matrix of one cylinder and C expands the waves scattered by all other cylinders about it. The crystal has a mode with zero Bloch wave vector where this matrix is singular, so dips of its smallest singular value mark the mode frequencies. Light travels in the xy plane (kz = 0). Lengths have no unit; the frequency column is k0 / 2π, the inverse vacuum wavelength.
"""A square lattice of cylinders: where its lattice modes lie."""
import numpy as np
import treams_rs as tr
# Enlarge for a full spectrum: treams uses 200 frequencies.
FREQUENCIES = 5
k0s = 2 * np.pi * np.linspace(0.01, 1, FREQUENCIES)
material = tr.Material(12.4)
mmax = 3
radius = 0.2
lattice = tr.Lattice.square(0.3)
kpar = [0, 0, 0]
# A mode of the crystal exists where the lattice interaction matrix
# I - T C is singular; its smallest singular value dips towards zero there.
res = []
for k0 in k0s:
cyl = tr.cylinder_tmatrix(
k0=k0, kz=kpar[2], mmax=mmax, radius=radius, material=material
)
svd = np.linalg.svd(cyl.latticeinteraction(lattice, kpar[:2]), compute_uv=False)
res.append(svd[-1])
if __name__ == "__main__":
print("Smallest singular value of the lattice interaction matrix")
print(f"{'k0/(2 pi)':>13}{'value':>13}")
for k0, value in zip(k0s, res, strict=True):
print(f"{k0 / (2 * np.pi):>13.6g}{value:>13.6g}")
# Source: https://github.com/tfp-photonics/treams/blob/1f5d0d6ebb007288f28bc9e16f6d266e8b55dc39/docs/examples/crystal_tmatrixc.py
# Adapted: reduced sizes, plotting removed.
# MIT license, copyright Dominik Beutel; see LICENSE.treams.
import numpy as np
import treams
k0s = 2 * np.pi * np.linspace(0.01, 1, 5)
materials = [treams.Material(12.4), treams.Material()]
mmax = 3
radius = 0.2
lattice = treams.Lattice.square(0.3)
kpar = [0, 0, 0]
res = []
for k0 in k0s:
cyl = treams.TMatrixC.cylinder(kpar[2], mmax, k0, radius, materials)
svd = np.linalg.svd(cyl.latticeinteraction(lattice, kpar[:2]), compute_uv=False)
res.append(svd[-1])
Output¶
Smallest singular value of the lattice interaction matrix
k0/(2 pi) value
0.01 1.67314e-05
0.2575 0.0111867
0.505 0.0424639
0.7525 0.0178158
1 0.000146804
Differences from the treams version¶
latticeinteraction(lattice, kpar)is a treams member that treams-rs keeps under its treams name, as in the photonic crystal example.solve_periodicsolves the same system when the response itself is needed.cylinder_tmatrixtakes keywords and the cylinder'smaterial; the exteriormediumis vacuum unless given.