CEARXRF
A Specific Purpose Monte Carlo Code for Modeling
the Energy-Dispersive X-Ray Fluorescence Analyzers
User's Guide
Sang Hong Lee
Center for Engineering Applications of Radioisotopes
Department of Nuclear Engineering
North Carolina State University
Raleigh, North Carolina 27695-7909
August 2001
Copyright Notice
Copyright (c) 2001
North Carolina State University
All Right Reserved
Forward
This manual is a practical guide for the use of our specific-purpose Monte Carlo code CEARXRF. The mathematics, data, physics, and Monte Carlo simulation found in CEARXRF will be not discussed - details of the particular techniques and of the Monte Carlo method itself will have to be found elsewhere. This manual shows the user how to prepare input for the code.
The Monte Carlo simulation of X-ray fluorescence analyzers began at CEAR in mid 1970. CEARXRF is the product of the combined effort of several people. Neither the code nor the manual is static since CEARXRF will continuously undergo improvements.
Suggestions and comments are welcome. Users are encouraged to report any bugs. The code and manual can be obtained from Professor Robin R. Gandner, Center for Engineering Applications of Radioisotopes, North Carolina State University, Raleigh, NC 27695-7909.
Sang Hoon Lee
919-515-3302
FAX: 919-515-5115
email:
Table of Contents
1. Introduction......
2. Code Execution......
3. Description of input files......
Geometry Input File......
Surface Definition......
Region Definition......
Universe and Envelop Definitions......
Main input file......
Output Card......
General card......
Source location card......
Zone Card......
Material Card......
Correlated zone card......
Differential spectra card......
Splitting Card......
Special Card......
4. Output files......
5. Input examples......
6. References......
1. Introduction
CEARXRF is a specific purpose Monte Carlo code for modeling the complete spectral response of energy-dispersive X-ray fluorescence (EDXRF) spectrometers. Development of the CEAAXRF code has been a continuous effort by several doctoral candidates when they were working on their dissertation at the Center for Engineering Applications of Radioisotopes (CEAR) at orth Carolina State University. The initial code was developed by A.R.Hawthorne to model interelement and matrix effects on characteristic X-ray lines (Hawthorne, 1977). It was then modified by J.M.Doster to include capability of predicting the entire pulse-height spectrum for EDXRF systems by using a simple Si(Li) detector response function(Doster, 1982). A semiempirical Si(Li) detector response function and cubic spline techniques for fitting X-ray cross section and efficiency (Yacout, 1987). A further refinement of the code was made by T.He to include a sophisticated semi-empirical Si(Li) detector response function, general geometry ability, and Monte Carlo Library Least Squares (MCLLS) approach (He, 1992). More functionalities were included by Dr. Q.Ao with assistance of S.H.Lee with the capability of accurately handling the XRF emission and low-energy photon transport. The latest development of the code by Dr. Lee is given the capability of simulating K and L X-ray at the same time with differential operator techniques. Detailed description of Monte Carlo simulation of XRF and photon transport physics as well as the code structure can be found in the Ph.D dissertations and related papers (Hawthorne, 1977; Doster, 1982; Yacout, 1987; He, 1992; Ao et al., 1997; Ao, 1997).
The CEARXRF code has man features that make it suitable for a variety of applications. They include: (1) multiple-element EDXRF simulation (Z=1-94), (2) complete EDXRF pulse-height spectrum calculation, (3) a variety of excitation modes, (4) polarized photon transport modeling, (5) complete K and L XRF simulation, (6) detailed XRF emission physics, (7) Doppler effect modeling in Compton scattering, (8) general geometry modeling, (9) spectroscopy analysis with the MCLLS approach, (10) correlated sampling for density and composition perturbation calculation, (11) detector response function Si(Li) and low-energy photon germanium detectors, (12) phton cross sections adapted from MCNP (Briesmeister, 1997) and latest atomic data, (13) optimized variance reduction techniques for EDXRF modeling, (14) differential operator technique, and (15) graphical interface to display simulation results on the fly.
2. Code Execution
CEARXRF was proof-tested on SUN Sparc workstation. The code was written in FORTRAN-77 and should be portable to a variety of computing environments.
The CEARXRF code package includes the following files that are stored in the directory /ncsu/ne_cear/nih2000/cearxrf_source on the EOS system:
Fortran source file:
cearxrf3s000511.f
dmcohprep.f
dmcxprep.f
dmgenera2.f
dmgeneral.f
dmhermet.f
dmincpre2.f
dmphoprep.f
dmrandom.f
dmsource.f
dmspprep.f
Photon cross section library:
Phcoh.lib
Phcx.lib
Phinc.lib
Phpho.lib
Input file:
*.gem
cearxrf3.inp
Geometry package common block:
cgenv.cmb
regsur.cmb
univ.cmb
Detector response function:
****
Make file:
Makefile
Code compilation requires the pgplot graphical library, which can be added in SUN with command “add pgplot511”. The compilation commands will be like this:
add pgplot511
make
3. Description of input files
Two input files are required for CEARXRF. The first file, cearxrf.inp, is the main input file. It specifies the cross section library, geometry input file, output file, sample material description, sample zone description, various calculation options and variance reduction options. The geometry input file, which is the second input file, is used for the geometry package HERMETOR.
Geometry Input File
Only basic information about geometry setup, surface specification, and region and surface description will be presented here/ Areas of further interest such as universe and envelop for complex and repeated geometry, can be found in the HERMETOR manual (Prettyman, 1992). CEARXRF describes the system geometry using a unique combination of boundary representation and constructive solid geometry. The geometry of CEARXRF treats and arbitrary three-dimensional configuration of user-defined materials in geometric regions bounded by first- and second-faces. Surfaces are defined by supplying coefficients to the analytic surface equations. CEARXRF treats geometric regions in a Cartesian coordinate system. In addition, the geometry-plotting capability in HERMETOR helps the user check for geometry errors.
The geometry input file has the following form:
One line for system title
x,y,z extents for geometry plotting
Surface definitions
Universe definitions
Region definitions
Envelop definitions
End
Surface Definition
Form: ns
j a list
ns = number of surfaces
j = surface number
a = surface type mnemonic
list = nine equation parameters specific to the surface type and the orientation of the
surface relative to the coordinate axes.
A surface is defined using one of the surface-type mnemonics from Table 1 and calculating the appropriate coefficients needed to satisfy the surface equation. For example, surface ‘cx’ 0 0 5 2 0 0 0 45 0 is a cylinder which has a radius of 2 centimeters, located at point (0 0 5) and inclined at 45 degrees to the y-axis.
Region Definition
Form: nr
i n list1 m list2 k
nr = number of regions
i = color index of the region for geometry plotting
n = number of embedded regions
list1 = list of embedded regions
m = numbers of surfaces bounding the region
list2 = list of signed surface numbers with each followed by 0
k = number of universes
Regions are defined using the sense of all points in a region with respect to a bounding surface. Suppose that s= f(x,y,z)=0 is the equation of a surface in the problem. For any set of points (x,y,z), if s=0 the points are on the surface. However for points not on the surface, if s is negative the points are said to have a negative sense with respect to that surface and conversely, a positive sense if s is positive. For example, the region inside a cylindrical surface has a negative sense, e.g. it is on the negative side of surface, while the region outside the surface has a positive sense, e.g. it is on the positive side of surface.
Universe and Envelop Definitions
Refer to HERMETOR User’s Guide for detail.
Main input file
The main input file has the following form:
Cross section data library file name
Coherent data library file name
Incoherent data library file name
Fluorescence X-Ray data library file name
Geometry Data File
Output Card
One Line for problem title and a brief description
GENERAL Card
SOURCE Card
Zone Card
Material Card
Correlated Zone Card
Differential Spectra Card
Splitting Card
Special Card
Output Card
Form: General Output
FIRST DETECTOR Output Spectrum of Reference Sample
1-st order Differential Spectra of Reference Sample
2-nd order Differential Spectra of Reference Sample
3-nd order Differential Spectra of Reference Sample
2-nd order cross-terms Differential Spectra of Reference Sample
Output Spectra of Correlated Samples
Output Spectrum of Reference Sample (XRF only)
1-st order Differential Spectra of Reference Sample(XRF only)
2-nd order Differential Spectra of Reference Sample(XRF only)
3-nd order Differential Spectra of Reference Sample(XRF only)
2-nd order cross-terms Differential Spectra of Reference Sample(XRF only)
Output Spectra of Correlated Samples(XRF only)
SECOND DETECTOR Output Spectrum of Reference Sample
1-st order Differential Spectra of Reference Sample
2-nd order Differential Spectra of Reference Sample
3-nd order Differential Spectra of Reference Sample
2-nd order cross-terms Differential Spectra of Reference Sample
Output Spectra of Correlated Samples
Output Spectrum of Reference Sample (XRF only)
1-st order Differential Spectra of Reference Sample(XRF only)
2-nd order Differential Spectra of Reference Sample(XRF only)
3-nd order Differential Spectra of Reference Sample(XRF only)
2-nd order cross-terms Differential Spectra of Reference Sample(XRF only)
Output Spectra of Correlated Samples(XRF only)
General card
Form: Card delimiter
Description line
nhist iseed nchannel shift gain wkill cuteng
Description line
ioppol iopcoh iopinc ioppho nelem
Description line
iatmno(1:nelem)
nhist = history number for simulation
iseed = random number seed
nchannel = output spectrum channel number
shift = output spectrum shift, one of two calibration parameters
gain = output spectrum gain, one of two calibration parameters
wkill = relative weight for history termination with Russian Roulette.
cuteng = cutoff energy (Mev)
ioppol = polarization option
0: no polarization effect considered
1: polarization effect considered
iopcoh = coherent scattering option, currently not used.
iopinc = incoherent scattering option
1. Compton scattering modified by ISF
2. Compton scattering modified by ISF + Total Doppler Broadening
3. Compton scattering modified by ISF + Total Doppler Broadening(by shlee)
4. Compton scattering modified by ISF + Total Doppler Broadening(by shlee esgmax=e0)
5. Compton scattering modified by ISF + Shellwise Doppler Broadening
6. Compton scattering modified by ISF + Shellwise Doppler Broadening(by shlee)
7. Compton scattering modified by ISF + Shellwise Doppler Broadening(by shlee esgmax=e0)
ioppho = photoelectric abs. and fluorescence model flag
0. analog (0, 1, 2, 3 photons possible)
1. always 1 photon
2. forced (1, 2, 3 photons possible)
( when it is inherently impossible,ioppho=1,2 cases can also produce no XRF lines)
nelem = element number in sample
iatmno(1:nelem) = element atomic number with index as element number
Source location card
Form: Source location delimiter
Description line
iopsloc,slocx,slocy,slocz slocp1,slocp2,slocp3, slocp4,slocp5,isloczon
Source energy description delimiter
Description line
iopsene,dpart,ndisc,dbias,cpart,ncont,cbias
Description line
(dene(i),temp1(i),temp2(i),i=1,ndisc) (optional dependent on iopsene)
(cene(i),ccdf(i),i=1,ncont) (optional dependent on iopsene)
Source direction delimiter
Description line
iopsdir sdiru,sdirv,sdirw sdirp1,sdirp2,sdirp3,sdirp4,sdirp5
Source polarization delimiter
Description line
iopspol spolp1 spolp2 spolp3 spolp4
iopsloc = source option
c------
c
c TYPE iopsloc slocx slocy slocz slocp1 slocp2 slocp3 slocp4 slocp5 isloczon
c
c point 1 x y z ------
c circular 2 x y z r - - th phi izonrej
c ring 3 x y z rout rin - th phi izonrej
c rectangle 4 x y z dx dy - th phi izonrej
c sphere 5 x y z r - - - - izonrej
c cylinder 6 x y z r H - th phi izonrej
c hollow 7 x y z rout rin H th phi izonrej
c parallelpiped 8 x y z dx dy dz th phi izonrej
c
c------
slocx = source center x-coordinate value
slocy = source center y-coordinate value
slocz = source center z-coordinate value
slocp1 = see the above table
slocp2 = see the above table
slocp3 = see the above table
slocp4 = see the above table
slocp5 = see the above table
isloczon = source location rejection option
isloczon - > 0 : locations outside this zone is
= 0 : no zone restriction
iopsene = source energy option
1 : discrete energy source
2 : continuous energy source
3 : discrete & continuous energy source
dpart = discrete energy source fraction
ndisc = length of discrete energy source table
dbias = biasing factor for discrete energy fraction
cpart = continuous energy source fraction (normalization between dpart and cpart will be automatic)
ncont = length of continuousenergy source table
cbias = biasing factor for constinuous energy fraction
dene(1:ndisc) = source photon energy in discrete category
temp1(1:ndisc) = probability of the energy in discrete category
temp2(1:ndisc) = biasing factor of the energy in discrete category
cene(1:ncont) = source photon energy in continuous category
ccdf(1:ncont) = cumulative prob. density ccdf(ncont)=1.0
iopsdir = source direction biasing option
iopsdirsdirusdirvsdirwsdirp1sdirp2sdirp3sdirp4sdirp5
1
2,3-direction cosine-N/AN/AN/AN/AN/A
4,5-direction cosine-KN/AN/AN/AN/A
6,7-direction cosine-N/AN/AN/AN/A
8,9-direction cosine-
1 : isotropic
2,3 : mono-directional
4,5 : exponential biasing, see MCNP 4A 2-137 for reference
6,7 : cone beam, isotropic distribution inside cone
8,9 : discrete cone-shaped beam, pdf used for three level
2, 4, 6, 8: direction based; 3, 5, 7, 9: target based
sdiru = see the above table
sdirv = see the above table
sdirw = see the above table
sdirp1 = see the above table
sdirp2 = see the above table
sdirp3 = see the above table
sdirp4 = see the above table
sdirp5 = see the above table
iopspol = source polarization option
iopspolsplop1spolp2spolp3spolp4
1N/AN/AN/AN/A
2
(, are in radian unit, , are fraction for these two choices.)
spolp1 = see the above table
spolp2 = see the above table
spolp3 = see the above table
spolp4 = see the above table
Zone Card
Form: Zone data delimiter
Description line
nxzone
Description line
i izonmat izoncor izondif izondet izonsplt zoncxb izonbias zonbtar(1:3) zonbpar(1:5) (nxzone line)
Description line
izout
nxzone = zone number
i = zone index
izonmat = material no. for i-th zone
izoncor = corr. mat. set for i-th zone
- no correlated case
- The ith correlated zone, which i>0, for now, only 1 is acceptable, which means only one correlated zone.
izondif = differential spectra option for i-th zone
- no differential spectrum considered
- The ith differential zone, which i>0, for now, only 1 is acceptable, which means only one differential zone.
izondet = zone index for detectors
0. non-detector zone
1. first detector
- second detector
izonsplt = zonewise splitting option
- no splitting
- otherwise, splitting is used
zoncxb = zone cross section biasing factor
izonbias = zone direction biasing option
zonbtar = target coordinate (x,y,z), not necessarily center of target
zonbpar = TBD
izout = zone number of outer space
Material Card
Form: Material data delimiter
Description line
nxmat
Description line
i dens nleng ( jtemp(i) , temp(i), i = 1,nleng ) (nxmat line)
nxmat = toal material number
i = material number
denmat = material density
nleng = number of elements in the material
jtemp(i) = atomic number for ith element
temp(i) = weight fraction or atomic number density for ith element
dens >1e-20: weight fraction
otherwise: atomic number density
Correlated zone card
Form:Correlated data delimiter
Description line
nxcorset
icormat
Description line
i dens nleng ( jtemp(i) , temp(i), i = 1,nleng ) (nxmat line)
nxcorset = number of correlated sample set
icormat = correlated set index
i = convenient correlated sample set index, not used in program
dens = material density
nleng = number of elements in material
jtemp(i) = atomic number for ith element
temp(i) = weight fraction or atomic number density for ith element, or fraction
compared to original atomic number density
dens >1e-20: weight fraction
dens <0 :relative fraction
otherwise: atomic number density
Differential spectra card
Form:Differential spectra delimiter
Description line
ndiffelem
Description line
jtemp(i),i=1,ndiffelem
ndiffelem = number of differential spectra
jtemp(i) = elemental atomic number for differential spectra
Splitting Card
Form: Splitting card delimiter
Description line
nxsplt
nxsplt = number of total splitting photon allowed
Special Card
Form:Special data delimiter
Description line
frtrace compdf
frtrace = fraction of even random sampling among all the elements without considering cross sections
compbf = Compton Scattering Bias Factor
4. Output files
CEARXRF output is very flexible, this part will be amended later after some standardization.
5. Input examples
1). Main input file cearxrf3.inp
'PHCX.LIB' Cross Section Data Library
'PHCOH.LIB' Coherent Data Library
'PHINC.LIB' Incoherent Data Library
'PHPHO.LIB' Fluorescence X-Ray Data Library
'dual17.gem' Geometry Data File
'dual17a.out' General Output
'dual17as0.dat' FIRST DETECTOR Output Spectrum of Reference Sample
'dual17as1.dat' 1-st order Differential Spectra of Reference Sample
'dual17as2.dat' 2-nd order Differential Spectra of Reference Sample
'dual17as3.dat' 3-nd order Differential Spectra of Reference Sample
'dual17as4.dat' 2-nd order cross-terms Differential Spectra of Reference Sample
'dual17asc.dat' Output Spectra of Correlated Samples
'dual17ax0.dat' Output Spectrum of Reference Sample (XRF only)
'dual17ax1.dat' 1-st order Differential Spectra of Reference Sample(XRF only)
'dual17ax2.dat' 2-nd order Differential Spectra of Reference Sample(XRF only)
'dual17ax3.dat' 3-nd order Differential Spectra of Reference Sample(XRF only)
'dual17ax4.dat' 2-nd order cross-terms Differential Spectra of Reference Sample(XRF only)
'dual17axc.dat' Output Spectra of Correlated Samples(XRF only)
'dual17as02.dat' SECOND DETECTOR Output Spectrum of Reference Sample
'dual17as12.dat' 1-st order Differential Spectra of Reference Sample
'dual17as22.dat' 2-nd order Differential Spectra of Reference Sample
'dual17as32.dat' 3-nd order Differential Spectra of Reference Sample
'dual17as42.dat' 2-nd order cross-terms Differential Spectra of Reference Sample
'dual17asc2.dat' Output Spectra of Correlated Samples
'dual17ax02.dat' Output Spectrum of Reference Sample (XRF only)
'dual17ax12.dat' 1-st order Differential Spectra of Reference Sample(XRF only)
'dual17ax22.dat' 2-nd order Differential Spectra of Reference Sample(XRF only)