Funding: EU FP7- 2011 under Grant Agreement nr. 284405 (IK, WFT, CR, and PW).Context. Molecular hydrogen (H2) is the main constituent of the gas in the planet-forming disks that surround many pre-main-sequence stars. H2 can be incorporated in the atmosphere of the nascent giant planets in disks. Deuterium hydride (HD) has been detected in a few disks and can be considered the most reliable tracer of H2, provided that its abundance throughout the disks with respect to H2 is well understood. Aims. We wish to form H2 and HD efficiently for the varied conditions encountered in protoplanetary disks: the densities vary from 104 to 1016 cm−3; the dust temperatures range from 5 to 1500 K, the gas temperatures go from 5 to a few 1000 Kelvin, and the...