First-principles study of structural, electronic and optical properties of ZnF2