Learn R Programming

powdR (version 1.1.0)

afps.powdRlib: Automated full pattern summation

Description

afps.powdRlib returns estimates of phase concentrations using automated full pattern summation of X-ray powder diffraction data. It is designed for high-throughput cases involving mineral quantification from large reference libraries.

Usage

# S3 method for powdRlib
afps(
  lib,
  smpl,
  harmonise,
  solver,
  obj,
  std,
  force,
  std_conc,
  tth_align,
  align,
  manual_align,
  shift,
  shift_res,
  tth_fps,
  lod,
  amorphous,
  amorphous_lod,
  ...
)

Arguments

lib

A powdRlib object representing the reference library. Created using the powdRlib constructor function.

smpl

A data frame. First column is 2theta, second column is counts

harmonise

logical parameter defining whether to harmonise the lib and smpl. Default = TRUE. Harmonises to the intersecting 2theta range at the coarsest resolution available.

solver

The optimisation routine to be used. One of c("BFGS", "Nelder-Mead", "CG" or "L-BFGS-B"). Default = "BFGS".

obj

The objective function to minimise. One of c("Delta", "R", "Rwp"). Default = "Rwp". See Chipera and Bish (2002) and page 247 of Bish and Post (1989) for definitions of these functions.

std

The phase ID (e.g. "QUA.1") to be used as internal standard. Must match an ID provided in the phases parameter.

force

An optional string of phase ID's or names specifying which phases should be forced to remain throughout the automated full pattern summation. The ID's or names supplied must be present within the lib$phases$phase_id or lib$phases$phase_name columns.

std_conc

The concentration of the internal standard (if known) in weight percent. If unknown then use std_conc = NA, in which case it will be assumed that all phases sum to 100 percent (default).

tth_align

A vector defining the minimum and maximum 2theta values to be used during alignment. If not defined, then the full range is used.

align

The maximum shift that is allowed during initial 2theta alignment (degrees). Default = 0.1.

manual_align

A logical operator denoting whether to optimise the alignment within the negative/position 2theta range defined in the align argument, or to use the specified value of the align argument for alignment of the sample to the standards. Default = FALSE, i.e. alignment is optimised.

shift

The maximum shift (degrees 2theta) that is allowed during the grid search phases selected from the non-negative least squares. Default = 0).

shift_res

A single integer defining the increase in resolution used during grid search shifting. Higher values facilitate finer shifts at the expense of longer computation. Default = 4.

tth_fps

A vector defining the minimum and maximum 2theta values to be used during automated full pattern summation. If not defined, then the full range is used.

lod

Optional parameter used to define the limit of detection (in weight percent) of the internal standard (i.e. the phase provided in the std argument). The lod value is used to estimate the lod of other phases during the fitting process and hence remove reference patterns that are considered below detection limit. Default = 0.1. If lod = 0 then limits of detection are not computed.

amorphous

A character string of any phase id's that should be treated as amorphous. Each must match a phase_id in the phases table of `lib`.

amorphous_lod

Optional parameter used to exclude amorphous phases if they are below this specified limit (percent). Must be between 0 and 100. Default = 0.

...

other arguments

Value

a list with components:

tth

a vector of the 2theta scale of the fitted data

fitted

a vector of the fitted XRPD pattern

measured

a vector of the original XRPD measurement (aligned)

residuals

a vector of the residuals (fitted vs measured)

phases

a dataframe of the phases used to produce the fitted pattern

phases_grouped

the phases dataframe grouped by phase_name and summed

rwp

the Rwp of the fitted vs measured pattern

weighted_pure_patterns

a dataframe of reference patterns used to produce the fitted pattern. All patterns have been weighted according to the coefficients used in the fit

coefficients

a named vector of coefficients used to produce the fitted pattern

inputs

a list of input arguments used in the function call

Details

Applies automated full pattern summation to an XRPD sample to quantify phase concentrations. Requires a powdRlib library of reference patterns with reference intensity ratios in order to derive mineral concentrations.

References

Bish, D.L., Post, J.E., 1989. Modern powder diffraction. Mineralogical Society of America.

Chipera, S.J., Bish, D.L., 2013. Fitting Full X-Ray Diffraction Patterns for Quantitative Analysis: A Method for Readily Quantifying Crystalline and Disordered Phases. Adv. Mater. Phys. Chem. 03, 47-53. doi:10.4236/ampc.2013.31A007

Chipera, S.J., Bish, D.L., 2002. FULLPAT: A full-pattern quantitative analysis program for X-ray powder diffraction using measured and calculated patterns. J. Appl. Crystallogr. 35, 744-749. doi:10.1107/S0021889802017405

Eberl, D.D., 2003. User's guide to RockJock - A program for determining quantitative mineralogy from powder X-ray diffraction data. Boulder, CA.

Examples

Run this code
# NOT RUN {
#Load the minerals library
data(minerals)

# Load the soils data
data(soils)

# }
# NOT RUN {
afps_sand <-  afps(lib = minerals,
                 smpl = soils$sandstone,
                 std = "QUA.2",
                 align = 0.2,
                 lod = 0.2,
                 amorphous = "ORG",
                 amorphous_lod = 1)

afps_lime <- afps(lib = minerals,
                smpl = soils$limestone,
                std = "QUA.2",
                align = 0.2,
                lod = 0.2,
                amorphous = "ORG",
                amorphous_lod = 1)

afps_granite <- afps(lib = minerals,
                   smpl = soils$granite,
                   std = "QUA.2",
                   align = 0.2,
                   lod = 0.2,
                   amorphous = "ORG",
                   amorphous_lod = 1)

#Alternatively run all 3 at once using lapply

afps_soils <- lapply(soils, afps,
                     lib = minerals,
                     std = "QUA.2",
                     align = 0.2,
                     lod = 0.2,
                     amorphous = "ORG",
                     amorphous_lod = 1)

#Automated quantification using the rockjock library

data(rockjock)
data(rockjock_mixtures)

#This takes a few minutes to run
rockjock_a1 <- afps(lib = rockjock,
                    smpl = rockjock_mixtures$Mix1,
                    std = "CORUNDUM",
                    align = 0.3,
                    lod = 1)

#Quantifying the same sample but defining the internal standard
#concentration (also takes a few minutes to run):
rockjock_a1s <- afps(lib = rockjock,
                     smpl = rockjock_mixtures$Mix1,
                     std = "CORUNDUM",
                     std_conc = 20,
                     align = 0.3,
                     lod = 1)

# }

Run the code above in your browser using DataLab