  The renormalization of electronic eigenenergies due to electron-phonon
interactions (temperature dependence and zero-point motion effect) is important
in many materials. We address it in the adiabatic harmonic approximation, based
on first principles (e.g. Density-Functional Theory), from different points of
view: directly from atomic position fluctuations or, alternatively, from
Janak's theorem generalized to the case where the Helmholtz free energy,
including the vibrational entropy, is used. We prove their equivalence, based
on the usual form of Janak's theorem and on the dynamical equation. We then
also place the Allen-Heine-Cardona (AHC) theory of the renormalization in a
first-principle context. The AHC theory relies on the rigid-ion approximation,
and naturally leads to a self-energy (Fan) contribution and a Debye-Waller
contribution. Such a splitting can also be done for the complete harmonic
adiabatic expression, in which the rigid-ion approximation is not required. A
numerical study within the Density-Functional Perturbation theory framework
allows us to compare the AHC theory with frozen-phonon calculations, with or
without the rigid-ion terms. For the two different numerical approaches without
rigid-ion terms, the agreement is better than 7 $\mu$eV in the case of diamond,
which represent an agreement to 5 significant digits. The magnitude of the non
rigid-ion terms in this case is also presented, distinguishing specific phonon
modes contributions to different electronic eigenenergies.
