# Reference example: block-style `if / else` in a reactions block.
#
# This file demonstrates how a conditional can select between two alternative
# elementary steps inside `reactions { ... }`.

let include_conversion_step = true

components {
  A {phase=gas, init=1.0, role=reactant},
  B {phase=gas, init=0.0, role=product, tags=[key]},
  * {phase=surface, init=1.0, tags=[emptysite]}
}

reactions {
  if(include_conversion_step) {
    {A}+{*}=>{B}+{*} @ ArrheniusDefault(Vf=1e6, Vb=0.0, Eaf=0.0, Eab=1e5)
  } else {
    {A}+{*}=>{B}+{*} @ ArrheniusDefault(Vf=1e6, Vb=1e7, Eaf=30e3, Eab=1e5)
  }
}

simulation {
  baseline @ transient_solve(
    model = thermal,
    solver = {method = cvode_bdf, atol = 1e-12, rtol = 1e-10, t_end = 1e3},
    conditions = [{T = 600}]
  )
}

output {
  formats = [tabdelim, hdf5],
  folder = "results_if_then_else_reaction"
}
