Skip to content

Commit

Permalink
Add negative initial mole fractions error check for input files.
Browse files Browse the repository at this point in the history
Sometimes people mess up and miss writing the E in scientific
notation. ie.  5e-7 becomes 5-7.  This causes problems.
  • Loading branch information
connie committed Mar 31, 2015
1 parent 9a1b650 commit 1df1c3f
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion rmgpy/rmg/input.py
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,10 @@ def simpleReactor(temperature,
sensitivityThreshold=1e-3
):
logging.debug('Found SimpleReactor reaction system')


for value in initialMoleFractions.values():
if value < 0:
raise InputError('Initial mole fractions cannot be negative.')
if sum(initialMoleFractions.values()) != 1:
logging.warning('Initial mole fractions do not sum to one; renormalizing.')
for spec in initialMoleFractions:
Expand Down

0 comments on commit 1df1c3f

Please sign in to comment.