  An insulator differs from a metal because of a different organization of the
electrons in their ground state. In recent years this feature has been probed
by means of a geometrical property: the quantum metric tensor, which addresses
the system as a whole, and is therefore limited to macroscopically homogenous
samples. Here we show that an analogous approach leads to a localization
marker, which can detect the metallic vs. insulating character of a given
sample region using as sole ingredient the ground state electron distribution,
even in the Anderson case (where the spectrum is gapless). When applied to an
insulator with nonzero Chern invariant, our marker is capable of discriminating
the insulating nature of the bulk from the conducting nature of the boundary.
Simulations (both model-Hamiltonian and first-principle) on several test cases
validate our theory.
