GSASIIRefineFitPeaks v1

../_images/GSASIIRefineFitPeaks-v1_dlg.png

GSASIIRefineFitPeaks dialog.

Summary

Perform Rietveld or Pawley refinement of lattice parameters on a diffraction spectrum using GSAS-II scriptable API

Properties

Name Direction Type Default Description
RefinementMethod Input string Pawley refinement Refinement method (Rietvield or Pawley). Allowed values: [‘Pawley refinement’, ‘Rietveld refinement’]
InputWorkspace Input Workspace Mandatory Workspace with spectra to fit peaks
WorkspaceIndex Input number 0 Index of the spectrum in InputWorkspace to fit. By default, the first spectrum (ie the only one for a focused workspace) is used
InstrumentFile Input string Mandatory Location of the phase file. Allowed extensions: [‘.prm’]
PhaseInfoFiles Input list of str lists Mandatory Paths to each required phase file. Allowed extensions: [‘.cif’]
PathToGSASII Input string Mandatory Path to the directory containing GSASII executable on the user’s machine
XMin Input number 0 Minimum x value to use for refinement, in the same units as the input workspace. Leave blank to refine from the start of the data to XMax. Note, if PawleyDMin corresponds to a greater TOF value than this, then PawleyDMin is used
XMax Input number 0 Maximum x value to use for refinement, in the same units as the input workspace. Leave blank to refine in the range XMin to the end of the data
RefineSigma Input boolean False Whether to refine the sigma-1 profile coefficient
RefineGamma Input boolean False Whether to refine the gamma-1 (called ‘X’ in GSAS-II) profile coefficient
OutputWorkspace Output Workspace Mandatory Workspace with fitted peaks
LatticeParameters Output TableWorkspace LatticeParameters Table to output the lattice parameters (refined)
Rwp Output number   Weighted profile R factor (as a percentage)
Sigma Output number   Sigma-1 profile coefficient
Gamma Output number   Gamma-1 profile coefficient (called X in GSAS-II)
SaveGSASIIProjectFile Input string Mandatory GSASII Project to work on. Allowed extensions: [‘.gpx’]
PawleyDMin Input number 1 For Pawley refiment: as defined in GSAS-II, the minimum d-spacing to be used in a Pawley refinement. Please refer to the GSAS-II documentation for full details. Note, if this corresponds to a TOF value less than XMin or the lowest TOF value in the data, the greatest of the 3 values is used as XMin
PawleyNegativeWeight Input number 0 For Pawley refinement: as defined in GSAS-II, the weight for a penalty function applied during a Pawley refinement on resulting negative intensities. Please refer to the GSAS-II documentation for full details.
MuteGSASII Input boolean False Set to True to prevent GSAS run info from being printed (not recommended, but can be useful for debugging)

Description

Warning

This algorithm requires GSAS-II to be installed on your computer. A version of GSAS-II containing the module GSASIIscriptable (added in April 2017) is required. See Installing_GSASII for how to get the correct version of GSAS-II.

Uses GSAS-II [TobyVonDreele2013] as external software to fit peaks to a powder / engineering diffraction pattern. Here the process of peak fitting is in the context of Rietveld / Pawley / Le Bail analysis [LeBail2005]

The algorithm supports two refinement methods: Pawley refinement and Rietveld refinement. The use of this algorithm is very close to the examples described in these two GSAS-II tutorials: Rietveld fitting / CW Neutron Powder fit for Yttrium-Iron Garnet, and Getting started / Fitting individual peaks & autoindexing, The functionality of this algorithm is based on the powder calculation module and the structure routines of GSAS-II.

The refinement methods of this algorithm are equivalent to the function “Calculate / Refine” from the main menu of the GSAS-II GUI.

The main inputs required are histogram data, an instrument definition parameter (in GSAS format, readable by GSAS-II), phase information and various parameters for the fitting/refinement process.

The phase information must be provided in CIF format (Crystallographic Information File). When phase information is available the algorithm will output the lattice parameters in a table workspace. The values are given for the the full set of lattice parameters (three lattice constants, three angles, and volume in this sequence: a, b, c, alpha, beta, gamma, volume). The a,b, and c values are given in Angstroms (\mathrm{\AA{}}). The angles are given in degrees, and the volume in \mathrm{\AA{}}^3.

The algorithm provides goodness-of-fit estimates in the outputs GoF and Rwp or weighted profile R-factor [Toby2008]. The Rwp is given as a percentage value.

When Pawley refinement is selected as refinement method the flag for histogram scale factor refinement is disabled, as recommended in the GSAS-II documentation, as this cannot be refined simultaneously with the Pawley reflection intensities.

The GSAS-II Rietveld/Pawley refinement process writes lattice parameters and extensive additional information in an output file with the same name as the output GSAS-II project file but with extension ”.lst”. This is noted in a log message that specifies where the file has been written (next to the output project file).

Installing GSAS-II

