We present the results from self-consistent numerical simulations of cosmic structure formation with a multifrequency radiative transfer scheme and non-equilibrium molecular chemistry of 13 primordial species (e−, H, H+, H−, He, He+, He++, H2, H, D, D+, HD and HeH+), performed using the simulation code gadget. We describe our implementation and we show tests for ionized sphere expansion in a static and dynamic density field around a central radiative source, and for cosmological abundance evolution coupled with the cosmic microwave background radiation. As a demonstrative application of radiative feedback on molecular gas, we also run cosmological simulations of early structure formation in a ∼1-Mpc sized box. Our tests agree well with analytical and numerical expectations. Consistent with other works, we find that ionization fronts from central sources can boost H2 fractions in shock-compressed gas. The tight dependence on H2 also leads to a corresponding boost of HD fractions. We see a strong lowering of the typical molecular abundances up to several orders of magnitude, which partially hinders further gas collapse of pristine neutral gas. This clearly suggests the need for reionized gas or metal cooling in the formation of the following generation of structures.