Full Pattern Summation of X-Ray Powder Diffraction Data

Full pattern summation of X-ray powder diffraction data as described in Chipera and Bish (2002) and Butler and Hillier (2021) . Derives quantitative estimates of crystalline and amorphous phase concentrations in complex mixtures.

powdR: Full Pattern Summation of X-Ray Powder Diffraction Data

BuildStatus CRAN_Status_Badge Total_Downloads

powdR is an implementation of the full pattern summation approach to quantitative mineralogy from X-ray powder diffraction data (Chipera and Bish 2002, 2013; Eberl 2003).

powdR has several advantages over the excel based implementations of full pattern summation such as FULLPAT (Chipera and Bish 2002) and RockJock (Eberl 2003). First, computation is faster and, when quantifying multiple samples, can be used in combination with other packages (e.g foreach and doParallel) for parralel processing. Secondly, powdR can be run via a shiny web application, which offers a user friendly interface for fast and iterative mineral quantification. Lastly, R represents a powerful tool for data manipulation, allowing users to creatively adapt, pre-treat and visualise their data.


The stable version of powdR is on CRAN:


Alternatively, the development version can be downloaded from GitHub

#Install devtools if you don't already have it on your machine


#> powdR: Full Pattern Summation of X-Ray Powder Diffraction Data
#Load some soils to quantify
#Load a powdRlib reference library of pure patterns
#Quantify a sample
q <-  fps(lib = minerals,
          smpl = soils$sandstone,
          refs = minerals$phases$phase_id,
          std = "QUA.1")
#> -Aligning sample to the internal standard
#> -Interpolating library to same 2theta scale as aligned sample
#> -Optimising...
#> -Removing negative coefficients and reoptimising...
#> -Computing phase concentrations
#> -Internal standard concentration unknown. Assuming phases sum to 100 %
#> ***Full pattern summation complete***
#Inspect the phase concentrations (summarised by name)
#>       phase_name phase_percent
#> 1         Illite        1.2599
#> 2     K-feldspar        1.2666
#> 3      Kaolinite        1.3476
#> 4 Organic-Matter       41.2340
#> 5    Plagioclase        1.1540
#> 6         Quartz       53.7379
#Inspect the quantification
plot(q, wavelength = "Cu")

Alternatively, plot(q, wavelength = "Cu", interactive = TRUE) provides an interactive plot for better inspection of the fit. More detailed usage instructions are provided in the package vignette.

The powdR Shiny app

To run powdR via the shiny app, use run_powdR(). This loads the application in your default web browser. The application has eight tabs:

  1. Reference Library Builder: Allows you to create and export a powdRlib reference library from two .csv files: one for the XRPD measurements, and the other for the ID, name and reference intensity ratio of each pattern.
  2. Reference Library Viewer: Facilitates quick inspection of the phases within a powdRlib reference library.
  3. Reference Library Editor: Allows the user to easily subset a powdRlib reference library .
  4. Full Pattern Summation: A user friendly interface for iterative full pattern summation of single samples.
  5. Automated Full Pattern Summation: A user friendly interface for automated full pattern summation of single samples.
  6. Results viewer: Allows for quick inspection of results derived from full pattern summation.
  7. Results editor: Allows for results from previously saved powdRfps and powdRafps objects to be edited via addition or removal of reference patterns to the fitting process.
  8. Help Provides a series of video tutorials (via YouTube) detailing the use of the powdR Shiny application.


Chipera, Steve J., and David L. Bish. 2002. “FULLPAT: A full-pattern quantitative analysis program for X-ray powder diffraction using measured and calculated patterns.” Journal of Applied Crystallography 35 (6): 744–49. https://doi.org/10.1107/S0021889802017405.

———. 2013. “Fitting Full X-Ray Diffraction Patterns for Quantitative Analysis: A Method for Readily Quantifying Crystalline and Disordered Phases.” Advances in Materials Physics and Chemistry 03 (01): 47–53. https://doi.org/10.4236/ampc.2013.31A007.

Eberl, D. D. 2003. “User’s guide to ROCKJOCK - A program for determining quantitative mineralogy from powder X-ray diffraction data.” Boulder, CA: USGS.


