Tuning the Structure of Nanoparticles by Small Concentrations of Impurities