Controlled variation of the refractive index in ion-damaged diamond