Skip to content

Commit 427c1f6

Browse files
committed
fix issue with ReverseDiff.TrackedArray treatment
the original function was actually effectively removing the tracking with kfs = zeros(Q.parameters[1],length(ph.reactions)) resulting in a Array{Float64,1} This behavior was originally hidden by a bug in ReverseDiff.jl that was subsequently fixed making us incompatible with recent versions this commit should make us compatible with newer versions of ReverseDiff
1 parent 3d7170d commit 427c1f6

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/PhaseState.jl

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ using Parameters
22
using SpecialFunctions
33
using LinearAlgebra
44
using Tracker
5+
using ReverseDiff
56
using RecursiveArrayTools
67

78
@inline function calcgibbs(ph::U,T::W) where {U<:IdealPhase,W<:Real}
@@ -56,7 +57,7 @@ end
5657
export getkf
5758

5859
@inline function getkfs(ph::U,T::W1,P::W2,C::W3,ns::Q,V::W4,phi) where {U,W1,W2,W3,W4<:Real,Q<:AbstractArray}
59-
kfs = zeros(Q.parameters[1],length(ph.reactions))
60+
kfs = similar(ns,length(ph.reactions))
6061
i = 1
6162
oldind = 1
6263
ind = 0
@@ -71,6 +72,7 @@ export getkf
7172
end
7273
return kfs
7374
end
75+
7476
export getkfs
7577

7678
"""

0 commit comments

Comments
 (0)