Skip to content

Commit

Permalink
update heaviside argument
Browse files Browse the repository at this point in the history
  • Loading branch information
bjodah committed Sep 15, 2024
1 parent ebbcb8e commit f668160
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions chempy/kinetics/rates.py
Original file line number Diff line number Diff line change
Expand Up @@ -198,8 +198,9 @@ def heaviside(x, z):
elif hasattr(backend, 'clip'): # e.g. numpy
def heaviside(x, z):
assert z == 0
lx = backend.log(backend.maximum(x, tiny))
xclp = be.clip(lx, lo, hi)
lx = backend.log(backend.maximum(backend.array(x), tiny))
xclp = backend.clip(lx, lo, hi)
x = (xclp - lo)/(hi - lo)
y = (3 - 2*x)*x*x
return y
else:
Expand Down

0 comments on commit f668160

Please sign in to comment.