MbT-Tool: Metabolism based on Thermodynamics

MbT-Tool: Metabolism based on Thermodynamics preview image

2 collaborators

Tags

(This model has yet to be categorized with any tags)
Visible to everyone | Changeable by everyone
Model was written in NetLogo 5.3.1 • Viewed 236 times • Downloaded 39 times • Run 0 times
Download the 'MbT-Tool: Metabolism based on Thermodynamics' modelDownload this modelEmbed this model

Do you have questions or comments about this model? Ask them here! (You'll first need to log in.)


WHAT IS IT?

MbT-tool is an computational tool to write a balanced biochemical equation using the thermodynamic approach “Thermodynamic Electron Equivalents Model” (TEEM) proposed by Perry L. McCarty (McCarty, 2007; Rittmann and McCarty, 2001). The novelty is that this biochemical equation considers in its structure the presence of a microorganism.

HOW TO USE IT

To begin the user has to select: 1. one electron donor and one electron acceptor from the organic half-reactions or from the inorganic half-reactions. 2. After that it will be selected the empirical chemical formula of the cells or input the molar relationship between the four main elements (C, H, O and N). 3. Then the user has to define the N-source to the biomass synthesis half-reaction, it is possible to choose between four different N-sources (NH4+, NO3-, NO2- or N2). 4. With this information the user has to decide the thermodynamic approach to write the balanced biochemical equation, is possible select between TEEM1 or TEEM2, if the user choose TEEM2 is necessary define the number of oxygenase reactions per mole of substrate introducing a entire number in the “q” parameter. 6. To finish the necessary input data the user has to define the energy transfer efficiency (ε) to the biochemical process. With all these information is possible execute MbT-tool clicking on the button “calculate”. With the button “download” the user can obtain the displayed information in one archive with “.txt” extension.

HOW IT WORKS

When the user clicks on the button calculate, the first procedure that the MbT-tool executes is creating a square matrix of i-rows by i-columns called “Reactions”. The number (i) of rows and the columns is the same and represents the number of chemical species programmed in the source code of the tool. Each row stores all numerical coefficients of each reduction-half-reaction with its Gibb’s standard free energy. Therefore each chemical species uses a different column and each half-reactions uses a different row. In all of the cases (except Gibb’s standard free energy) if the numerical coefficient is positive means reaction reactant and if is negative means reaction product.

When the matrix reactions is ready, MbT-tool select from its rows the electron donor (Rd) and the electron acceptor (Ra) taking into account the user selection about these half-reactions, and place the corresponding information in different matrixes, the matrix called “Rd” for Rd and the matrix called “Ra” for Ra. In the case of the Rd also is establish what chemical compound is the electron source, this last information will be used in the yield prediction calculations.

With the matrixes Rd and Ra ready, MbT-tool setups Rc taking into account the user selection about the microorganism empirical chemical formula and the N-source. This information is stored in a matrix called “b-biomass”.

The next step is make the thermodynamic calculations following the mathematical expressions of TEEM taking into account the user selection between TEEM1 or TEEM2, if the TEEM2 model is selected, MbT-tool use value of the parameter “q” that represents the number of oxygenase reactions per mole of substrate, the default value for “q” is zero.

Into the thermodynamic calculations the Gibb’s free energy for Rc (∆Gpc) is evaluate depending on the N-source and the estimate value of 3.33 kJ per gram cells (McCarty, 1971; Rittmann and McCarty, 2001). This value is referred to the empirical cell formula of C5H7O2N (Rittmann and McCarty, 2001) and MbT-tool adjust it depending of the user selection about the microorganism empirical chemical formula.

To complete the information MbT-tool uses the value of energy-transfer-efficiency (ε) selected by the user.

With all this information MbT-tool displays the half-reactions of Rd and Ra with their Gibb’s free energy, the Rc, Re, Rs, the portion of electrons (feo) to generate energy, the portion of electrons (fso) cell synthesis, the energy-transfer-efficiency, the balanced equation (R) in which the microorganisms responsible for the process are included and also the values of bacterial yield prediction using the units (gcells moldonor-1), (molCcells moldonor-1) and (molCcells molCdonor-1).

THINGS TO NOTICE

If the result of the combination between the selectees electron donor and electron acceptor is outside of TEEM1 or TEEM2 scope the MbT-tool doesn´t continue with its calculation and the user view this error message on the screen “With this combination of electron donor and electron acceptor, is not possible write a global reaction. Please select another combination or change the efficiency value”.

If the user selects the same half-reaction to electron donor and electron acceptor MbT-tool doesn´t continue with its calculations and the user view this message on the screen “It is not possible that the electron donor is equal to the electron acceptor”.

THINGS TO TRY

To obtain a balanced biochemical equation fitted to the experimental data the user could move the slider “efficiency” and run MbT-tool again. The user has to compare de bacterial yield prediction obtained between different N-sources for the biomass synthesis, and also between the results obtained from TEEM1 or TEEM2

EXTENDING THE PROGRAM

In the code tab the user could add another half-reaction for the electron donor or for the electron acceptor, using the chemical species programmed just adding another row and also is possible add another chemical specie just adding another column to the matrix “reactions”. The reactants must to be writing with positive coefficient and the products of the new half-reaction must to be writing with negative coefficient. When the user include a new half-reaction is necessary declare it on the chosen menus “Electrondonor” and “Electronacceptor”.

In the case that a new chemical specie is added, is necessary add another reduction-half-reaction, the user must to follow the following steps to do it: i) modify (increase) the number called “columnmatrix” this indicates the number of chemical species programmed in the current version of MbT-tool, with the changes on this number the user modifies the number of rows and columns of the matrix “Reactions”, ii) add the new reaction name on the sliders to select “Electrondonor” and “Electronacceptor”, iii) add new lines of code in the section-code to define the electron donor and the electron acceptor, and iv) add new lines of code in the procedure called “outputall”.

NETLOGO FEATURES

MbT-tool is programed using built-in language primitives and the extension "matrix" of NetLogo. To extend the utility could be necessary program the possibility of write biochemical equations using more than one electron donor or more than one electron acceptor.

CREDITS AND REFERENCES

MbT-Tool. Microbial metabolism as biochemical equations based on thermodynamics: An open-access tool. Araujo P., Gras A. and Ginovart M. - 2016

This work is licensed under the Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License. To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-sa/4.0/.

Comments and Questions

