This work reports on defect engineering related to optical centers in diamond by ion implantation. In particular, we demonstrate that thermal diffusion of vacancies to a few micrometers in depth can be effectively suppressed provided these are electrically charged and located within the depletion region of an abrupt p+ -n junction. The observed effect is complementary to the observations in the previous study (Favaro et al 2017 Nat. Commun. 8 15409) showing that charging of implantation-induced vacancies at such junction structures in diamond inhibits the formation of vacancy complexes in proximity to the targeted optical centers. In the present work we first generate vacancies near the surface of a low nitrogen doped CVD diamond substrate by He and C ion implantation before these are diffused by annealing at 1200∘C into the bulk. In the next step the depth distribution of NV centers generated by trapping of these vacancies is analyzed on a micron scale. For precise tuning of the implantation conditions we derived data on the boron and nitrogen doping by step etching of planar p+ resistors and p+ -n- p+ diode structures combined with electrical characterization and modeling. In the next step, tin-vacancy (SnV) centers were produced by 40 keV Sn implantation across the same junction structures at optimized conditions. In this way we observe an enhancement of the SnV yield and noticeable suppression of NV centers by diffusion and trapping of vacancies along the tracks of tin ions. Such ‘subsidiary’ NVs could significantly affect the emission of SnV and potentially other centers in the same spectral range.