Template:Team:Paris Saclay/simbox
From 2013.igem.org
(Difference between revisions)
Line 283: | Line 283: | ||
//Shuffle reaction order | //Shuffle reaction order | ||
shuffle_array(sim.reac_order); | shuffle_array(sim.reac_order); | ||
+ | |||
+ | for(var i= 0 ; i < sim.reac_order.length ; ++i) | ||
+ | { | ||
+ | var usedmols= new Array(); | ||
+ | |||
+ | var reac= sim.reactions[sim.reac_order[i]]; | ||
+ | var proba= reac.probability; | ||
+ | for(var j= 0 ; j < reac.inputs.length ; ++j) | ||
+ | { | ||
+ | var inid= reac.inputs[j]; | ||
+ | if(usedmols[inid] == undefined) | ||
+ | usedmols[inid]= 1; | ||
+ | else | ||
+ | usedmols[inid] ++; | ||
+ | proba *= sim.molecules[inid].quantity; | ||
+ | } | ||
+ | for(var j= 0 ; j < reac.outputs.length ; ++j) | ||
+ | { | ||
+ | var outid= reac.outputs[j]; | ||
+ | if(usedmols[outid] != undefined) | ||
+ | usedmols[outid]--; | ||
+ | } | ||
+ | proba /= Math.pow(sim.volume, reac.inputs.length); | ||
+ | |||
+ | } | ||
for(var i= 0 ; i < sim.molecules.length ; ++i) | for(var i= 0 ; i < sim.molecules.length ; ++i) |
Revision as of 00:09, 3 August 2013