Theory of X-Ray and Thermal-Neutron Scattering by Real Crystals