From bc2a7c32013bba4410b95a4aba6ea0e906bcc047 Mon Sep 17 00:00:00 2001 From: Sam Shaner Date: Mon, 31 Oct 2016 12:28:01 -0400 Subject: [PATCH] added error if element added via materials.xml file --- openmc/material.py | 2 +- src/input_xml.F90 | 12 ++++++++++++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/openmc/material.py b/openmc/material.py index e33615642..c265c9069 100644 --- a/openmc/material.py +++ b/openmc/material.py @@ -687,7 +687,7 @@ class Material(object): allnucs = self._nuclides + self._elements dist_per_type = allnucs[0][2] for nuc in allnucs: - if not nuc[2] == dist_per_type: + if nuc[2] != dist_per_type: msg = 'All nuclides and elements in a distributed ' \ 'material must have the same type, either ao or wo' raise ValueError(msg) diff --git a/src/input_xml.F90 b/src/input_xml.F90 index c5c35d710..2cefd76f6 100644 --- a/src/input_xml.F90 +++ b/src/input_xml.F90 @@ -2198,6 +2198,7 @@ contains type(Node), pointer :: node_sab => null() type(NodeList), pointer :: node_mat_list => null() type(NodeList), pointer :: node_nuc_list => null() + type(NodeList), pointer :: node_ele_list => null() type(NodeList), pointer :: node_macro_list => null() type(NodeList), pointer :: node_sab_list => null() @@ -2309,6 +2310,17 @@ contains end select end if + ! Issue error if elements are provided + call get_node_list(node_mat, "element", node_ele_list) + + if (get_list_size(node_ele_list) > 0) then + call fatal_error("Unable to add an element to material " & + // trim(to_str(mat % id)) // " since the element option has & + &been removed from the xml input. Elements can only be added via & + &the Python API, which will expand elements into their natural & + &nuclides.") + end if + ! ======================================================================= ! READ AND PARSE TAGS