  We present a first-principles-based (second-principles) scheme that permits
large-scale materials simulations including both atomic and electronic degrees
of freedom on the same footing. The method is based on a predictive
quantum-mechanical theory, e.g., Density Functional Theory, and its accuracy
can be systematically improved at a very modest computational cost. Our
approach is based on dividing the electron density of the system into a
reference part - typically corresponding to the system's neutral,
geometry-dependent ground state - and a deformation part - defined as the
difference between the actual and reference densities. We then take advantage
of the fact that the bulk part of the system's energy depends on the reference
density alone; this part can be efficiently and accurately described by a force
field, thus avoiding explicit consideration of the electrons. Then, the effects
associated to the difference density can be treated perturbatively with good
precision by working in a suitably chosen Wannier function basis. Further, the
electronic model can be restricted to the bands of interest. All these features
combined yield a very flexible and computationally very efficient scheme. Here
we present the basic formulation of this approach, as well as a practical
strategy to compute model parameters for realistic materials. We illustrate the
accuracy and scope of the proposed method with two case studies, namely, the
relative stability of various spin arrangements in NiO and the formation of a
two-dimensional electron gas at the interface between band insulators LaAlO$_3$
and SrTiO$_3$. We conclude by discussing ways to overcome the limitations of
the present approach (most notably, the assumption of a fixed bonding
topology), as well as its many envisioned possibilities and future extensions.