powdR 1.0.0

New features

  • Outputs from fps() and afps() (powdRfps and powdRafps objects, respectively) contain an inputs component. This provides a list of each of the arguments (including defaults) used to produce the fit.

  • summarise_mineralogy() is a new function that creates a summary table from lists containing multiple powdRfps and/or powdRafps objects.

  • A comprehensive reference library of pure phases from the RockJock computer software is now provided as an example powdRlib object called rockjock. This library covers most clay, non-clay and amorphous phases that may be encountered in soil samples. The library can be loaded into the global environment via data(rockjock). Data of synthetic mineral mixtures are also now provided in the rockjock_mixtures data, which can be used to test the accuracy of full pattern summation via the fps() and afps() functions.

  • fps() and afps() now accept "L-BFGS-B" in the solver argument. If selected, this uses L-BFGS-B optimisation constrained so that parameters cannot be lower than zero.

  • fps() now contains an optional shift argument, identical to that already implemented in afps(). This defines the 2$\theta$ range within with a grid-search algorithm can optimise the aligment of standards to the sample. If not defined in the function call it defaults to 0.

  • fps() and afps() now have a shift_res argument which accepts a single integer to define the increase in resolution used during grid search shifting. Higher values facilitate finer shifts at the expense of longer computation. If not defined in the function call it defaults to 4.

  • fps() and afps() now have a logical manual_align argument which specifies whether to manually align the sample to the value specified in the align argument (manual_align = TRUE), or optimise the alignment based on a maximum shift defined in the align argument (manual_align = FALSE).

  • fps() and afps() now have a logical harmonise argument which specifies whether to automatically harmonise the sample and library onto the same 2$\theta$ scale via linear interpolation.

  • The lod argument of afps(), now simply represents an estimate of the limit of detection of the selected internal standard defined by the std argument. The function then uses the reference intensity ratios to estimate limits of detection for all other phases.

  • fps() now contains an optional remove_trace argument that allows the user to exclude phases below a small trace value that would unlikely be detected. Default = 0.

  • subset() is a new function that allows simple subsetting of a powdRlib object.

  • The run_powdR() shiny app now contains tabs for subsetting a powdRlib object via subset() function, editingpowdRfps and powdRafps objects, and video tutorials.

powdR 0.2.0

New features

  • Suggests packages nnls (>=1.4), baseline (>= 1.2) and shinyWidgets (>= 0.4.3) in the DESCRIPTION.

  • fps() now accepts "NNLS" in the solver argument. If "NNLS" (non-negative least squares) is selected, the algorithm uses non negative least squares instead of minimising an objective function. This is a much faster alternative but less accurate for samples containing amorphous phases.

  • bkg() is a new function that allows for backgrounds to be fitted to XRPD data. It is a wrapper of the baseline::baseline.fillPeaks() method, and the output is a powdRbkg object.

  • afps() is a new function that automates the process of full pattern summation by firstly selecting samples from the reference library (using NNLS) and then excluding those estimated to be below detection limit. The output is a powdRafps object.

  • New plot() methods for powdRbkg and powdRafps objects

  • The shiny application behind run_powdR() has been updated to accept "NNLS", and now includes tabs for background fitting (using bkg()) and automated full pattern summation (using afps()).

powdR 0.1.0

  • Released on CRAN

Reference manual

It appears you don't have a PDF plugin for this browser. You can click here to download the reference manual.


1.3.0 by Benjamin Butler, 4 months ago


Report a bug at https://github.com/benmbutler/powdR/issues

Browse source code at https://github.com/cran/powdR

Authors: Benjamin Butler [aut, cre] , Stephen Hillier [aut] , Dylan Beaudette [ctb] , Dennis Eberl [ctb]

Documentation:   PDF Manual  

GPL-2 | file LICENSE license

Imports plyr, reshape, plotly, ggplot2, stats, utils, ggpubr, shiny, DT, nnls, shinyWidgets, baseline, tidyr, FactoMineR, factoextra, rxylib

Suggests knitr, rmarkdown, bookdown

See at CRAN