On Windows, run either scripts\GSAS-II\install_gsas_latest.bat or scripts\GSAS-II\install_gsas_vetted.bat. Use the former for the latest version of GSAS-II and the latter for the most recent version to have been manually verified to work with GSASIIRefineFitPeaks. This will install GSAS-II to your current working drive (usually C) in a directory called g2conda.

On Linux, from scripts\GSAS-II run python install_gsas_proxy.py. Optionally, you can supply a desired revision number (defaults to the latest) with the -v flag and a directory (defaults to /) to install GSAS-II to with the -d flag.

References:

[LeBail2005]Le Bail, A (2005). “Whole Powder Pattern Decomposition Methods and Applications: A Retrospection”. Powder Diffraction 20(4): 316-326.
[TobyVonDreele2013]Toby, B. H., & Von Dreele, R. B. (2013). “GSAS-II: the genesis of a modern open-source all purpose crystallography software package”. Journal of Applied Crystallography, 46(2), 544-549.
[Toby2008]Toby, B. H. (2008). “R factors in Rietveld analysis: How good is good enough?”. Powder Diffraction, 21(1), 67-70.

Usage

Warning

Take these usage examples with a pinch of salt, as they are not tested for correctness on our servers, due to the requirement to have GSAS-II installed. Please contact the Mantid developers if something is awry.

Example - Pawley refinement of lattice parameters from a diffraction spectrum

# You would normally generate the focused file using the Engg GUI or,
# alternatively, with commands like these:
#
# ws_to_focus = Load('ENGINX00256663-256675')
# wks_ceria = Load('ENGINX00255924')
# wks_vana = Load('ENGINX00254854')
# # Using default expected peaks for Ceria
# difa, difc, tzero, peaks_tbl = EnggCalibrate(InputWorkspace=wks_ceria, VanadiumWorkspace=wks_vana, Bank='North')
# wks_focused = EnggFocus(InputWorkspace=wks, VanadiumWorkspace=wks_vana, Bank='North')
# SaveNexus(InputWorkspace=wks_focused, Filename='focused_bank1_ENGINX00256663.nxs')
#
wks = Load('focused_bank1_ENGINX00256663.nxs')
peaks, lattice_params, rwp, sigma, gamma = \
    GSASIIRefineFitPeaks(InputWorkspace=wks,
                         RefinementMethod="Pawley refinement",
                         InstrumentFile='template_ENGINX_241391_236516_North_bank.prm',
                         PhaseInfoFiles='Fe-alpha.cif,Fe-gamma.cif',
                         PathToGSASII='/home/user/g2conda/GSASII',
                         RefineSigma=True,
                         RefineGamma=True,
                         SaveGSASIIProjectFile='example_gsas2_project.gpx',
                         OutputWorkspace="FittedPeaks")
print("Weighted profile R-factor (Rwp): {0:.5f}".format(rwp))
print("Lattice parameters, a: {a}, b: {b}, c: {c}, alpha: {alpha}, beta: {beta}, gamma: {gamma}, "
      "Volume: {volume:.3f}".format(**lattice_params.row(0)))
print("Sigma={}, Gamma={}".format(sigma, gamma))

Output:

Weighted profile R-factor (Rwp): 77.75515
Lattice parameters, a: 2.8665, b: 2.8665, c: 2.8665, alpha: 90.0, beta: 90.0, gamma: 90.0, Volume: 23.554
Sigma=81.0939, Gamma=0.1855

Example - Rietveld refinement of lattice parameters from a diffraction spectrum

wks=Load('focused_bank1_ENGINX00256663.nxs')
peaks, lattice_params, rwp, sigma, gamma = \
    GSASIIRefineFitPeaks(InputWorkspace=wks,
                         RefinementMethod='Rietveld refinement',
                         InstrumentFile='template_ENGINX_241391_236516_North_bank.prm',
                         PhaseInfoFiles='Fe-alpha.cif,Fe-gamma.cif',
                         PathToGSASII='/home/user/g2conda/GSASII',
                         SaveGSASIIProjectFile='example_gsas2_project.gpx',
print("Weighted profile R-factor (Rwp): {0:.5f}".format(rwp))
print("Lattice parameters, a: {a}, b: {b}, c: {c}, alpha: {alpha}, beta: {beta}, gamma: {gamma}, "
      "Volume: {volume:.3f}".format(**lattice_params.row(0)))
print("Sigma={}, Gamma={}".format(sigma, gamma))

Output:

Weighted profile R-factor (Rwp): 77.75499
Lattice parameters, a: 2.8665, b: 2.8665, c: 2.8665, alpha: 90.0, beta: 90.0, gamma: 90.0, Volume: 23.554
Sigma=81.0939, Gamma=0.1855

Categories: Algorithm Index | Diffraction\Engineering | Diffraction\Fitting

Source

Python: GSASIIRefineFitPeaks.py (last modified: 2018-10-05)