The process begins with the growth of a high-quality crystal of the substance to be studied. This crystal is then subjected to a beam of X-rays, which are diffracted in various directions. The resulting diffraction pattern is captured on a detector. Using complex mathematical algorithms, the diffraction data is then converted into an electron density map, revealing the positions of atoms in the crystal.