Allow non-positive atomic weights for custom elements
This commit is contained in:
parent
f0cdb6df8c
commit
abf71c4cb1
2 changed files with 8 additions and 10 deletions
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue