From 24f3dd6f55e1fd8dbeb5e0f587dfdbeda7578c5f Mon Sep 17 00:00:00 2001 From: tjlaboss Date: Tue, 25 Jul 2017 15:51:24 -0600 Subject: [PATCH] Replace ZAID notation with human-readable --- scripts/openmc-update-inputs | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/scripts/openmc-update-inputs b/scripts/openmc-update-inputs index 72aee9c0f..7143851d8 100755 --- a/scripts/openmc-update-inputs +++ b/scripts/openmc-update-inputs @@ -11,6 +11,7 @@ from itertools import chain from random import randint from shutil import move import xml.etree.ElementTree as ET +import re import openmc.data @@ -238,6 +239,18 @@ def update_geometry(geometry_root): return was_updated +def replace_zaid(name): + """Replace a nuclide name in the ZAID notation with the correct name.""" + # TODO: Account for metastable and any other special cases + name = name.strip() + z = int(name[:-3]) + a = int(name[-3:]) # Strips leading 0s + symbol = openmc.data.ATOMIC_SYMBOL[z] + name = str(symbol).title() + str(a) + return name + + + def update_materials(root): """Update the given XML materials tree. Return True if changes were made.""" was_updated = False @@ -247,6 +260,9 @@ def update_materials(root): if 'name' in nuclide.attrib: nucname = nuclide.attrib['name'] nucname = nucname.replace('-', '') + s = re.search("\s*(?