A very popular ab-initio scheme to calculate electronic properties in solids
is the use of hybrid functionals in density functional theory (DFT) that mixes
a portion of Fock exchange with DFT functionals. In spite of their success, a
major problem still remains, related to the use of one single mixing parameter
for all materials. Guided by physical arguments that connect the mixing
parameter to the dielectric properties of the solid, and ultimately to its band
gap, we propose a method to calculate this parameter from the electronic
density alone. This method is able to cut significantly the error of
traditional hybrid functionals for large and small gap materials, while
retaining a good description of structural properties. Moreover, its
implementation is simple and leads to a negligible increase of the
computational time.Comment: submitte