|
44 | 44 | from rmgpy.molecule import Molecule |
45 | 45 | from rmgpy.molecule.fragment import Fragment |
46 | 46 | from rmgpy.molecule.group import Group |
47 | | -from rmgpy.quantity import Energy, Quantity, RateCoefficient, SurfaceConcentration |
| 47 | +from rmgpy.quantity import Energy, Quantity, RateCoefficient, SurfaceConcentration, Concentration |
48 | 48 | from rmgpy.rmg.model import CoreEdgeReactionModel |
49 | 49 | from rmgpy.rmg.reactionmechanismsimulator_reactors import ( |
50 | 50 | ConstantTLiquidSurfaceReactor, |
@@ -659,7 +659,7 @@ def liquid_cat_reactor(temperature, |
659 | 659 | concentration = Quantity(conc) |
660 | 660 | # check the dimensions are ok |
661 | 661 | # convert to mol/m^3 (or something numerically nice? or must it be SI) |
662 | | - initialConcentrations[spec] = concentration.value_si |
| 662 | + initialConcentrations[spec] = concentration.value_si # is this a mistake? shouldn't this also be quantity? |
663 | 663 | else: |
664 | 664 | if len(conc) != 2: |
665 | 665 | raise InputError("Concentration values must either be in the form of (number,units) or a list with 2 " |
@@ -1756,6 +1756,9 @@ def format_initial_mole_fractions(system): |
1756 | 1756 | f.write(' temperature = ' + format_temperature(system) + '\n') |
1757 | 1757 | f.write(' initialConcentrations={\n') |
1758 | 1758 | for spcs, conc in system.initial_concentrations.items(): |
| 1759 | + # conc may have been converted to SI, so we need to convert back |
| 1760 | + if type(conc) == float: |
| 1761 | + conc = Quantity(conc, Concentration.units) |
1759 | 1762 | f.write(' "{0!s}": ({1:g},"{2!s}"),\n'.format(spcs.label, conc.value, conc.units)) |
1760 | 1763 | elif isinstance(system, SurfaceReactor): |
1761 | 1764 | f.write('surfaceReactor(\n') |
|
0 commit comments