You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
78 lines
2.0 KiB
78 lines
2.0 KiB
// Mg + 2Cl <--> Mg+2 + 2Cl-
|
|
// dxp/gxn 04/10/04
|
|
|
|
// ctmc model
|
|
stochastic
|
|
|
|
// constants
|
|
const int N1 = 10; // number of Mg molecules
|
|
const int N2 = N1; // number of Cl molecules
|
|
|
|
|
|
// Cl and Cl- module
|
|
module cl
|
|
|
|
cl : [0..N2] init N2;
|
|
// total number of Cl and Cl- molecules is fixed at N2
|
|
// cl is the number of Cl molecules
|
|
// therefore N2-cl is the number of Cl- molecules
|
|
|
|
// reactions with Cl
|
|
[e1] cl>0 -> cl : (cl'=cl-1);
|
|
[e2] cl>0 -> cl : (cl'=cl-1);
|
|
// reactions with CL-
|
|
[e3] cl<N2 -> (N2-cl) : (cl'=cl+1);
|
|
[e4] cl<N2 -> (N2-cl) : (cl'=cl+1);
|
|
|
|
endmodule
|
|
|
|
// Mg, Mg+ and Mg+2 module
|
|
module mg
|
|
|
|
mg : [0..N1] init N1;
|
|
mg_p : [0..N1] init 0;
|
|
// total number of Mg and Mg+ and Mg+2 molecules is fixed at N1
|
|
// mg is the number of Mg molecules
|
|
// mg_p is the number of Mg molecules
|
|
// therefore N1-(mg+mg+) gives the number of Mg+2 molecules
|
|
|
|
[e1] mg>0 & mg_p<N1 -> mg : (mg'=mg-1) & (mg_p'=mg_p+1);
|
|
[e2] mg_p>0 -> mg_p : (mg_p'=mg_p-1);
|
|
[e3] mg_p>0 & mg<N1 -> mg_p : (mg'=mg+1) & (mg_p'=mg_p-1);
|
|
[e4] mg_p+mg<N1 -> N1-(mg_p+mg) : (mg_p'=mg_p+1);
|
|
|
|
endmodule
|
|
|
|
|
|
// base rates
|
|
const double e1rate = 10; // Mg + Cl --> Mg+ + Cl-
|
|
const double e2rate = 100; // Mg+ + Cl --> Mg+2 + Cl-
|
|
const double e3rate = 50; // Mg+ + Cl- --> Mg + Cl
|
|
const double e4rate = 5; // Mg+2 + Cl- --> Mg+ + Cl-
|
|
|
|
// module representing the base rates of reactions
|
|
module base_rates
|
|
|
|
dummy : bool; // dummy variable
|
|
|
|
[e1] true -> e1rate : true;
|
|
[e2] true -> e2rate : true;
|
|
[e3] true -> e3rate : true;
|
|
[e4] true -> e4rate : true;
|
|
|
|
endmodule
|
|
|
|
// rewards (percentage of Mg/Mg+/Mg+2 molecules)
|
|
|
|
// set these variables equal to 0 or 1 depending on reward of interest
|
|
const int mg_reward;
|
|
const int mgplus_reward;
|
|
const int mgplus2_reward;
|
|
|
|
rewards
|
|
|
|
true : mg_reward*100*mg/N1;
|
|
true : mgplus_reward*100*mg_p/N1;
|
|
true : mgplus2_reward*max(100*(N1-(mg_p+mg))/N1,0);
|
|
|
|
endrewards
|