Structure and lattice dynamics of rare-earth ferroborate crystals: Ab initio calculation