1: \begin{abstract}
2: We develop a first-principles scheme to calculate adiabatic and
3: non-adiabatic phonon frequencies in the full Brillouin zone.
4: The method relies on the variational properties of a force-constants
5: functional with respect to the first-order perturbation of the electronic charge
6: density and on the localization of the deformation potential in the
7: Wannier function basis. This allows for calculation
8: of phonon dispersion curves free
9: from convergence issues related to Brillouin zone sampling.
10: In addition our approach justify the use of the static screened potential
11: in the calculation of the phonon linewidth due to decay in electron-hole pairs.
12: We apply the method to the calculation of the phonon dispersion and
13: electron-phonon coupling in MgB$_2$ and CaC$_6$. In both compounds we demonstrate
14: the occurrence of several Kohn anomalies, absent in previous calculations, that are
15: manifest only after careful electron and phonon momentum integration.
16: In MgB$_2$, the presence of Kohn anomalies
17: on the E$_{2g}$ branches improves the agreement with measured phonon spectra
18: and affects the
19: position of the main peak in the Eliashberg function.
20: In CaC$_6$ we show that the non-adiabatic
21: effects on in-plane carbon vibrations are not localized at zone center
22: but are sizable throughout the full Brillouin zone.
23: Our method opens new perspectives in large-scale first-principles
24: calculations of dynamical properties and electron-phonon interaction.
25: \end{abstract}
26: