  We present a constrained density functional perturbation theory scheme for
the calculation of structural and harmonic vibrational properties of insulators
in the presence of an excited and thermalized electron-hole plasma. The method
is ideal to tame ultrafast light induced structural transitions in the regime
where the photocarriers thermalize faster than the lattice, the electron-hole
recombination time is longer than the phonon period and the photocarrier
concentration is large enough to be approximated by an electron-hole plasma.
The complete derivation presented here includes total energy, forces and stress
tensor, variable cell structural optimization, harmonic vibrational properties
and the electron-phonon interaction. We discuss in detail the case of zone
center optical phonons not conserving the number of electrons and inducing a
Fermi shift in the photo-electron and hole distributions. We validate our
implementation by comparing with finite differences in Te and VSe2. By
calculating the evolution of the phonon spectrum of Te, Si and GaAs as a
function of the fluence of the incoming laser light, we demonstrate that even
at low fluences, corresponding to approximately 0.1 photocarriers per cell, the
phonon spectrum is substantially modified with respect to the ground state one
with new Kohn anomalies appearing and a substantial softening of zone center
optical phonons. Our implementation can be efficiently used to detect
reversible transient phases and irreversible structural transition induced by
ultrafast light absorption.
