First-principles calculations on implanted TiO2 by 3d transition metal ions