  We investigate the collapse of primordial gas in a minihalo with
three-dimensional radiation hydrodynamics simulations that accurately model the
transfer of H2 line emission. For this purpose, we have implemented a
multiline, multifrequency ray-tracing scheme in the moving-mesh code Arepo that
is capable of adaptively refining rays based on the Healpix algorithm, as well
as a hybrid equilibrium/non-equilibrium primordial chemistry solver. We find
that a multifrequency treatment of the individual H2 lines is essential, since
for high optical depths the smaller cross-section in the wings of the lines
greatly increases the amount of energy that can escape. The influence of
Doppler shifts due to bulk velocities is comparatively small, since systematic
velocity differences in the cloud are typically smaller than the sound speed.
During the initial collapse phase, the radially averaged escape fraction agrees
relatively well with the fit of Ripamonti & Abel. However, in general it is not
advisable to use a simple density-dependent fitting function, since the escape
fraction depends on many factors and does not capture the suppression of
density perturbations due to the diffusion of radiation. The Sobolev method
overestimates the escape fraction by more than an order of magnitude, since the
properties of the gas change on scales smaller than the Sobolev length.
