Skip to content

Commit f6027ad

Browse files
hwpangmjohnson541
authored andcommitted
rops for fragment based reaction array
1 parent 0c81645 commit f6027ad

File tree

1 file changed

+31
-0
lines changed

1 file changed

+31
-0
lines changed

src/Simulation.jl

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -419,6 +419,37 @@ function rops!(ropvec,rarray,cs,kfs,krevs,V,start,ind)
419419
end
420420

421421

422+
function rops!(ropmat,rarray,fragmentbasedrxnarray,cs,kfs,krevs,V,start)
423+
numfragmentbasedreacprod, numrxns = size(fragmentbasedrxnarray)
424+
half = Int(numfragmentbasedreacprod/2)
425+
for i = 1:length(kfs)
426+
R = getrate(rarray,cs,kfs,krevs,V,i)
427+
428+
for j = 1:half
429+
if fragmentbasedrxnarray[j,i] != 0
430+
@fastmath ropmat[fragmentbasedrxnarray[j,i]] -= R
431+
end
432+
end
433+
434+
for j = half+1:numfragmentbasedreacprod
435+
if fragmentbasedrxnarray[j,i] != 0
436+
@fastmath ropmat[fragmentbasedrxnarray[j,i]] += R
437+
end
438+
end
439+
end
440+
end
441+
442+
function rops!(ropvec,rarray,fragmentbasedrxnarray,cs,kfs,krevs,V,start,ind)
443+
numfragmentbasedreacprod, numrxns = size(fragmentbasedrxnarray)
444+
half = Int(numfragmentbasedreacprod/2)
445+
for i = 1:length(kfs)
446+
@views c = count(isequal(ind),fragmentbasedrxnarray[half+1:end,i])-count(isequal(ind),fragmentbasedrxnarray[1:half,i])
447+
if c != 0.0
448+
R = getrate(rarray,cs,kfs,krevs,V,i)
449+
@fastmath @inbounds ropvec[i+start] = c*R
450+
end
451+
end
452+
end
422453

423454
"""
424455
Calculates sensitivities with respect to `target` at the time point at the end of the simulation

0 commit comments

Comments
 (0)