calc.Gr {BBEST} R Documentation

## Calculate and plot the Pair Distribution Function

### Description

Calculates and plots the corrected Pair Distribution Function.

### Usage

```calc.Gr(fit.results, rho.0, plot=TRUE, r.min = 0, r.max = 5,
dr = 0.01, Q.min = NA, Q.max = NA, nsd = 2, gr.compare=NA)
```

### Arguments

 `fit.results` the return value of `do.fit`. `plot` logical, whether to plot the PDF. `rho.0` numeric, the atomic number density of the material: the number of atoms per unit cell divided by a volume of the unit cell. `r.min, r.max, dr` numerics. Function is plotted in the region `[r.min, r.max]`. `Q.min, Q.max` numerics. To calculate the sine-Fourier transform, the total scattering function S(Q) is "terminated" at a certain `Q=Qmax` point. The best Qmax point to terminate S(Q) (that corresponds to the value of S(Q)-1 closest to zero) is sought in the `[Q.min,Q.max]` region. `nsd` numeric, the number of standard deviations to plot the uncertainty. `gr.compare` numeric vector. If not `NA`, specifies the function to add to the plot. Should correspond to the same grid (`[r.min, r.max, dr]`).

### Details

The function uses `ggplot2` package for plotting. `ggplot2` package can be installed by typing `install.packges("ggplot2")`.

### Value

A list with elements:

 `r` numeric vector of grid points `gr` numeric vector, indicates the corrected Pair Distribution Function. `stdev` numeric vector, indicates estimated standard deviation.

`do.fit`