Skip to content

Commit

Permalink
scale stoichiometric coefficients to match default rate equation
Browse files Browse the repository at this point in the history
  • Loading branch information
joyxyz1994 committed Oct 11, 2023
1 parent 6731162 commit 3eeb045
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
5 changes: 3 additions & 2 deletions qsdsan/_process.py
Original file line number Diff line number Diff line change
Expand Up @@ -706,8 +706,9 @@ def _normalize_stoichiometry(self, new_ref):
self._stoichiometry = [v/factor for v in stoich]

def _normalize_rate_eq(self, new_ref):
factor = abs(self._stoichiometry[self._components.index(str(new_ref))])
self._rate_equation *= factor
if self._rate_equation:
factor = abs(self._stoichiometry[self._components.index(str(new_ref))])
self._rate_equation *= factor

def show(self):
info = f"Process: {self.ID}"
Expand Down
4 changes: 4 additions & 0 deletions qsdsan/processes/_madm1.py
Original file line number Diff line number Diff line change
Expand Up @@ -567,6 +567,10 @@ def __new__(cls, components=None, path=None,
parameters=cls._stoichio_params,
compile=False)

for i in ('fast_P_binding', 'slow_P_sorption', 'dissolution_HFO_HP', 'dissolution_HFO_LP'):
p = getattr(self, i)
p.ref_component = 'S_IP'

precipitation = []
for i in cls._precipitate_IDs[:-3]:
new_p = Process('precipitation_%s' % i.lstrip('X_'),
Expand Down

0 comments on commit 3eeb045

Please sign in to comment.