Introduction

McMaille is a program for indexing powder patterns by Monte Carlo and grid search (maille in french = cell in english). The 2theta 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. In McMaille versions 0.92.0, the calculated intensities were adjusted by a Le Bail fit (applying 3 iterations of the Rietveld decomposition formula) using Gaussian peak shapes. In version 3.0, time is gained by a factor 20 by using columnar peak shapes and a "fit" by percentage of inclusion of the calculated columns inside the "observed" one. 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) 8792, though the latter uses a genetic algorithm and the raw data. Moreover, McMaille proposes an option of simultaneous two phases indexing and an automated expert system (black box mode) with a simplified manual. Armel Le Bail  September/October 2002 
Download McMaille version 3.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 : McMaillev3.zip The compiler used for building the executable was Compaq Visual Fortran. About the .hkl files :
More on the method As soon as a Monte Carlo cell proposal produces Rp < Rmaxref ~0.5 (similar definition as Rp in the Rietveld method), that cell is more closely examined. Because a least square refinement would not be efficient, the cell parameters are changed (NCYCLES times, see below) a bit (in the range 0. to 0.02 Angstroms and 0. to 0.2 degrees), randomly by using the Monte Carlo process, around their values, checking if Rp decreases. Most of the times Rp decreases enormously, sometimes below the selected Rmax (for keeping the cell) and Rmin (for stopping the run cause the cell could be the right one). This cell adjustment is analogous to simulated annealing. Moreover, a second criterium is used being that if the number of expected peaks is explained (NDATNIND) with Rp > Rmaxref, that proposal cell is examined too. This is a brute force indexing approach, very simple to develop. Least square parameters refinements (using the old CELREF routine by Laugier & Filhol) are performed at the end on the selected cell(s). Some important values defined in the program are below : Nhkl Min Nhkl Max NCYCLES NTRIED/NSOL cubic 6xNDAT 400 200 100 rhombohedral 12xNDAT 600 500 1000 hexagonal 12xNDAT 800 500 1000 tetragonal 12xNDAT 800 500 1000 orthorhombic 20xNDAT 1000 1000 10000 monoclinic 20xNDAT 1000 2000 100000 triclinic 20xNDAT 1000 5000 100000 NDAT = Number of powder pattern peaks examined Nhkl = Number of calculated hkl compared to the data (read in the .hkl files) NCYCLES = Number of random parameter small changes for a given selected cell proposal (having Rp < Rmaxref) NTRIED = Number of Monte Carlo events NSOL = Number of solutions retained having Rp < Rmax The NTRIED/NSOL ratio helps to reduce the number of retained cells. If the value is < to the numbers listed above, then Rmax is decreased by 5%. However, the process is not active if NSOL < 50 and Rmax should be given negative. Avoiding being overloaded by cell proposal is better resolved by decreasing the control parameters W (peak width) and/or Nind (number of nonindexed peak positions tolerated) and/or Rmaxref (the Rp level below which a cell will be refined). Parameters Running McMaille (by either clicking on McMaille.exe and giving the entry file name  no extension  or in a DOS box by typing "McMaille name" ) requires a parameters data file. A typical data file (should be named name.dat, name being your choice) follows : SR2CR2O7 Title 1.54056 0.0 2 Wavelength, Zeropoint, Ngrid 1 1 1 0 0 0 Symmetry codes 0.16 6 W , Nind 3. 15. 200. 1500. 0.1 0.2 0.4 Pmin, Pmax, Vmin, Vmax, Rmin, Rmax, Rmaxref 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. 2theta, Intensity 12.217 1120. Etc 15.835 124. 20 couples of positions and 18.709 455. intensities should cover usual Etc cases, but more may be necessary (max = 100) Or, if W above is negative : 11.180 345. 0.16 2theta, Intensity, W 12.217 1120. 0.10 Etc 15.835 124. 0.24 triplets of positions, 18.709 455. 0.16 intensities and widths Etc In Black box mode, the file is much shorter : SR2CR2O7 Title 1.54056 0.0 3 Wavelength, Zeropoint, Ngrid !!! A line starting by ! is ignored 11.180 345. 2theta, Intensity 12.217 1120. Etc 15.835 124. 20 couples of positions and 18.709 455. intensities. You may put more Etc but only 20 will be used.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  will be added to the data). 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
In black box mode, the next lines should be the 2theta and intensities couples of values, directly  see the nameb.dat files. 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.
W : the width of the columnar peak shape in degrees. It is recommended to choose W = 2 * FWHM, as a minimum. Using 0.1 < W < 0.3 should produce some correct cells for inlab data at ~1.5 A wavelength. Using 0.05 < W < 0.15 could be applicable to data coming from a synchrotron Facility at ~0.7 A wavelength (extremely good peak positions are certainly required, anyway). This parameter should reflect your data accuracy, it is close to a tolerated error. Large values (0.30 for a copper target) give more chance to the Monte Carlo process to find easily a minima, but the risk is to be overloaded by false propositions. Play with it... The fact is that most of the test cases will produce the correct solution faster with W=0.5. However, being overloaded by cell proposal is resolved by decreasing W (peak width) or Nind or Rmaxref. NOTE : if W is negative, then, triplets of 2theta, I and Width values should be read instead of doublets of 2theta and I values. Moreover, these widths will be multiplied by W (then, use W=1 if you wish not to change the widths, or W=2 if you want to enlarge the widths by a factor 2, etc). Nind : Number of nonindexed reflections you tolerate. Why not 26 for a set of 20 hkl ? Avoiding being overloaded by cell proposal is resolved by decreasing Nind (or W or Rmaxref). Pmin, Pmax : minimum and maximum cell parameters for the search. Try first 215 or 220, then, if no solution appears, increase Pmax. NOTE : If Pmin is negative, then it becomes possible to play more on
the individual parameter limits, and a supplementary line should be given
with 12 values :
Vmin, Vmax : minimum and maximum cell volumes for the search. Try first small volumes 20400, then increase Vmax if no solution occurs. Rmin, Rmax, Rmaxref :
Rp profile reliability factor limits.
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.
Sang : grid search step
applied to the cell angles.
NOTE : the line including the 2 following parameters is optional (should not occur if NGRID = 1) Ntests : number of
Monte Carlo tests. Use 50010000000000 or more.
Nruns : number of Monte
Carlo runs. One run will execute Ntests tests.
2theta, Intensity
: values obtained at the peak hunting step.
McMaille
expects very accurate peak positions,
Output McMaille produces 4 or 5 types of output files : name.imp containing the details of the calculations
and a final sorted summary.
The screen output delivers for each symmetry examined the first cell
proposal,
Strategy 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 20000 steps per second in McMaillev3.0 (was "only" 1000 steps per second in McMaillev2.0)... 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 insensitive 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 (though...). 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. The black box mode detailed below can do that for you : BLACK BOX MODE :
Symmetry max MC events Pmax Vmax cubic V*0.5 3*dmax (3*dmax)**3  no limit hex/rhomb/tetra 400000 30 4000 orthorhombic 4x1000000 20 500100015002000 monoclinic 4x10000000 20 500100015002000 triclinic 4x1000000000 20 2505007501000 Four runs in orthorhombic, monoclinic and triclinic will be made by using different maximum volumes, successively. Other global fixed parameters : NDAT cutted at 20 (if not less), NIND = 2, Pmin = 2., Vmin = 8., W = 0.30*wavelenght/1.54056, SPAR = 0.02, SANG = 0.05, Rmin = 0.02, Rmax = 0.15, Rmaxref = 0.40 Dmax is the d value for the first peak position at low diffraction angle.This black box mode could solve simple cases. If not, using the manual modes (NGRID = 0, 1, or 2) would be necessary, enlarging the above cell parameters and volume limits. Trying first in cubic symmetry (this is why the namenew.dat file is made for the cubic case), and then going to lowest symmetries if no result. For recognizing the very best solution in a black box mode output, you have to find, in principle, the cell proposal corresponding to the smallest Rp with highest symmetry and smallest volume, indexing the largest number of peaks. Not always an easy task... so, open your eyes ! Then check your choice(s) by the Chekcell program and by whole pattern fitting by the Pawley or Le Bail methods (Fullprof, Gsas, Rietica, Maud, etc, etc). FASTER PRELIMINARY TEST :
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 20000 tests per second obtained with an Intel Pentium IV 2.4GHz processor). Note that these 20000 tests per second were estimated for a cubic case with Nhkl = 400 in the cub.hkl file. In the more complex triclinic case, the test number with Nhkl = 1000 in tri.hkl decresases to 7000 per second. You may obtain more tests per second by decreasing Nhkl (~40000 per second in cubic with Nhkl = 100). The speed will also strongly depend on the number of peak positions selected (20 recommended). In order to have a real idea of the needed time, make a small run (100000 Monte Carlo events, for instance) and extrapolate to the large run. TWO PHASES MODE (use
cautiously !):
NOTE : pressing the K keystroke (capital letter  for Kill) will stop the program a few seconds later, saving the current results.
Examples The test samples attached with the McMaille package (testn.dat) come mainly from the TREOR and DICVOL distribution package tests (using arbitrarily intensities set to 100.), plus some other example like Y_{2}O_{3}, NAC, and the samples 13 from the SDPDRR2 Round Robin. Running them on your own PC should produce the solutions. Examples of time (Pentium IV 2.4GHz) needed by McMaille for its test files are below (all tests by Monte Carlo, not grid search) : Cimetidine (cim.dat) : monoclinic  9 seconds
NAC (nac.dat) : cubic  < 1 second
SDPDRR2 Sample 1 (sample1.dat)
: monoclinic  23 seconds
SDPDRR2 Sample 2 (sample2.dat)
: monoclinic  > 6 minutes
SDPDRR2 Sample 3 (sample3.dat)
: cubic  1 second
Test 1  Cd3(OH)5(NO3) (test1.dat)  orthorhombic  3 seconds
Test2 (test2.dat)  tetragonal  < 1 second
Test3 (test3.dat)  orthorhombic  5 seconds
Test 4 : monoclinic  less than 1 minute
Test 5: (NH4)2S2O3  monoclinic  16 seconds
Test 6 : triclinic  small cell  < 2 minutes
Test7  cubic ???  < 1 second
Test 8  monoclinic  < 2 minutes
Test 9  triclinic  < 1 minute
Y2O3  cubic  < 1 second
See also the nameb.* files which are corresponding to the Black
Box mode.
In mixture1.imp (2 cubic phases), the correct couple of solutions appears in 15th position : Rp2 Vol Ind Nsol a b c alpha beta gamma 0.113 1078.288 29 7 10.2544 10.2544 10.2544 90.000 90.000 90.000 0.165 1190.411 14 7 10.5982 10.5982 10.5982 90.000 90.000 90.000In mixture2.imp, (one tetragonal + one orthorhombic phase), the correct solution is the 1st : Rp2 Vol Ind Nsol a b c alpha beta gamma 0.259 1188.120 30 13 11.1880 11.1880 9.4919 90.000 90.000 90.000 0.106 378.244 15 4 10.0276 3.4206 11.0274 90.000 90.000 90.000Times may be different on your machine (could be less or more, this is Monte Carlo... you need chance). In 1520 years, computers will be 2^{10} to 2^{13} faster (x1000 to x8000 faster), at least, probably. Even grid search in triclinic will be manageable.
To do I have done a lot already, wasting randomly considerable time ;)...
Send your comments, ideas and bug reports
