Skip to content

Commit

Permalink
Fix the bug in the Material.from_xml_element function (openmc-dev#3278)
Browse files Browse the repository at this point in the history
Co-authored-by: Paul Romano <paul.k.romano@gmail.com>
  • Loading branch information
2 people authored and ahnaf-tahmid-chowdhury committed Feb 6, 2025
1 parent fe08ba5 commit 153d15f
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion openmc/material.py
Original file line number Diff line number Diff line change
Expand Up @@ -1582,7 +1582,6 @@ def from_xml_element(cls, elem: ET.Element) -> Material:

if 'volume' in elem.attrib:
mat.volume = float(elem.get('volume'))
mat.depletable = bool(elem.get('depletable'))

# Get each nuclide
for nuclide in elem.findall('nuclide'):
Expand All @@ -1592,6 +1591,9 @@ def from_xml_element(cls, elem: ET.Element) -> Material:
elif 'wo' in nuclide.attrib:
mat.add_nuclide(name, float(nuclide.attrib['wo']), 'wo')

# Get depletable attribute
mat.depletable = elem.get('depletable') in ('true', '1')

# Get each S(a,b) table
for sab in elem.findall('sab'):
fraction = float(sab.get('fraction', 1.0))
Expand Down

0 comments on commit 153d15f

Please sign in to comment.