Heat of formation and band structure of binary and ternary metal hydrides