  We have studied the evolution of molecular gas during the early stages of
protostellar collapse. In addition to allowing for the freeze out of `heavy'
species on to grains, we have computed the variation of population densities of
the different nuclear spin states of ``tracer'' molecular ions such as H2D+ and
D2H+. Processes which determine the relative populations of the nuclear spin
states of molecules and molecular ions have received much less attention in the
literature than those involved in their deuteration; but in fact the former
processes are as significant as the latter and often involve the same
reactants. We find that the ortho:para ratio of some species, e.g. H2D+, vary
considerably as the density increases. Because the dynamical timescale is much
shorter than some of the chemical timescales, there can be large departures of
the predictions of the free--fall model from the steady state solution at the
same density and temperature. In the case of H2, it seems unlikely that the
steady state value of the ortho:para ratio is attained before protostellar
collapse from the progenitor molecular cloud commences. Values of the
ortho:para H2 ratio much higher than in steady state, which would prevail in
``young'' molecular clouds, are found to be inconsistent with high levels of
deuteration of the gas. The internal energy of ortho--H2 acts as a reservoir of
chemical energy which inhibits the deuteration of H3+ and hence of other
species, such as N2H+ and NH3. In essence, the deuteration of molecular ions
and molecules is sensitive to the ortho:para H2 ratio and hence to the chemical
and thermal history of the parent molecular cloud.
