is possible to find an optimal set of Bloch phases with respect to the IM locality measure analytically. Although the required constrains will not be fulfilled in the general case, the Wannier functions calculated using such an analytical set of phases show strong tendency towards localizations and can be used as an efficient starting point for the numerical optimization. In Section \[sec:Applications\] using several examples of PhC defect structures, the quality of the constructed Wannier functions is demonstrated. Section \[sec:Conclusion\] concludes the paper.

Second moment optimization\[sec:SM\]
====================================

Definitions
-----------

In what follows, we limit ourselves to the two-dimensional (2D) case, which is characterized by the periodic dielectric functions $\epsilon({\mathbf{r}})=\epsilon({\mathbf{r+R}})$, $\forall{\mathbf{R}}\in\mathcal{L}$, with ${\mathbf{r}}=(x,y)$ denoting a 2D vector in the $x$-$y$-plane and ${\mathbf{R}}$ being a lattice vector of some 2D lattice $\mathcal{L}$. In this case, the wave equation for time harmonic TM (transverse magnetic), $E({\mathbf{r}},t)={\mathrm{e}^{-\mathrm{i} \omega t}}E({\mathbf{r}})$, and TE (transverse electric), $H({\mathbf{r}},t)={\mathrm{e}^{-\mathrm{i} \omega t}}H({\mathbf{r}})$, polarization reads, respectively, $$\begin{aligned}
\mathcal{L}_{E}E({\mathbf{r}})=-\frac{1}{\epsilon({\mathbf{r}})}\nabla^{2}E({\mathbf{r}}) & = & \frac{\omega^{2}}{\mathrm{c}^{2}}E({\mathbf{r}})\label{eq:waveeqn_TM}\\
\mathcal{L}_{H}H({\mathbf{r}})=-\nabla\frac{1}{\epsilon({\mathbf{r}})}\nabla H({\mathbf{r}}) & = & \frac{\omega^{2}}{\mathrm{c}^{2}}H({\mathbf{r}}).\label{eq:waveeqn_TE}\end{aligned}$$ The wave operators $\mathcal{L}_{E}$ and $\mathcal{L}_{H}$ are hermitian with respect to the corresponding inner products: $$\langle f|g\rangle_E=\int_{V}d^{2}r{f^{*}({\bf r)\epsilon({\bf r)}}}g({\bf r)}\label{eq:innerProd_TM}$$ $$\langle f|g\rangle_H=\int_{V}d^{2}rf^{*}({\mathbf{r}})g({\mathbf{r}}). \label{eq:innerProd_TE}$$ $V$ is the 2D volume of the crystal. It is 