Lattice structure and phase transitions of hydrogen in intermetallic compounds