Please start the discussion about this model! (You'll first need to log in.)

Click to Run Model

; MbT-tool - Metabolism-based on Thermodynamics by Araujo P., Gras A. and Ginovart M. - 2016

extensions [matrix sound]
globals [reactions rd ra rd1 rd2 molecular-weight e-eeq/mol dGpc gamma_cells b-biomass carbon hydrogen oxygen nitrogen
         b-co2 b-hco3 b-nh4 b-bio b-h2o b-no3- b-no2- b-n2 b-H+ dGp n m dGr A fs fe yc/c to-print  gamma_donor reaction
         energy_reaction synthesis_reaction dGfa dGs p c c2 y_grams_cells/mol_donor y_mol_C_cell/mol_donor row_matrix column_matrix
         e_d1 e_d2 x_d1 x_d2]

to calculate
  clear-all
  if Electron_donor = "--- Organic Reactions ---" or Electron_donor = "--- Inorganic Reactions ---" [output-type "Please, select a valid primary electron donor" error-sound stop]
  if Electron_donor_2 = "--- Organic Reactions ---" and second_electron_donor? = true or Electron_donor_2 = "--- Inorganic Reactions ---" and second_electron_donor? = true [output-type "Please, select a valid second electron donor" error-sound stop]
  if Electron_acceptor = "--- Organic Reactions ---" or Electron_acceptor = "--- Inorganic Reactions ---" [output-type "Please, select a valid electron acceptor" error-sound stop]
  if Electron_donor = Electron_acceptor [output-type "It is not possible that the electron donor is equal to the electron acceptor " error-sound stop]
  setup-reactions
  setup-electron-donor
  setup-electron-acceptor
  setup-microorganism
  let check (matrix:get ra 0 25) - (matrix:get rd 0 25)
  if check = 0 [output-type "It is not possible that the electron donor is equal to the electron acceptor " error-sound stop]
  setup-thermodynamic
  if fs <= 0 or fe <= 0 [output-print "With this combination of electron-donor and electron acceptor, is not possible write a global reaction" output-print "Please select another combination or change the efficiency value" error-sound stop]
  setup-reaction
  yield-prediction
  setup-output
end 

to error-sound
sound:play-note "TRUMPET" 60 64 0.5
end 

to setup-thermodynamic
if Thermodynamics = "TEEM_1"
  [
  set dGp 35.09 - (matrix:get rd 0 25)
  ifelse dGp > 0 [set n 1][set n -1]
  set dGr (matrix:get ra 0 25) - (matrix:get rd 0 25)
  set A -1 * (((dGp / (efficiency ^ n))+(matrix:get b-biomass 0 25 / efficiency))/(efficiency * dGr))
  set fs (1 / (1 + A)) set fe (A / (1 + A))
  ]
if Thermodynamics = "TEEM_2"
  [
   set dGp 30.09 - (matrix:get rd 0 25)
   ifelse dGp > 0 [set n 1][set n -1]
   ifelse Electron_donor = "Methane" or Electron_donor = "Methanol" or Electron_donor = "Formate" [set dGfa 46.53][set dGfa 0]
   ifelse dGfa > 0 [set m 1][set m n]
   set p abs (1 / (matrix:get rd 0 c))
   set dGr (matrix:get ra 0 25) - (matrix:get rd 0 25) - (q / p)* (-219.2)
   set dGs ((dGfa - (matrix:get rd 0 25)) / (efficiency ^ m)) + ((30.9 - dGfa)/(efficiency ^ n)) + (matrix:get b-biomass 0 25 / efficiency)
   set A -1 * dGs / (efficiency * dGr)
   set fs (1 / (1 + A)) set fe (A / (1 + A))
  ]
end 

to yield-prediction
set y_grams_cells/mol_donor  abs(((matrix:get reaction 0 6) * molecular-weight) / (matrix:get reaction 0 c))
let g_donor (matrix:get rd 0 3 + matrix:get rd 0 5)
ifelse g_donor <= 0 [ ][set gamma_donor 1 / g_donor set yc/c (gamma_donor / gamma_cells) * fs]
set y_mol_C_cell/mol_donor abs(((matrix:get reaction 0 6) * carbon) / (matrix:get reaction 0 c))
end 

to setup-reaction
 set energy_reaction ra matrix:- rd
 set synthesis_reaction b-biomass matrix:- rd
 set reaction ((fe matrix:* ra) matrix:+ (fs matrix:* b-biomass) matrix:- (rd))
end 

to setup-microorganism
 set b-biomass matrix:make-constant 1 column_matrix 0
 if Microorganism = "C(n)H(a)O(b)N(c) - Bacteria, Generic" [set carbon c-carbon set hydrogen c-hydrogen set oxygen c-oxygen set nitrogen c-nitrogen]
 if Microorganism = "C4.17H8O1.75N - Bacteria, Undefined" [set carbon 4.17 set hydrogen 8 set oxygen 1.75 set nitrogen 1]
 if Microorganism = "C5H9O2.5N - Agrobacterium tumefaciens, succinate" [set carbon 5 set hydrogen 9 set oxygen 2.5 set nitrogen 1]
 if Microorganism = "C4H7.2O1.93N - Paracoccus denitrificans, succinate" [set carbon 4 set hydrogen 7.2 set oxygen 1.93 set nitrogen 1]
 if Microorganism = "C3.85H6.69O1.78N - Escherichia coli, glucose" [set carbon 3.85 set hydrogen 6.69 set oxygen 1.78 set nitrogen 1]
 if Microorganism = "C4.16H8O1.25N - Escherichia coli, undefined" [set carbon 4.16 set hydrogen 8 set oxygen 1.25 set nitrogen 1]
 if Microorganism = "C4.17H7.21O1.79N - Klebsiella aerogenes, Glycerol, u=0.85 h-1" [set carbon 4.17 set hydrogen 7.21 set oxygen 1.79 set nitrogen 1]
 if Microorganism = "C4.54H7.91O1.95N - Klebsiella aerogenes, Glycerol, u=0.1 h-1" [set carbon 4.54 set hydrogen 7.91 set oxygen 1.95 set nitrogen 1]
 if Microorganism = "C4.17H7.42O1.38N - Aerobacter aerogenes, undefined" [set carbon 4.17 set hydrogen 7.42 set oxygen 1.83 set nitrogen 1]
 if Microorganism = "C4H8O2N - Bacteria, Undefined" [set carbon 4 set hydrogen 8 set oxygen 2 set nitrogen 1]
 if Microorganism = "C5H8.33O0.81N - Bacteria, Undefined" [set carbon 5 set hydrogen 8.33 set oxygen 0.81 set nitrogen 1]
 if Microorganism = "C5H8O2N - Bacteria, acetate, aerobic" [set carbon 5 set hydrogen 8 set oxygen 2 set nitrogen 1]
 if Microorganism = "C5.3H9.1O2.5N - Stahrch, Methanogenic" [set carbon 5.3 set hydrogen 9.1 set oxygen 2.5 set nitrogen 1]
 if Microorganism = "C5.1H8.5O2.5N - Glucose, Methanogenic" [set carbon 5.1 set hydrogen 8.5 set oxygen 2.5 set nitrogen 1]
 if Microorganism = "C4.1H6.8O2.2N - Nutrient Broth, Methanogenic" [set carbon 4.1 set hydrogen 6.8 set oxygen 2.2 set nitrogen 1]
 if Microorganism = "C5H8.8O3.2N - Leucine, Methanogenic" [set carbon 5 set hydrogen 8.8 set oxygen 3.2 set nitrogen 1]
 if Microorganism = "C4.9H9O3N - Glycine, Methanogenic" [set carbon 4.9 set hydrogen 9 set oxygen 3 set nitrogen 1]
 if Microorganism = "C4.7H7.7O2.1N - Octanoate, Methanogenic" [set carbon 4.7 set hydrogen 7.7 set oxygen 2.1 set nitrogen 1]
 if Microorganism = "C4.9H9.4O2.9N - Acetate, Methanogenic" [set carbon 4.9 set hydrogen 9.4 set oxygen 2.9 set nitrogen 1]
 if Microorganism = "C9H16O5N - Acetate, Nitrite N source aerobic" [set carbon 9 set hydrogen 16 set oxygen 5 set nitrogen 1]
 if Microorganism = "C9H15O5N - Acetate, Nitrate N source aerobic" [set carbon 9 set hydrogen 15 set oxygen 5 set nitrogen 1]
 if Microorganism = "C7H12O4N - Acetate, Ammomia N source aerobic" [set carbon 7 set hydrogen 12 set oxygen 4 set nitrogen 1]
 if Microorganism = "C5H7O2N - Casein, aerobic" [set carbon 5 set hydrogen 7 set oxygen 2 set nitrogen 1]
 if Microorganism = "C6.33H10.21O3.53N - Saccharomyces cerevisiae, glucose" [set carbon 6.33 set hydrogen 10.21 set oxygen 3.53 set nitrogen 1]

 set molecular-weight 12.011 * carbon + 1.008 * hydrogen + 16 * oxygen + 14 * nitrogen

 if N-Source = "NH4+" [
 set e-eeq/mol (4 * carbon + hydrogen - 2 * oxygen - 3 * nitrogen)
 set b-co2 ((carbon - nitrogen) / e-eeq/mol)
 set b-hco3 (nitrogen / e-eeq/mol)
 set b-nh4 (nitrogen / e-eeq/mol)
 set b-H+ (1)
 set b-bio (1 / e-eeq/mol)
 set b-h2o ((2 * carbon - oxygen + nitrogen) / e-eeq/mol)
 set dGpc (3.324 * molecular-weight / e-eeq/mol)
 set gamma_cells e-eeq/mol / carbon ]

 if N-Source = "NO3-" [
 set e-eeq/mol (4 * carbon + hydrogen - 2 * oxygen + 5 * nitrogen)
 set b-co2 (carbon / e-eeq/mol)
 set b-no3- (nitrogen / e-eeq/mol)
 set b-H+ ((4 * carbon + hydrogen - 2 * oxygen + 6 * nitrogen) / e-eeq/mol)
 set b-bio (1 / e-eeq/mol)
 set b-h2o ((3 * nitrogen + 2 * carbon - oxygen) / e-eeq/mol)
 set dGpc (3.341 * molecular-weight / e-eeq/mol)
 set gamma_cells e-eeq/mol / carbon ]

 if N-Source = "NO2-" [
 set e-eeq/mol (4 * carbon + hydrogen - 2 * oxygen + 3 * nitrogen)
 set b-co2 (carbon / e-eeq/mol)
 set b-no2- (nitrogen / e-eeq/mol)
 set b-H+ ((4 * carbon + hydrogen - 2 * oxygen + 4 * nitrogen) / e-eeq/mol)
 set b-bio (1 / e-eeq/mol)
 set b-h2o ((2 * nitrogen + 2 * carbon - oxygen) / e-eeq/mol)
 set dGpc (3.333 * molecular-weight / e-eeq/mol)
 set gamma_cells e-eeq/mol / carbon ]

 if N-Source = "N2" [
 set e-eeq/mol (4 * carbon + hydrogen - 2 * oxygen)
 set b-co2 (carbon / e-eeq/mol)
 set b-n2 (nitrogen / (2 * e-eeq/mol))
 set b-H+ (1)
 set b-bio (1 / e-eeq/mol)
 set b-h2o ((2 * carbon - oxygen) / e-eeq/mol)
 set dGpc (3.334 * molecular-weight / e-eeq/mol)
 set gamma_cells e-eeq/mol / carbon ]

 matrix:set b-biomass 0 13 (b-n2)
 matrix:set b-biomass 0 9 (b-no3-)
 matrix:set b-biomass 0 10 (b-no2-)
 matrix:set b-biomass 0 1 (b-H+)
 matrix:set b-biomass 0 2 (1)
 matrix:set b-biomass 0 3 (b-co2)
 matrix:set b-biomass 0 4 (b-nh4)
 matrix:set b-biomass 0 5 (b-hco3)
 matrix:set b-biomass 0 6 (-1 * b-bio)
 matrix:set b-biomass 0 7 (-1 * b-h2o)
 matrix:set b-biomass 0 25 (dGpc)
end 

to setup-electron-donor
  if Electron_donor = "H2O -> O2" [set rd1 matrix:submatrix reactions 0 0 1 column_matrix set c 7]
  if Electron_donor = "(S2O3)2- -> (SO4)2-" [set rd1 matrix:submatrix reactions 1 0 2 column_matrix set c 21]
  if Electron_donor = "S -> (SO4)2-" [set rd1 matrix:submatrix reactions 2 0 3 column_matrix set c 22]
  if Electron_donor = "(SO3)2- -> (SO4)2-" [set rd1 matrix:submatrix reactions 3 0 4 column_matrix set c 18]
  if Electron_donor = "H2S + HS- -> (SO3)2-" [set rd1 matrix:submatrix reactions 4 0 5 column_matrix set c 19]
  if Electron_donor = "H2S + HS- -> (SO4)2-" [set rd1 matrix:submatrix reactions 5 0 6 column_matrix set c 19]
  if Electron_donor = "N2 -> N2O" [set rd1 matrix:submatrix reactions 6 0 7 column_matrix set c 13]
  if Electron_donor = "N2O -> NO" [set rd1 matrix:submatrix reactions 7 0 8 column_matrix set c 12]
  if Electron_donor = "N2 -> NO2-" [set rd1 matrix:submatrix reactions 8 0 9 column_matrix set c 13]
  if Electron_donor = "NO -> NO2-" [set rd1 matrix:submatrix reactions 9 0 10 column_matrix set c 11]
  if Electron_donor = "N2 -> NO3-" [set rd1 matrix:submatrix reactions 10 0 11 column_matrix set c 13]
  if Electron_donor = "NO + N2O -> NO3-" [set rd1 matrix:submatrix reactions 11 0 12 column_matrix set c 12]
  if Electron_donor = "N2O -> NO3-" [set rd1 matrix:submatrix reactions 12 0 13 column_matrix set c 12]
  if Electron_donor = "NO -> NO3-" [set rd1 matrix:submatrix reactions 13 0 14 column_matrix set c 11]
  if Electron_donor = "NO2- -> NO3-" [set rd1 matrix:submatrix reactions 14 0 15 column_matrix set c 10]
  if Electron_donor = "H2 -> H+" [set rd1 matrix:submatrix reactions 15 0 16 column_matrix set c 14]
  if Electron_donor = "Fe2+ -> Fe3+" [set rd1 matrix:submatrix reactions 16 0 17 column_matrix set c 16]
  if Electron_donor = "NH4+ -> N2" [set rd1 matrix:submatrix reactions 17 0 18 column_matrix set c 4]
  if Electron_donor = "NH4+ -> NO3-" [set rd1 matrix:submatrix reactions 18 0 19 column_matrix set c 4]
  if Electron_donor = "NH4+ -> NO2-" [set rd1 matrix:submatrix reactions 19 0 20 column_matrix set c 4]
  if Electron_donor = "Acetate" [set rd1 matrix:submatrix reactions 20 0 21 column_matrix set c 8]
  if Electron_donor = "Alanine" [set rd1 matrix:submatrix reactions 21 0 22 column_matrix set c 23]
  if Electron_donor = "Benzoate" [set rd1 matrix:submatrix reactions 22 0 23 column_matrix set c 24]
  if Electron_donor = "Citrate" [set rd1 matrix:submatrix reactions 23 0 24 column_matrix set c 26]
  if Electron_donor = "Ethanol" [set rd1 matrix:submatrix reactions 24 0 25 column_matrix set c 27]
  if Electron_donor = "Formate" [set rd1 matrix:submatrix reactions 25 0 26 column_matrix set c 28]
  if Electron_donor = "Glucose" [set rd1 matrix:submatrix reactions 26 0 27 column_matrix set c 29]
  if Electron_donor = "Glutamate" [set rd1 matrix:submatrix reactions 27 0 28 column_matrix set c 30]
  if Electron_donor = "Glycerol" [set rd1 matrix:submatrix reactions 28 0 29 column_matrix set c 31]
  if Electron_donor = "Glycine" [set rd1 matrix:submatrix reactions 29 0 30 column_matrix set c 32]
  if Electron_donor = "Lactate" [set rd1 matrix:submatrix reactions 30 0 31 column_matrix set c 33]
  if Electron_donor = "Methane" [set rd1 matrix:submatrix reactions 31 0 32 column_matrix set c 34]
  if Electron_donor = "Methanol" [set rd1 matrix:submatrix reactions 32 0 33 column_matrix set c 35]
  if Electron_donor = "Palmitate" [set rd1 matrix:submatrix reactions 33 0 34 column_matrix set c 36]
  if Electron_donor = "Propionate" [set rd1 matrix:submatrix reactions 34 0 35 column_matrix set c 37]
  if Electron_donor = "Pyruvate" [set rd1 matrix:submatrix reactions 35 0 36 column_matrix set c 38]
  if Electron_donor = "Succinate" [set rd1 matrix:submatrix reactions 36 0 37 column_matrix set c 39]
  if Electron_donor = "NTA - Acid nitrilotriacetic" [set rd1 matrix:submatrix reactions 37 0 38 column_matrix set c 40]

  ifelse second_electron_donor? = true [
  if Electron_donor_2 = "H2O -> O2" [set rd2 matrix:submatrix reactions 0 0 1 column_matrix set c2 7]
  if Electron_donor_2 = "(S2O3)2- -> (SO4)2-" [set rd2 matrix:submatrix reactions 1 0 2 column_matrix set c2 21]
  if Electron_donor_2 = "S -> (SO4)2-" [set rd2 matrix:submatrix reactions 2 0 3 column_matrix set c2 22]
  if Electron_donor_2 = "(SO3)2- -> (SO4)2-" [set rd2 matrix:submatrix reactions 3 0 4 column_matrix set c2 18]
  if Electron_donor_2 = "H2S + HS- -> (SO3)2-" [set rd2 matrix:submatrix reactions 4 0 5 column_matrix set c2 19]
  if Electron_donor_2 = "H2S + HS- -> (SO4)2-" [set rd2 matrix:submatrix reactions 5 0 6 column_matrix set c2 19]
  if Electron_donor_2 = "N2 -> N2O" [set rd2 matrix:submatrix reactions 6 0 7 column_matrix set c2 13]
  if Electron_donor_2 = "N2O -> NO" [set rd2 matrix:submatrix reactions 7 0 8 column_matrix set c2 12]
  if Electron_donor_2 = "N2 -> NO2-" [set rd2 matrix:submatrix reactions 8 0 9 column_matrix set c2 13]
  if Electron_donor_2 = "NO -> NO2-" [set rd2 matrix:submatrix reactions 9 0 10 column_matrix set c2 11]
  if Electron_donor_2 = "N2 -> NO3-" [set rd2 matrix:submatrix reactions 10 0 11 column_matrix set c2 13]
  if Electron_donor_2 = "NO + N2O -> NO3-" [set rd2 matrix:submatrix reactions 11 0 12 column_matrix set c2 12]
  if Electron_donor_2 = "N2O -> NO3-" [set rd2 matrix:submatrix reactions 12 0 13 column_matrix set c2 12]
  if Electron_donor_2 = "NO -> NO3-" [set rd2 matrix:submatrix reactions 13 0 14 column_matrix set c2 11]
  if Electron_donor_2 = "NO2- -> NO3-" [set rd2 matrix:submatrix reactions 14 0 15 column_matrix set c2 10]
  if Electron_donor_2 = "H2 -> H+" [set rd2 matrix:submatrix reactions 15 0 16 column_matrix set c2 14]
  if Electron_donor_2 = "Fe2+ -> Fe3+" [set rd2 matrix:submatrix reactions 16 0 17 column_matrix set c2 16]
  if Electron_donor_2 = "NH4+ -> N2" [set rd2 matrix:submatrix reactions 17 0 18 column_matrix set c2 4]
  if Electron_donor_2 = "NH4+ -> NO3-" [set rd2 matrix:submatrix reactions 18 0 19 column_matrix set c2 4]
  if Electron_donor_2 = "NH4+ -> NO2-" [set rd2 matrix:submatrix reactions 19 0 20 column_matrix set c2 4]
  if Electron_donor_2 = "Acetate" [set rd2 matrix:submatrix reactions 20 0 21 column_matrix set c2 8]
  if Electron_donor_2 = "Alanine" [set rd2 matrix:submatrix reactions 21 0 22 column_matrix set c2 23]
  if Electron_donor_2 = "Benzoate" [set rd2 matrix:submatrix reactions 22 0 23 column_matrix set c2 24]
  if Electron_donor_2 = "Citrate" [set rd2 matrix:submatrix reactions 23 0 24 column_matrix set c2 26]
  if Electron_donor_2 = "Ethanol" [set rd2 matrix:submatrix reactions 24 0 25 column_matrix set c2 27]
  if Electron_donor_2 = "Formate" [set rd2 matrix:submatrix reactions 25 0 26 column_matrix set c2 28]
  if Electron_donor_2 = "Glucose" [set rd2 matrix:submatrix reactions 26 0 27 column_matrix set c2 29]
  if Electron_donor_2 = "Glutamate" [set rd2 matrix:submatrix reactions 27 0 28 column_matrix set c2 30]
  if Electron_donor_2 = "Glycerol" [set rd2 matrix:submatrix reactions 28 0 29 column_matrix set c2 31]
  if Electron_donor_2 = "Glycine" [set rd2 matrix:submatrix reactions 29 0 30 column_matrix set c2 32]
  if Electron_donor_2 = "Lactate" [set rd2 matrix:submatrix reactions 30 0 31 column_matrix set c2 33]
  if Electron_donor_2 = "Methane" [set rd2 matrix:submatrix reactions 31 0 32 column_matrix set c2 34]
  if Electron_donor_2 = "Methanol" [set rd2 matrix:submatrix reactions 32 0 33 column_matrix set c2 35]
  if Electron_donor_2 = "Palmitate" [set rd2 matrix:submatrix reactions 33 0 34 column_matrix set c2 36]
  if Electron_donor_2 = "Propionate" [set rd2 matrix:submatrix reactions 34 0 35 column_matrix set c2 37]
  if Electron_donor_2 = "Pyruvate" [set rd2 matrix:submatrix reactions 35 0 36 column_matrix set c2 38]
  if Electron_donor_2 = "Succinate" [set rd2 matrix:submatrix reactions 36 0 37 column_matrix set c2 39]
  if Electron_donor_2 = "NTA - Acid nitrilotriacetic" [set rd2 matrix:submatrix reactions 37 0 38 column_matrix set c2 40]

  set e_d1 abs ( 1 / matrix:get rd1 0 c)
  set e_d2 abs ( 1 / matrix:get rd2 0 c2)
  let total_electrons (e_d1 + e_d2)
  set x_d1 (e_d1 / total_electrons)
  set x_d2 (e_d2 / total_electrons)
  set rd (x_d1 matrix:* rd1) matrix:+ (x_d2 matrix:* rd2)
  ]
  [set rd rd1 matrix:+ rd2]
end 

to setup-electron-acceptor
  if Electron_acceptor = "O2 -> H2O" [set ra matrix:submatrix reactions 0 0 1 column_matrix ]
  if Electron_acceptor = "(SO4)2- -> (S2O3)2-" [set ra matrix:submatrix reactions 1 0 2 column_matrix ]
  if Electron_acceptor = "(SO4)2- -> S" [set ra matrix:submatrix reactions 2 0 3 column_matrix ]
  if Electron_acceptor = "(SO4)2- -> (SO3)2-" [set ra matrix:submatrix reactions 3 0 4 column_matrix ]
  if Electron_acceptor = "(SO3)2- -> H2S + HS-" [set ra matrix:submatrix reactions 4 0 5 column_matrix ]
  if Electron_acceptor = "(SO4)2- -> H2S + HS-" [set ra matrix:submatrix reactions 5 0 6 column_matrix ]
  if Electron_acceptor = "N2O -> N2" [set ra matrix:submatrix reactions 6 0 7 column_matrix ]
  if Electron_acceptor = "NO -> N2O" [set ra matrix:submatrix reactions 7 0 8 column_matrix ]
  if Electron_acceptor = "NO2- -> N2" [set ra matrix:submatrix reactions 8 0 9 column_matrix ]
  if Electron_acceptor = "NO2- -> NO" [set ra matrix:submatrix reactions 9 0 10 column_matrix ]
  if Electron_acceptor = "NO3- -> N2" [set ra matrix:submatrix reactions 10 0 11 column_matrix ]
  if Electron_acceptor = "NO3- -> NO + N2O" [set ra matrix:submatrix reactions 11 0 12 column_matrix ]
  if Electron_acceptor = "NO3- -> N2O" [set ra matrix:submatrix reactions 12 0 13 column_matrix ]
  if Electron_acceptor = "NO3- -> NO" [set ra matrix:submatrix reactions 13 0 14 column_matrix ]
  if Electron_acceptor = "NO3- -> NO2-" [set ra matrix:submatrix reactions 14 0 15 column_matrix ]
  if Electron_acceptor = "H+ -> H2" [set ra matrix:submatrix reactions 15 0 16 column_matrix ]
  if Electron_acceptor = "Fe3+ -> Fe2+" [set ra matrix:submatrix reactions 16 0 17 column_matrix ]
  if Electron_acceptor = "N2 -> NH4+" [set ra matrix:submatrix reactions 17 0 18 column_matrix ]
  if Electron_acceptor = "NO3- -> NH4+" [set ra matrix:submatrix reactions 18 0 19 column_matrix ]
  if Electron_acceptor = "NO2- -> NH4+" [set ra matrix:submatrix reactions 19 0 20 column_matrix ]
  if Electron_acceptor = "Acetate" [set ra matrix:submatrix reactions 20 0 21 column_matrix ]
  if Electron_acceptor = "Alanine" [set ra matrix:submatrix reactions 21 0 22 column_matrix ]
  if Electron_acceptor = "Benzoate" [set ra matrix:submatrix reactions 22 0 23 column_matrix ]
  if Electron_acceptor = "Citrate" [set ra matrix:submatrix reactions 23 0 24 column_matrix ]
  if Electron_acceptor = "Ethanol" [set ra matrix:submatrix reactions 24 0 25 column_matrix ]
  if Electron_acceptor = "Formate" [set ra matrix:submatrix reactions 25 0 26 column_matrix ]
  if Electron_acceptor = "Glucose" [set ra matrix:submatrix reactions 26 0 27 column_matrix ]
  if Electron_acceptor = "Glutamate" [set ra matrix:submatrix reactions 27 0 28 column_matrix ]
  if Electron_acceptor = "Glycerol" [set ra matrix:submatrix reactions 28 0 29 column_matrix ]
  if Electron_acceptor = "Glycine" [set ra matrix:submatrix reactions 29 0 30 column_matrix ]
  if Electron_acceptor = "Lactate" [set ra matrix:submatrix reactions 30 0 31 column_matrix ]
  if Electron_acceptor = "Methane" [set ra matrix:submatrix reactions 31 0 32 column_matrix ]
  if Electron_acceptor = "Methanol" [set ra matrix:submatrix reactions 32 0 33 column_matrix ]
  if Electron_acceptor = "Palmitate" [set ra matrix:submatrix reactions 33 0 34 column_matrix ]
  if Electron_acceptor = "Propionate" [set ra matrix:submatrix reactions 34 0 35 column_matrix ]
  if Electron_acceptor = "Pyruvate" [set ra matrix:submatrix reactions 35 0 36 column_matrix ]
  if Electron_acceptor = "Succinate" [set ra matrix:submatrix reactions 36 0 37 column_matrix ]
  if Electron_acceptor = "NTA - Acid nitrilotriacetic" [set ra matrix:submatrix reactions 37 0 38 column_matrix ]
end 

to setup-output
  output-print " "
  ifelse second_electron_donor? = true [output-type "(rd) Electron donor(s) --> " output-type Electron_donor output-type " + " output-type Electron_donor_2 output-print " : "]
  [output-type "(rd) Electron donor --> " output-type Electron_donor output-print " : "]
  set to-print matrix:copy rd
  output-all
  output-print " "
  output-type "(ra) Electron acceptor --> " output-type Electron_acceptor output-print " : "
  set to-print matrix:copy ra
  output-all
  output-print " "
  output-type "(rc) Biomass half reaction : " output-type Microorganism output-type " , N-Source : " output-print N-source
  ifelse (matrix:get b-biomass 0 3) = 0 [ ][output-type precision (matrix:get b-biomass 0 3) 4 output-type " CO2 + "]
  ifelse (matrix:get b-biomass 0 5) = 0 [ ][output-type precision (matrix:get b-biomass 0 5) 4 output-type " HCO3- + "]
  ifelse (matrix:get b-biomass 0 4) = 0 [ ][output-type precision (matrix:get b-biomass 0 4) 4 output-type " NH4+ + "]
  ifelse (matrix:get b-biomass 0 9) = 0 [ ][output-type precision (matrix:get b-biomass 0 9) 4 output-type " NO3- + "]
  ifelse (matrix:get b-biomass 0 10) = 0 [ ][output-type precision (matrix:get b-biomass 0 10) 4 output-type " NO2- + "]
  ifelse (matrix:get b-biomass 0 13) = 0 [ ][output-type precision (matrix:get b-biomass 0 13) 4 output-type " N2 + "]
  ifelse (matrix:get b-biomass 0 1) = 0 [ ][output-type precision (matrix:get b-biomass 0 1) 4 output-type " H+ + "]
  ifelse (matrix:get b-biomass 0 2) = 0 [ ][output-type precision (matrix:get b-biomass 0 2) 4 output-type " e- --> "]
  output-type precision abs (matrix:get b-biomass 0 6) 4 output-type " C'" output-type carbon output-type "'H'" output-type hydrogen output-type "'O'" output-type oxygen output-type "'N'" output-type nitrogen output-type " + "
  output-type precision abs (matrix:get b-biomass 0 7) 4 output-type " H2O "
  output-type "[ ∆G = " output-type precision (matrix:get b-biomass 0 25) 4 output-print " KJ/e-eq ]"
  output-print " "
  output-print "Energy reaction : "
  set to-print matrix:copy energy_reaction
  output-all
  output-print " "
  output-print "Synthesis reaction : "
  set to-print matrix:copy synthesis_reaction
  output-all
  output-print " "
  output-type "Balanced equation using " output-type Thermodynamics output-print " : "
  output-type "[ fe = " output-type precision fe 2 output-type " ] [ fs = " output-type precision fs 2 output-type " ] [ e = " output-type efficiency output-print " ]"
  set to-print matrix:copy reaction
  output-all
  output-print " "
  output-print "Yield prediction :"
  output-type "Yg/m = " output-type precision y_grams_cells/mol_donor 3
  if Electron_donor = "H2S + HS- -> (SO3)2-" or Electron_donor = "H2S + HS- -> (SO4)2-" [output-print " [ grams_cells/mol_H2S ]"]
  ifelse Electron_donor = "NO + N2O -> NO3-" [output-print " [ grams_cells/mol_N2O ]"][output-print " [ grams_cells/mol_donor ]"]
  output-type "Yc/m = " output-type precision y_mol_C_cell/mol_donor 3
  if Electron_donor = "H2S + HS- -> (SO3)2-" or Electron_donor = "H2S + HS- -> (SO4)2-" [output-print " [ mol_C_cell/mol_H2S ]"]
  ifelse Electron_donor = "NO + N2O -> NO3-" [output-print " [ mol_C_cells/mol_N2O ]"][output-print " [ mol_C_cells/mol_donor ]"]
  ifelse yc/c = 0 [ ][output-type "Yc/c = " output-type precision yc/c 3 output-print " [ mol_C_cell/mol_C_donor ]"]
end 

to output-all
ifelse (matrix:get to-print 0 8) <= 0 [ ][output-type "+ " output-type precision (matrix:get to-print 0 8) 4 output-type " CH3COO- "]
ifelse (matrix:get to-print 0 23) <= 0 [ ][output-type "+ " output-type precision (matrix:get to-print 0 23) 4 output-type " CH3CHNH2COO- "]
ifelse (matrix:get to-print 0 24) <= 0 [ ][output-type "+ " output-type precision (matrix:get to-print 0 24) 4 output-type " C6H5COO- "]
ifelse (matrix:get to-print 0 26) <= 0 [ ][output-type "+ " output-type precision (matrix:get to-print 0 26) 4 output-type " (COO-)CH2COH(COO-)CH2COO- "]
ifelse (matrix:get to-print 0 27) <= 0 [ ][output-type "+ " output-type precision (matrix:get to-print 0 27) 4 output-type " CH3CH2OH "]
ifelse (matrix:get to-print 0 28) <= 0 [ ][output-type "+ " output-type precision (matrix:get to-print 0 28) 4 output-type " HCOO- "]
ifelse (matrix:get to-print 0 29) <= 0 [ ][output-type "+ " output-type precision (matrix:get to-print 0 29) 4 output-type " C6H12O6 "]
ifelse (matrix:get to-print 0 30) <= 0 [ ][output-type "+ " output-type precision (matrix:get to-print 0 30) 4 output-type " COOHCH2CH2CHNH2COO- "]
ifelse (matrix:get to-print 0 31) <= 0 [ ][output-type "+ " output-type precision (matrix:get to-print 0 31) 4 output-type " CH2OHCHOHCH2OH "]
ifelse (matrix:get to-print 0 32) <= 0 [ ][output-type "+ " output-type precision (matrix:get to-print 0 32) 4 output-type " CH2NH2COOH "]
ifelse (matrix:get to-print 0 33) <= 0 [ ][output-type "+ " output-type precision (matrix:get to-print 0 33) 4 output-type " CH3CHOHCOO- "]
ifelse (matrix:get to-print 0 34) <= 0 [ ][output-type "+ " output-type precision (matrix:get to-print 0 34) 4 output-type " CH4 "]
ifelse (matrix:get to-print 0 35) <= 0 [ ][output-type "+ " output-type precision (matrix:get to-print 0 35) 4 output-type " CH3OH "]
ifelse (matrix:get to-print 0 36) <= 0 [ ][output-type "+ " output-type precision (matrix:get to-print 0 36) 4 output-type " CH3(CH2)14COO- "]
ifelse (matrix:get to-print 0 37) <= 0 [ ][output-type "+ " output-type precision (matrix:get to-print 0 37) 4 output-type " CH3CH2COO- "]
ifelse (matrix:get to-print 0 38) <= 0 [ ][output-type "+ " output-type precision (matrix:get to-print 0 38) 4 output-type " CH3COCOO- "]
ifelse (matrix:get to-print 0 39) <= 0 [ ][output-type "+ " output-type precision (matrix:get to-print 0 39) 4 output-type " (C4H4O4)2- "]
ifelse (matrix:get to-print 0 40) <= 0 [ ][output-type "+ " output-type precision (matrix:get to-print 0 40) 4 output-type " (C6H6O6N)3- "]
ifelse (matrix:get to-print 0 0) <= 0 [ ][output-type "+ " output-type precision (matrix:get to-print 0 0) 4 output-type " O2 "]
ifelse (matrix:get to-print 0 3) <= 0 [ ][output-type "+ " output-type precision (matrix:get to-print 0 3) 4 output-type " CO2 "]
ifelse (matrix:get to-print 0 4) <= 0 [ ][output-type "+ " output-type precision (matrix:get to-print 0 4) 4 output-type " NH4+ "]
ifelse (matrix:get to-print 0 5) <= 0 [ ][output-type "+ " output-type precision (matrix:get to-print 0 5) 4 output-type " HCO3- "]
ifelse (matrix:get to-print 0 6) <= 0 [ ][output-type "+ " output-type precision (matrix:get to-print 0 6) 4 output-type " C'" output-type carbon output-type "'H'" output-type hydrogen output-type "'O'" output-type oxygen output-type "'N'" output-type nitrogen output-type " "]
ifelse (matrix:get to-print 0 7) <= 0 [ ][output-type "+ " output-type precision (matrix:get to-print 0 7) 4 output-type " H2O "]
ifelse (matrix:get to-print 0 9) <= 0 [ ][output-type "+ " output-type precision (matrix:get to-print 0 9) 4 output-type " NO3- "]
ifelse (matrix:get to-print 0 10) <= 0 [ ][output-type "+ " output-type precision (matrix:get to-print 0 10) 4 output-type " NO2- "]
ifelse (matrix:get to-print 0 11) <= 0 [ ][output-type "+ " output-type precision (matrix:get to-print 0 11) 4 output-type " NO "]
ifelse (matrix:get to-print 0 12) <= 0 [ ][output-type "+ " output-type precision (matrix:get to-print 0 12) 4 output-type " N2O "]
ifelse (matrix:get to-print 0 13) <= 0 [ ][output-type "+ " output-type precision (matrix:get to-print 0 13) 4 output-type " N2 "]
ifelse (matrix:get to-print 0 14) <= 0 [ ][output-type "+ " output-type precision (matrix:get to-print 0 14) 4 output-type " H2 "]
ifelse (matrix:get to-print 0 15) <= 0 [ ][output-type "+ " output-type precision (matrix:get to-print 0 15) 4 output-type " Fe3+ "]
ifelse (matrix:get to-print 0 16) <= 0 [ ][output-type "+ " output-type precision (matrix:get to-print 0 16) 4 output-type " Fe2+ "]
ifelse (matrix:get to-print 0 17) <= 0 [ ][output-type "+ " output-type precision (matrix:get to-print 0 17) 4 output-type " (SO4)2- "]
ifelse (matrix:get to-print 0 18) <= 0 [ ][output-type "+ " output-type precision (matrix:get to-print 0 18) 4 output-type " (SO3)2- "]
ifelse (matrix:get to-print 0 19) <= 0 [ ][output-type "+ " output-type precision (matrix:get to-print 0 19) 4 output-type " H2S "]
ifelse (matrix:get to-print 0 20) <= 0 [ ][output-type "+ " output-type precision (matrix:get to-print 0 20) 4 output-type " HS- "]
ifelse (matrix:get to-print 0 21) <= 0 [ ][output-type "+ " output-type precision (matrix:get to-print 0 21) 4 output-type " (S2O3)2- "]
ifelse (matrix:get to-print 0 22) <= 0 [ ][output-type "+ " output-type precision (matrix:get to-print 0 22) 4 output-type " S "]
ifelse (matrix:get to-print 0 1) <= 0 [ ][output-type "+ " output-type precision (matrix:get to-print 0 1) 4 output-type " H+ "]
ifelse (matrix:get to-print 0 2) <= 0 [ ][output-type "+ " output-type precision (matrix:get to-print 0 2) 4 output-type " e- "]
output-type "--> "
ifelse (matrix:get to-print 0 6) >= 0 [ ][output-type precision abs (matrix:get to-print 0 6) 4 output-type " C'" output-type carbon output-type "'H'" output-type hydrogen output-type "'O'" output-type oxygen output-type "'N'" output-type nitrogen output-type " "]
ifelse (matrix:get to-print 0 8) >= 0 [ ][output-type "+ " output-type precision abs (matrix:get to-print 0 8) 4 output-type " CH3COO- "]
ifelse (matrix:get to-print 0 23) >= 0 [ ][output-type "+ " output-type precision abs (matrix:get to-print 0 23) 4 output-type " CH3CHNH2COO- "]
ifelse (matrix:get to-print 0 24) >= 0 [ ][output-type "+ " output-type precision abs (matrix:get to-print 0 24) 4 output-type " C6H5COO- "]
ifelse (matrix:get to-print 0 26) >= 0 [ ][output-type "+ " output-type precision abs(matrix:get to-print 0 26) 4 output-type " (COO-)CH2COH(COO-)CH2COO- "]
ifelse (matrix:get to-print 0 27) >= 0 [ ][output-type "+ " output-type precision abs (matrix:get to-print 0 27) 4 output-type " CH3CH2OH "]
ifelse (matrix:get to-print 0 28) >= 0 [ ][output-type "+ " output-type precision abs (matrix:get to-print 0 28) 4 output-type " HCOO- "]
ifelse (matrix:get to-print 0 29) >= 0 [ ][output-type "+ " output-type precision abs (matrix:get to-print 0 29) 4 output-type " C6H12O6 "]
ifelse (matrix:get to-print 0 30) >= 0 [ ][output-type "+ " output-type precision abs (matrix:get to-print 0 30) 4 output-type " COOHCH2CH2CHNH2COO- "]
ifelse (matrix:get to-print 0 31) >= 0 [ ][output-type "+ " output-type precision abs (matrix:get to-print 0 31) 4 output-type " CH2OHCHOHCH2OH "]
ifelse (matrix:get to-print 0 32) >= 0 [ ][output-type "+ " output-type precision abs (matrix:get to-print 0 32) 4 output-type " CH2NH2COOH "]
ifelse (matrix:get to-print 0 33) >= 0 [ ][output-type "+ " output-type precision abs (matrix:get to-print 0 33) 4 output-type " CH3CHOHCOO- "]
ifelse (matrix:get to-print 0 34) >= 0 [ ][output-type "+ " output-type precision abs (matrix:get to-print 0 34) 4 output-type " CH4 "]
ifelse (matrix:get to-print 0 35) >= 0 [ ][output-type "+ " output-type precision abs (matrix:get to-print 0 35) 4 output-type " CH3OH "]
ifelse (matrix:get to-print 0 36) >= 0 [ ][output-type "+ " output-type precision abs (matrix:get to-print 0 36) 4 output-type " CH3(CH2)14COO- "]
ifelse (matrix:get to-print 0 37) >= 0 [ ][output-type "+ " output-type precision abs (matrix:get to-print 0 37) 4 output-type " CH3CH2COO- "]
ifelse (matrix:get to-print 0 38) >= 0 [ ][output-type "+ " output-type precision abs (matrix:get to-print 0 38) 4 output-type " CH3COCOO- "]
ifelse (matrix:get to-print 0 39) >= 0 [ ][output-type "+ " output-type precision abs (matrix:get to-print 0 39) 4 output-type " (C4H4O4)2- "]
ifelse (matrix:get to-print 0 40) >= 0 [ ][output-type "+ " output-type precision abs (matrix:get to-print 0 40) 4 output-type " (C6H6O6N)3- "]
ifelse (matrix:get to-print 0 0) >= 0 [ ][output-type "+ " output-type precision abs (matrix:get to-print 0 0) 4 output-type " O2 "]
ifelse (matrix:get to-print 0 1) >= 0 [ ][output-type "+ " output-type precision abs (matrix:get to-print 0 1) 4 output-type " H+ "]
ifelse (matrix:get to-print 0 2) >= 0 [ ][output-type "+ " output-type precision abs (matrix:get to-print 0 2) 4 output-type " e- "]
ifelse (matrix:get to-print 0 3) >= 0 [ ][output-type "+ " output-type precision abs (matrix:get to-print 0 3) 4 output-type " CO2 "]
ifelse (matrix:get to-print 0 4) >= 0 [ ][output-type "+ " output-type precision abs (matrix:get to-print 0 4) 4 output-type " NH4+ "]
ifelse (matrix:get to-print 0 5) >= 0 [ ][output-type "+ " output-type precision abs (matrix:get to-print 0 5) 4 output-type " HCO3- "]
ifelse (matrix:get to-print 0 9) >= 0 [ ][output-type "+ " output-type precision abs (matrix:get to-print 0 9) 4 output-type " NO3- "]
ifelse (matrix:get to-print 0 10) >= 0 [ ][output-type "+ " output-type precision abs (matrix:get to-print 0 10) 4 output-type " NO2- "]
ifelse (matrix:get to-print 0 11) >= 0 [ ][output-type "+ " output-type precision abs (matrix:get to-print 0 11) 4 output-type " NO "]
ifelse (matrix:get to-print 0 12) >= 0 [ ][output-type "+ " output-type precision abs (matrix:get to-print 0 12) 4 output-type " N2O "]
ifelse (matrix:get to-print 0 13) >= 0 [ ][output-type "+ " output-type precision abs (matrix:get to-print 0 13) 4 output-type " N2 "]
ifelse (matrix:get to-print 0 14) >= 0 [ ][output-type "+ " output-type precision abs (matrix:get to-print 0 14) 4 output-type " H2 "]
ifelse (matrix:get to-print 0 15) >= 0 [ ][output-type "+ " output-type precision abs (matrix:get to-print 0 15) 4 output-type " Fe3+ "]
ifelse (matrix:get to-print 0 16) >= 0 [ ][output-type "+ " output-type precision abs (matrix:get to-print 0 16) 4 output-type " Fe2+ "]
ifelse (matrix:get to-print 0 17) >= 0 [ ][output-type "+ " output-type precision abs (matrix:get to-print 0 17) 4 output-type " (SO4)2- "]
ifelse (matrix:get to-print 0 18) >= 0 [ ][output-type "+ " output-type precision abs (matrix:get to-print 0 18) 4 output-type " (SO3)2- "]
ifelse (matrix:get to-print 0 19) >= 0 [ ][output-type "+ " output-type precision abs (matrix:get to-print 0 19) 4 output-type " H2S "]
ifelse (matrix:get to-print 0 20) >= 0 [ ][output-type "+ " output-type precision abs (matrix:get to-print 0 20) 4 output-type " HS- "]
ifelse (matrix:get to-print 0 21) >= 0 [ ][output-type "+ " output-type precision abs (matrix:get to-print 0 21) 4 output-type " (S2O3)2- "]
ifelse (matrix:get to-print 0 22) >= 0 [ ][output-type "+ " output-type precision abs (matrix:get to-print 0 22) 4 output-type " S "]
ifelse (matrix:get to-print 0 7) >= 0 [ ][output-type "+ " output-type precision abs (matrix:get to-print 0 7) 4 output-type " H2O "]
ifelse to-print = reaction or to-print = energy_reaction or to-print = synthesis_reaction[ ][ifelse (matrix:get to-print 0 25) = 0 [ ][output-type "[ ∆G = " output-type precision (matrix:get to-print 0 25) 4 output-type " KJ/e-eq ]"]]
output-print " "
end 

to setup-reactions
set column_matrix 41                   ; type here the number of chemical species involved
set row_matrix (column_matrix - 1)     ; this number is the number of reduction-half-reactions in this version of the tool.

set reactions matrix:make-constant row_matrix column_matrix 0

   matrix:set reactions 0 0 (1 / 4)    ; O2
   matrix:set reactions 0 1 (1)        ; H+
   matrix:set reactions 0 2 (1)        ; e-
   matrix:set reactions 0 7 (-1 / 2)   ; H2O
   matrix:set reactions 0 25 (-78.72)  ; ∆G

   matrix:set reactions 1 17 (1 / 4)   ; (SO4)2-
   matrix:set reactions 1 1 (5 / 4)    ; H+
   matrix:set reactions 1 2 (1)        ; e-
   matrix:set reactions 1 7 (-5 / 8)   ; H2O
   matrix:set reactions 1 21 (-1 / 8)  ; (S2O3)2-
   matrix:set reactions 1 25 (23.58)   ; ∆G

   matrix:set reactions 2 17 (1 / 6)   ; (SO4)2-
   matrix:set reactions 2 1 (4 / 3)    ; H+
   matrix:set reactions 2 2 (1)        ; e-
   matrix:set reactions 2 7 (-2 / 3)   ; H2O
   matrix:set reactions 2 22 (-1 / 6)  ; S
   matrix:set reactions 2 25 (19.15)   ; ∆G

   matrix:set reactions 3 17 (1 / 2)   ; (SO4)2-
   matrix:set reactions 3 1 (1)        ; H+
   matrix:set reactions 3 2 (1)        ; e-
   matrix:set reactions 3 7 (-1 / 2)   ; H2O
   matrix:set reactions 3 18 (-1 / 2)  ; (SO3)2-
   matrix:set reactions 3 25 (50.30)   ; ∆G

   matrix:set reactions 4 18 (1 / 6)    ; (SO3)2-
   matrix:set reactions 4 1 (5 / 4)     ; H+
   matrix:set reactions 4 2 (1)         ; e-
   matrix:set reactions 4 7 (-1 / 2)    ; H2O
   matrix:set reactions 4 19 (-1 / 12)  ; H2S
   matrix:set reactions 4 20 (-1 / 12)  ; HS-
   matrix:set reactions 4 25 (11.03)    ; ∆G

   matrix:set reactions 5 17 (1 / 8)    ; (SO4)2-
   matrix:set reactions 5 1 (19 / 16)   ; H+
   matrix:set reactions 5 2 (1)         ; e-
   matrix:set reactions 5 7 (-1 / 2)    ; H2O
   matrix:set reactions 5 19 (-1 / 16)  ; H2S
   matrix:set reactions 5 20 (-1 / 16)  ; HS-
   matrix:set reactions 5 25 (20.85)    ; ∆G

   matrix:set reactions 6 12 (1 / 2)     ; N2O
   matrix:set reactions 6 1 (1)          ; H+
   matrix:set reactions 6 2 (1)          ; e-
   matrix:set reactions 6 7 (-1 / 2)     ; H2O
   matrix:set reactions 6 13 (-1 / 2)    ; N2
   matrix:set reactions 6 25 (-133.469)  ; ∆G

   matrix:set reactions 7 11 (1)         ; NO
   matrix:set reactions 7 1 (1)          ; H+
   matrix:set reactions 7 2 (1)          ; e-
   matrix:set reactions 7 7 (-1 / 2)     ; H2O
   matrix:set reactions 7 12 (-1 / 2)    ; N2O
   matrix:set reactions 7 25 (-115.829)  ; ∆G

   matrix:set reactions 8 10 (1 / 3)   ; NO2-
   matrix:set reactions 8 1 (4 / 3)    ; H+
   matrix:set reactions 8 2 (1)        ; e-
   matrix:set reactions 8 7 (-2 / 3)   ; H2O
   matrix:set reactions 8 13 (-1 / 6)  ; N2
   matrix:set reactions 8 25 (-92.56)  ; ∆G

   matrix:set reactions 9 10 (1)        ; NO2-
   matrix:set reactions 9 1 (2)         ; H+
   matrix:set reactions 9 2 (1)         ; e-
   matrix:set reactions 9 7 (-1)        ; H2O
   matrix:set reactions 9 11 (-1)       ; NO
   matrix:set reactions 9 25 (-33.718)  ; ∆G

   matrix:set reactions 10 9 (1 / 5)     ; NO3-
   matrix:set reactions 10 1 (6 / 5)     ; H+
   matrix:set reactions 10 2 (1)         ; e-
   matrix:set reactions 10 7 (-3 / 5)    ; H2O
   matrix:set reactions 10 13 (-1 / 10)  ; N2
   matrix:set reactions 10 25 (-72.20)   ; ∆G

   matrix:set reactions 11 9 (7 / 24)    ; NO3-
   matrix:set reactions 11 1 (31 / 24)   ; H+
   matrix:set reactions 11 2 (1)         ; e-
   matrix:set reactions 11 7 (-31 / 48)  ; H2O
   matrix:set reactions 11 11 (-1 / 6)   ; NO
   matrix:set reactions 11 12 (-1 / 16)  ; N2O
   matrix:set reactions 11 25 (-48.274)  ; ∆G

   matrix:set reactions 12 9 (1 / 4)    ; NO3-
   matrix:set reactions 12 1 (5 / 4)    ; H+
   matrix:set reactions 12 2 (1)        ; e-
   matrix:set reactions 12 7 (-5 / 8)   ; H2O
   matrix:set reactions 12 12 (-1 / 8)  ; N2O
   matrix:set reactions 12 25 (-57.54)  ; ∆G

   matrix:set reactions 13 9 (1 / 3)    ; NO3-
   matrix:set reactions 13 1 (4 / 3)    ; H+
   matrix:set reactions 13 2 (1)        ; e-
   matrix:set reactions 13 7 (-2 / 3)   ; H2O
   matrix:set reactions 13 11 (-1 / 3)  ; NO
   matrix:set reactions 13 25 (-39.00)  ; ∆G

   matrix:set reactions 14 9 (1 / 2)    ; NO3-
   matrix:set reactions 14 1 (1)        ; H+
   matrix:set reactions 14 2 (1)        ; e-
   matrix:set reactions 14 7 (-1 / 2)   ; H2O
   matrix:set reactions 14 10 (-1 / 2)  ; NO2-
   matrix:set reactions 14 25 (-41.65)  ; ∆G

   matrix:set reactions 15 1 (1)        ; H+
   matrix:set reactions 15 2 (1)        ; e-
   matrix:set reactions 15 14 (-1 / 2)  ; H2
   matrix:set reactions 15 25 (39.87)   ; ∆G

   matrix:set reactions 16 15 (1)       ; Fe3+
   matrix:set reactions 16 2 (1)        ; e-
   matrix:set reactions 16 16 (-1)      ; Fe2+
   matrix:set reactions 16 25 (-74.27)  ; ∆G

   matrix:set reactions 17 13 (1 / 6)  ; N2
   matrix:set reactions 17 1 (4 / 3)   ; H+
   matrix:set reactions 17 2 (1)       ; e-
   matrix:set reactions 17 4 (-1 / 3)  ; NH4+
   matrix:set reactions 17 25 (26.70)  ; ∆G

   matrix:set reactions 18 9 (1 / 8)    ; NO3-
   matrix:set reactions 18 1 (5 / 4)    ; H+
   matrix:set reactions 18 2 (1)        ; e-
   matrix:set reactions 18 7 (-3 / 8)   ; H2O
   matrix:set reactions 18 4 (-1 / 8)   ; NH4+
   matrix:set reactions 18 25 (-35.11)  ; ∆G

   matrix:set reactions 19 10 (1 / 6)   ; NO2-
   matrix:set reactions 19 1 (4 / 3)    ; H+
   matrix:set reactions 19 2 (1)        ; e-
   matrix:set reactions 19 4 (-1 / 6)   ; NH4+
   matrix:set reactions 19 7 (-1 / 3)   ; H2O
   matrix:set reactions 19 25 (-32.93)  ; ∆G

   matrix:set reactions 20 1 (1)      ; H+
   matrix:set reactions 20 2 (1)      ; e-
   matrix:set reactions 20 3 (1 / 8)  ; CO2
   matrix:set reactions 20 5 (1 / 8)  ; HCO3-
   matrix:set reactions 20 7 (-3 / 8) ; H2O
   matrix:set reactions 20 8 (-1 / 8) ; Acetate
   matrix:set reactions 20 25 (27.40) ; ∆G

   matrix:set reactions 21 1 (11 / 12) ; H+
   matrix:set reactions 21 2 (1)       ; e-
   matrix:set reactions 21 3 (1 / 6)   ; CO2
   matrix:set reactions 21 4 (1 / 12)  ; NH4+
   matrix:set reactions 21 5 (1 / 12)  ; HCO3-
   matrix:set reactions 21 7 (-5 / 12) ; H2O
   matrix:set reactions 21 23 (-1 / 12) ; Alanine
   matrix:set reactions 21 25 (31.37)  ; ∆G

   matrix:set reactions 22 1 (1)        ; H+
   matrix:set reactions 22 2 (1)        ; e-
   matrix:set reactions 22 3 (1 / 5)    ; CO2
   matrix:set reactions 22 5 (1 / 30)   ; HCO3-
   matrix:set reactions 22 7 (-13 / 30) ; H2O
   matrix:set reactions 22 24 (-1 / 30)  ; Benzoate
   matrix:set reactions 22 25 (27.34)   ; ∆G

   matrix:set reactions 23 1 (1)       ; H+
   matrix:set reactions 23 2 (1)       ; e-
   matrix:set reactions 23 3 (1 / 6)   ; CO2
   matrix:set reactions 23 5 (1 / 6)   ; HCO3-
   matrix:set reactions 23 7 (-4 / 9)  ; H2O
   matrix:set reactions 23 26 (-1 / 18) ; Citrate
   matrix:set reactions 23 25 (33.08)  ; ∆G

   matrix:set reactions 24 1 (1)       ; H+
   matrix:set reactions 24 2 (1)       ; e-
   matrix:set reactions 24 3 (1 / 6)   ; CO2
   matrix:set reactions 24 7 (-1 / 4)  ; H2O
   matrix:set reactions 24 27 (-1 / 12) ; Ethanol
   matrix:set reactions 24 25 (31.18)  ; ∆G

   matrix:set reactions 25 1 (1)      ; H+
   matrix:set reactions 25 2 (1)      ; e-
   matrix:set reactions 25 5 (1 / 2)  ; HCO3-
   matrix:set reactions 25 7 (-1 / 2) ; H2O
   matrix:set reactions 25 28 (-1 / 2) ; Formate
   matrix:set reactions 25 25 (39.19) ; ∆G

   matrix:set reactions 26 1 (1)       ; H+
   matrix:set reactions 26 2 (1)       ; e-
   matrix:set reactions 26 3 (1 / 4)   ; CO2
   matrix:set reactions 26 7 (-1 / 4)  ; H2O
   matrix:set reactions 26 29 (-1 / 24) ; Glucose
   matrix:set reactions 26 25 (41.35)  ; ∆G

   matrix:set reactions 27 1 (1)       ; H+
   matrix:set reactions 27 2 (1)       ; e-
   matrix:set reactions 27 3 (1 / 6)   ; CO2
   matrix:set reactions 27 4 (1 / 18)  ; NH4+
   matrix:set reactions 27 5 (1 / 9)   ; HCO3-
   matrix:set reactions 27 7 (-4 / 9)  ; H2O
   matrix:set reactions 27 30 (-1 / 18) ; Glutamate
   matrix:set reactions 27 25 (30.93)  ; ∆G

   matrix:set reactions 28 1 (1)       ; H+
   matrix:set reactions 28 2 (1)       ; e-
   matrix:set reactions 28 3 (3 / 14)  ; CO2
   matrix:set reactions 28 7 (-3 / 14) ; H2O
   matrix:set reactions 28 31 (-1 / 14) ; Glycerol
   matrix:set reactions 28 25 (33.88)  ; ∆G

   matrix:set reactions 29 1 (1)      ; H+
   matrix:set reactions 29 2 (1)      ; e-
   matrix:set reactions 29 3 (1 / 6)  ; CO2
   matrix:set reactions 29 4 (1 / 6)  ; NH4+
   matrix:set reactions 29 5 (1 / 6)  ; HCO3-
   matrix:set reactions 29 7 (-1 / 2) ; H2O
   matrix:set reactions 29 32 (-1 / 6) ; Glycine
   matrix:set reactions 29 25 (39.80) ; ∆G

   matrix:set reactions 30 1 (1)       ; H+
   matrix:set reactions 30 2 (1)       ; e-
   matrix:set reactions 30 3 (1 / 6)   ; CO2
   matrix:set reactions 30 5 (1 / 12)  ; HCO3-
   matrix:set reactions 30 7 (-1 / 3)  ; H2O
   matrix:set reactions 30 33 (-1 / 12) ; Lactato
   matrix:set reactions 30 25 (32.29)  ; ∆G

   matrix:set reactions 31 1 (1)      ; H+
   matrix:set reactions 31 2 (1)      ; e-
   matrix:set reactions 31 3 (1 / 8)  ; CO2
   matrix:set reactions 31 7 (-1 / 4) ; H2O
   matrix:set reactions 31 34 (-1 / 8) ; Methane
   matrix:set reactions 31 25 (23.53) ; ∆G

   matrix:set reactions 32 1 (1)      ; H+
   matrix:set reactions 32 2 (1)      ; e-
   matrix:set reactions 32 3 (1 / 6)  ; CO2
   matrix:set reactions 32 7 (-1 / 6) ; H2O
   matrix:set reactions 32 35 (-1 / 6) ; Methanol
   matrix:set reactions 32 25 (36.84) ; ∆G

   matrix:set reactions 33 1 (1)        ; H+
   matrix:set reactions 33 2 (1)        ; e-
   matrix:set reactions 33 3 (15 / 19)  ; CO2
   matrix:set reactions 33 5 (1 / 92)   ; HCO3-
   matrix:set reactions 33 7 (-31 / 92) ; H2O
   matrix:set reactions 33 36 (-1 / 92)  ; Palmitate
   matrix:set reactions 33 25 (27.26)   ; ∆G

   matrix:set reactions 34 1 (1)       ; H+
   matrix:set reactions 34 2 (1)       ; e-
   matrix:set reactions 34 3 (1 / 7)   ; CO2
   matrix:set reactions 34 5 (1 / 14)  ; HCO3-
   matrix:set reactions 34 7 (-5 / 14) ; H2O
   matrix:set reactions 34 37 (-1 / 14) ; Propionate
   matrix:set reactions 34 25 (27.63)  ; ∆G

   matrix:set reactions 35 1 (1)       ; H+
   matrix:set reactions 35 2 (1)       ; e-
   matrix:set reactions 35 3 (1 / 5)   ; CO2
   matrix:set reactions 35 5 (1 / 10)  ; HCO3-
   matrix:set reactions 35 7 (-2 / 5)  ; H2O
   matrix:set reactions 35 38 (-1 / 10) ; Pyruvate
   matrix:set reactions 35 25 (35.09)  ; ∆G

   matrix:set reactions 36 1 (1)       ; H+
   matrix:set reactions 36 2 (1)       ; e-
   matrix:set reactions 36 3 (1 / 7)   ; CO2
   matrix:set reactions 36 5 (1 / 7)   ; HCO3-
   matrix:set reactions 36 7 (-3 / 7)  ; H2O
   matrix:set reactions 36 39 (-1 / 14) ; Succinate
   matrix:set reactions 36 25 (29.09)  ; ∆G

   matrix:set reactions 37 1 (20 / 18) ; H+
   matrix:set reactions 37 2 (1)       ; e-
   matrix:set reactions 37 4 (1 / 18)  ; NH4+
   matrix:set reactions 37 5 (6 / 18)  ; HCO3-
   matrix:set reactions 37 7 (-12 / 18) ; H2O
   matrix:set reactions 37 40 (-1 / 18) ; NTA - Acid nitrilotriacetic
   matrix:set reactions 37 25 (68.889) ; ∆G
end 

to download
  ifelse second_electron_donor? = true
  [export-output (word (word behaviorspace-run-number"_rd_("Electron_donor"+"Electron_donor_2")_ra_("Electron_acceptor")_rc_("Microorganism")_N-soruce_("N-Source")_with_"Thermodynamics"_with_"efficiency)".txt")]
  [export-output (word (word behaviorspace-run-number"_rd_("Electron_donor")_ra_("Electron_acceptor")_rc_("Microorganism")_N-soruce_("N-Source")_with_"Thermodynamics"_with_"efficiency)".txt")] ; Outputfile name with .txt extension and Behaviorspace numering
end 

There is only one version of this model, created almost 6 years ago by Pablo Alejandro Araujo Granda.

Attached files

File Type Description Last updated
MbT-Tool: Metabolism based on Thermodynamics.png preview Preview for 'MbT-Tool: Metabolism based on Thermodynamics' almost 6 years ago, by Pablo Alejandro Araujo Granda Download

This model does not have any ancestors.

This model does not have any descendants.