The photovoltaic conversion efficiency in usual semiconductors is limited to 30% while thermodynamics sets an upper limit of above 70%. Here we show how efficiencies in the 50% range could be achieved using carefully chosen magnetic doping in wide gap semiconductors. To meet the requirement to obtain useful compounds we propose rules and a selection method based on ab initio calculations coupled with material efficiency predictions. As a result of an investigation over hundreds of compounds, AlP:Cr was found to be the most promising semiconductor.