  Formation of halos in the Dark Ages from initial spherical perturbations is
analyzed in a four component Universe (dark matter, dark energy, baryonic
matter and radiation) in the approximation of relativistic hydrodynamics.
Evolution of density and velocity perturbations of each component is obtained
by integration of a system of nine differential equations from $z=10^8$ up to
virialization, which is described phenomenologically. It is shown that the
number density of dark matter halos with masses
$M\sim10^8-10^9\,\mathrm{M_{\odot}}$ virialized at $z\sim10$ is close to the
number density of galaxies in comoving coordinates. The dynamical dark energy
of classical scalar field type does not significantly influence the evolution
of the other components, but dark energy with a small value of effective sound
speed can affect the final halo state. Simultaneously, the
formation/dissociation of the first molecules have been analyzed in the halos
which are forming. The results show that number densities of molecules
$\rm{H_2}$ and $\rm{HD}$ at the moment of halo virialization are $\sim10^3$ and
$\sim400$ times larger, respectively, than on a uniformly expanding background.
It is caused by increased density and rates of reactions at quasilinear and
nonlinear evolution stages of density and velocity of the baryonic component of
halos. It is shown also that the temperature history of the halo is important
for calculating the concentration of molecular ions with low binding energy.
So, in a halo with virial temperature $\sim10^5$ K the number density of the
molecular ion HeH$^+$ is approximately 100 times smaller than that on the
cosmological background.
