  Context: Atomic and molecular lines in galaxies offer insights into energy
budgets and feedback mechanisms. Aims: This study establishes a new framework
for interpreting these lines and deducing energy budgets from observations.
Methods: Atomic and molecular lines detected in a given object are assumed to
result from the combination of distributions of shocks and photo-dissociation
regions (PDR). Using the Paris-Durham shock code and the Meudon PDR code,
emissions are computed over a wide range of parameters. Total emissions are
calculated using probability distribution functions, with a defined distance
metric based on observed and predicted intensity ratios. Results: We analyze
the radio galaxy 3C 326 N, finding both shocks and PDRs necessary to explain
the line fluxes. Viable solutions occur only at low densities ($\rm n_H < 100
cm^{-3}$), indicating emission from diffuse interstellar matter. The optimal
solution involves low-velocity shocks (5-20 km/s) in PDRs illuminated by UV
radiation ten times stronger than in the solar neighborhood. The H$2$ 0-0 S(0)
$28 \mu$m, [CII] $158 \mu$m, and [OI] $63 \mu$m lines originate from PDRs,
while other H$2$ lines mostly come from shocks. The reprocessed radiative and
mechanical energies are $\rm {L_{UV} = 6.3\times10^9 L\odot}$ and $\rm {L_K =
3.9\times10^8 L_\odot}$, respectively, in agreement with 3C 326 N's infrared
luminosity, and consistent with 1% of the AGN jet kinetic power dissipated in
the interstellar medium. Conclusions: This study demonstrates that the
radiative and mechanical energy budgets of galaxies can be derived from
observations of atomic and molecular lines alone. It highlights the unexpected
importance of the diffuse medium for 3C 326 N. Comparison with new JWST data
for 3C 326 N shows striking agreement, opening new prospects for predicting and
interpreting extragalactic observations.
