Ab initio calculations of the geometry and electronic structure of point defects in ferroelectrics with a perovskite structure