The selfcollimation of light in perfectly periodic photonic crystals (PC) have attracted significant research efforts due to its potential role in photonic integrated circuits, which have several key advantages over discrete optical components. The goal of this example is to demonstrate a simple optical switch utilizing selfcollimated beams and line defects in photonic crystals.

The 2D photonic crystal is composed of dielectric rods of radius 0.35um and dielectric constant of 12. The lattice constant is a = 1um and Perfectly Matched Layers (PML) are used on all boundaries. A Gaussian beam (with FWHM of about 5um) at frequency 0.194c/a is launched from one side of the PC, and the resultant modes have electric fields parallel to the rod axis. Note that the PC is extended pass the PML boundaries in order to prevent reflections at these boundaries (see Extending structures through PML).
As shown in Lee et al. and the figures below, the selfcollimated beam can propagate with almost no diffraction along the PC (left image), and can also be completely reflected at the PCair interface created by the line defect along the diagonal (right image).
The power_vs_r.lsf script sweeps through the various defect radii and plots the transmission/reflection as a function of defect radius for the file pc_switch.fsp. The result reproduces figure 2 of the Lee et al. paper, demonstrating that the power ratio between the two split beams can be very well controlled by varying the radii of the defect rods.
An optical switch is purposed by Zhang et al. based on the same PC/line defect set up described above. The defect radius here is 0.274um, which results in about 50% transmitted and reflected power (see the point of intersection in the figure above). The figures below show the results of the line defect on the selfcollimated beam.
If two identical Gaussian beams with intensities \(I_1 = I_2 = I_0 \) and phases \( \varphi_{1}\) and \( \varphi_{2} \) are launched at the same time, the selfcollimated beams will interact and result in output intensities of:
$$ \begin{array}{l}{I_{o 1}=I_{0}\left(1+\sin \left(\varphi_{1}\varphi_{2}\right)\right)} \\ {I_{o 2}=I_{0}\left(1\sin \left(\varphi_{1}\varphi_{2}\right)\right)}\end{array} $$
Which means that \(I_{o1} = 2 I_0 \text{, } {I_{o 2} = 0 \) when \( \varphi_{1}\varphi_{2}=2 k \pi+\pi / 2 \) and \(I_{o1} = 0 \text{, } {I_{o 2} = 2 I_0 \) when \( \varphi_{1}\varphi_{2}=2 k \pi  \pi / 2 \), as shown in the figures below (figure 4 from Zhang et al).
By combining the results for both 1 and 2 Gaussian beams, this PC/line defect device can now operate as a logic OR and XOR gate, as describe in Table 1 of the Zhang et al paper. These results can be reproduced using pc_switch_2beams.fsp.