A RHEED system requires an electron source (gun), photoluminescent detector screen and a sample with a clean surface, although modern RHEED systems have additional parts to optimize the technique. The electron gun generates a beam of electrons which strike the sample at a very small angle relative to the sample surface. Incident electrons diffract from atoms at the surface of the sample, and a small fraction of the diffracted electrons interfere constructively at specific angles and form regular patterns on the detector. The electrons interfere according to the position of atoms on the sample surface, so the diffraction pattern at the detector is a function of the sample surface. Figure 1 shows the most basic setup of a RHEED system.