calcPDF: Functions to calculate the PDF

Description Usage Arguments Details Value Note See Also Examples

Description

Functions to calculate the pair distribution function (PDF) and Q-dependent PDF given a matrix of atomic positions. The latter is relatively time-consuming.

Usage

1
2
3
4
5
6
7
8
calcPDF(nanop, dr=.01, minR=.01, maxR=20, 
        scatterLength=NA, scatterFactor=NA,  
        type="neutron", Qmin=1e-16)                        
calcQDepPDF(nanop=NA, dr=.1, minR=1, maxR=20, dQ=.01, minQ=1, maxQ=20,
            verbose=0, subdivisions = 100, order=1000,
            rel.tol=.Machine$double.eps^.7,
            addNoise=FALSE, noiseFun=NA, 
            totalScattParams=list(), preTotalScat=NA, ...)

Arguments

nanop

numeric matrix in which each row gives the coordinates of an atomic position in the nanoparticle. For calcPDF calculations if nanop is not an object returned by simPart or displacePart attributes nAtomTypes, atomType, layer_start, layer_end, layerS_start, layerS_end, rowcore, scatterLength, and scatterFactor should be set manually; see simPart.

dr

numeric indicating the desired step size in r.

minR

numeric indicating the minimum value of r for which function should be evaluated.

maxR

numeric indicating the maximum value of r for which function should be evaluated.

scatterLength

numeric vector describing neutron scattering lengths for all atom types in the particles. If NA the value is sought in nanop attributes.

scatterFactor

list containing X-ray scattering factor parameters, see calcTotalScatt. If NA the value is sought in nanop attributes.

type

character; type of scattering. Either "X-ray" or "neutron".

Qmin

numeric used to approximate Q-dependent X-ray scattering factor via its value at point Q=Qmin.

dQ

numeric indicating the desired step size in Q in total scattering function calculations.

minQ

numeric indicating the minimum value of Q for which the total scattering function should be evaluated.

maxQ

numeric indicating the maximum value of Q for which the total scattering function should be evaluated.

verbose

numeric; if greater than zero a status report is given after computing the function every verbose steps in r.

subdivisions

numeric, the maximum number of subintervals for the Fourier integral calculation.

order

numeric, order of Gauss-Legendre quadrature.

rel.tol

numeric, relative accuracy requested for the Fourier integral calculation.

addNoise

logical indicating whether noise should be added to the total scattering structure function. If addNoise=TRUE then function noiseFun is applied to the approximation of the total scattering structure function at points Q determined by the numerical integration routine.

noiseFun

function used to add noise to the total scattering structure function, applied only if addNoise=TRUE. The first argument should be a numeric vector representing the total scattering structure function. Additional arguments may be passed via ....

totalScattParams

list contacting objects sigma, n, delta, kind, dr, del, eps, type, scatterLength, and scatterFactor that are passed to calcTotalScatt function for total scattering function calculation. See calcTotalScatt for details. Should be specified if preTotalScat=NA.

preTotalScat

list with elements Q (grid points) and gQ (values of the total scattering structure function at the corresponding gridpoints). If NA calcTotalScatt parameter should be specified.

...

additional arguments for noiseFun.

Details

If preTotalScat is not NA calcQDepPDF function calculates Fourier transform of the vector gQ$preTotalScat. Otherwise it uses parameters specified in totalScattParams to generate total scattering function first.

Value

list with elements

r

numeric vector of values at which the function was evaluated,

gr

numeric vector of function values.

Note

To normalize calcPDF in the same way as calcQDepPDF it should be multiplied by 4π r.

calcQDepPDF is currently rather time-consuming.

See Also

simPart, displacePart

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
## simulate a particle 
Cu <- createAtom("Cu")
part <- simPart(atoms=list(Cu), atomsShell=list(Cu), r=8, 
    rcore=6, latticep=4.08, latticepShell=3.89)
## uniform displacement of positions
partx1 <- displacePart(part, sigma=c(.005, 0.005))
## different displacement in core than shell 
partx2 <-  displacePart(part, sigma=c(.005, .02))

## calculate and plot PDF associated with both particles 
gr1 <- calcPDF(partx1, maxR=24, scatterLength=c(4.87, 7.97), dr=.02)
gr2 <- calcPDF(partx2, maxR=24, scatterLength=c(4.87, 7.97), dr=.02)

plot(gr1$r, gr1$gr, type="l")
lines(gr2$r, gr2$gr, col=2)

## calculate scattering fucntion
gQ <- calcTotalScatt(part, type="neutron", dr=.02,
    scatterLength=c(4.87, 7.97), sigma=c(.005, .02))
t1 <- which(gQ$Q > 30)[1]
t2 <- which(gQ$Q > 34.9)[1]
cut <- gQ$Q[t1:t2][which(abs(gQ$gQ[t1:t2])
    ==min(abs(gQ$gQ[t1:t2]) ))[1]]
## calculate Q-dependent PDF
gr3 <- calcQDepPDF(part, minR=0, maxR=24, dr=0.02, minQ=.771, maxQ=cut,
    verbose=100, preTotalScat=list(Q=gQ$Q, gQ=gQ$gQ) )
## compare results with that obtained by calcPDF:
## ...normalization:
gr2 <- 4*pi*gr2$r*gr2$gr
## calculate and subtract gamma term:
gQSAS <- calcTotalScatt(part, type="neutron",  minQ=0.001, 
    maxQ=0.771, dQ=0.005,  dr=.02, 
    scatterLength=c(4.87, 7.97), sigma=c(.005, .02))
gammaR <- calcQDepPDF(part, minR=0.01, maxR=24,
    maxQ=.771, minQ=0.001, dr=.02,
    verbose=100, preTotalScat=list(Q=gQSAS$Q, gQ=gQSAS$gQ))
gr2 <- gr2 - gammaR$gr

## plot pair distribution functions associated with both technique:
plot(gr1$r, gr2, type="l")
lines(gr3$r, gr3$gr, col=2, lwd=2)

nanop documentation built on May 2, 2019, 3:39 p.m.

Related to calcPDF in nanop...