TOF_fit_LM program  
================== 
This directory contains input files for refining part of TOF diffraction patterns using the program TOF_fit_LM.exe
The input control file has extension *.pik (PIK file). When a refinement is done it outputs a file with extension 
*.new (NEW) that can also be used as input control file.

In the command line you should invoke the program together with the input control file and the data file
For instance:

MyPrompt> TOF_fit_LM  test.pik Nac-cwl-1p5.xys
or  
MyPrompt> TOF_fit_LM  test.new Nac-cwl-1p5.xys

The output files are:
test.xrf     : Equivalent to a *.prf file of FullProf. Should be opened as a PRF in WinPLOTR-2006
test_pf.out  : Output file containing the refined parameters, standard deviations and correlations
test.new     : Equivalent to a *.pik file, it can be used as input file for the next refinement
               If the results are good, it may be copied to *.pik for saving it.
test.irf     : Numerical lookup table with the list of d-spacing, sigma^2  gamma  alpha and beta 
               of each peak 

The content of the input control file *.pik (or *.new) is the following. The meaning of the parameters
is simple. The flag values are 0 (fixed) or 1 (refined).

Explanation of the control parameters: 

[TOF_init,TOF_fin] : Interval of the diffraction pattern to be refined
Nbac  : Number of background points given below
Npeak : Number of peaks given below
Ncyc  : Maximum number of cycles
Inst  : Format of the input data file (same as FullProf)
Jobt  : 0, normal refinement; 1, simulation job
Cont  : If different from zero, an additional set is analysed within the same input control file.
        The next set starts as for the first set (title, etc.), the last set should have Cont=0. 
        When using several sets in the same input control file, an XRF file is generated 
        for each set. A single IRF file is generated containing d,sigma^2,gamma,alpha,beta 
        for the different sets.
        If we invoke the program with a NEW file containing several sets the new generated
        control file is a PIK file. An example called test_few.pik is provided in this directory.        
Weight: Normally zero (standard deviation of data as input). If Weight=1, w(i)=1.0/ycalc(i).
Corr  : Parameter correlations higher than corr% are output
Constr: If different from zero a box constraint is applied to the parameter
Percent: Percentage for applying box constraints: if the variation of a parameter is 
         bigger than current_value*percent/100, it is not applied and the
         current_value is restored for the next cycle. Only applied if Constr /= 0.         
Algorithm: CURFIT (fixed at present)

The refinable parameters are explained with the following example of input file 
(corresponding to test.new file):

=> TITLE: Prueba de TOF-fit
!    TOF_init       TOF_fin      Nbac Npeak  Ncyc  Inst  Jobt  Cont Weight Corr Constr Percent  Algorithm
     11343.0000     12338.1660    13    27    50    10     0     0     0    50     0    20      CURFIT
  22587.316406  <=  d to T.O.F. coefficient
!  Global Profile Parameters:
      0.000000     0      <= Global-alpha0  &  Flag  
      0.000000     0      <= Global-alpha1  &     alpha= alpha0 + alpha1/d + alpha2/d^2 + alpha3/sqrt(d)   
      0.000000     0      <= Global-alpha2  &       
      0.279958     1      <= Global-alpha3  &       
      0.176437     1      <= Global-beta0   &       
     -0.004110     1      <= Global-beta1   &      Beta= beta0 + beta1/d + beta2/d^2 + beta3/d^4    
      0.000000     0      <= Global-beta2   &       
      0.000000     0      <= Global-beta3   &       
     98.504875     1      <= Global-Sig-2   &       
      0.000000     0      <= Global-Sig-1   &    sigma = sig2 d^4 + sig1 d^2 + sig0 + sig-q/d^2    
      0.000000     0      <= Global-Sig-0   &       
     -0.379774     1      <= Global-Sig-Q   &       
      0.291311     1      <= Global-eta0    &       
      0.000000     0      <= Global-eta1    &      eta = eta0 + eta1 d  + eta2 d^2     
      0.000000     0      <= Global-eta2    &       
!  Background Parameters:
!       TOF        Background   Flag 
    11343.0000       87.7609     0
    11359.6338       83.1954     0
   . . . . . . . . . . . . . . . . 
!  Reflection Parameters:
!    TOF-Bragg     Intensity   Shift-sigma   Shift-alpha    Shift-beta     Shift-eta     Flags
    11357.4365      507.3739        0.0000      0.000000      0.000000      0.000000   1 1 0 0 0 0       1
    11412.9941      347.2972        0.0000      0.000000      0.000000      0.000000   1 1 0 0 0 0       2
    11439.5537      154.2333        0.0000      0.000000      0.000000      0.000000   1 1 0 0 0 0       3
   . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
   
 Notice that we cannot refine simultaneuously all peak shape parameters. We can nullify some of them
 and try different combinations. Here we refine directly the parameter eta of the pV function. The
 program calculates gamma for each peak and output its value in the IRF file.