From 494e2faf88c2836d713f761c70713db92584dcb5 Mon Sep 17 00:00:00 2001 From: Andrew Johnson Date: Fri, 4 Jun 2021 09:07:31 -0700 Subject: [PATCH] Operator pulls Materials.cross_sections from material file Closes #1843 --- openmc/deplete/operator.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/openmc/deplete/operator.py b/openmc/deplete/operator.py index 0e28b7ed33..0e5cc9efa3 100644 --- a/openmc/deplete/operator.py +++ b/openmc/deplete/operator.py @@ -12,6 +12,7 @@ from collections import OrderedDict import os import xml.etree.ElementTree as ET from warnings import warn +from pathlib import Path import numpy as np from uncertainties import ufloat @@ -610,6 +611,14 @@ class Operator(TransportOperator): for mat in materials: mat._nuclides.sort(key=lambda x: nuclides.index(x[0])) + # Grab the cross sections tag from the existing file + mfile = Path("materials.xml") + if mfile.exists(): + tree = ET.parse(str(mfile)) + xs = tree.find('cross_sections') + if xs is not None: + materials.cross_sections = xs.text + materials.export_to_xml() def _get_tally_nuclides(self):