Skip to content

Commit 6050c78

Browse files
shimwellpaulromano
andauthored
making use of endf.get_evaluations (#3819)
Co-authored-by: Paul Romano <[email protected]>
1 parent 3ba8a9f commit 6050c78

File tree

2 files changed

+2
-30
lines changed

2 files changed

+2
-30
lines changed

openmc/data/endf.py

Lines changed: 1 addition & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212

1313
from .data import gnds_name
1414
from .function import Tabulated1D
15-
from endf.material import _LIBRARY, _SUBLIBRARY
15+
from endf.material import _LIBRARY, _SUBLIBRARY, get_materials as get_evaluations
1616
from endf.incident_neutron import SUM_RULES
1717
from endf.records import (
1818
float_endf,
@@ -39,32 +39,6 @@ def get_tab1_record(file_obj):
3939
return params, Tabulated1D(tab.x, tab.y, tab.breakpoints, tab.interpolation)
4040

4141

42-
def get_evaluations(filename):
43-
"""Return a list of all evaluations within an ENDF file.
44-
45-
Parameters
46-
----------
47-
filename : str
48-
Path to ENDF-6 formatted file
49-
50-
Returns
51-
-------
52-
list
53-
A list of :class:`openmc.data.endf.Evaluation` instances.
54-
55-
"""
56-
evaluations = []
57-
with open(str(filename), 'r') as fh:
58-
while True:
59-
pos = fh.tell()
60-
line = fh.readline()
61-
if line[66:70] == ' -1':
62-
break
63-
fh.seek(pos)
64-
evaluations.append(Evaluation(fh))
65-
return evaluations
66-
67-
6842
class Evaluation:
6943
"""ENDF material evaluation with multiple files/sections
7044

openmc/data/neutron.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -805,9 +805,7 @@ def from_njoy(cls, filename, temperatures=None, evaluation=None, **kwargs):
805805
# Helper function to get a cross section from an ENDF file on a
806806
# given energy grid
807807
def get_file3_xs(ev, mt, E):
808-
file_obj = StringIO(ev.section[3, mt])
809-
get_head_record(file_obj)
810-
_, xs = get_tab1_record(file_obj)
808+
xs = ev.section_data[3, mt]['sigma']
811809
return xs(E)
812810

813811
heating_local = Reaction(901)

0 commit comments

Comments
 (0)