The first-principle calculation of structures and defect energies in tetragonal PbTiO3