Ab initiostatic dielectric matrices from the density-functional approach. I. Formulation and application to semiconductors and insulators | Synapse