Dear developers,<div><br></div><div>I am trying to understand how the variation of occupations and Fermi level is implemented in density-functional perturbation theory for metals. In the Baroni, de Gironcoli, and Dal Corso Rev Mod Phys paper on DFPT, this issue appears in equations 68 and 75-79. I see that routine ef_shift can implement the result of a shift in the Fermi level as in either eq. 68 or eq. 75 depending on the value of &quot;flag&quot;. But for the calculation of the shift itself, I do not see the correspondence between what is done in the code and the equations in the paper. Eq. 79 refers to a quantity \Delta n_{ext} and an integral of the LDOS with \Delta V_{SCF} to calculate the shift in Fermi level. However in ef_shift it appears that the density response drhoscf is used instead of these quantities in the numerator, which doesn&#39;t seem like the same thing. Can you explain what the relation is between the calculation in the code and the equations in the RMP paper?</div>
<div><br></div><div>Thank you,</div><div>David Strubbe</div><div>UC Berkeley</div>