# NOT RUN {
# First create the crystal structure (in P1)
a <- 10
SG <- "P1"
x0 <- c(1,4,6.5)
Z <- c(8,26,6)
B <- c(18,20,17)
occ <- c(1,1,1)
sdata <- standardise_sdata(a,SG,x0,Z,B,occ)
# 10 Miller indices plus DC component
hidx <- 0:10
# Compute structure factors
ftmp1 <- strufac(hidx,sdata)
# Number of grid points
N <- 1000
# Density
rtmp <- fousynth(a,ftmp1$Fmod,ftmp1$Fpha,hidx,N)
# Using inverse Fourier to obtain structure factors
ftmp2 <- invfousynth(a,rtmp$rr,hidx)
# Comparison
print(abs(ftmp1$Fmod-ftmp2$Fmod))
print(abs(ftmp1$Fpha-ftmp2$Fpha))
# }
Run the code above in your browser using DataLab