Neutral beam stopping and emission in fusion plasmas I: deuterium beams