Lattice-constant prediction and effect of vacancies in aliovalently doped perovskites