0

接続されている化学反応がいくつかあります。すべての反応には 3 つの利用可能なドナーのうちの 1 つがあり、それらは消費されていくため、最終的には 0 になり、それが起こると反応を実行できなくなります。

したがって、たとえばドナー B の濃度が低く、最初の反応で消費された場合、3 番目の反応は実行できません。

#Reactions look like that. 
#1. A + B -> C +  B_1 
#2. C + G -> D + G_1
#3. D + B -> E + B_1
#4. E + G -> F + G_1
#5. D + H -> J + H_1

それらをExcelで読んでいます。

  wb = open_workbook(reactions)
  ws = wb.sheet_by_index(0)
  n_rows = ws.nrows

  #number of reactions
  no_reactions = n_rows - 1

 components = []
 for i in range(1,n_rows):
    if ws.cell_value(i,reactant_location) not in components:
       components.append(ws.cell_value(i,reactant_location))
    if ws.cell_value(i,product_location) not in components:
       components.append(ws.cell_value(i,product_location))
    if ws.cell_value(i,donor_location) not in components:
       components.append(ws.cell_value(i,donor_location))

 def simple_equation_system(t,c):
    for i in range(1,no_reactions+1):
       cr = components.index(ws.cell_value(i,reactant_location))
       cd = components.index(ws.cell_value(i,donor_location))
       cp = components.index(ws.cell_value(i,product_location)
       r_r = 1 * c[cr] * c[cd]
       dcdt[cr] += -r_r
       dcdt[cp] += r_r
     return dcdt

ドナー濃度を入力する方法がわかりません。そのドナーが「B」であるたびに、ドナーの濃度が 1 減算されます。たとえば、B の濃度が 1 の場合、1 回目、2 回目、5 回目の反応のみが起こり、しかし、3番目と4番目ではありません。

おそらく、すべてのドナーを通過し、それが見つかったときに前のものから減算する for ループを実行する必要があります。

4

0 に答える 0