Ab initio study of the structure and dynamical properties of crystalline ice