  Cosmological N-body hydrodynamic computations following atomic and molecular
chemistry (e$^-$, H, H$^+$, H$^-$, He, He$^+$, He$^{++}$, D, D$^+$, H$_2$,
H$_2^+$, HD, HeH$^+$), gas cooling, star formation and production of heavy
elements (C, N, O, Ne, Mg, Si, S, Ca, Fe, etc.) from stars covering a range of
mass and metallicity are used to explore the origin of several chemical
abundance patterns and to study both the metal and molecular content during
simulated galaxy assembly. The resulting trends show a remarkable similarity to
up-to-date observations of the most metal-poor damped Lyman-$\alpha$ absorbers
at redshift $z\gtrsim 2$. These exhibit a transient nature and represent
collapsing gaseous structures captured while cooling is becoming effective in
lowering the temperature below $\sim 10^4\,\rm K$, before they are disrupted by
episodes of star formation or tidal effects. Our theoretical results agree with
the available data for typical elemental ratios, such as [C/O], [Si/Fe],
[O/Fe], [Si/O], [Fe/H], [O/H] at redshifts $z\sim 2-7$. Correlations between HI
and H$_2$ abundances show temporal and local variations and large spreads as a
result of the increasing cosmic star formation activity from $z\sim 6$ to
$z\sim 3$. The scatter we find in the abundance ratios is compatible with the
observational data and is explained by simultaneous enrichment by sources from
different stellar phases or belonging to different stellar populations.
Simulated synthetic spectra support the existence of metal-poor cold clumps
with large optical depth at $z\sim 6$ that could be potential population~III
sites at low or intermediate redshift. The expected dust content is in line
with recent determinations.
