Electron transfer and localization in endohedral metallofullerenes: Ab initio density functional theory calculations