Structural and electronic properties of metal-doped organic semiconductors