diff --git a/src/thermo/Phase.cpp b/src/thermo/Phase.cpp index 81b748071a..4981835d69 100644 --- a/src/thermo/Phase.cpp +++ b/src/thermo/Phase.cpp @@ -705,12 +705,14 @@ size_t Phase::addElement(const std::string& symbol, doublereal weight, int elem_type) { // Look up the atomic weight if not given - if (weight == -12345.0) { - weight = getElementWeight(symbol); - if (weight < 0.0) { - throw CanteraError("Phase::addElement", - "No atomic weight found for element: " + symbol); + if (weight == 0.0) { + try { + weight = getElementWeight(symbol); + } catch (CanteraError&) { + // assume this is just a custom element with zero atomic weight } + } else if (weight == -12345.0) { + weight = getElementWeight(symbol); } // Check for duplicates diff --git a/src/thermo/ThermoFactory.cpp b/src/thermo/ThermoFactory.cpp index 1b8d7401bd..babcad8011 100644 --- a/src/thermo/ThermoFactory.cpp +++ b/src/thermo/ThermoFactory.cpp @@ -474,11 +474,7 @@ void installElements(Phase& th, const XML_Node& phaseNode) entropy298 = fpValueCheck(e298Node["value"]); } } - if (weight != 0.0) { - th.addElement(symbol, weight, anum, entropy298); - } else { - th.addElement(symbol); - } + th.addElement(symbol, weight, anum, entropy298); } }