  Multilayer X-ray mirrors consist of a coating of a large number of alternate
layers of high Z and low Z materials with a typical thickness of 10-100
Angstrom, on a suitable substrate. Such coatings play an important role in
enhancing the reflectivity of X-ray mirrors by allowing reflections at angles
much larger than the critical angle of X-ray reflection for the given
materials. Coating with an equal thickness of each bilayer enhances the
reflectivity at discrete energies, satisfying Bragg condition. However, by
systematically varying the bilayer thickness in the multilayer stack, it is
possible to design X-ray mirrors having enhanced reflectivity over a broad
energy range. One of the most important applications of such a depth graded
multilayer mirror is to realize hard X-ray telescopes for astronomical
purposes. Design of such multilayer X-ray mirrors and their characterization
with X-ray reflectivity measurements require appropriate software tools. We
have initiated the development of hard X-ray optics for future Indian X-ray
astronomical missions, and in this context, we have developed a program,
DarpanX, to calculate X-ray reflectivity for single and multilayer mirrors. It
can be used as a stand-alone tool for designing multilayer mirrors with
required characteristics. But more importantly, it has been implemented as a
local model for the popular X-ray spectral fitting program, XSPEC, and thus can
be used for accurate fitting of the experimentally measured X-ray reflectivity
data. DarpanX is implemented as a Python 3 module, and an API is provided to
access the underlying algorithms. Here we present details of DarpanX
implementation and its validation for different type multilayer structures. We
also demonstrate the model fitting capability of DarpanX for experimental X-ray
reflectivity measurements of single and multilayer samples.
