# NOT RUN {
# Create an arbitrary structure with a heavy atom (Fe)
a <- 20
SG <- "P1"
x0 <- c(1,2,6,16)
Z <- c(6,8,26,7)
B <- c(8,7,5,8)
occ <- c(1,1,1,1)
sdata <- standardise_sdata(a,SG,x0,Z,B,occ)
# Miller indices, from -5 to 5 (to include negatives for anomalous)
hidx <- -5:5
# Experimental structure factors with anomalous contribution
# (lambda = 1.74) for creating Fm and Fp. Errors only due to
# photons fluctuations.
set.seed(9195) # For demo purposes.
ltmp <- sfobs(hidx,sdata,ntrialP=10,anoflag=TRUE,lbda=1.74)
# Fp and sigFp (Miller indices from 1 to 5)
isel <- 1:5
idx <- match(isel,hidx)
Fp <- ltmp$F[idx]
sigFp <- ltmp$sF[idx]
# Fm and sigFm
isel <- (-1):(-5)
idx <- match(isel,hidx)
Fm <- ltmp$F[idx]
sigFm <- ltmp$sF[idx]
# Now only positive Miller indices
hidx <- 1:5
# Create standardised data for reciprocal space
fdata <- standardise_fdata(a,SG,hidx,Fp=Fp,sigFp=sigFp,
Fm=Fm,sigFm=sigFm)
# Fp and Fm
print(fdata$Fp)
print(fdata$sigFp)
print(fdata$Fm)
print(fdata$sigFm)
# Fobs and sigFobs automatically created
print(fdata$Fobs)
print(fdata$sigFobs)
# Structure factors without anomalous data for the same structure
hidx <- 1:5
set.seed(9195) # For demo purposes.
ltmp <- sfobs(hidx,sdata,ntrialP=10)
Fobs <- ltmp$F
sigFobs <- ltmp$sF
fdata <- standardise_fdata(a,SG,hidx,Fobs=Fobs,sigFobs=sigFobs)
print(fdata)
# }
Run the code above in your browser using DataLab