next up previous contents
Next: Usage Up: SAFiCF: A Simulated Annealing Previous: Theoretical Background   Contents


The SAFiCF Program

The block diagram for the program is shown in figure 1. The main functions to calculate the crystal field (CF) Hamilton matrix and the neutron cross-section has been described in the previous section. The rest of the program is built around the simulated annealing (SA) minimisation routine for continuous variables of Corana et al. [Corana et al.(1987)Corana, Marchesi, Martini, and Ridella]. The strength of this routine is in the way it generates the random steps in the CF parameters such that around half the time the move is accepted and half the time the move is rejected. The simulated annealing algorithm works by setting a temperature, $ T_\textrm{SA}$ , and then adjusting the parameters $ \mathbf{p}$ of the fit to minimise a cost function $ \phi(\mathbf{p})$ , accepting a new set of randomly generated parameters (a move) if the new cost function is lower than the current cost function ( $ \phi(\mathbf{p}')<\phi(\mathbf{p})$ , or if not, then randomly with a probability $ \exp([\phi(\mathbf{p})-\phi(\mathbf{p}')]/T)$ . Thus if the temperature is high, the algorithm maps out a large part of the parameter space.

After a number of moves at a certain temperature to reach equilibrium, the temperature is decreased. In this way, the algorithm moves steadily towards a minimum of the cost function. Although the algorithm does not guarantee that this is the global minimum, it is better than greedy algorithm such as the Levenberg-Marquardt algorithm for problems with many shallow minima. The Corana algorithm in adjusting the moves such that a 1:1 ratio between accepted and rejected move is maintained efficiently explores the parameter space without wasting calculations. In other respects however, it is a fairly standard SA implementation.

Figure 1: Block diagram of the SAFiCF program.
\includegraphics[width=0.9\textwidth viewport=14 17 590 816]{figs/block.pdf}

We simulate the inelastic neutron spectra (INS) of a magnetic ion in a crystal field using equations 12 or 13 as the user demands, or using simply the dipole transition probabilities given by the large curly brackets of either expression scaled by an arbitrary constant. These delta functions are then convoluted with Gaussian functions whose width are either set to a constant by the user, to be proportional to the energy transfer, or calculated from the chopper and instruments programmed in (at the moment for the spectrometers at ISIS). The area of the Gaussian are thus proportional to the dipole transition probabilities as in 12 or 13.

We also use the function saficf_findpeaks(xdat,ydat,edat) to estimate the peak positions of the transitions observed in the spectra, and add to the cost function a root mean square difference term between the calculated and observed energies, in addition to the root mean square difference between the observed and simulated spectra:

$\displaystyle \textrm{Cost} = \left( \sum_x \frac{( y(x)_\textrm{calc} - y(x)_\...
...sitions} (\Delta_{\textrm{calc}}-\Delta_{\textrm{obs}})^2 \right)^{\frac{1}{2}}$ (14)

This additional term helps to make the actual minima deeper, so that the algorithm will converge more accurately.

Finally, SAFiCF also handles multiple datasets taken at different temperatures, incident energy, and chopper frequencies4, and uses the function saficf_rescale(T,Ei,f,xdat,ydat,edat) to rescale the data such that the elastic line is the same for each dataset. The function saficf_elaspars(xdat,ydat) is used to fit the elastic line using a Levenberg-Marquardt algorithm.


next up previous contents
Next: Usage Up: SAFiCF: A Simulated Annealing Previous: Theoretical Background   Contents
2008-01-21