  Density functional perturbation theory is a well-established method to study
responses of molecules and solids, especially responses to atomic displacements
or to different perturbing fields (electric, magnetic). Like for density
functional theory, the treatment of metals is delicate, due to the Fermi-Dirac
statistics and electronic bands crossing the Fermi energy. At zero temperature,
there is an abrupt transition from occupied states to unoccupied ones, usually
addressed with smearing schemes. Also, at finite temperature, fractional
occupations are present, and the occupation numbers may vary in response to the
perturbation. The present work establishes the characteristics of density
functional perturbation theory stemming from the underlying variational
principle, in the case of metals. After briefly reviewing variational density
functional theory for metals, the convexity of the entropy function of the
occupation number is analyzed, and, at finite temperature, the benefit of
resmearing the Fermi-Dirac broadening with the Methfessel-Paxton one is
highlighted. Then the variational expressions for the second-order derivative
of the free energy are detailed, exposing the different possible gauge choices.
The influence of the inaccuracies in the unperturbed wavefunctions from the
prior density functional theory calculation is studied. The whole formalism is
implemented in the ABINIT software package.
