not unique. The common choice used in the literature [@busch; @whittaker; @john] is to minimize the second moment (SM) of the modulus square of the Wannier function [@marzari1; @marzari2]. Unfortunately, it turned out that the SM, as a functional of the set of Bloch phases $\phi_{n{\mathbf{k}}}$, has multiple local minima, so that local optimization procedures, like the conjugate gradient method, tend not to find the global minimum and the locality of the Wannier function optimized in this way depends sensitively on the initial set of Bloch phases. Global optimization procedures are, on the other hand, slow and computationally exceedingly expensive.

The purpose of this paper is a systematic analysis of different locality measures using both local and global optimization methods. In Section \[sec:SM\] we construct SM optimized maximally localized Wannier functions, comparing conjugate gradient (local) and genetic-algorithm-based (global) methods. This analysis leads us in Section \[sec:IM\] to propose a new locality measure, namely the integrated modulus square (IM) measure, resulting in an optimization problem with a single extremum only. This allows one to use fast and efficient local optimization techniques to construct maximally localized Wannier functions. In Section \[sec:BC\] we show that, if the Bloch modes conform certain conditions, it 