Skip to content

Commit 4268cd3

Browse files
committed
cleanup equality with one checks
1 parent 03478b1 commit 4268cd3

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

src/systems/reaction/reactionsystem.jl

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -62,9 +62,9 @@ function oderatelaw(rx)
6262
coef = one(eltype(substoich))
6363
for (i,stoich) in enumerate(substoich)
6464
coef *= factorial(stoich)
65-
rl *= (stoich != one(stoich)) ? substrates[i]^stoich : substrates[i]
65+
rl *= isone(stoich) ? substrates[i] : substrates[i]^stoich
6666
end
67-
(coef != one(coef)) && (rl /= coef)
67+
(!isone(coef)) && (rl /= coef)
6868
end
6969
rl
7070
end
@@ -79,10 +79,10 @@ function assemble_drift(rs)
7979
for (spec,stoich) in rx.netstoich
8080
i = species_to_idx[spec]
8181
if iszero(eqs[i].rhs)
82-
Δspec = (stoich == one(stoich)) ? rl : stoich * rl
82+
Δspec = isone(stoich) ? rl : stoich * rl
8383
eqs[i] = Equation(eqs[i].lhs, Δspec)
8484
else
85-
Δspec = (abs(stoich) == one(stoich)) ? rl : abs(stoich) * rl
85+
Δspec = isone(abs(stoich)) ? rl : abs(stoich) * rl
8686
if stoich > zero(stoich)
8787
eqs[i] = Equation(eqs[i].lhs, eqs[i].rhs + Δspec)
8888
else
@@ -102,7 +102,7 @@ function assemble_diffusion(rs)
102102
rlsqrt = sqrt(oderatelaw(rx))
103103
for (spec,stoich) in rx.netstoich
104104
i = species_to_idx[spec]
105-
eqs[i,j] = (stoich == one(stoich)) ? rlsqrt : stoich * rlsqrt
105+
eqs[i,j] = isone(stoich) ? rlsqrt : stoich * rlsqrt
106106
end
107107
end
108108
eqs

0 commit comments

Comments
 (0)