We have developed a procedure for fitting experimental and simulated X-ray
reflectivity and diffraction data in order to automate and to quantify the
characterization of thin-film structures. The optimization method employed
is a type of genetic algorithm called 'Differential Evolution'. The method
is capable of rapid convergence to the global minimum of an error function
in parameter space even when there are many local minima in addition to the
global minimum. We show how to estimate the pointwise errors of the optimi
zed parameters, and how to determine whether the model adequately represent
s the structure. The procedure is capable of fitting some tens of adjustabl
e parameters, given suitable data.