The structure dependent electronic energy of alloys