diff --git a/examples/basic/materials.xml b/examples/basic/materials.xml
index 42cc3059f0..450c988f19 100644
--- a/examples/basic/materials.xml
+++ b/examples/basic/materials.xml
@@ -11,7 +11,7 @@
-
+
diff --git a/src/cross_section.f90 b/src/cross_section.f90
index 0f102db276..c3cfa75a58 100644
--- a/src/cross_section.f90
+++ b/src/cross_section.f90
@@ -37,7 +37,6 @@ contains
integer :: i ! index in materials array
integer :: j ! index over nuclides in material
integer :: index ! index in xsdatas array
- integer :: n ! length of key
integer :: index_nuclides ! index in nuclides
integer :: index_sab ! index in sab_tables
character(10) :: key ! name of isotope, e.g. 92235.03c
@@ -51,34 +50,38 @@ contains
index_nuclides = 0
index_sab = 0
do i = 1, n_materials
+ ! Get pointer to material
mat => materials(i)
+
+ ! First go through all the nuclide and check if they exist on other
+ ! materials -- if not, then increment the count for the number of
+ ! nuclides and add to dictionary
do j = 1, mat % n_nuclides
- index = mat % xsdata(j)
- key = xsdatas(index) % id
- n = len_trim(key)
+ key = mat % names(j)
call lower_case(key)
- select case (key(n:n))
- case ('c')
- if (.not. dict_has_key(nuclide_dict, key)) then
- index_nuclides = index_nuclides + 1
- call dict_add_key(nuclide_dict, key, index_nuclides)
- mat % nuclide(j) = index_nuclides
- else
- mat % nuclide(j) = dict_get_key(nuclide_dict, key)
- end if
- case ('t')
- if (.not. dict_has_key(sab_dict, key)) then
- index_sab = index_sab + 1
- call dict_add_key(sab_dict, key, index_sab)
- mat % sab_table = index_sab
- else
- mat % sab_table = 0
- end if
- case default
- msg = "Unknown cross section table type: " // key
- call fatal_error(msg)
- end select
+ if (.not. dict_has_key(nuclide_dict, key)) then
+ index_nuclides = index_nuclides + 1
+ call dict_add_key(nuclide_dict, key, index_nuclides)
+ mat % nuclide(j) = index_nuclides
+ else
+ mat % nuclide(j) = dict_get_key(nuclide_dict, key)
+ end if
end do
+
+ ! Check if S(a,b) exists on other materials
+ if (mat % has_sab_table) then
+ key = mat % sab_name
+ call lower_case(key)
+ if (.not. dict_has_key(sab_dict, key)) then
+ index_sab = index_sab + 1
+ call dict_add_key(sab_dict, key, index_sab)
+ mat % sab_table = index_sab
+ else
+ mat % sab_table = dict_get_key(sab_dict, key)
+ end if
+ else
+ mat % sab_table = 0
+ end if
end do
n_nuclides_total = index_nuclides
@@ -101,25 +104,39 @@ contains
do i = 1, n_materials
mat => materials(i)
do j = 1, mat % n_nuclides
+ ! Get index in xsdatas array for this nuclide
index = mat % xsdata(j)
- key = xsdatas(index) % id
- n = len_trim(key)
+
+ ! Get name of nuclide
+ key = mat % names(j)
call lower_case(key)
- select case (key(n:n))
- case ('c')
- if (.not. dict_has_key(temp_dict, key)) then
- index_nuclides = index_nuclides + 1
- call read_ACE_continuous(index_nuclides, index)
- call dict_add_key(temp_dict, key, index_nuclides)
- end if
- case ('t')
- if (.not. dict_has_key(temp_dict, key)) then
- index_sab = index_sab + 1
- call read_ACE_thermal(index_sab, index)
- call dict_add_key(temp_dict, key, index_sab)
- end if
- end select
+
+ if (.not. dict_has_key(temp_dict, key)) then
+ index_nuclides = index_nuclides + 1
+ call read_ACE_continuous(index_nuclides, index)
+ call dict_add_key(temp_dict, key, index_nuclides)
+ end if
end do
+
+ ! Read S(a,b) table if this material has one and it hasn't been read
+ ! already
+ if (mat % has_sab_table) then
+ ! Find index in xsdatas
+ key = mat % sab_name
+ if (dict_has_key(xsdata_dict, key)) then
+ index = dict_get_key(xsdata_dict, key)
+ else
+ msg = "Cannot find cross-section " // trim(key) // " in specified &
+ &xsdata file."
+ call fatal_error(msg)
+ end if
+
+ if (.not. dict_has_key(temp_dict, key)) then
+ index_sab = index_sab + 1
+ call read_ACE_thermal(index_sab, index)
+ call dict_add_key(temp_dict, key, index_sab)
+ end if
+ end if
end do
! delete dictionary
diff --git a/src/initialize.f90 b/src/initialize.f90
index 7aded4d4a1..82e0440cd4 100644
--- a/src/initialize.f90
+++ b/src/initialize.f90
@@ -17,7 +17,7 @@ module initialize
use output, only: title, echo_input, message, print_summary, &
print_particle, header, print_plot
use source, only: initialize_source
- use string, only: int_to_str, starts_with, ends_with
+ use string, only: int_to_str, starts_with, ends_with, lower_case
use tally, only: create_tally_map, TallyObject
use timing, only: timer_start, timer_stop
@@ -527,6 +527,7 @@ contains
integer :: index ! index used for several purposes
integer :: i ! index in materials array
integer :: j ! index over nuclides in material
+ integer :: n ! length of string
real(8) :: sum_percent !
real(8) :: awr ! atomic weight ratio
real(8) :: x ! atom percent
@@ -556,13 +557,23 @@ contains
do j = 1, mat % n_nuclides
! Set indices for nuclides
key = mat % names(j)
- index = dict_get_key(xsdata_dict, key)
- if (index == DICT_NULL) then
+
+ ! Check to make sure cross-section is continuous energy neutron table
+ n = len_trim(key)
+ if (key(n:n) /= 'c') then
+ msg = "Cross-section table " // trim(key) // " is not a " // &
+ "continuous-energy neutron table."
+ call fatal_error(msg)
+ end if
+
+ if (dict_has_key(xsdata_dict, key)) then
+ index = dict_get_key(xsdata_dict, key)
+ mat % xsdata(j) = index
+ else
msg = "Cannot find cross-section " // trim(key) // " in specified &
&xsdata file."
call fatal_error(msg)
end if
- mat % xsdata(j) = index
! determine atomic weight ratio
awr = xsdatas(index) % awr
diff --git a/src/input_xml.f90 b/src/input_xml.f90
index 95d42259ea..de2b252e18 100644
--- a/src/input_xml.f90
+++ b/src/input_xml.f90
@@ -487,6 +487,7 @@ contains
elseif (nuc % ao /= ZERO .and. nuc % wo /= ZERO) then
msg = "Cannot specify both atom and weight percents for a nuclide: " &
// trim(name)
+ call fatal_error(msg)
end if
! Copy atom/weight percents