Skip to content

Commit 59f4070

Browse files
authored
Merge pull request #16 from openmc-data-storage/adding_sab
adding_sab_options
2 parents a600284 + 4aa6416 commit 59f4070

File tree

9 files changed

+586
-88
lines changed

9 files changed

+586
-88
lines changed

README.md

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,11 @@ openmc_data_downloader -l ENDFB-7.1-NNDC -e Li -p photon
117117
openmc_data_downloader -l ENDFB-7.1-NNDC -e Li -p neutron photon
118118
```
119119

120+
### Downloading the neutron cross section for elements and an SaB cross sections
121+
```bash
122+
openmc_data_downloader -l ENDFB-7.1-NNDC -e Be O -s c_Be_in_BeO
123+
```
124+
120125

121126
## Usage - within a Python enviroment
122127

@@ -183,6 +188,23 @@ odd.just_in_time_library_generator(
183188
)
184189
```
185190

191+
### Downloading neutron cross sections for a material with an SaB
192+
```python
193+
import openmc
194+
import openmc_data_downloader as odd
195+
196+
my_mat = openmc.Material()
197+
my_mat.add_element('Be', 0.5)
198+
my_mat.add_element('O', 0.5)
199+
my_mat.add_s_alpha_beta('Be_in_BeO')
200+
201+
odd.just_in_time_library_generator(
202+
libraries='ENDFB-7.1-NNDC',
203+
materials= my_mat
204+
particles = ['neutrons'],
205+
)
206+
```
207+
186208
### Downloading photon and neutron cross sections for isotopes and elements from the TENDL 2019 library
187209
```python
188210
import openmc

openmc_data_downloader/__init__.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,17 @@
22
from .cross_sections_directory import (NATURAL_ABUNDANCE,
33
LIB_OPTIONS,
44
PARTICLE_OPTIONS,
5-
xs_info)
5+
SAB_OPTIONS,
6+
ISOTOPE_OPTIONS,
7+
xs_info,
8+
sab_info)
69

710
from .utils import (create_cross_sections_xml, just_in_time_library_generator,
811
download_data_frame_of_isotopes, download_single_file,
912
expand_elements_to_isotopes,
1013
expand_materials_xml_to_isotopes,
14+
expand_materials_xml_to_sab,
1115
identify_isotopes_to_download,
12-
expand_materials_to_isotopes)
16+
expand_materials_to_isotopes,
17+
expand_materials_to_sabs,
18+
identify_sab_to_download)

openmc_data_downloader/cross_sections_directory.py

Lines changed: 120 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11

22
import re
33

4+
from numpy import nested_iters
5+
46
# from https://github.com/openmc-dev/openmc/blob/develop/openmc/data/data.py
57
# remove when pip install openmc via PyPi is available
68
NATURAL_ABUNDANCE = {
@@ -135,37 +137,29 @@
135137
'Gd152', 'Gd153', 'Gd154', 'Gd155', 'Gd156', 'Gd157', 'Gd158', 'Gd159',
136138
'Gd160', 'Gd161', 'Ge70', 'Ge71', 'Ge72', 'Ge73', 'Ge74', 'Ge75', 'Ge76',
137139
'H1', 'H2', 'H3', 'He3', 'He4', 'Hf174', 'Hf175', 'Hf176', 'Hf177',
138-
'Hf178', 'Hf179', 'Hf180', 'Hf181', 'Hf182', 'Hg196', 'Hg197',
139-
'Hg197_m1', 'Hg198', 'Hg199', 'Hg200', 'Hg201', 'Hg202',
140-
'Hg203', 'Hg204', 'Ho163', 'Ho165', 'Ho166_m1', 'I126',
141-
'I127', 'I128', 'I129', 'I130', 'I131', 'I132',
142-
'I132_m1', 'I133', 'I134', 'I135', 'In113', 'In114',
143-
'In115', 'Ir190', 'Ir191', 'Ir192', 'Ir193', 'Ir194_m1',
144-
'K39', 'K40', 'K41', 'Kr78', 'Kr79', 'Kr80', 'Kr81',
145-
'Kr82', 'Kr83', 'Kr84', 'Kr85', 'Kr86', 'La137',
146-
'La138', 'La139', 'La140', 'Li6', 'Li7', 'Lu173',
147-
'Lu174', 'Lu175', 'Lu176', 'Lu177', 'Mg24', 'Mg25',
148-
'Mg26', 'Mg27', 'Mn52', 'Mn53', 'Mn54', 'Mn55',
149-
'Mo100', 'Mo92', 'Mo93', 'Mo94', 'Mo95', 'Mo96',
150-
'Mo97', 'Mo98', 'Mo99', 'N14', 'N15', 'Na22', 'Na23',
151-
'Nb91', 'Nb92', 'Nb93', 'Nb94', 'Nb94_m1', 'Nb95',
152-
'Nd142', 'Nd143', 'Nd144', 'Nd145', 'Nd146', 'Nd147',
153-
'Nd148', 'Nd149', 'Nd150', 'Ne20', 'Ne21', 'Ne22',
154-
'Ni56', 'Ni57', 'Ni58', 'Ni59', 'Ni60', 'Ni61',
155-
'Ni62', 'Ni63', 'Ni64', 'Ni66', 'Np234', 'Np235',
156-
'Np236', 'Np236_m1', 'Np237', 'Np238', 'Np239', 'O16',
157-
'O17', 'O18', 'Os184', 'Os185', 'Os186', 'Os187',
158-
'Os188', 'Os189', 'Os190', 'Os191', 'Os192', 'Os193',
159-
'P31', 'P32', 'P33', 'Pa229', 'Pa230', 'Pa231',
160-
'Pa232', 'Pa233', 'Pb204', 'Pb205', 'Pb206', 'Pb207',
161-
'Pb208', 'Pd102', 'Pd103', 'Pd104', 'Pd105', 'Pd106',
162-
'Pd107', 'Pd108', 'Pd109', 'Pd110', 'Pm143', 'Pm144',
163-
'Pm145', 'Pm146', 'Pm147', 'Pm148', 'Pm148_m1', 'Pm149',
164-
'Pm150', 'Pm151', 'Po208', 'Po209', 'Po210', 'Pr141',
165-
'Pr142', 'Pr143', 'Pt190', 'Pt191', 'Pt192', 'Pt193',
166-
'Pt194', 'Pt195', 'Pt196', 'Pt197', 'Pt198', 'Pu236',
167-
'Pu237', 'Pu238', 'Pu239', 'Pu240', 'Pu241', 'Pu242',
168-
'Pu243', 'Pu244', 'Pu245', 'Pu246', 'Ra223', 'Ra224',
140+
'Hf178', 'Hf179', 'Hf180', 'Hf181', 'Hf182', 'Hg196', 'Hg197', 'Hg197_m1',
141+
'Hg198', 'Hg199', 'Hg200', 'Hg201', 'Hg202', 'Hg203', 'Hg204', 'Ho163',
142+
'Ho165', 'Ho166_m1', 'I126', 'I127', 'I128', 'I129', 'I130', 'I131',
143+
'I132', 'I132_m1', 'I133', 'I134', 'I135', 'In113', 'In114', 'In115',
144+
'Ir190', 'Ir191', 'Ir192', 'Ir193', 'Ir194_m1', 'K39', 'K40', 'K41', 'Kr78',
145+
'Kr79', 'Kr80', 'Kr81', 'Kr82', 'Kr83', 'Kr84', 'Kr85', 'Kr86', 'La137',
146+
'La138', 'La139', 'La140', 'Li6', 'Li7', 'Lu173', 'Lu174', 'Lu175', 'Lu176',
147+
'Lu177', 'Mg24', 'Mg25', 'Mg26', 'Mg27', 'Mn52', 'Mn53', 'Mn54', 'Mn55',
148+
'Mo100', 'Mo92', 'Mo93', 'Mo94', 'Mo95', 'Mo96', 'Mo97', 'Mo98', 'Mo99',
149+
'N14', 'N15', 'Na22', 'Na23', 'Nb91', 'Nb92', 'Nb93', 'Nb94', 'Nb94_m1',
150+
'Nb95', 'Nd142', 'Nd143', 'Nd144', 'Nd145', 'Nd146', 'Nd147', 'Nd148',
151+
'Nd149', 'Nd150', 'Ne20', 'Ne21', 'Ne22', 'Ni56', 'Ni57', 'Ni58', 'Ni59',
152+
'Ni60', 'Ni61', 'Ni62', 'Ni63', 'Ni64', 'Ni66', 'Np234', 'Np235', 'Np236',
153+
'Np236_m1', 'Np237', 'Np238', 'Np239', 'O16', 'O17', 'O18', 'Os184',
154+
'Os185', 'Os186', 'Os187', 'Os188', 'Os189', 'Os190', 'Os191', 'Os192',
155+
'Os193', 'P31', 'P32', 'P33', 'Pa229', 'Pa230', 'Pa231', 'Pa232', 'Pa233',
156+
'Pb204', 'Pb205', 'Pb206', 'Pb207', 'Pb208', 'Pd102', 'Pd103', 'Pd104',
157+
'Pd105', 'Pd106', 'Pd107', 'Pd108', 'Pd109', 'Pd110', 'Pm143', 'Pm144',
158+
'Pm145', 'Pm146', 'Pm147', 'Pm148', 'Pm148_m1', 'Pm149', 'Pm150', 'Pm151',
159+
'Po208', 'Po209', 'Po210', 'Pr141', 'Pr142', 'Pr143', 'Pt190', 'Pt191',
160+
'Pt192', 'Pt193', 'Pt194', 'Pt195', 'Pt196', 'Pt197', 'Pt198', 'Pu236',
161+
'Pu237', 'Pu238', 'Pu239', 'Pu240', 'Pu241', 'Pu242', 'Pu243', 'Pu244',
162+
'Pu245', 'Pu246', 'Ra223', 'Ra224',
169163
'Ra225', 'Ra226', 'Rb85', 'Rb86', 'Rb87', 'Rb88',
170164
'Re185', 'Re186', 'Re186_m1', 'Re187', 'Re188', 'Rh101',
171165
'Rh102', 'Rh103', 'Rh104', 'Rh105', 'Rh99', 'Ru100',
@@ -227,11 +221,10 @@
227221
'Ba132', 'Ba133', 'Ba134', 'Ba135', 'Ba136', 'Ba137', 'Ba138', 'Ba140',
228222
'Be7', 'Be9', 'Bi209', 'Bk245', 'Bk246', 'Bk247', 'Bk248', 'Bk249',
229223
'Bk250', 'Br79', 'Br81', 'C0', 'Ca40', 'Ca42', 'Ca43', 'Ca44', 'Ca46',
230-
'Ca48', 'Cd106', 'Cd108', 'Cd110', 'Cd111',
231-
'Cd112', 'Cd113', 'Cd114', 'Cd115_m1', 'Cd116', 'Ce136', 'Ce138', 'Ce139',
232-
'Ce140', 'Ce141', 'Ce142', 'Ce143', 'Ce144', 'Cf246', 'Cf248', 'Cf249',
233-
'Cf250', 'Cf251', 'Cf252', 'Cf253', 'Cf254', 'Cl35', 'Cl37', 'Cm240',
234-
'Cm241', 'Cm242', 'Cm243', 'Cm244', 'Cm245', 'Cm246', 'Cm247', 'Cm248',
224+
'Ca48', 'Cd106', 'Cd108', 'Cd110', 'Cd111', 'Cd112', 'Cd113', 'Cd114',
225+
'Cd115_m1', 'Cd116', 'Ce136', 'Ce138', 'Ce139', 'Ce140', 'Ce141', 'Ce142',
226+
'Ce143', 'Ce144', 'Cf246', 'Cf248', 'Cf249', 'Cf250', 'Cf251', 'Cf252',
227+
'Cf253', 'Cf254', 'Cl35', 'Cl37', 'Cm240', 'Cm241', 'Cm242', 'Cm243', 'Cm244', 'Cm245', 'Cm246', 'Cm247', 'Cm248',
235228
'Cm249', 'Cm250', 'Co58', 'Co58_m1', 'Co59', 'Cr50', 'Cr52', 'Cr53',
236229
'Cr54', 'Cs133', 'Cs134', 'Cs135', 'Cs136', 'Cs137', 'Cu63', 'Cu65',
237230
'Dy156', 'Dy158', 'Dy160', 'Dy161', 'Dy162', 'Dy163', 'Dy164', 'Er162',
@@ -316,34 +309,49 @@
316309
endfb_71_nndc_xs_info.append(entry)
317310

318311

312+
endfb_71_nndc_thermal = [
313+
'c_Al27', 'c_Be', 'c_Be_in_BeO', 'c_C6H6', 'c_D_in_D2O', 'c_Fe56',
314+
'c_Graphite', 'c_H_in_CH2', 'c_H_in_CH4_liquid', 'c_H_in_CH4_solid',
315+
'c_H_in_H2O', 'c_H_in_ZrH', 'c_O_in_BeO', 'c_O_in_UO2', 'c_U_in_UO2',
316+
'c_Zr_in_ZrH', 'c_ortho_D', 'c_ortho_H', 'c_para_D', 'c_para_H',
317+
]
318+
319+
320+
endfb_71_nndc_sab_info = []
321+
for name in endfb_71_nndc_thermal:
322+
entry = {}
323+
# perhaps there is a better way of doing this
324+
entry['name'] = name
325+
entry['particle'] = 'thermal'
326+
entry['library'] = 'ENDFB-7.1-NNDC'
327+
entry['remote_file'] = name + '.h5'
328+
entry['url'] = endfb_71_nndc_base_url + \
329+
'neutron/' + entry['remote_file']
330+
entry['local_file'] = entry['library'] + '_' + entry['remote_file']
331+
endfb_71_nndc_sab_info.append(entry)
332+
319333
fendl_31d_neutron_isotopes = [
320334
'Ag107', 'Ag109', 'Al27', 'Ar36', 'Ar38', 'Ar40', 'Au197', 'B10', 'B11',
321335
'Ba130', 'Ba132', 'Ba134', 'Ba135', 'Ba136', 'Ba137', 'Ba138', 'Be9',
322336
'Bi209', 'Br79', 'Br81', 'C12', 'C13', 'Ca40', 'Ca42', 'Ca43', 'Ca44',
323337
'Ca46', 'Ca48', 'Cd106', 'Cd108', 'Cd110', 'Cd111', 'Cd112', 'Cd113',
324338
'Cd114', 'Cd116', 'Ce136', 'Ce138', 'Ce140', 'Ce142', 'Cl35', 'Cl37',
325-
'Co59', 'Cr50', 'Cr52', 'Cr53', 'Cr54', 'Cs133', 'Cu63',
326-
'Cu65', 'Er162', 'Er164', 'Er166', 'Er167', 'Er168',
327-
'Er170', 'F19', 'Fe54', 'Fe56', 'Fe57', 'Fe58',
328-
'Ga69', 'Ga71', 'Gd152', 'Gd154', 'Gd155', 'Gd156',
329-
'Gd157', 'Gd158', 'Gd160', 'Ge70', 'Ge72', 'Ge73',
330-
'Ge74', 'Ge76', 'H1', 'H2', 'H3', 'He3', 'He4',
331-
'Hf174', 'Hf176', 'Hf177', 'Hf178', 'Hf179', 'Hf180',
332-
'I127', 'K39', 'K40', 'K41', 'La138', 'La139', 'Li6',
333-
'Li7', 'Lu175', 'Lu176', 'Mg24', 'Mg25', 'Mg26',
334-
'Mn55', 'Mo100', 'Mo92', 'Mo94', 'Mo95', 'Mo96',
335-
'Mo97', 'Mo98', 'N14', 'N15', 'Na23', 'Nb93', 'Ni58',
336-
'Ni60', 'Ni61', 'Ni62', 'Ni64', 'O16', 'O17', 'O18',
337-
'P31', 'Pb204', 'Pb206', 'Pb207', 'Pb208', 'Pt190',
338-
'Pt192', 'Pt194', 'Pt195', 'Pt196', 'Pt198', 'Re185',
339-
'Re187', 'Rh103', 'S32', 'S33', 'S34', 'S36', 'Sb121',
340-
'Sb123', 'Sc45', 'Si28', 'Si29', 'Si30', 'Sn112',
341-
'Sn114', 'Sn115', 'Sn116', 'Sn117', 'Sn118', 'Sn119',
342-
'Sn120', 'Sn122', 'Sn124', 'Ta181', 'Th232', 'Ti46',
343-
'Ti47', 'Ti48', 'Ti49', 'Ti50', 'U235', 'U238', 'V50',
344-
'V51', 'W180', 'W182', 'W183', 'W184', 'W186', 'Y89',
345-
'Zn64', 'Zn66', 'Zn67', 'Zn68', 'Zn70', 'Zr90',
346-
'Zr91', 'Zr92', 'Zr94', 'Zr96',
339+
'Co59', 'Cr50', 'Cr52', 'Cr53', 'Cr54', 'Cs133', 'Cu63', 'Cu65', 'Er162',
340+
'Er164', 'Er166', 'Er167', 'Er168', 'Er170', 'F19', 'Fe54', 'Fe56', 'Fe57',
341+
'Fe58', 'Ga69', 'Ga71', 'Gd152', 'Gd154', 'Gd155', 'Gd156', 'Gd157',
342+
'Gd158', 'Gd160', 'Ge70', 'Ge72', 'Ge73', 'Ge74', 'Ge76', 'H1', 'H2',
343+
'H3', 'He3', 'He4', 'Hf174', 'Hf176', 'Hf177', 'Hf178', 'Hf179', 'Hf180',
344+
'I127', 'K39', 'K40', 'K41', 'La138', 'La139', 'Li6', 'Li7', 'Lu175',
345+
'Lu176', 'Mg24', 'Mg25', 'Mg26', 'Mn55', 'Mo100', 'Mo92', 'Mo94', 'Mo95',
346+
'Mo96', 'Mo97', 'Mo98', 'N14', 'N15', 'Na23', 'Nb93', 'Ni58', 'Ni60',
347+
'Ni61', 'Ni62', 'Ni64', 'O16', 'O17', 'O18', 'P31', 'Pb204', 'Pb206',
348+
'Pb207', 'Pb208', 'Pt190', 'Pt192', 'Pt194', 'Pt195', 'Pt196', 'Pt198',
349+
'Re185', 'Re187', 'Rh103', 'S32', 'S33', 'S34', 'S36', 'Sb121', 'Sb123',
350+
'Sc45', 'Si28', 'Si29', 'Si30', 'Sn112', 'Sn114', 'Sn115', 'Sn116',
351+
'Sn117', 'Sn118', 'Sn119', 'Sn120', 'Sn122', 'Sn124', 'Ta181', 'Th232',
352+
'Ti46', 'Ti47', 'Ti48', 'Ti49', 'Ti50', 'U235', 'U238', 'V50', 'V51',
353+
'W180', 'W182', 'W183', 'W184', 'W186', 'Y89', 'Zn64', 'Zn66', 'Zn67',
354+
'Zn68', 'Zn70', 'Zr90', 'Zr91', 'Zr92', 'Zr94', 'Zr96',
347355
]
348356

349357
fendl_31d_base_url = 'https://github.com/openmc-data-storage/FENDL-3.1d/raw/main/h5_files/'
@@ -361,15 +369,15 @@
361369
fendl_31d_xs_info.append(entry)
362370
# could add size of file in mb as well
363371

364-
fendl_31d_photon_isotopes = [
372+
fendl_31d_photon_elements = [
365373
'Ag', 'Al', 'Ar', 'Au', 'B', 'Ba', 'Be', 'Bi', 'Br', 'C', 'Ca', 'Cd', 'Ce',
366374
'Cl', 'Co', 'Cr', 'Cs', 'Cu', 'Er', 'F', 'Fe', 'Ga', 'Gd', 'Ge', 'H', 'He',
367375
'Hf', 'I', 'K', 'La', 'Li', 'Lu', 'Mg', 'Mn', 'Mo', 'N', 'Na', 'Nb', 'Ni',
368376
'O', 'P', 'Pb', 'Pt', 'Re', 'Rh', 'S', 'Sb', 'Sc', 'Si', 'Sn', 'Ta', 'Th',
369377
'Ti', 'U', 'V', 'W', 'Y', 'Zn', 'Zr'
370378
]
371379

372-
for element in fendl_31d_photon_isotopes:
380+
for element in fendl_31d_photon_elements:
373381
for isotope in NATURAL_ABUNDANCE[element]:
374382
entry = {}
375383
# perhaps there is a better way of doing this
@@ -500,9 +508,61 @@ def zaid_to_isotope(zaid: str) -> str:
500508
xs_info = endfb_71_nndc_xs_info + tendl_2019_xs_info + \
501509
fendl_31d_xs_info + endfb_71_wmp_xs_info
502510

511+
sab_info = endfb_71_nndc_sab_info # + JEFF 3.2 also contains sab
512+
503513
all_libs = []
504514
for entry in xs_info:
505515
all_libs.append(entry['library'])
506516

507517
LIB_OPTIONS = list(set(all_libs))
508518
PARTICLE_OPTIONS = ['neutron', 'photon']
519+
SAB_OPTIONS = [
520+
'c_Al27',
521+
'c_Al_in_Sapphire',
522+
'c_Be',
523+
'c_BeO',
524+
'c_Be_in_BeO',
525+
'c_Be_in_Be2C',
526+
'c_C6H6',
527+
'c_C_in_SiC',
528+
'c_Ca_in_CaH2',
529+
'c_D_in_D2O',
530+
'c_D_in_D2O_ice',
531+
'c_Fe56',
532+
'c_Graphite',
533+
'c_Graphite_10p',
534+
'c_Graphite_30p',
535+
'c_H_in_CaH2',
536+
'c_H_in_CH2',
537+
'c_H_in_CH4_liquid',
538+
'c_H_in_CH4_solid',
539+
'c_H_in_CH4_solid_phase_II',
540+
'c_H_in_H2O',
541+
'c_H_in_H2O_solid',
542+
'c_H_in_C5O2H8',
543+
'c_H_in_Mesitylene',
544+
'c_H_in_Toluene',
545+
'c_H_in_YH2',
546+
'c_H_in_ZrH',
547+
'c_Mg24',
548+
'c_O_in_Sapphire',
549+
'c_O_in_BeO',
550+
'c_O_in_D2O',
551+
'c_O_in_H2O_ice',
552+
'c_O_in_UO2',
553+
'c_N_in_UN',
554+
'c_ortho_D',
555+
'c_ortho_H',
556+
'c_Si28',
557+
'c_Si_in_SiC',
558+
'c_SiO2_alpha',
559+
'c_SiO2_beta',
560+
'c_para_D',
561+
'c_para_H',
562+
'c_U_in_UN',
563+
'c_U_in_UO2',
564+
'c_Y_in_YH2',
565+
'c_Zr_in_ZrH',
566+
]
567+
nested_list = list(NATURAL_ABUNDANCE.values())
568+
ISOTOPE_OPTIONS = [item for sublist in nested_list for item in sublist]

openmc_data_downloader/openmc_data_downloader

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,8 @@ generation of custom cross_section.xml files
1010

1111
import argparse
1212
from pathlib import Path
13-
from typing import List
1413

15-
from openmc_data_downloader import just_in_time_library_generator, LIB_OPTIONS
14+
from openmc_data_downloader import just_in_time_library_generator, LIB_OPTIONS, SAB_OPTIONS
1615

1716

1817
if __name__ == '__main__':
@@ -32,12 +31,20 @@ if __name__ == '__main__':
3231
'-i', '--isotopes',
3332
nargs='*',
3433
default=[],
35-
help="The isotopes to download"
34+
help="The isotope or isotopes to download"
3635
)
36+
parser.add_argument(
37+
'-s',
38+
'--sab',
39+
nargs='*',
40+
default=[],
41+
help="The SaB cross sections to download. Options include " +
42+
" ".join(SAB_OPTIONS))
43+
3744
parser.add_argument(
3845
'-e', '--elements', nargs='*',
3946
default=[],
40-
help="The elements to download"
47+
help="The element or elements to download"
4148
)
4249
parser.add_argument(
4350
'-p', '--particles', nargs='*',
@@ -63,6 +70,7 @@ if __name__ == '__main__':
6370
just_in_time_library_generator(
6471
libraries=args.libraries,
6572
isotopes=args.isotopes,
73+
sab=args.sab,
6674
elements=args.elements,
6775
destination=args.destination,
6876
materials_xml=args.materials_xml,

0 commit comments

Comments
 (0)