Infrared Spectra of Hydrogen-Bonded Ionic Crystals: Ab Initio Study of Mg(OH)2 and beta-Be(OH)2