Skip to content

Commit

Permalink
swap max(0,P) with max(P,0) to better propagate units (first arg unit)
Browse files Browse the repository at this point in the history
  • Loading branch information
jcschaff committed Sep 24, 2024
1 parent 1c2cf8c commit 6f97352
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -45,10 +45,10 @@ static StochasticFunction solveGeneralKineticsStochasticFunction(ReactionStep rs

Expression netRate = rs.getKinetics().getAuthoritativeParameter().getExpression();
try {
Expression forwardNetRate = Expression.max(new Expression(0.0), netRate);
Expression forwardNetRate = Expression.max(netRate, new Expression(0.0));

if (rs.isReversible()) {
Expression reverseNetRate = Expression.max(new Expression(0.0), Expression.negate(netRate));
Expression reverseNetRate = Expression.max(Expression.negate(netRate), new Expression(0.0));
return new GeneralKineticsStochasticFunction(forwardNetRate, reverseNetRate, reactants, products);
} else {
return new GeneralKineticsStochasticFunction(forwardNetRate, null, reactants, products);
Expand Down

0 comments on commit 6f97352

Please sign in to comment.