|
1 |
| -using Parameters |
2 | 1 | import Base: length,show,print,println
|
3 | 2 | using StaticArrays
|
4 | 3 | abstract type AbstractReaction end
|
5 | 4 | export AbstractReaction
|
6 | 5 |
|
7 |
| -@with_kw struct ElementaryReaction{T<:AbstractRate,Q<:Integer,V1<:AbstractArray,V2<:AbstractArray,V3<:AbstractArray,V4<:AbstractArray,V5<:AbstractArray,V6<:AbstractArray,V7<:AbstractArray,V8<:AbstractArray,V9<:AbstractArray} <: AbstractReaction |
| 6 | +struct ElementaryReaction{T<:AbstractRate,Q<:Integer,V1<:AbstractArray,V2<:AbstractArray,V3<:AbstractArray,V4<:AbstractArray,V5<:AbstractArray,V6<:AbstractArray,V7<:AbstractArray,V8<:AbstractArray,V9<:AbstractArray} <: AbstractReaction |
8 | 7 | index::Q
|
9 | 8 | reactants::V1
|
10 | 9 | reactantinds::V2
|
11 | 10 | products::V3
|
12 | 11 | productinds::V4
|
13 | 12 | kinetics::T
|
14 |
| - electronchange::Int64 = 0 |
15 |
| - radicalchange::Int64 = -100 |
16 |
| - reversible::Bool = true |
17 |
| - forwardable::Bool = true |
18 |
| - pairs::V5 = [[""]] |
19 |
| - fragmentbasedreactants::V6 = [] |
20 |
| - fragmentbasedproducts::V7 = [] |
21 |
| - fragmentbasedreactantinds::V8 = [] |
22 |
| - fragmentbasedproductinds::V9 = [] |
23 |
| - comment::String = "" |
| 13 | + electronchange::Int64 |
| 14 | + radicalchange::Int64 |
| 15 | + reversible::Bool |
| 16 | + forwardable::Bool |
| 17 | + pairs::V5 |
| 18 | + fragmentbasedreactants::V6 |
| 19 | + fragmentbasedproducts::V7 |
| 20 | + fragmentbasedreactantinds::V8 |
| 21 | + fragmentbasedproductinds::V9 |
| 22 | + comment::String |
24 | 23 | end
|
| 24 | + |
| 25 | +function ElementaryReaction(; index::Q, reactants::V1, reactantinds::V2, products::V3, productinds::V4, kinetics::T, electronchange::Int64=0, radicalchange::Int64=-100, reversible::Bool=true, forwardable::Bool=true, pairs::V5=[[""]], fragmentbasedreactants::V6=[], fragmentbasedproducts::V7=[], fragmentbasedreactantinds::V8=[], fragmentbasedproductinds::V9=[], comment::String="") where {T<:AbstractRate,Q<:Integer,V1<:AbstractArray,V2<:AbstractArray,V3<:AbstractArray,V4<:AbstractArray,V5<:AbstractArray,V6<:AbstractArray,V7<:AbstractArray,V8<:AbstractArray,V9<:AbstractArray} |
| 26 | + return ElementaryReaction(index, reactants, reactantinds, products, productinds, kinetics, electronchange, radicalchange, reversible, forwardable, pairs, fragmentbasedreactants, fragmentbasedproducts, fragmentbasedreactantinds, fragmentbasedproductinds, comment) |
| 27 | +end |
| 28 | + |
25 | 29 | export ElementaryReaction
|
26 | 30 |
|
27 | 31 | getrxnstr(rxn::T) where {T<:AbstractReaction} = join([join(getfield.(rxn.reactants,:name),"+"),join(getfield.(rxn.products,:name),"+")],"<=>")
|
|
0 commit comments