First-principles pseudopotential calculations for hydrogen in 4d transition metals. I. Mixed-basis method for total energies and forces