## Methods and Materials
### Optimization of Waveguide Geometry of PhC NB Cavity Structure with a Horizontal Air Gap  
The PhC NB cavity with the horizontal air gap was designed for optimal refractive index sensing using the FDTD method. Figure 2a shows the schematics of the proposed PhC NB cavity structure with a horizontal air gap. According to the previous photonic band calculation, the radius of the air hole, \(r_{0}\), at the center is set as \(0.45a\). The radius of the surrounded air hole is gradually reduced to \(r_{bm}\), which represents the air holes acting as a PBG mirror for the cavity mode. In this simulation, three air holes with radius \(r_{bm}\) are used as a PBG mirror at each waveguide end. It is worth noting that in order to achieve a high Q-factor and sensitivity simultaneously, the radius of the air holes is reduced in a quadratic manner because the dispersion curve of the air gap mode is parabolic, as discussed later in detail [9]. The radius of the \(i\)-th air hole from the center is set as:  
\[r_{i}=r_{0}-i^{2}\Delta r/m^{2} \tag{1}\]  
where \(m\) is the total number of gradually reduced air holes. Here, \(m=9\) and the variation in the size of air holes, \(\Delta r\) (=\(r_{0}-r_{bm}\)), is set as \(0.10\)\(r_{0}\). All other structural parameters are the same as the previous band diagram calculation. Figure 2b shows the cut-views of the electric field distribution, \(E_{z}\), of the air gap cavity mode along the center plane of the air gap when the width and thickness of the air gap are \(w=0.95a\) and \(t_{\text{g}}=0.15a\), respectively. According to the \(x\)-\(z\) cut-view, the electric field of the cavity mode is strongly confined in the air gap region, which makes very sensitized to the refractive index change to the environment. For practical applications of optical sensing, it is necessary to achieve not only high sensitivity but also a high Q-factor. In the first optimization step, we investigated the effect of the width of the Si waveguide on both sensitivity and Q-factor. The sensitivity, \(S\), was defined as follows:  
\[S=\Delta\lambda_{\text{res}}/\Delta n \tag{2}\]  
where \(\Delta\lambda_{\text{res}}\) is the peak wavelength shift of the cavity mode due to the refractive index change of the environment, \(\Delta n\). Here, we set the range of the refractive index change as \(1.000\) to \(1.001\) considering the gas sensing. Figure 2c shows the Q-factor and \(S\) as functions of the width of the Si waveguide. As the width of the waveguide increases, both the Q-factor and \(S\) decrease. The reduction of \(S\) and the Q-factor at greater widths is caused by an increase in the electric field in the dielectrics and an increase in waveguide loss, respectively. In contrast, as the thickness of the air gap increases, the Q-factor decreases but \(S\) increases. The enhancement of \(S\) and reduction of the Q-factor is caused by  
Figure 1: **(a)** Photonic band diagram of the transverse magnetic (TM) modes at the photonic crystals (PhC) nanobeam (NB) with a horizontal air gap. The solid (or dashed) lines correspond to the radius of the air hole at \(r/a=0.45\) (or \(0.40\)). The left insets show the top and side views of the PhC NB with the air gap. The right insets are the cut-views of the electric field distribution of the first TM mode and the air gap mode at the band edge marked with the red circle. **(b)** Normalized frequencies of the TM band edge mode as a function of the radius of air holes. The red line is the band edge frequency of the air gap mode. the increase in the air portion and the weak PBG effect, respectively. So, there is a trade-off in order to obtain both a high Q-factor and \(S\). Here, we set \(t\) and \(t_{\text{g}}\) as \(1.2a\) and \(0.15a\), respectively. In the second optimization step for a high Q-factor and \(S\), we investigated the modulation function to reduce air holes from the center to the mirror holes in the PhC NB cavity. Figure 3a shows the Q-factor and \(S\) of the air gap cavity mode as a function of the variation of air holes.