To do


McMaille V2.0


McMaille (pronounce MacMy) is a program for indexing powder patterns by Monte Carlo and grid search (maille in french = cell in english). The 2-theta peak positions extracted from a peak hunting program are used together with the intensities in order to build a pseudo powder pattern to which are compared patterns calculated from the cell parameters proposed by a Monte Carlo or by a grid systematic search process. The calculated intensities are adjusted by a Le Bail fit (applying 3 iterations of the Rietveld decomposition formula). The best cells are refined, more or less. This is similar to the (unnamed and still unavailable ?) software by B.M. Kariuki et al., J. Synchrotron Rad. 6. (1999) 87-92, though the latter uses a genetic algorithm.

Armel Le Bail    -  September 2002



McMaille version 2.0 is distributed under the GNU Public Licence conditions.

The zipped package contains the executable for Windows 95/98/NT/XP, as well as the FORTRAN source code (quite short and documented) and some examples described below.

Get it :

Let the cub.hkl, hex.hkl, rho.hkl, tet.hkl, ort.hkl, mon.hkl, tri.hkl files in the same 
directory as McMaille.exe as well as your parameters .dat files. 

The compiler used for building the executable was Compaq Visual Fortran.


Running McMaille (by clicking on McMaille.exe) requires a parameters data file. A typical data file (should be named name.dat) follows :

SR2CR2O7                    Title
1.54056 0.0 2               Wavelength, Zeropoint, Ngrid
1 1 1 0 0 0                 Symmetry codes
0.0 0.0 0.16 4              U, V, W, Nstep
3. 15. 200. 1500. 0.1  0.3  Pmin, Pmax, Vmin, Vmax, Rmin, Rmax
0.2 0.2                     Spar, Sang  (grid search only)
20000  1                    Ntests, Nruns (Monte Carlo only)
!!!                         A line starting by ! is ignored
11.180   345.               2-theta, Intensity
12.217  1120.               Etc
15.835   124. 
18.709   455. 
Title : for your problem identification.

Wavelength : your experiment wavelength. If you used CuKalpha, you should have stripped alpha2 before peak positions hunting.

Zeropoint : your powder pattern zeropoint (global value including the zero due to the diffractometer and the zero due to sample misplacement). It is recommended to have a standard compound mixed with your sample or to apply the harmonics method for zeropoint estimation.

Ngrid : code for the process to be applied
            Ngrid = 0 : Monte Carlo
            Ngrid = 1 : grid search
            Ngrid = 2 : both process
  NOTE : grid search in triclinic is not implemented (would be too long...)

Symmetry codes : 6 codes allowing to select the crystal system to be explored.
                 1st  code : if 0, no search, if 1, search in cubic 
                 2nd code : if 0, no search, if 1, search in hexagonal/trigonal
                                                         if 2, search in rhombohedral (hex. setting)
                 3rd code : if 0, no search, if 1, search in tetragonal
                 4th code : if 0, no search, if 1, search in orthorhombic
                 5th code : if 0, no search, if 1, search in monoclinic
                 6th code : if 0, no search, if 1, search in triclinic

U, V, W : the Caglioti law characterizing the variation of the peak widths as a function of the diffraction angle. Use standard values for your diffractometer or larger values. Taking U=V=0. and 0.04 < W < 0.16 should produce some correct cells for wavelengths close to 1.5 A. For very good synchrotron radiation data and wavelength close to 0.7 A, use 0.004 < W < 0.016. Extremely good peak positions are required

Nstep : mean number of counting steps that you expect above the FWHM.
                   This parameter can only have values of 3, 4, or 5. For usual cases, 4
                   is correct, 3 allows to gain speed, 5 produces longer calculation times.

Pmin, Pmax : minimum and maximum cell parameters for the search.

Vmin, Vmax : minimum and maximum cell volumes for the search.

Rmin, Rmax : Rp profile reliability factor limits.
                      Rmin allows to stop the search as soon as a a cell corresponding to
                               Rp <  Rmin is obtained - use 0.10-0.15 or up to 0.20
                      Rmax is the max Rp value below which a cell is refined and kept
                               in memory - use 0.30-40 or up to 0.50. Decrease that
                               value if the program produces too much results (no more
                               than 1000 cell will be sorted, anyway).

NOTE : the line including the 2 following parameters is optional (should not occur if NGRID = 0)

