  We present an ab initio approach for the calculation of phonon self-energies
and their fluctuation diagnostics, which allows us to identify the electronic
processes behind phonon anomalies. Application to the
transition-metal-dichalcogenide monolayer 1H-TaS$_2$ reveals that coupling
between the longitudinal-acoustic phonons and the electrons from an isolated
low-energy metallic band is entirely responsible for phonon anomalies such as
the mode softening and associated charge-density waves observed in this
material. Our analysis allows us to distinguish between different
mode-softening mechanisms including matrix-element effects, Fermi-surface
nesting, and Van Hove scenarios. We find that matrix-element effects
originating from a peculiar type of Dirac pseudospin textures control the
charge-density-wave physics in 1H-TaS$_2$ and similar transition metal
dichalcogenides.
