====== Creation of the synthetic dataset ====== Synthetic data sets are useful to learn how to process data. You can input the experimental parameters you will use in your actual experiment and your actual sample. The software to do so is [[software:polyxsim|PolyXSim]]. For high pressure experiments, the purpose of this step is to simulate the outcome of a DAC experiment (grains with random orientations, random strains etc.). You can check the possible outcome of an actual experiment. You can also check if your workflow for data processing is actually working as the input parameters are known. The simulation will provide 2D diffraction images but also G-vectors, inverse UB matrices (UBi) for all grains, and some more files. You will get at least 7 different files from the simulation as well as the diffraction images. The amount of diffraction images depends on the ω range and the step size defined in the input file. For example, a ω range Δω = [-28°;+28°] with a step size δω = 0.5° produces 112 images (with numbers from 0 to 111). ===== Basic usage ===== PolyXSim -i input_file (.inp or .ini) ===== Input file ===== Input file can include a collection of parameters. Information on the input parameters can be found here [[https://sourceforge.net/p/fable/wiki/PolyXSim%20-%20input/]] ==== Input file example : 10 grains of post-perovskite ==== Here are input files for simulating an experiment at the P02.2 beamline in PETRA * Wavelength is 0.289 Å * Detector is a Perkin-Elmer with 2048x2048 pixels, 200 μm pixel size in both directions, 400 mm from the sample. No tilt, no messing with detector orientation. * Data collected over an range of Δω = [-28°;+28°] in steps δω = 0.5°. Grain information * 10 grains of post-perovkite * random crystal orientations * no strain * randomly placed in a box of 10 x 10 x 10 μm3 * grains of 1 μm grain size in average with a minimum grain size of 0.5 μm and a maximum size of 1.5 μm * no background noise * very sharp peaks The full input file is here [[fileformat:inp:basic|simu-ppv-basic.inp]] ==== Input file example 2: 10 grains of post-perovskite with spreading of peaks ==== This second input file is the same experiment as previous but * peak shapes are set to Gaussian with 0.02° spread in 2θ, 0.5° in η and 0.5° in ω * A background with noise. This second dataset is more difficult to process. You will really need to work on your background to get it to work. The full input file is here [[fileformat:inp:background|simu-ppv-bg.inp]]. Computations are much longer. Expect 1 minute per image. 2 hours for 112 images. ==== Input file example 3: olivine from a CIF file ==== This third example is a test of calculation from a [[fileformat:cif|CIF file]] for the crystal structure. In order to run this simulation, you need to install the [[software:PyCifRW|PyCifRW]] python package otherwise it will not work. Our problem was that the widely used space group for olivine, //Pbnm//, do not have a space groupe number and we need a space group number for the index.ini input file for GrainSpotter. So we use a CIF file to translate the crystallographic properties of olivine from //Pbnm// to //Pnma// an other space group used for olivine which does have a space group number. The transformation from //Pbnm// to//Pnma// is not complicated, it is only an interchange of axis : * a (Pbnm) -> c (Pnma) * b (Pbnm) -> a (Pnma) * c (Pbnm) -> b (Pnma) But we need to specify it to PolyXSim in order to have the good symetry of the olivine, and hence, the good corresponding diffraction peaks. First get a //Pbnm// CIF file from the American Mineralogist crystal structure database and transform it to have a CIF file for //Pnma// space group. In order to do so, only change the cell length on each axes (//a//,//b//,//c//) like shown before, and the //x//, //y//, //z// axes in the symetry operations (//x// to //z//, //y// to //x//, //z// to //y//). Do not forget to change the space group name from //Pbnm// to //Pnma//. [[fileformat:cif|Here]] is the obtained CIF file. Then, before the simulation of your data, in the .inp file for PolyXSim you should put a # before the space group line and make the structure_phase_0 line active. You should have : ### Structural unit_cell 10.1902 5.9787 4.7534 90.0 90.0 90.0 #unit_cell a [Ã…] b [Ã…] c [Ã…] alpha [°] beta [°] gamma [°] , Y being the phase number id #sgno 62 #space group number #oR #sgname_phase_0 'Pbnm' #remember to put quotation marks around the string if more phases then have the keywords unit_cell_phase_1, sgno_phase_1 etc. #or structure_phase_0 'Fosterite_Pnma.cif' Do not forget to change the order of the axes in the unit_cell line of PolyXSim as well! From here, PolyXSim simulate grains in the //Pnma// system so the peaks you obtain (and then the G-vectors) are in //Pnma//. Be carefull when comparing with other studies for which the //Pbnm// system is more common! Use the space group number 62 in the .ini file of GrainsPotter to find the grains from these Pnma G-vectors. ==== Remarks ==== Here are typical errors that we bumped into * Be careful of the intensity (beamflux). Should be in the order of 1015-1017 * Check the name of the parameter for the space group number (sgno) or space group symbol (sgname). ===== Output files ===== There are a number of possible output files from this procedure. Most are usually created quite fast. The time consuming process is the creation of synthetic diffraction images. This time highly depends on the parameters in the input file, e.g. the amount of grains, the peak shape, strain tensors, or additional noise. For a simple test, it is wise to use an input file with very simple parameters (only a few grains, no strain tensors, no noise, small ω range etc.). Possible output files include: * [[fileformat:edf|edf]]: diffraction images, with a header including the omega angle. Be careful, you might be generating gigabytes of data! * [[fileformat:tif|tif]]: diffraction images in TIFF format. Be careful, you might be generating gigabytes of data! * [[fileformat:flt|flt]] - peaks, as you would get them from a [[processing:search_for_peaks|peak searching routine]] and that can be loaded in [[software:imaged11|ImageD11]]. * [[fileformat:gff|gff]] - a file containing grain information, 1 grain on each line. * [[fileformat:gve|gve]] - a list of g-vectors, as you should see them in an experiment. The peaks are transformed into scattering vectors (g-vectors). This file can be used for indexing in either [[software:grainspotter|GrainSpotter]] or [[software:imaged11|ImageD11]] indexing. * [[fileformat:ini|ini]] - an sample input file for indexing with [[software:grainspotter|GrainSpotter]] using the .gve file. It will then be possible to try the GrainSpotter indexing program immediately. * [[fileformat:ubi|ubi]] - a list of the UBi matrices of the simulated grains. Grain orientations as inv(U*B). * [[fileformat:ref|ref]] - reflection files (one per grain) having all the information about the reflections. * [[fileformat:par|par]] - the input parameters for PolyXSim written in the par format for [[software:ImageD11|ImageD11]] processing.