X-ray diffraction is a technique used to determine the atomic and molecular structure of crystals. When an X-ray beam hits a crystal, the beam diffracts into specific directions based on the atomic planes in the crystal. Bragg's law describes the diffraction pattern and is used to explain the angles and wavelengths of the diffracted X-rays. To collect diffraction data, crystals are mounted on a goniometer and bombarded with X-rays while being rotated, producing a diffraction pattern. The pattern can then be analyzed to determine information about the crystal structure like lattice parameters and atomic arrangement.