Skip to content

Commit a51c178

Browse files
committed
Enable addreactionratecontributionsforwardreverse for four party reaction
1 parent 10a62c2 commit a51c178

File tree

1 file changed

+21
-11
lines changed

1 file changed

+21
-11
lines changed

src/Reactor.jl

Lines changed: 21 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -424,15 +424,19 @@ export addreactionratecontributions!
424424
@inbounds @fastmath fR = kfs[i]*cs[rarray[1,i]]
425425
elseif @inbounds rarray[3,i] == 0
426426
@inbounds @fastmath fR = kfs[i]*cs[rarray[1,i]]*cs[rarray[2,i]]
427-
else
427+
elseif @inbounds rarray[4,i] == 0
428428
@inbounds @fastmath fR = kfs[i]*cs[rarray[1,i]]*cs[rarray[2,i]]*cs[rarray[3,i]]
429+
else
430+
@inbounds @fastmath fR = kfs[i]*cs[rarray[1,i]]*cs[rarray[2,i]]*cs[rarray[3,i]]*cs[rarray[4,i]]
429431
end
430-
if @inbounds rarray[5,i] == 0
431-
@inbounds @fastmath rR = krevs[i]*cs[rarray[4,i]]
432-
elseif @inbounds rarray[6,i] == 0
433-
@inbounds @fastmath rR = krevs[i]*cs[rarray[4,i]]*cs[rarray[5,i]]
432+
if @inbounds rarray[6,i] == 0
433+
@inbounds @fastmath rR = krevs[i]*cs[rarray[5,i]]
434+
elseif @inbounds rarray[7,i] == 0
435+
@inbounds @fastmath rR = krevs[i]*cs[rarray[5,i]]*cs[rarray[6,i]]
436+
elseif @inbounds rarray[8,i] == 0
437+
@inbounds @fastmath rR = krevs[i]*cs[rarray[5,i]]*cs[rarray[6,i]]*cs[rarray[7,i]]
434438
else
435-
@inbounds @fastmath rR = krevs[i]*cs[rarray[4,i]]*cs[rarray[5,i]]*cs[rarray[6,i]]
439+
@inbounds @fastmath rR = krevs[i]*cs[rarray[5,i]]*cs[rarray[6,i]]*cs[rarray[7,i]]*cs[rarray[8,i]]
436440
end
437441
@inbounds @fastmath frts[i] = fR*V
438442
@inbounds @fastmath rrts[i] = rR*V
@@ -443,13 +447,19 @@ export addreactionratecontributions!
443447
@inbounds @fastmath dydt[rarray[2,i]] -= R
444448
if @inbounds rarray[3,i] != 0
445449
@inbounds @fastmath dydt[rarray[3,i]] -= R
450+
if @inbounds rarray[4,i] != 0
451+
@inbounds @fastmath dydt[rarray[4,i]] -= R
452+
end
446453
end
447454
end
448-
@inbounds @fastmath dydt[rarray[4,i]] += R
449-
if @inbounds rarray[5,i] != 0
450-
@inbounds @fastmath dydt[rarray[5,i]] += R
451-
if @inbounds rarray[6,i] != 0
452-
@inbounds @fastmath dydt[rarray[6,i]] += R
455+
@inbounds @fastmath dydt[rarray[5,i]] += R
456+
if @inbounds rarray[6,i] != 0
457+
@inbounds @fastmath dydt[rarray[6,i]] += R
458+
if @inbounds rarray[7,i] != 0
459+
@inbounds @fastmath dydt[rarray[7,i]] += R
460+
if @inbounds rarray[8,i] != 0
461+
@inbounds @fastmath dydt[rarray[8,i]] += R
462+
end
453463
end
454464
end
455465
end

0 commit comments

Comments
 (0)