a coherent scattering playground
CosPlay shows in animation what crystallography textbooks explain through equations: X-ray diffraction as a sum of waves.
When an X-ray wave hits an electron (scatterer), its energy is absorbed and re-emitted as a spherical wave with the same energy (wavelength) and a phase shift of π/2. When more electrons are present (molecules and crystals), this occurs for each electron, and the sum of all the waves produces what we measure as coherent elastic scattering.
When the spacing between rows of scatterers repeats with a specific d and along a certain direction (both satisfying Bragg's law), the sum of these waves (interference) produces bright beams of intensity: diffraction.
In CosPlay, Bragg's law is not imposed: it emerges spontaneously from a simple sum of emitted waves, whose phases are defined by the scatterers' position inside the field of the source wave.
That's more than enough theory… time to start playing! Can you find the famous “planes” of scatterers when you see a Bragg beam appearing?
CosPlay — a coherent scattering playground
Copyright © 2026 Stefano Canossa
CosPlay is free software: you may use it, study it, pass it on and change it under the GNU General Public License, version 3 or any later version. Anything you build from it must stay free under the same terms.
It is distributed in the hope that it will be useful, but without any warranty; without even the implied warranty of merchantability or fitness for a particular purpose. See the licence for the details.