Spar : grid search step applied to the cell parameters.
                Recommended values (small values increase calculation time, but too
                large values will not allow the cell to be determined) : 
                    cubic : 0.01
                    hexagonal/rhombohedral/tetragonal : 0.01-0.05
                    orthorhombic : 0.05-0.20 (0.01 is best, but see the time)
                    monoclinic : 0.05-0.30 (0.01 is best, but see the time)
                    triclinic : not implemented 

Sang : grid search step applied to the cell angles.
                 Recommended values (small values influence calculation time) : 
                    monoclinic : 0.05-0.20 (0.01 would be best, but see the time)
                    triclinic : not implemented

NOTE : the line including the 2 following parameters is optional (should not occur if NGRID = 1)

Ntests : number of Monte Carlo tests. Use 1000-10000000 or more.
                       cubic : 1000 could be enough
                       hexagonal/tetragonal : 10000 could be enough
                       orthorhombic : 100000 to 1 or 2000000 could be enough
                       monoclinic : 1000000 to 100000000 could be enough
                       triclinic : 1000000000 could be not enough...

Nruns : number of Monte Carlo runs. One run will execute Ntests tests.
                   Due to Monte Carlo random number generation, performing 10 runs
                   of 1000 tests may not lead to the same result as 1 run of 10000 tests.

2-theta, Intensity : values obtained at the peak hunting step. 
                     Recommended : 20 couples of values.
                                     Max : 100 couples of values.
                     You may play on the intensities and decrease those that seem
                      too high and which will represent a too large part of the total

                   McMaille expects very accurate peak positions,
                 the same as the other indexing programs.


McMaille produces 3 output files :

name.imp   containing the details of the calculations and a final sorted summary..
name.ckm  containing an ordered list of the "best cells" for the CHEKCELL 
                   program. Note that the FoMs are not real FoMs, but are calculated 
                   as the inverse of Rp multiplied by 5... A pseudo-FoM larger than 20
                   is a priori interesting, corresponding to Rp < 25%. A pseudo-FoM
                   close to 50 or larger may indicate the correct cell (Rp < 10%).
name.prf    containing the "best" profile result (with lowest Rp), to be seen by the 
                   WINPLOTR program.


McMaille is a "brute force" program that can be "almost exhaustive" in grid search mode, provided the grid steps are very short. The only problem is : TIME. Calculations for the triclinic case with 1000 steps for each of the six cell parameters would lead to 1000000000000000000 tests, which corresponds to many centuries at the current speed of 1000 steps per second... However, an exhaustive search is quite manageable in grid search mode with a step of 0.01 Angstrom for cubic/hexagonal/tetragonal crystal systems. 

The recommendation is : First use TREOR, DICVOL, ITO, CRYSFIRE. If no result, then apply McMaille with your fastest PC.

If McMaille is so long, and if it is suggested to apply the classical software, what is the McMaille interest ? McMaille is rather insensible to IMPURITIES. Note that "impurity" means supplementary phase(s) that do not contribute for more than 10% of the total intensity diffracted. You should not expect from McMaille solutions for mixtures of 2 or more unknown major phases. It is obvious that known impurity peaks (identified by a search/match process) should be removed from the list of peaks submitted to McMaille.

Making several successive applications of McMaille is recommended. First cubic, then hexagonal and tetragonal, or those 3 crystal systems in one try. Then orthorhombic, if no clear solution appears at the previous runs. Then monoclinic, if no clear solution appears at the previous runs. Finally triclinic.

Repeat several Monte Carlo runs if nothing is produced (several Monte Carlo runs will not use the same random number sequences, and will not examine the same combinations of cell parameters). This is essentially a question of chance...

Because calculations can be extremely long if you use the grid search procedure with small steps, a WARNING occurs at the beginning of McMaille runs giving an estimation of the calculation time (on the basis of 1000 tests per second obtained with an Intel Pentium IV 2.4GHz processor).


The test samples attached with the McMaille package (testn.dat) come mainly from the TREOR and DICVOL distribution package tets (using arbitrarily intensities set to 100.). Running them on your own PC should produce the solutions (though the triclinic case would ask for long-long time, and the monoclinic ones may ask for hours).

To do

Peak shapes
Simple Gaussian peak shapes are used, leading to 1000 cells tested per second on a Pentium IV 2.4GHz. But why not a more simple peak shape like a triangle which would probably lead to much faster calculations ? This will be examined soon.

Computer speed
We are depending on the Moore law... come back to this software in 50 years... unless triangles strongly improve the McMaille efficiency, some day (by a factor 2 maybe, due to replacing exponentials by more simple operations, or better ?).

Send your comments and bug reports to :

Armel Le Bail    -  September 2002