This module contains the core routines to extract an optimal subspace from a set of entangled bands.
At input it contains a large set of eigenvalues. At it is slimmed down to contain only those inside the energy window.
Is there a frozen window
true if the i-th band inside outer window is frozen
index of lowest band inside outer window at nkp-th
number of frozen bands at nkp-th k point
number of bands inside outer window at nkp-th k point
outer-window band index for the i-th non-frozen state (equals 1 if it is the bottom of outer window)
Main disentanglement routine
This subroutine selects the states that are inside the outer window (ie, the energy window out of which we fish out the optimally-connected subspace) and those that are inside the inner window (that make up the frozen manifold, and are straightfowardly included as they are). This, in practice, amounts to slimming down the original num_wann x num_wann overlap matrices, removing rows and columns that belong to u_nks that have been excluded forever, and marking (indexing) the rows and columns that correspond to frozen states.
Construct projections for the start of the disentanglement routine
COMPUTES THE LEADING EIGENVECTORS OF Q_froz . P_s . Q_froz, WHERE P_s PROJECTOR OPERATOR ONTO THE SUBSPACE S OF THE PROJECTED GAUSSIANS, P_f THE PROJECTOR ONTO THE FROZEN STATES, AND Q_froz = 1 - P_froz, ALL EXP IN THE BASIS OF THE BLOCH EIGENSTATES INSIDE THE OUTER ENERGY WINDOW (See Eq. (27) in Sec. III.G of SMV)
Extracts an num_wann-dimensional subspace at each k by minimizing Omega_I
Extracts an num_wann-dimensional subspace at each k by minimizing Omega_I (Gamma point version)