Structure optimization and frozen phonons in LiNbO3