R/getScatterFactor.R

Defines functions scatterFactor getScatterFactor

Documented in getScatterFactor scatterFactor

getScatterFactor <- function(name){

#fpe <- read.table("scF.dat")
fpath <- system.file("extdata", "fpe.csv", package="nanop")
fpe <- read.csv(file = fpath, header = TRUE)


num <- switch(name,
	"H"=1,
	"H1-"=2,
	"He"=3,
	"Li"=4,
	"Li1+"=5,
	"Be"=6,
	"Be2+"=7,
	"B"=8,
	"C"=9,
	"Cval"=10,
	"N"=11,
	"O"=12,
	"O1-"=13,
	"O2-"=14,
	"F"=15,
	"F1-"=16,
	"Ne"=17,
	"Na"=18,
	"Na1+"=19,
	"Mg"=20,
	"Mg2+"=21,
	"Al"=22,
	"Al3+"=23,
	"Si"=24,
	"Siva"=25,
	"Si4+"=26,
	"P"=27,
	"S"=28,
	"Cl"=29,
	"Cl1-"=30,
	"Ar"=31,
	"K"=32,
	"K1+"=33,
	"Ca"=34,
	"Ca2+"=35,
	"Sc"=36,
	"Sc3+"=37,
	"Ti"=38,
	"Ti2+"=39,
	"Ti3+"=40,
	"Ti4+"=41,
	"V"=42,
	"V2+"=43,
	"V3+"=44,
	"V5+"=45,
	"Cr"=46,
	"Cr2+"=47,
	"Cr3+"=48,
	"Mn"=49,
	"Mn2+"=50,
	"Mn3+"=51,
	"Mn4+"=52,
	"Fe"=53,
	"Fe2+"=54,
	"Fe3+"=55,
	"Co"=56,
	"Co2+"=57,
	"Co3+"=58,
	"Ni"=59,
	"Ni2+"=60,
	"Ni3+"=61,
	"Cu"=62,
	"Cu1+"=63,
	"Cu2+"=64,
	"Zn"=65,
	"Zn2+"=66,
	"Ga"=67,
	"Ga3+"=68,
	"Ge"=69,
	"Ge4+"=70,
	"As"=71,
	"Se"=72,
	"Br"=73,
	"Br1-"=74,
	"Kr"=75,
	"Rb"=76,
	"Rb1+"=77,
	"Sr"=78,
	"Sr2+"=79,
	"Y"=80,
	"Zr"=81,
	"Zr4+"=82,
	"Nb"=83,
	"Nb3+"=84,
	"Nb5+"=85,
	"Mo"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180,
	"Pb4+"=181,
	"Bi"=182,
	"Bi3+"=183,
	"Bi5+"=184,
	"Po"=185,
	"At"=186,
	"Rn"=187,
	"Fr"=188,
	"Ra"=189,
	"Ra2+"=190,
	"Ac"=191,
	"Ac3+"=192,
	"Th"=193,
	"Th4+"=194,
	"Pa"=195,
	"U"=196,
	"U3+"=197,
	"U4+"=198,
	"U6+"=199,
	"Np"=200,
	"Np3+"=201,
	"Np4+"=202,
	"Np6+"=203,
	"Pu"=204,
	"Pu3+"=205,
	"Pu4+"=206,
	"Pu6+"=207,
	"Am"=208,
	"Cm"=209,
	"Bk"=210,
	"Cf"=211
)
if(is.null(num))
  stop("unknown atom name \n", immediate. = TRUE)
  

scF <- fpe[num, ]

list(a1=scF$a1, a2=scF$a2, a3=scF$a3, a4=scF$a4, a5=scF$a5, 
     b1=scF$b1, b2=scF$b2, b3=scF$b3, b4=scF$b4, b5=scF$b5, 
	 c=scF$c)
} 




######################################################################################
scatterFactor <- function(scatterFactor, Q){
  s <- (Q/(4*pi))^2
  scatterFactor$a1*exp(-scatterFactor$b1*s) + scatterFactor$a2*exp(-scatterFactor$b2*s) +
   scatterFactor$a3*exp(-scatterFactor$b3*s) + scatterFactor$a4*exp(-scatterFactor$b4*s) +
   scatterFactor$a5*exp(-scatterFactor$b5*s) + scatterFactor$c
}

Try the nanop package in your browser

Any scripts or data that you put into this service are public.

nanop documentation built on May 30, 2017, 7:22 a.m.