In a pure crystal structure of some semiconductor compound each molecule is usually bound to other four by covalent bonds, in other words each of the four valence electrons of each molecule is in a covalent bond with another molecule. At 0K all electrons remain in these covalent bonds, but as the temperature rises electrons start to gain enough thermal energy to escape these bonds and move to wholes left by other electrons that also escaped their bonds. The energy required for these electrons to escape is the same energy released when these electrons fill the wholes, right? I would assume that's just a symmetry argument. But by doping the pure semiconductor with molecules of a different chemical species we can get different behaviors of the structure, for example, by substituting some molecules in the pure semiconductor by a molecule with five valence electrons we get more free electrons at lower temperatures. That's because four of the five valance electrons in this new molecule are going to substitute the four valence electrons of the original semiconductor molecules in the covalent bonds. However, the fifth valence electron of the new molecule is going to be only loosely bound to the molecule's nucleus, requiring lower temperatures to break that bond than the temperatures required to break the covalent bonds in the pure semiconductor material. But still the energy required to break these bonds is the same as the energy released when these free electrons attach to the nucleus of another one of these new molecules whose fifth electron has also escaped. Right? We can also dope the pure crystal structure with molecules with three valence electrons. That results in three covalent bonds and a whole by default. By having one of the free electrons from the N-type material occupy the whole that exists in the P-type material we can get the release of a photon. My question is, assuming all of this is correct (and I know it might not be), why do we get the release of a photon? I mean, when an electron occupies a whole in the N-type material it also releases energy, right? Why don't we get a photon then?