A timeline for massive star-forming regions via combined observation of
  o-H$_2$D$^+$ and N$_2$D$^+$
  Context: In cold and dense gas prior to the formation of young stellar
objects, heavy molecular species (including CO) are accreted onto dust grains.
Under these conditions H$_3^+$ and its deuterated isotopologues become more
abundant, enhancing the deuterium fraction of molecules such as N$_2$H$^+$ that
are formed via ion-neutral reactions. Because this process is extremely
temperature sensitive, the abundance of these species is likely linked to the
evolutionary stage of the source.
  Aims: We investigate how the abundances of o-H$_2$D$^+$ and N$_2$D$^+$ vary
with evolution in high-mass clumps.
  Methods: We observed with APEX the ground-state transitions of o-H$_2$D$^+$
near 372 GHz, and N$_2$D$^+$(3-2) near 231 GHz for three massive clumps in
different evolutionary stages. The sources were selected within the
G351.77-0.51 complex to minimise the variation of initial chemical conditions,
and to remove distance effects. We modelled their dust continuum emission to
estimate their physical properties, and also modelled their spectra under the
assumption of local thermodynamic equilibrium to calculate beam-averaged
abundances.
  Results: We find an anticorrelation between the abundance of o-H$_2$D$^+$ and
that of N$_2$D$^+$, with the former decreasing and the latter increasing with
evolution. With the new observations we are also able to provide a qualitative
upper limit to the age of the youngest clump of about 10$^5$ yr, comparable to
its current free-fall time.
  Conclusions: We can explain the evolution of the two tracers with simple
considerations on the chemical formation paths, depletion of heavy elements,
and evaporation from the grains. We therefore propose that the joint
observation and the relative abundance of o-H$_2$D$^+$ and N$_2$D$^+$ can act
as an efficient tracer of the evolutionary stages of the star-formation
process.
