Adaptation of multilayer formalism to the solution of temperature dependent X-ray diffraction in crystals