Radsrc LLNL
Radsrc LLNL
Abstract
The RadSrc (pronounced “Rad-Source”) suite provides computational support for applications addressing
radioactive decay and emission of radiation from decay. The RadSrc library computes the concentrations of
decay products given an initial concentration and age, and photon radiation due to continuing decay of those
products. Written in C++, the library provides an object-oriented interface to computational results, as well as
its underlying database of isotope information. The library also provides a simplified interface in FORTRAN
and C++ intended for use in Monte Carlo applications, and can accommodate varying levels of integration
with other code bases. A stand-alone application, RadSrc, serves as an interactive user interface to the li-
brary. The RadSrc suite is open source and licensed under the BSD license and can be downloaded from
http://nuclear.llnl.gov/simulation.
∗
Contact info: [email protected], 925-423-2347
Contents
1 Introduction 3
2 Installation 3
3 RadSrc Application 5
3.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
3.2 Usage . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
3.3 Application Database . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
3.4 Problem Definition . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
3.5 Examples of Execution . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
3.6 Output Files . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10
4 RadSrc Library 12
4.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12
4.2 Optional Documentation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
4.3 Configuring GEANT4 to use RadSrc . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
4.4 Calling RadSrc from within GEANT4 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
4.5 Calling RadSrc from FORTRAN . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15
4.6 Configuring MCNP/MCNPX to use RadSrc . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16
4.7 Configuring COG to use RadSrc . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16
References 20
A Library API 21
A.1 Error Handling . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21
A.2 Caveats . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21
A.3 FORTRAN/C/C++ Monte Carlo Interface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21
A.4 Class CIsotope . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25
A.5 Class CDatabaseManager . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26
A.6 Class CIsotopeDatabase . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26
A.7 Class CIsotopeData . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27
A.8 Class CDecayMode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28
A.9 Class CPhoton . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29
A.10 Class CDecayComputer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29
A.11 Class CBatemanSolution . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31
A.12 Class CIsotopeMixture . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31
A.13 Class CPhotonComputer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31
A.14 Class CPhotonIterator . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33
A.15 Class CGammaEntry . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33
A.16 Class CBinnedData . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 34
2
1 Introduction
Many applications exist that require the calculation of an ideal theoretical radiation spectrum resulting from the
natural decay of radioactive elements. Often this idealized source spectrum is modified through Monte Carlo
simulation of radiation transport to account for absorption and scattering of radiation in matter. Monte Carlo
transport codes such as MCNP/X [1], GEANT4 [2], and COG [3] allow the user to specify custom radiation
sources in the transport simulation. This nevertheless required users to manually specify the radiation source
distributions and/or supply samples from the distributions.
A previous solution, GAMGEN [4], automated the calculation of decay product concentrations in an aged
material containing radioisotopes and the distribution of photons emitted by nuclear decay. Despite the added
convenience of having the photon distributions computed, manual intervention was required to communicate this
information into the Monte Carlo codes. The RadSrc Suite has been developed to incorporate this calculation
directly into the Monte Carlo codes themselves and also provide a stand-alone application.
RadSrc accepts an initial isotope mixture and desired age and computes the concentrations of the decay prod-
ucts, and photon emission spectrum from radioactive isotopes in the aged mixture. The user has the opportunity
to select certain lines of interest and bin the remainder; this can simplify comparison of the computed spectrum
to experimental data. Several binning options are provided, including pre-computed binning schemes TART and
MORSE, uniform binning and binning proportional to a square-root of energy function. The user is similarly free
to choose any of these binning schemes for the computed bremsstrahlung radiation (if present) and the custom tally
bins for the MCNP and MCNP/X transport codes.
Written in modern C++, the RadSrc library takes advantage of modern techniques to streamline the calculation
and modularize the functions of database handling, decay product and photon calculations, and provide flexible
interfaces. The library simultaneously provides a rich interface to the library capabilities for C++ applications while
it also provides a slim interface to FORTRAN Monte Carlo applications. The object-oriented design facilitates
the adaptation of new sources of isotope data beyond that provided in the RadSrc distribution. A stand-alone
application, radsrc, is included to reproduce the functionality of GAMGEN using the RadSrc library.
The RadSrc Suite and its data have been released under the BSD open source license. Users are free to
incorporate RadSrc functionality into their own applications, or adjust and enhance the isotope database with new
isotopes, new decay modes, or improved values; as long as the RadSrc copyright statement appears in their code
and RadSrc usage is acknowledged.
2 Installation
The RadSrc Suite is distributed as a single archive containing the source code, isotope data, examples, and docu-
mentation. Precompiled binaries of the stand-alone application for MacOS and Windows are also provided. You
can download everything from http://nuclear.llnl.gov/simulation.
The complete distribution in a self-contained directory structure:
To install, simply go to the top level directory and type make. This will compile both the library and the stand-
alone application with the GNU compiler. To compile just the library, without making the application, type
make libradsrc.
The provided makefile also includes flags for the Intel and Portland Group compilers. To compile using either
of these compilers, include the target intel or portland on the command line.
3
If you have doxygen installed on your system, type make docs to generate the html documentation. A file
that redirects to the main page is provided in the doc directory for your convenience.
To accommodate applications that cannot specify the location of the isotope data base, the RadSrc Suite checks
environment variables for the correct path. Because the RadSrc library can load multiple databases, each database
parser looks for an environment variable specific to the parser. All parsers fall back to the RADSRC DATA en-
vironment variable if the parser-specific variable is not set. The GAMGEN legacy database parser first checks
RADSRC LEGACYDATA, then RADSRC DATA to locate the database. If neither variable is set or no database is
found at that location, the library attempts to load from subdirectory data in the current working directory.
You may configure the library to use extended-precision arithmetic when calculating isotope concentrations.
To accomplish this compile with USE HIGH PRECISION defined, or edit porting.h. You may also use an
external library by editing porting.h. Then, HighPrecisionType must be a typedef to a class that
supports basic arithmetic operators and the exponential function. Note that the RadSrc application currently only
links with the double precision library.
4
3 RadSrc Application
3.1 Introduction
The calculation of radioactive decay products, although straightforward, is well suited for automation. The Rad-
Src library combines radioisotope data, x-ray and gamma-ray line catalogs, and measured bremsstrahlung spectra
to automatically compute the photon emission from an aged radiological sample. The binary program radsrc
is the interactive (or batch) user-interface for computing photon intensity distributions. It is designed to dupli-
cate the output and essential functionality of the GAMGEN application, using the RadSrc library to perform the
calculations.
Application features:
• Calculation of decay product concentrations given an initial isotope mixture and the age
• List of gamma and x-ray photons produced by radioactive decay, as well as the particular decay(s) generating
each photon line and the initial isotope responsible for the presence of the line
• Sorted output of photons by energy and intensity per gram
• Bremsstrahlung background for the 238 U decay family
• Computes bin structure for separate tally of scattered and unscattered photons during transport simulation
• Flexible selection of binning methods for photon lines, bremsstrahlung photons, and scattered photon tally
• Outputs photon lines, bremsstrahlung photons, and tally bin structures in MCNP-compatible format
• Written in portable C++ language
3.2 Usage
The application can be used in either interactive or non-interactive mode. In interactive mode the program accepts
problem definition from standard input. For non-interactive mode, the program reads the problem definition from
a file.
The application resides in the high level bin directory so it is invoked with the command bin/radsrc. The
command line syntax is:
bin/radsrc [-hq] [config-file]
The -h flag provides command-line syntax help.
The -q flag suppresses the writing of run summaries to stdout.
If config-file is not given, the application runs in interactive mode.
6
the beta decay of Protactinium (Pa234m) using 238U metal as the medium. Bremsstrahlung never appears in the
output.lin file because it is a continuous distribution and not a discrete line. However, the total bremsstrahlung
intensity rate is listed as part of the heading of both the output.lin and output.mci file.
Whenever Monte Carlo input decks are to be produced, some of the following specifications are required.
Binning options for Bremsstrahlung
Binning options for gamma lines
Binning structure for binned gamma photons
Binning Options for Bremsstrahlung If brem off is included in the primary specifications Bremsstrahlung
binning options are not necessary and RadSrc does not request them.
However, if brem off is not included, the user must specify the binning structure for bremsstrahlung radia-
tion. RadSrc provides a measured bremsstrahlung spectrum due to beta decay of 234m Pa, scaled to the concentra-
tion of 234m Pa present and rebinned as specified by the user. In general, binned data have the following options:
1) Default Binning
2) Read from a file
3) Equal spaced bins
4) Proportional to Energy Width
5) TART 65 bins (NaI)
6) MORSE 35 bins (NaI)
7) GADRAS 1000 bins (HPGe)
Option 1 Default binning, is a bin structure specified by the provided file named lib/dfltbrem.dat
which may be customized for local installations.
Option 2 Read from a file, reads bin boundaries from a user-provided file. A default filename is suggested,
depending on the quantity being binned.
Option 3 Equal spaced bins, creates a specified number of bins with specified minimum and maximum
energy boundaries.
Option 4 Proportional to Energy Width, does the same as equal space bins but varies the bin width in pro-
portion to the function k1 + k2 E 1/2 , with k1 and k2 specified by the user and E is the lower energy boundary of
the bin.
Binning options for gamma lines The gamma line binning options menu is as follows.
1) Keep all lines discrete
2) Bin all lines
3) Keep the default lines
4) Read the line list from a file
Option 1 Keep all lines discrete, uses a default energy range. RadSrc prints the minimum and maximum
values of the default energy range and asks if it is acceptable. The following lines show an example in the interactive
mode.
Do you want to use the default energy range (90 , 3300)
for the gamma line sources and unscattered tally? y/n (y):
If the user choses n, he must then specify a minimum and maximum value, in keV.
7
Options 2 Bin all lines. A standard binning option list is presented with the same choices as described above
for the Bremsstrahlung binning option.
Option 3 Keep the default lines, which are defined in the provided file lib/dfltlins.dat. A standard
binning option list is presented with the same choices as described above for the Bremsstrahlung binning option.
Option 4 Read the line list from a file, reads line energies from a user-specified file. Note that the lists of line
energies must exactly match the line energies listed in the database, and changes in the database should be reflected
in the line energy lists. However, a mechanism is provided to specify approximate energy ranges. By default, line
energies must be specified to 0.1 keV.
If you elect to bin some or all of the lines, RadSrc restricts its output of unbinned lines to those that fall within
the same energy range as the binned lines. The unscattered photon tally is also restricted to this energy range. If
you do not bin any lines, you must specify a minimum and maximum energy. If you specified the optional range
keyword in the primary specification, that range is used.
Binning structure for binned gamma photons The secondary specifications are completed by selecting a bin-
ning structure for binned gamma photons (but only if you elected to bin photons) and for the scattered photon tally.
These selections are the same as the bremsstrahlung binning options described above.
> cd radsrc
> bin/radsrc
Enter sources on one or multiple lines.
(the total must be between 99.9% and 100%).
Terminate the input by specifying the desired age in years.
8
Age: 4.7304e+08 s, 15 yrs
Do you want to produce Monte Carlo input decks? y/n (y): y
1) Default Binning
2) Read from a file
3) Equal spaced bins
4) Proportional to Energy Width
5) TART 65 bins (NaI)
6) MORSE 35 bins (NaI)
7) GADRAS 1000 bins (HPGe)
Select (1-7): 1
1) Default Binning
2) Read from a file
3) Equal spaced bins
4) Proportional to Energy Width
5) TART 65 bins (NaI)
6) MORSE 35 bins (NaI)
7) GADRAS 1000 bins (HPGe)
Select (1-7): 1
1467 lines computed.
Total Gamma Line Intensity: 4185.8 ph/s/gm
Total Bremsstrahlung Intensity: 2552.08 ph/s/gm
1136 unbinned lines between 100.31 keV and 1998 keV
Intensity of Unbinned lines is 435.092
Intensity of Binned lines is 0
Intensity of Bremsstrahlung 2552.08
Total Intensity of all sources is 2987.17
9
output.mci = MCNP/MCNPX input format
output.cog = COG input format
output.def = Recording of user input
Output To see the contents of the four output files produced by this example look at the files:
test/test.du/reference/output.lin
test/test.du/reference/output.mci
test/test.du/reference/output.cog
test/test.du/reference/output.def
Contents of the input file The input file, test/test.du/reference/output.def, contains the follow-
ing.
U234 .00071
U235 .182
U236 .00284
U238 99.814
AGE 15.
y #....generate MC files
1 #....default brem binning
1 #....keep all gamma lines discrete
n #....don’t use the default energy range
100. #....minimum energy value
2000. #....maximum energy value
1 #....default tally binning
Output The contents of the four output files produced by this example are the same as for the previous (interac-
tive) example.
11
4 RadSrc Library
4.1 Introduction
The RadSrc library is written in C++ employing an object-oriented design. The library consists of four components:
Users who are solely interested in obtaining photon distributions for Monte Carlo simulations will be satisfied
by the simplified FORTRAN and C++ interfaces presented. Other users of the library may directly interface with
the library objects to access the isotope database or the full capabilities of decay product and photon calculation
routines. Details of the library API are presented in the appendix.
The required information about isotopes is provided by the CIsotopeDatabase class. This class contains phys-
ical information about isotopes such as mass and half-life; a listing of all decay modes, their branch fractions, and
daughter isotope; and a listing of all gamma rays and x rays produced by each decay. The class provides iterators
to list all decays and photons in an isotope record. Isotope databases are in turn managed by the CDatabaseM-
anager. The CDatabaseManager makes it possible to obtain isotope information from different data suppliers as
well as accommodate different storage mechanisms.
Decay product calculations are handled by the CDecayComputer class. The object is configured with an
initial atomic fractions of isotopes and the desired age. Also, an isotope database is selected. After performing
the decay product calculation, the object provides a listing of a decay products, their concentrations, the decays
producing the products, and the ultimate parent isotope(s) present in the initial mixture that yielded each decay
product. Users may create multiple CDecayComputer objects to address multiple sources in the same calculation.
Photon intensity calculations are handled by the CPhotonComputer class. This object is associated with a
CDecayComputer object when it is created. This object takes the aged isotope concentrations and computes the
discrete x ray and gamma ray emissions listed in the isotope database for each decay mode of each isotope present.
It also computes a binned bremsstrahlung distribution when applicable if the necessary data is present in the isotope
database. A CPhotonComputer object provides a list of all the photon lines, sorted by either energy or intensity,
as well as the decays that produced the photons and the ultimate parent isotope(s) in the initial mixture. This object
also permits sampling from the photon distribution using a user- supplied random number generator.
Users will obtain the greatest utility of the library by directly employing the aforementioned objects. However,
we anticipate that many users will simply want to obtain the aged mixture concentrations and sample photons from
decay sources in the mixtures. To that end, we provide a simplified interface to both FORTRAN/C and C++. The
simplified interface encapsulates the CPhotonComputer and CDecayComputer classes, handles initialization,
and interfaces with the user’s code subject to most of the limitations of FORTRAN 77. The ability to address
independent mixture calculations is retained in the FORTRAN environment by providing an opaque handle to the
user upon initialization. This handle is passed back to the library in every function call.
Initialization of the library requires special attention. Users attempting to integrate the RadSrc library an
application with controlled access to the source code may be limited in ways they can communicate information
to the library. Therefore we have provided four mechanisms for initializing the library:
• Hard-coded initialization in the user’s own code using RSADDISOTOPE() and RSMIX().
• Passing character data that has been incorporated into the application’s I/O and initialization routines on to
the library one line at a time using RSADDCONFIG() and RSSOURCECONFIG().
• Hard-coding the filename of a configuration file into the user’s own code using RSLOADCONFIG().
12
• Relying on environment variables to locate both the isotope data and the problem configuration.
With these four mechanisms available, libradsrc can accommodate any level of integration with the user’s applica-
tion.
#include "radsource.h"
#include "cpp_api.h"
and create some pointer variables that point to instances of the RadSrc class,
radsrc::CRadSource* pRadSource;
radsrc::CRadSource* t1RadSource;
radsrc::CRadSource* t2RadSource;
13
the RadSrc routines live in the namespace radsrc:: in order to prevent conflicts with geant4 classes.
To create a new instance of RadSrc one calls,
t1RadSource = radsrc::CApi::newSource();
The instance of RadSrc must then be initialized with a problem definition. A number of ways to do that are
provided. One way is to create a text file with the problem definition and pass the location of that file to the
LoadConfig member function.
If a NULL string is passed the program will look for the environment variable RADSRC_CONFIG to find the input
text file.
The text file must be in the form
U235 90.0
U238 10.0
AGE 20.0
where the fraction of each isotope is specified and should add up to 100%. The last line in the file should be an
AGE card with the age given in years.
Additionally, the problem specification can be passed as input lines to the code,
where the addConfig member function accepts text lines of input and the sourceConfig processes the input
and performs the RadSrc calculations and setup.
Once the problem is specified the gamma-ray distributions can be sampled with a call to:
The function returns an energy in keV. The function localran is a wrapper for the standard GEANT4 random
number generator G4UniformRandom.
The RadSrc problem can also be specified from the GEANT4 command line through the commands defined in
the ExN01PrimaryGeneratorMessenger class. They duplicate from the command line what is available in
the code.
/radsrc/file ’./problem.in’
/radsrc/file ’’
will look for the environment variable RADSRC_CONFIG to find the input text file. The complete problem speci-
fication can also be passed on the command line by using
The GEANT4 code is set up so that the ExN01PrimaryGeneratorAction class will try to find a RadSrc
input text file at instanciation. A constructor function is provided which passes a string which specifies the file
location. See exampleN01.cc for an example. That definition can be overridden from the command line. If no
problem definition is specified the program will terminate at the first event.
14
4.5 Calling RadSrc from FORTRAN
MCNP/MCNPX and COG provide dummy source subroutines called source.F90 (MCNP/MCNPX) and IsoP.F
(COG), which can be used to call the RadSrc routines. While RadSrc is native C++, a number of Fortran callable
subroutines are provided to allow Fortran code to use the package. All routines names begin with RS in order to
prevent accidental conflicts with the Monte Carlo code. Multiple instances of the RadSrc library can be created to
model multiple sources. Simply provide a different handle for each case. Inside the subroutine define the variables
and functions that the library will use.
INTEGER*8 HANDLE
LOGICAL SUCCESS, RSLOADCONFIG, FIRST, RSSOURCECONFIG
REAL*8 RSGTRPHOTON
As the RadSrc library is written in C++ one must also link in the stdc++ library. To allow the program to see the
class definitions add a path to the C++ headers by modifying
INCLUDE_DIRS = -I$(RADSRC_HOME)/src/libradsrc/
Ensure that the environment variable RADSRC_HOME points to your copy of the RadSrc installation. At this point
you can try to relink the MCNP executable to ensure that the libraries are being properly linked. In order for the
RadSrc library to be able to find its data files an environment variable must be set:
This is correct for the intel compiler. Other compilers may require different libraries. The environment variable
RADSRC_HOME should be set to point to your installation of RadSrc. As the RadSrc library is written in C++ one
must also link in the stdc++ library.
At this point you can try to link the COG user library to ensure that the libraries are being properly linked. In
order for the RadSrc library to be able to find its data files an environment variable must be set:
16
Options Unique to COG
The IsoP.F subroutine can also be configured to accept input from the COG input file. Using the code fragment:
IF(FIRST)THEN
FIRST=.FALSE.
CALL RSNEWSOURCE(HANDLE)
DO 99 I=1,NARGS
CALL RSADDCONFIG(HANDLE,ARGA(I))
99 ENDDO
SUCCESS = RSSOURCECONFIG(HANDLE)
IF (SUCCESS .NEQV. .TRUE.) THEN
PRINT *, ’Error setting up problem’
STOP
ENDIF
endif
the COG user source input will be passed to the RadSrc library. Setup up the source specification in the COG input
file with the following format:
source
usrsor IsoP
U235 90.0
U238 10.0
AGE 15.0
Due to the limitations of the COG input parser none of the individual words in the input can be longer than 8
characters.
17
5 Method for Computation of Decay Products
Radioisotopes can decay into other isotopes with lower average binding energy per nucleon [5]. Isotopes will
typically decay by one of several processes: alpha decay, which emits an α particle (helium nucleus) and reduces
both the atomic number and atomic mass by two; beta-minus decay, with emission of a β − particle (electron),
which increases the atomic number; or beta decay with (beta-plus) or without (electron capture) emission of a β +
particle (positron), either of which decreases the atomic number.
Radioactive decay is frequently accompanied by emission of photons. The parent isotope may decay to an
excited state, which enter the ground state by emitting one or more gamma rays. The atomic electrons may also
emit x rays as they re-adjust to the new nuclear potential. If a charged particle is emitted in the decay, it may also
emit photon radiation, called bremsstrahlung radiation [5], as it travels through condensed matter. A radioisotope
may decay by both alpha and beta modes. Also, a particular decay mode may decay to both the ground state and
one or more excited states of the daughter nucleus, with different gamma and bremsstrahlung emission. These are
termed decay branches. The probability of any particular decay branch occurring is the branch fraction. There are
further variations of these decays. For example, a decay to an excited state may result in emission of a neutron.
The rates of decay for all the decay branches sum to the overall decay rate. The half-life, ln 2 divided by the overall
decay rate, is the time when half of the atoms of a radioisotope have decayed.
A radioisotope may decay into one or more isotopes that are themselves radioactive. As these daughter isotopes
decay into other radioisotopes, a chain of decays is followed. This chain will branch at isotopes with multiple
significant decay, and often rejoin when two paths contain the same alpha and beta decays but in a different order.
The decay chain of 238 U is shown in Figure 1 as a typical example.
238U 234T h 234mP a 234 U 230T h 226R a 222R n 218 P o 210 206
Pb Pb
Figure 1: Decay paths for 238 U and its daughter isotopes, including at most a single alpha and a single beta decay.
There are 30 possible paths from 238 U to 206 Pb.
As time progresses, the numbers of atoms of the daughter isotopes rise and fall. Since the half-lives of isotopes
in the decay chain range over many orders of magnitude, certain isotopes will come to dominate the decay of other
isotopes, and the concentrations of these isotopes will be fixed to a nearly constant ratio. This is termed secular
equilibrium. One may infer the presence and concentration of an isotope that does not emit photons by detecting
and measuring the intensity of photons emitted by another isotope that is in secular equilibrium with the hidden
isotope. To do this, we must calculate the isotope ratio at the time of measurement.
Bateman derived the closed-form solution to the differential equations governing radioactive decay through the
use of Laplace transforms in 1910 [6, 7]. The form of the solution lends itself to calculation by recursion. Without
loss of generality, we can reduce the problem of multiple initial parent isotopes to independent problems with a
single parent isotope and sum the individual solutions. Each parent isotope is the root of a directed acyclic graph
with decay products as nodes. Further, we can consider each path in the directed graph independently of the other
paths and sum the solutions for each linear decay chain. These decompositions are made possible by the linearity
of the original system of differential equations.
18
Consider the following system of equations describing a particular decay path:
1 i=0
Ni (0) = (3)
0 i>0
In these expressions, Ni (t) is the time dependent concentration of isotope i, λi is the decay constant for that
isotope, and fi is the branch probability for the particular decay of isotope i given in this chain. It is readily verified
by substitution that this system has solutions of the form:∗
i
X
Ni (t) = Ai,j e−λj t (4)
j=0
with
A0,0 = 1
fi−1 λi−1
Ai,j = Ai−1,j ; 0≤j<i
λi − λj (5)
i−1
X
Ai,i = − Ai,j
j=0
This recursive formulation is particularly amenable to calculation with dynamic programming techniques. The
decay graph is traversed using the lists of decay modes provided by the isotope database. Each branch is followed in
turn by recursively calling the calculation routine with the branch fraction and daughter isotopes applicable to that
branch, and the constants Ai,j for the branching isotope. Upon reaching a stable isotope, the recursive functions
return to each branch point, then following the next branch until no branches remain. This avoids re-computing
the constants for all the isotopes preceding a branching decay.
The pairs of constants Ai,j and decay constants λj are stored in a mapping as they are computed. Terms
associated with the same λj are summed as all possible decay paths to a particular daughter isotope are encountered.
At the conclusion of the calculation, the mapping holds all contributing exponential terms to the time dependent
concentration of each isotope.
∗
This form implicitly assumes that all decay constants are distinct. Although this is true in general for nuclear decay sequences, libradsrc
will exit if presented with a contrived example containing identical decay constants.
19
References
[1] “MCNPX Version 2.5.0 User’s Manual,” LA-CP-05-0369, Los Alamos National Laboratory (2005). 3
[2] S. Agostinelli, et. al., “GEANT4 — a simulation toolkit,” Nucl. Inst. Meth. A 506, 250-303 (2003). 3
[3] R. Buck, et. al. “A Multiparticle Monte Carlo Transport Code, User’s Manual, Fifth Edition,” UCRL-TM-
202590, Lawrence Livermore National Laboratory (2002). 3
[4] T. Gosnell, “Automated calculation of photon source emission from arbitrary mixtures of naturally radioactive
heavy nuclides,” Nucl. Inst. Meth. A 299, 682-686 (1990). 3
[5] K. S. Krane, Introductory Nuclear Physics. John Wiley & Sons:New York (1988). 18
[6] H. Bateman, “Solution of a system of differential equations occuring in the theory of radioactive transforma-
tion,” Proc. Cambridge Phil. Soc. 15, 423-427 (1910). 18
[7] D. S. Pressyanov, “Short solution of the radioactive decay chain equations,” Am. J. Phys. 70(4), 444-445
(2002). 18
20
A Library API
This appendix describes the libradsrc API.∗ Libradsrc provides a simplified API for applications solely interested
in computing and sampling photon distributions. A full-featured C++ API is also provided for complete access to
the isotope database and decay product and photon calculations.
Note that all C++ functions are contained within the radsrc namespace.
• An unrecognized database type is requested, or a database parser is requested to parse a foreign database
type. (Currently, only the GAMGEN legacy database is supported).
• If you call an accessor method in an uninitialized CGammaEntry object or dereference an invalid CPho-
tonIterator.
A.2 Caveats
ASCII to floating-point conversion routines differ from machine to machine. As a result, photon energies are
known to be slightly different on different architectures, despite being constant values that are never computed.
Finite precision can cause the concentration of some daughter products to be negative at very short times
relative to their half-lives.
LOGICAL SUCCESS
INTEGER*8 HANDLE
CHARACTER*n FILENAME, CONFIGSTRING
INTEGER LENGTH, Z, A, M, N, NMAX
DOUBLE PRECISION CONCENTRATION, E, AGE, LINES[2][NMAX], FOURV[4], DRNG
REAL*4 FRNG
INTRINSIC/EXTRINSIC FRNG, DRNG
CALL RSNEWSOURCE(HANDLE)
CALL ADDISOTOPE(HANDLE,92,238,0,100D0)
SUCCESS = MIX(HANDLE,25D0)
21
CALL RSNEWSOURCE(HANDLE)
SUCCESS = RSLOADCONFIG(HANDLE,’config.txt’)
• Concatenate a series of character strings into a single string containing the configuration.
CALL RSNEWSOURCE(HANDLE)
DO
CALL RSADDCONFIG(HANDLE,CONFIGSTRING)
END DO
SUCCESS = RSSOURCECONFIG(HANDLE)
C++:
No explicit C API is provided. Instead, C programs should call the FORTRAN API functions (with trailing
underscores) using the prototypes provided.
CALL RSNEWSOURCE(HANDLE)
22
static int CApi::loadConfig (CRadSource ∗pRadSource, const std::string &filename)
int rsloadconfig (char ∗pHandle, char ∗ptr, int len)
SUCCESS = RSLOADCONFIG(HANDLE,FILENAME)
SUCCESS = RSLOADCONFIG(HANDLE,’filename.txt’)
SUCCESS = RSLOADCONFIG(HANDLE,’’) for default location
static void CApi::addIsotope (CRadSource ∗pRadSource, int z, int a, int m, double perc)
void rsaddisotope (char ∗pHandle, const int &z, const int &a, const int &m, const double &perc)
CALL RSADDISOTOPE(HANDLE,Z,A,M,CONCENTRATION)
N = RSNLINES(HANDLE)
static void CApi::getLines (CRadSource ∗pRadSource, double lines[ ][2], int nmax)
void rsgetlines (char ∗pHandle, double lines[ ][2], const int &nmax)
E = RSGETPHOTON(HANDLE, DRNG)
E = RSGTRPHOTON(HANDLE, FRNG)
23
A.3.7 Get a random 4-vector E,px,py,pz in natural units (keV).
Sample an isotropic four-vector from the photon distribution using the random number generator provided. Note
that the FORTRAN and C interfaces have different function names for single and double precision random number
functions.
static void CApi::get4V (const CRadSource ∗pRadSource, double e[4], double(∗prng)(void))
static void CApi::get4V (const CRadSource ∗pRadSource, double e[4], float(∗prng)(void))
void rsget4v (const char ∗pHandle, double e[4], double(∗prng)(void))
void rsgtr4v (const char ∗pHandle, double e[4], float(∗prng)(void))
CALL RSGET4V(HANDLE, FOURV, DRNG)
CALL RSGTR4V(HANDLE, FOURV, FRNG)
SUCCESS = RSSOURCECONFIG(HANDLE)
SUCCESS = RSMIX(HANDLE,AGE)
24
A.3.12 Sort the photon list.
Sorts the photon list by ascending energy or descending intensity. Parameter is 1 for energy and 2 for intensity.
CIsotope ()
CIsotope (int z, int a, int mm=0)
25
A.5 Class CDatabaseManager
This class creates isotope databases from database-specific routines and classes. CIsotopeDatabase and CDatabase-
Manager provide a uniform interface for accessing isotope information regardless of the source, storage, or for-
matting of the underlying data. The CDatabaseManager class is a singleton.
A.5.1 Enumerations
A.5.2 Typedef
A.6.1 Typedefs
26
A.6.5 Iterators for accessing isotope data.
These methods return iterators to access isotope data for each isotope in the database.
A.7.1 Typedef
27
A.7.8 Get the standard average atomic mass for the isotope.
Units are in grams.
A.8.1 Enumerations
enum DecayType { UNSPECIFIED, ALPHA, BETA GENERIC, BETA MINUS, BETA PLUS, ELEC-
TRON CAPTURE, INTERNAL TRANSITION, ALPHANEUTRON, BETANEUTRON }
A.8.2 Typedefs
28
A.8.7 Obtain iterators for the discrete photons produced by this decay.
29
A.10.2 Append a radioisotope to the input mixture list.
The parameters are a fully constructed CIsotope class and the quantity of that isotope in unspecified units. The
units will later be defined with a call to normalizeInputUnits.
void clear ()
30
A.10.10 Get the current isotope database.
Get the current isotope database being used by this CDecayComputer object.
Get a list (as an STL set) of radioisotopes in the initial mixture that eventually decayed into this isotope.
const std::set< CIsotope > & getChainParents (void) const
31
A.13.1 Enumerations
A.13.2 Typedefs
32
A.13.7 Select a subset of the discrete lines and bin the rest.
These methods subset the list of photons according to a list of desired energies. Photons that are not in the list of
desired energies are combined into a distribution of binned intensities. Energies may be provided as either an STL
vector of doubles, or an array of doubles.
Care must be taken to ensure that the energies in the list and the energies in the isotope database are identical
in the machine’s native representation.
33
A.15.1 Typedefs
A.15.2 Get the isotope in the initial mixture that produces this line.
This method returns a list (as an STL set) of all the isotopes in the initial mixture that decayed into an isotope that
subsequently emitted this line.
A.15.5 Get a formatted list decays and ultimate parent isotopes of a line.
This method returns an STL string containing a list of isotopes in the initial mixture that eventually produce this
discrete line. These isotopes are printed in square brackets []. It then lists the specific decays, parent to daughter,
separated by arrows, ->.
34
A.16.1 Members
HighPrecisionType m sum
35