X-ray diffraction on a three-dimensional lattice with account taken of the coherence of X-rays