Nanoparticles doped with rare earth and transition metal ions for optoelectronic applications