As a background note, we should talk a bit about why we add in the Bragg data in RMCProfile, which actually gives the program its current name — before the Bragg data is supported in RMCProfile, the program was called RMCA. In brief, the purpose is to constraint the model from the average structure perspective. One may wonder that we already have the total scattering data in reciprocal space which by itself contains the Bragg peaks and thus can automatically provide the constraint in that aspect. So the question is why we still bother bring in the Bragg data as a separate dataset. The fundamental reason is due to the different way of constructing the total scattering and the Bragg pattern from a given structure model. For total scattering, no matter whether the calculation is performed in real space (the Fourier transform of which will give the reciprocal space pattern) or reciprocal space (using the Debye formula), it will be performed on arbitrary Q points explicitly. In such a process, the periodic condition will only be assumed beyond the supercell but not the unit cell. As such, although the Bragg peaks will be recovered if the explicit periodicity does exist beyond the unit cell, they would be broadened with regard to the finite size of the simulation supercell — even the box can be set up as very large, but still it is finite in size. This will sacrifice the resolution in Q-space of the data — to keep consistent with the simulation, we should convolve a sinc function (corresponding to the Fourier transform of a window function in real space) to our experimental data. Therefore, having the Q-space total scattering data in the RMC modeling is not an optimal way of constraining the model from the average structure perspective. With this regard, the Bragg data is different — for the Bragg data calculation, we simply assume perfect periodicity beyond the unit cell and accordingly the calculation in Q-space only needs to be done on a finite list of Q points (i.e., those hkl peaks) according to the structure factor formulation. Focusing on those hkl peaks gives one the complete description of the average structure, and therefore, having Bragg data in the RMC modeling will provide a stronger driving force (as compared to the total scattering data in Q-space) for our model towards such a direction. One can refer to the paper by M. Tucker, et al. on the original implementation and discussion .
To include the Bragg data in the RMC modeling, the RMC engine can calculate the structure factor given the supercell model but at the same time one still needs the peak profile to compose the Bragg pattern to compare with the experimental data directly. At this stage, we need to borrow the peak profile information from the Rietveld refinement process, where the peak profile has already been established. So, in practice, the workflow would be to do a Rietveld (or Pawley) refinement first against the experimental Bragg data, after which we can use some tools to extract the peak profile information from the Rietveld refinement. Currently, RMCProfile supports the interface with GSAS (both I and II) and Topas for extracting the peak profile. With GSAS, we have implemented the used peak profile functions in RMCProfile so one can just use the tool like get_gsas_bragg coming with the RMCProfile release package to extract the parameters of the selected peak profile function so that within RMCProfile, we can construct the peak profile function. However, the get_gsas_bragg tool only works with GSAS-I. The GSAS-II provide an embedded interface for preparing the files needed by RMCProfile. Those files include the one containing the peak profile parameters (the .inst file), the background file (the .back file), the Bragg data file (the .bragg file) and a file for specifying the hlk range to search (the .hkl file). Users are recommended to read section-4.13 in the RMCProfile manual about detailed information on those files. Also, one can refer to section-4.1.4 of the RMCProfile manual for the input of keywords in the .dat file concerning the Bragg data fitting in RMCProfile.
With Topas, we do it in a different way — instead of implementing the peak profile function, we tabulate the peak profile function sitting on the same grid with the experimental Bragg data and carry it over to RMCProfile directly. Technically, to prepare the tabulated peak profile given a Topas refinement, one can use the tool topas4rmc tool which can be installed via anaconda (https://anaconda.org/apw247/topas4rmc) — one needs to install conda first and optionally (but recommended) to create a dedicated conda environment for RMCProfile. This topas4rmc tool is a GUI and one can refer to the help tab of the GUI for detailed instructions about how-to. We need four files generated by the GUI, .hkl, .hkl#, .bragg#, and .back#, where ‘#’ represents the number of data section in topas. One may have multiple data sections in the topas refinement corresponding to, e.g., different banks. In practice, we can just pick one of them to move on with. For sure, we need to grab those four files and rename them to be with the same stem name of the RMCProfile input files. For details, refer to section-4.13 in the RMCProfile manual. Then in RMProfile .dat file, a typical input would be like,
> BRAGG_SHAPE :: topas
> TOPAS_PARAMETERS :: 3.004837 4
> DMIN :: 0.5
> SUPERCELL :: 20 20 20
> WEIGHT :: 1
> WEIGHTED_RESIDUAL ::
Here, 3.004837 is the scale factor and in practice we need to grab the factor from our topas Rietveld refinement. The number ‘4’ here should be consistent with the topas data section that one selected to use in the RMC fitting. Currently, we only support a single Bragg dataset fitting in RMCProfile.
 Matthew G Tucker, et al, 2007, J. Phys.: Condens. Matter, 19, 335218.