the Sq-A structure, TE polarization, 5th band (bottom). The dashed, green line shows the locality of the best-localized Wannier function in each generation. Every 100 generations, these Wannier functions served as a starting point for the subsequent CG optimization step (red crosses). On the right hand side, the modulus square of the SM-optimized Wannier function is shown for an early (top: 40000th, bottom: 38300th) and a later (top: 60000th, bottom: 100000th) generation, respectively.[]{data-label="fig:ga_sm"}](all-g-te-sm "fig:"){width="0.95\columnwidth"}

Genetic algorithm
-----------------

The proper choice of the initial set of Bloch phases is in general not trivial [@john]. Even if such a choice can be justified, one can never be sure that the resulting SM-optimized Wannier functions indeed correspond to the global minimum of the SM. To solve the global optimization problem and to examine the validity of the SM optimization in more detail, we have applied a global, stochastic-based optimization technique, namely a genetic algorithm (GA) method [@MIT99]. Taking the biologic evolution in nature as a model, the GA method works with a population of individuals which pass through a selection procedure and can reproduce themselves. Each Wannier function represents an individual. The set of Bloch phases, which determines the Wannier function, is represented 