test_reactions.py 58 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607
  1. #! /usr/bin/env python
  2. from testutils import McellTest
  3. from testutils import get_output_dir
  4. from testutils import cleandir
  5. from reaction_output import RequireCountConstraints
  6. from reaction_output import RequireCountEquilibrium
  7. from reaction_output import RequireCountRxnRate
  8. from reaction_output import RequireCounts
  9. from reaction_output import RequireCountsPositive
  10. from reaction_output import RequireCountsPositiveOrZero
  11. from reaction_output import RequireHitsCrossRelations
  12. from reaction_output import RequireValidTriggerOutput
  13. import unittest
  14. import math
  15. class TestReactionsNumeric(unittest.TestCase):
  16. def test_volume(self):
  17. t = McellTest("reactions", "01-volume_highconc.mdl", ["-quiet"])
  18. t.add_extra_check(RequireCountConstraints("dat/01-volume_highconc/V_out.dat",
  19. [(0, 1, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0),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1000
  32. (0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0), # 1000
  33. (0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0), # 1000
  34. (0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0), # 1000
  35. (0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0), # 1000
  36. (0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1)], # 1000
  37. [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000],
  38. header=True))
  39. t.add_extra_check(RequireCountEquilibrium("dat/01-volume_highconc/V_out.dat",
  40. [500] * 26,
  41. [25] * 26,
  42. header=True))
  43. t.add_extra_check(RequireCountRxnRate("dat/01-volume_highconc/rxn_out.dat",
  44. values=[1e5]*7 + [3.33e4]*1 +[1e5]*7 + [3.33e4]*1,
  45. tolerances=[1.5e4]*7 + [5e3]*1 +[1.5e4]*7 + [5e3]*1,
  46. min_time=5e-3,
  47. base_time=0.0,
  48. header=True))
  49. t.invoke(get_output_dir())
  50. def test_volume_noacc3d(self):
  51. t = McellTest("reactions", "02-volume_highconc_noacc3d.mdl", ["-quiet"])
  52. t.add_extra_check(RequireCountConstraints("dat/02-volume_highconc_noacc3d/V_out.dat",
  53. [(0, 1, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0), # 0
  54. (0, 0, 0, 1, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0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 0, 0, 1, 0, 0, 0, 0), # 1000
  67. (0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0), # 1000
  68. (0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0), # 1000
  69. (0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0), # 1000
  70. (0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1)], # 1000
  71. [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000],
  72. header=True))
  73. t.add_extra_check(RequireCountEquilibrium("dat/02-volume_highconc_noacc3d/V_out.dat",
  74. [500] * 26,
  75. [25] * 26,
  76. header=True))
  77. t.add_extra_check(RequireCountRxnRate("dat/02-volume_highconc_noacc3d/rxn_out.dat",
  78. values= [1e5] * 5 + [2e4] * 3 + [1e5] * 5 + [2e4] * 3,
  79. tolerances=([1.5e4] * 5) + ([6e3] * 3) + ([1.5e4] * 5) + ([6e3] * 3),
  80. min_time=5e-3,
  81. base_time=0.0,
  82. header=True))
  83. t.invoke(get_output_dir())
  84. def test_surface(self):
  85. t = McellTest("reactions", "03-surface.mdl", ["-quiet"])
  86. t.add_extra_check(RequireCountConstraints("dat/03-surface/V_out.dat",
  87. [(0, 1, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0), # 0 /* S_b1 == S_b2 */
  88. (0,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 0, 0), # 1000 /* V_t4 + B_vt2 == 1000 */
  127. (0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0), # 1000 /* V_t7 + B_vt3 == 1000 */
  128. (0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0), # 1000 /* V_vt1 + B_vvt == 1000 */
  129. (0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0), # 1000 /* V_vt4 + B_vvt2 == 1000 */
  130. (0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1)], # 1000 /* V_vt4 + B_vvt2 == 1000 */
  131. [0]*26 + [1000]*18,
  132. header=True))
  133. t.add_extra_check(RequireCountEquilibrium("dat/03-surface/V_out.dat",
  134. [500] * 62,
  135. [25] * 62,
  136. header=True))
  137. t.add_extra_check(RequireCountRxnRate("dat/03-surface/rxn_out.dat",
  138. values= [1e5] * 15 + [1e4]*3 + [1e5] * 15 + [1e4]*3,
  139. tolerances=[1.5e4] * 15 + [7.0e3] * 3 + [1.5e4] * 15 + [7.0e3] * 3,
  140. min_time=5e-3,
  141. base_time=0.0,
  142. header=True))
  143. t.add_extra_check(RequireCountRxnRate("dat/03-surface/b19_rxn_out.dat",
  144. values= [3.3e4] * 4,
  145. tolerances=[0.99e4] * 4,
  146. min_time=5e-3,
  147. base_time=0.0,
  148. header=True))
  149. t.add_extra_check(RequireCountRxnRate("dat/03-surface/b20_rxn_out.dat",
  150. values= [5.0e4] * 1 + [2.5e4] * 3,
  151. tolerances=[1.0e4] * 1 + [0.5e4] * 3,
  152. min_time=5e-3,
  153. base_time=0.0,
  154. header=True))
  155. t.invoke(get_output_dir())
  156. def test_surface_with_surface_class(self):
  157. t = McellTest("reactions", "04-surface.mdl", ["-quiet"])
  158. t.add_extra_check(RequireCountConstraints("dat/04-surface/V_out.dat",
  159. [(0, 1, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0), # 0 /* S_b1 == S_b2 */
  160. (0, 0, 0, 1, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0), # 0 /* S_b3 == S_b4 */
  161. (0, 0, 0, 0, 0, 1, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0), # 0 /* S_bt1 == S_bt2 */
  162. (0, 0, 0, 0, 0, 0, 0, 1, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0), # 0 /* S_bt3 == S_bt4 */
  163. (0, 0, 0, 0, 0, 0, 0, 0, 0, 1, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0), # 0 /* V_b1 == S_vb2 */
  164. (0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0), # 0 /* V_bt1 == S_vbt2 */
  165. (0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0), # 0 /* V_b3 == S_vb4 */
  166. (0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0), # 0 /* V_bt3 == S_vbt4 */
  167. (1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0), # 1000 /* S_u + B_u == 1000 */
  168. (0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0), # 1000 /* S_b1 + B_b == 1000 */
  169. (0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0), # 1000 /* S_b3 + B_b2 == 1000 */
  170. (0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0), # 1000 /* S_bt1 + B_bt == 1000 */
  171. (0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0), # 1000 /* S_bt3 + B_bt2 == 1000 */
  172. (0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0), # 1000 /* V_b1 + B_vb == 1000 */
  173. (0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0), # 1000 /* V_bt1 + B_vbt == 1000 */
  174. (0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0), # 1000 /* V_b3 + B_vb2 == 1000 */
  175. (0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1)], # 1000 /* V_bt3 + B_vbt2 == 1000 */
  176. [0]*8 + [1000]*9,
  177. header=True))
  178. t.add_extra_check(RequireCountEquilibrium("dat/04-surface/V_out.dat",
  179. [500] * 26,
  180. [25] * 26,
  181. header=True))
  182. t.add_extra_check(RequireCountRxnRate("dat/04-surface/rxn_out.dat",
  183. values= [1e5] * 18,
  184. tolerances=[1.5e4] * 18,
  185. min_time=5e-3,
  186. base_time=0.0,
  187. header=True))
  188. t.add_extra_check(RequireCountEquilibrium("dat/04-surface/b13_u_out.dat",
  189. [500] * 2,
  190. [50] * 2,
  191. header=True))
  192. t.add_extra_check(RequireCountRxnRate("dat/04-surface/b13_u_rxn_out.dat",
  193. values= [3.3e4] * 6,
  194. tolerances=[0.99e4] * 6,
  195. min_time=5e-3,
  196. base_time=0.0,
  197. header=True))
  198. t.add_extra_check(RequireCountEquilibrium("dat/04-surface/b14_u_out.dat",
  199. [1000] * 2,
  200. [50] * 2,
  201. header=True))
  202. t.add_extra_check(RequireCountRxnRate("dat/04-surface/b14_u_rxn_out.dat",
  203. values= [8.0e4]*2 + [4.0e4]*2 + [2.4e4]*2,
  204. tolerances=[2.4e4]*2 + [1.2e4]*2 + [0.72e4]*2,
  205. min_time=5e-3,
  206. base_time=0.0,
  207. header=True))
  208. t.add_extra_check(RequireCountEquilibrium("dat/04-surface/b15_u_out.dat",
  209. [1000] * 2,
  210. [50] * 2,
  211. header=True))
  212. t.add_extra_check(RequireCountRxnRate("dat/04-surface/b15_u_rxn_out.dat",
  213. values= [2.4e4]*2 + [4.0e4]*2 + [8.0e4]*2,
  214. tolerances=[0.72e4]*2 + [1.2e4]*2 + [2.4e4]*2,
  215. min_time=5e-3,
  216. base_time=0.0,
  217. header=True))
  218. t.add_extra_check(RequireCountRxnRate("dat/04-surface/b16_b_rxn_out.dat",
  219. values= [5.1e4] * 3,
  220. tolerances=[1.02e4] * 3,
  221. min_time=5e-3,
  222. base_time=0.0,
  223. header=True))
  224. t.add_extra_check(RequireCountRxnRate("dat/04-surface/b17_b_rxn_out.dat",
  225. values= [7.26e4] + [3.63e4] + [2.18e4],
  226. tolerances=[1.04e4] + [0.73e4] + [0.44e4],
  227. min_time=5e-3,
  228. base_time=0.0,
  229. header=True))
  230. t.invoke(get_output_dir())
  231. def test_region_borders_cube(self):
  232. # The test is done on the cube with simple region border geometry.
  233. # Region r1 borders are REFLECTIVE for molecule A, ABSORPTIVE for B,
  234. # and TRANSPARENT for C. Initially we place 100 molecules of each type
  235. # inside region r1. We check that all molecules A are contained
  236. # within r1 and there are none of them in the surrounding region r2.
  237. # Because B has high diffusion coefficient, they all get absorbed
  238. # at the border, and after some time we should register none of them
  239. # inside either r1 or r2. The total count of C as sum across regions
  240. # r1 and r2 is constant over the simulation.
  241. # Region r3 borders are REFLECTIVE for molecules D and E. We place
  242. # 100 molecules D there that also undergo unimolecular reaction
  243. # D @ surface_class -> E[rate]. We check that total sum of D and E
  244. # within the region r3 is equal to 100.
  245. t = McellTest("reactions", "07-region_borders.mdl", ["-quiet"])
  246. t.add_extra_check(RequireCounts("dat/07-region_borders/box_1_A.dat", [(f*1e-6,100,0) for f in range(0,101)], "# Seconds r1_A r2_A"))
  247. t.add_extra_check(RequireCounts("dat/07-region_borders/box_1_B.dat", [(f*1e-6,0,0) for f in range(70,101)], "# Seconds r1_B r2_B"))
  248. t.add_extra_check(RequireCountConstraints("dat/07-region_borders/box_1_C.dat", constraints=[(1,1),(1,1),(1,1),(1,1),(1,1),(1,1),(1,1),(1,1),(1,1),(1,1),
  249. (1,1),(1,1),(1,1),(1,1),(1,1),(1,1),(1,1),(1,1),(1,1),(1,1),
  250. (1,1),(1,1),(1,1),(1,1),(1,1),(1,1),(1,1),(1,1),(1,1),(1,1),
  251. (1,1),(1,1),(1,1),(1,1),(1,1),(1,1),(1,1),(1,1),(1,1),(1,1),
  252. (1,1),(1,1),(1,1),(1,1),(1,1),(1,1),(1,1),(1,1),(1,1),(1,1),
  253. (1,1),(1,1),(1,1),(1,1),(1,1),(1,1),(1,1),(1,1),(1,1),(1,1),
  254. (1,1),(1,1),(1,1),(1,1),(1,1),(1,1),(1,1),(1,1),(1,1),(1,1),
  255. (1,1),(1,1),(1,1),(1,1),(1,1),(1,1),(1,1),(1,1),(1,1),(1,1),
  256. (1,1),(1,1),(1,1),(1,1),(1,1),(1,1),(1,1),(1,1),(1,1),(1,1),
  257. (1,1),(1,1),(1,1),(1,1),(1,1),(1,1),(1,1),(1,1),(1,1),(1,1)],
  258. totals = [100,100,100,100,100,100,100,100,100,100,
  259. 100,100,100,100,100,100,100,100,100,100,
  260. 100,100,100,100,100,100,100,100,100,100,
  261. 100,100,100,100,100,100,100,100,100,100,
  262. 100,100,100,100,100,100,100,100,100,100,
  263. 100,100,100,100,100,100,100,100,100,100,
  264. 100,100,100,100,100,100,100,100,100,100,
  265. 100,100,100,100,100,100,100,100,100,100,
  266. 100,100,100,100,100,100,100,100,100,100,
  267. 100,100,100,100,100,100,100,100,100,100],
  268. header=True))
  269. t.add_extra_check(RequireCountConstraints("dat/07-region_borders/box_1_r3.dat", constraints=[(1,1),(1,1),(1,1),(1,1),(1,1),(1,1),(1,1),(1,1),(1,1),(1,1),
  270. (1,1),(1,1),(1,1),(1,1),(1,1),(1,1),(1,1),(1,1),(1,1),(1,1),
  271. (1,1),(1,1),(1,1),(1,1),(1,1),(1,1),(1,1),(1,1),(1,1),(1,1),
  272. (1,1),(1,1),(1,1),(1,1),(1,1),(1,1),(1,1),(1,1),(1,1),(1,1),
  273. (1,1),(1,1),(1,1),(1,1),(1,1),(1,1),(1,1),(1,1),(1,1),(1,1),
  274. (1,1),(1,1),(1,1),(1,1),(1,1),(1,1),(1,1),(1,1),(1,1),(1,1),
  275. (1,1),(1,1),(1,1),(1,1),(1,1),(1,1),(1,1),(1,1),(1,1),(1,1),
  276. (1,1),(1,1),(1,1),(1,1),(1,1),(1,1),(1,1),(1,1),(1,1),(1,1),
  277. (1,1),(1,1),(1,1),(1,1),(1,1),(1,1),(1,1),(1,1),(1,1),(1,1),
  278. (1,1),(1,1),(1,1),(1,1),(1,1),(1,1),(1,1),(1,1),(1,1),(1,1)],
  279. totals = [100,100,100,100,100,100,100,100,100,100,
  280. 100,100,100,100,100,100,100,100,100,100,
  281. 100,100,100,100,100,100,100,100,100,100,
  282. 100,100,100,100,100,100,100,100,100,100,
  283. 100,100,100,100,100,100,100,100,100,100,
  284. 100,100,100,100,100,100,100,100,100,100,
  285. 100,100,100,100,100,100,100,100,100,100,
  286. 100,100,100,100,100,100,100,100,100,100,
  287. 100,100,100,100,100,100,100,100,100,100,
  288. 100,100,100,100,100,100,100,100,100,100],
  289. header=True))
  290. t.add_extra_check(RequireCounts("dat/07-region_borders/box_2_r4.dat", [(f*1e-6,0) for f in range(70,101)], "# Seconds r4_A"))
  291. t.add_extra_check(RequireCountsPositive("dat/07-region_borders/box_2_A.dat","# Seconds r2_A r3_A"))
  292. t.add_extra_check(RequireCounts("dat/07-region_borders/box_3_r5.dat", [(f*1e-6,200) for f in range(70,101)], "# Seconds r5_A"))
  293. t.add_extra_check(RequireCounts("dat/07-region_borders/box_3_r6.dat", [(f*1e-6,0) for f in range(70,101)], "# Seconds r6_A"))
  294. t.invoke(get_output_dir())
  295. def test_region_borders_sphere(self):
  296. # The test is done on the sphere with complex region border geometry.
  297. # Region r1 boundary crosses the apex of the sphere.
  298. # Region r1 borders are REFLECTIVE for molecule A, ABSORPTIVE for B,
  299. # and TRANSPARENT for C. Initially we place 100 molecules of each type
  300. # inside region r1. We check that all molecules A are contained
  301. # within r1 and there are none of them in the surrounding region r2.
  302. # Because B has high diffusion coefficient, they all get absorbed
  303. # at the border, and after some time we should register none of them
  304. # inside either r1 or r2. The total count of C as sum across regions
  305. # r1 and r2 is constant over the simulation.
  306. # Region r3 borders are REFLECTIVE for molecules D and E. We place
  307. # 100 molecules D there that also undergo unimolecular reaction
  308. # D @ surface_class -> E[rate]. We check that total sum of D and E
  309. # within the region r3 is equal to 100.
  310. # Also TRIGGER statements are checked.
  311. t = McellTest("reactions", "08-region_borders.mdl", ["-quiet"])
  312. t.add_extra_check(RequireCounts("dat/08-region_borders/A.dat", [(f*1e-6,100,0) for f in range(0,101)], "# Seconds r1_A r2_A"))
  313. t.add_extra_check(RequireCounts("dat/08-region_borders/B.dat", [(f*1e-6,0,0) for f in range(99,101)], "# Seconds r1_B r2_B"))
  314. t.add_extra_check(RequireCountConstraints("dat/08-region_borders/C.dat", constraints=[(1,1),(1,1),(1,1),(1,1),(1,1),(1,1),(1,1),(1,1),(1,1),(1,1),
  315. (1,1),(1,1),(1,1),(1,1),(1,1),(1,1),(1,1),(1,1),(1,1),(1,1),
  316. (1,1),(1,1),(1,1),(1,1),(1,1),(1,1),(1,1),(1,1),(1,1),(1,1),
  317. (1,1),(1,1),(1,1),(1,1),(1,1),(1,1),(1,1),(1,1),(1,1),(1,1),
  318. (1,1),(1,1),(1,1),(1,1),(1,1),(1,1),(1,1),(1,1),(1,1),(1,1),
  319. (1,1),(1,1),(1,1),(1,1),(1,1),(1,1),(1,1),(1,1),(1,1),(1,1),
  320. (1,1),(1,1),(1,1),(1,1),(1,1),(1,1),(1,1),(1,1),(1,1),(1,1),
  321. (1,1),(1,1),(1,1),(1,1),(1,1),(1,1),(1,1),(1,1),(1,1),(1,1),
  322. (1,1),(1,1),(1,1),(1,1),(1,1),(1,1),(1,1),(1,1),(1,1),(1,1),
  323. (1,1),(1,1),(1,1),(1,1),(1,1),(1,1),(1,1),(1,1),(1,1),(1,1)],
  324. totals = [100,100,100,100,100,100,100,100,100,100,
  325. 100,100,100,100,100,100,100,100,100,100,
  326. 100,100,100,100,100,100,100,100,100,100,
  327. 100,100,100,100,100,100,100,100,100,100,
  328. 100,100,100,100,100,100,100,100,100,100,
  329. 100,100,100,100,100,100,100,100,100,100,
  330. 100,100,100,100,100,100,100,100,100,100,
  331. 100,100,100,100,100,100,100,100,100,100,
  332. 100,100,100,100,100,100,100,100,100,100,
  333. 100,100,100,100,100,100,100,100,100,100],
  334. header=True))
  335. t.add_extra_check(RequireCountConstraints("dat/08-region_borders/r2.dat", constraints=[(1,1),(1,1),(1,1),(1,1),(1,1),(1,1),(1,1),(1,1),(1,1),(1,1),
  336. (1,1),(1,1),(1,1),(1,1),(1,1),(1,1),(1,1),(1,1),(1,1),(1,1),
  337. (1,1),(1,1),(1,1),(1,1),(1,1),(1,1),(1,1),(1,1),(1,1),(1,1),
  338. (1,1),(1,1),(1,1),(1,1),(1,1),(1,1),(1,1),(1,1),(1,1),(1,1),
  339. (1,1),(1,1),(1,1),(1,1),(1,1),(1,1),(1,1),(1,1),(1,1),(1,1),
  340. (1,1),(1,1),(1,1),(1,1),(1,1),(1,1),(1,1),(1,1),(1,1),(1,1),
  341. (1,1),(1,1),(1,1),(1,1),(1,1),(1,1),(1,1),(1,1),(1,1),(1,1),
  342. (1,1),(1,1),(1,1),(1,1),(1,1),(1,1),(1,1),(1,1),(1,1),(1,1),
  343. (1,1),(1,1),(1,1),(1,1),(1,1),(1,1),(1,1),(1,1),(1,1),(1,1),
  344. (1,1),(1,1),(1,1),(1,1),(1,1),(1,1),(1,1),(1,1),(1,1),(1,1)],
  345. totals = [100,100,100,100,100,100,100,100,100,100,
  346. 100,100,100,100,100,100,100,100,100,100,
  347. 100,100,100,100,100,100,100,100,100,100,
  348. 100,100,100,100,100,100,100,100,100,100,
  349. 100,100,100,100,100,100,100,100,100,100,
  350. 100,100,100,100,100,100,100,100,100,100,
  351. 100,100,100,100,100,100,100,100,100,100,
  352. 100,100,100,100,100,100,100,100,100,100,
  353. 100,100,100,100,100,100,100,100,100,100,
  354. 100,100,100,100,100,100,100,100,100,100],
  355. header=True))
  356. t.add_extra_check(RequireHitsCrossRelations("dat/08-region_borders/A_hits_C_cross.dat", "# Seconds A_fr_hits A_back_hits A_all_hits C_fr_cross C_back_cross C_all_cross"))
  357. t.add_extra_check(RequireValidTriggerOutput("dat/08-region_borders/C_trigger_fr_hits.dat", 1, False, None, None, xrange=(-10,10),yrange=(-10,10),zrange=(-10,10)))
  358. t.add_extra_check(RequireValidTriggerOutput("dat/08-region_borders/C_trigger_back_hits.dat", 1, False, None, None, xrange=(-10,10),yrange=(-10,10),zrange=(-10,10)))
  359. t.add_extra_check(RequireValidTriggerOutput("dat/08-region_borders/C_trigger_all_hits.dat", 1, False, None, None, xrange=(-10,10),yrange=(-10,10),zrange=(-10,10)))
  360. t.add_extra_check(RequireValidTriggerOutput("dat/08-region_borders/C_trigger_fr_cross.dat", 1, False, None, None, xrange=(-10,10),yrange=(-10,10),zrange=(-10,10)))
  361. t.add_extra_check(RequireValidTriggerOutput("dat/08-region_borders/C_trigger_back_cross.dat", 1, False, None, None, xrange=(-10,10),yrange=(-10,10),zrange=(-10,10)))
  362. t.add_extra_check(RequireValidTriggerOutput("dat/08-region_borders/C_trigger_all_cross.dat", 1, False, None, None, xrange=(-10,10),yrange=(-10,10),zrange=(-10,10)))
  363. t.invoke(get_output_dir())
  364. def test_region_borders_cube_all_molecules(self):
  365. # The test is done on the six cubes with simple region
  366. # border geometry.
  367. # Region r1 is TOP, and region r2 consist of all other sides.
  368. # For each of the above cubes region r1 is assigned surface class
  369. # that has properties such TRANSPARENT/REFLECTIVE/ABSORPTIVE
  370. # for ALL_MOLECULES or ALL_SURFACE_MOLECULES.
  371. # Initially we place surface molecules A and B in the amount of
  372. # 100 molecules of each type inside region r1.
  373. # We count molecules A and B in the regions r1 and r2.
  374. t = McellTest("reactions", "09-region_borders.mdl", ["-quiet"])
  375. t.add_extra_check(RequireCounts("dat/09-region_borders/refl_all_mols.dat", [(f*1e-6,100,100,0,0) for f in range(0,101)], "# Seconds r1_A r1_B r2_A r2_B"))
  376. t.add_extra_check(RequireCounts("dat/09-region_borders/refl_all_surface_mols.dat", [(f*1e-6,100,100,0,0) for f in range(0,101)], "# Seconds r1_A r1_B r2_A r2_B"))
  377. t.add_extra_check(RequireCounts("dat/09-region_borders/absorb_all_mols.dat", [(f*1e-6,0,0,0,0) for f in range(90,101)], "# Seconds r1_A r1_B r2_A r2_B"))
  378. t.add_extra_check(RequireCounts("dat/09-region_borders/absorb_all_surface_mols.dat", [(f*1e-6,0,0,0,0) for f in range(90,101)], "# Seconds r1_A r1_B r2_A r2_B"))
  379. t.add_extra_check(RequireCountConstraints("dat/09-region_borders/transp_all_mols.dat", constraints=[(1,1,1,1),(1,1,1,1),(1,1,1,1),(1,1,1,1),(1,1,1,1),(1,1,1,1),(1,1,1,1),(1,1,1,1),(1,1,1,1),(1,1,1,1),
  380. (1,1,1,1),(1,1,1,1),(1,1,1,1),(1,1,1,1),(1,1,1,1),(1,1,1,1),(1,1,1,1),(1,1,1,1),(1,1,1,1),(1,1,1,1),
  381. (1,1,1,1),(1,1,1,1),(1,1,1,1),(1,1,1,1),(1,1,1,1),(1,1,1,1),(1,1,1,1),(1,1,1,1),(1,1,1,1),(1,1,1,1),
  382. (1,1,1,1),(1,1,1,1),(1,1,1,1),(1,1,1,1),(1,1,1,1),(1,1,1,1),(1,1,1,1),(1,1,1,1),(1,1,1,1),(1,1,1,1),
  383. (1,1,1,1),(1,1,1,1),(1,1,1,1),(1,1,1,1),(1,1,1,1),(1,1,1,1),(1,1,1,1),(1,1,1,1),(1,1,1,1),(1,1,1,1),
  384. (1,1,1,1),(1,1,1,1),(1,1,1,1),(1,1,1,1),(1,1,1,1),(1,1,1,1),(1,1,1,1),(1,1,1,1),(1,1,1,1),(1,1,1,1),
  385. (1,1,1,1),(1,1,1,1),(1,1,1,1),(1,1,1,1),(1,1,1,1),(1,1,1,1),(1,1,1,1),(1,1,1,1),(1,1,1,1),(1,1,1,1),
  386. (1,1,1,1),(1,1,1,1),(1,1,1,1),(1,1,1,1),(1,1,1,1),(1,1,1,1),(1,1,1,1),(1,1,1,1),(1,1,1,1),(1,1,1,1),
  387. (1,1,1,1),(1,1,1,1),(1,1,1,1),(1,1,1,1),(1,1,1,1),(1,1,1,1),(1,1,1,1),(1,1,1,1),(1,1,1,1),(1,1,1,1),
  388. (1,1,1,1),(1,1,1,1),(1,1,1,1),(1,1,1,1),(1,1,1,1),(1,1,1,1),(1,1,1,1),(1,1,1,1),(1,1,1,1),(1,1,1,1)],
  389. totals = [200,200,200,200,200,200,200,200,200,200,
  390. 200,200,200,200,200,200,200,200,200,200,
  391. 200,200,200,200,200,200,200,200,200,200,
  392. 200,200,200,200,200,200,200,200,200,200,
  393. 200,200,200,200,200,200,200,200,200,200,
  394. 200,200,200,200,200,200,200,200,200,200,
  395. 200,200,200,200,200,200,200,200,200,200,
  396. 200,200,200,200,200,200,200,200,200,200,
  397. 200,200,200,200,200,200,200,200,200,200,
  398. 200,200,200,200,200,200,200,200,200,200],
  399. header=True))
  400. t.add_extra_check(RequireCountConstraints("dat/09-region_borders/transp_all_surface_mols.dat", constraints=[(1,1,1,1),(1,1,1,1),(1,1,1,1),(1,1,1,1),(1,1,1,1),(1,1,1,1),(1,1,1,1),(1,1,1,1),(1,1,1,1),(1,1,1,1),
  401. (1,1,1,1),(1,1,1,1),(1,1,1,1),(1,1,1,1),(1,1,1,1),(1,1,1,1),(1,1,1,1),(1,1,1,1),(1,1,1,1),(1,1,1,1),
  402. (1,1,1,1),(1,1,1,1),(1,1,1,1),(1,1,1,1),(1,1,1,1),(1,1,1,1),(1,1,1,1),(1,1,1,1),(1,1,1,1),(1,1,1,1),
  403. (1,1,1,1),(1,1,1,1),(1,1,1,1),(1,1,1,1),(1,1,1,1),(1,1,1,1),(1,1,1,1),(1,1,1,1),(1,1,1,1),(1,1,1,1),
  404. (1,1,1,1),(1,1,1,1),(1,1,1,1),(1,1,1,1),(1,1,1,1),(1,1,1,1),(1,1,1,1),(1,1,1,1),(1,1,1,1),(1,1,1,1),
  405. (1,1,1,1),(1,1,1,1),(1,1,1,1),(1,1,1,1),(1,1,1,1),(1,1,1,1),(1,1,1,1),(1,1,1,1),(1,1,1,1),(1,1,1,1),
  406. (1,1,1,1),(1,1,1,1),(1,1,1,1),(1,1,1,1),(1,1,1,1),(1,1,1,1),(1,1,1,1),(1,1,1,1),(1,1,1,1),(1,1,1,1),
  407. (1,1,1,1),(1,1,1,1),(1,1,1,1),(1,1,1,1),(1,1,1,1),(1,1,1,1),(1,1,1,1),(1,1,1,1),(1,1,1,1),(1,1,1,1),
  408. (1,1,1,1),(1,1,1,1),(1,1,1,1),(1,1,1,1),(1,1,1,1),(1,1,1,1),(1,1,1,1),(1,1,1,1),(1,1,1,1),(1,1,1,1),
  409. (1,1,1,1),(1,1,1,1),(1,1,1,1),(1,1,1,1),(1,1,1,1),(1,1,1,1),(1,1,1,1),(1,1,1,1),(1,1,1,1),(1,1,1,1)],
  410. totals = [200,200,200,200,200,200,200,200,200,200,
  411. 200,200,200,200,200,200,200,200,200,200,
  412. 200,200,200,200,200,200,200,200,200,200,
  413. 200,200,200,200,200,200,200,200,200,200,
  414. 200,200,200,200,200,200,200,200,200,200,
  415. 200,200,200,200,200,200,200,200,200,200,
  416. 200,200,200,200,200,200,200,200,200,200,
  417. 200,200,200,200,200,200,200,200,200,200,
  418. 200,200,200,200,200,200,200,200,200,200,
  419. 200,200,200,200,200,200,200,200,200,200],
  420. header=True))
  421. t.invoke(get_output_dir())
  422. def test_surf_properties_all_molecules(self):
  423. # The test is done on the collection of two cubes, one enclosed inside
  424. # the another. The outer cube has REFLECTIVE mesh for ALL_MOLECULES.
  425. # The properties of inner cubes change from REFLECTIVE to TRANSPARENT
  426. # to ABSORPTIVE for ALL_MOLECULES as we move from one collection
  427. # to another. Volume molecules A,B,C are released inside the inner cube.
  428. # We count molecules in the space between the cubes.
  429. t = McellTest("reactions", "10-surf_properties_all_molecules.mdl", ["-quiet"])
  430. t.add_extra_check(RequireCounts("dat/10-surf_properties_all_molecules/refl.dat", [(f*1e-6,0,0,0) for f in range(0,101)], "# Seconds A_diff B_diff C_diff"))
  431. t.add_extra_check(RequireCounts("dat/10-surf_properties_all_molecules/absorp.dat", [(f*1e-6,0,0,0) for f in range(0,101)], "# Seconds A_diff B_diff C_diff"))
  432. t.add_extra_check(RequireCountsPositive("dat/10-surf_properties_all_molecules/transp.dat","# Seconds A_diff B_diff C_diff"))
  433. t.invoke(get_output_dir())
  434. def test_surf_properties_all_volume_molecules(self):
  435. # The test is done on the collection of two cubes, one enclosed inside
  436. # the another. The outer cube has REFLECTIVE mesh for ALL_VOLUME_MOLECULES.
  437. # The properties of inner cubes change from REFLECTIVE to TRANSPARENT
  438. # to ABSORPTIVE for ALL_VOLUME_MOLECULES as we move from one collection
  439. # to another. Volume molecules A,B,C are released inside the inner cube.
  440. # We count molecules in the space between the cubes.
  441. t = McellTest("reactions", "11-surf_properties_all_volume_molecules.mdl", ["-quiet"])
  442. t.add_extra_check(RequireCounts("dat/11-surf_properties_all_volume_molecules/refl.dat", [(f*1e-6,0,0,0) for f in range(0,101)], "# Seconds A_diff B_diff C_diff"))
  443. t.add_extra_check(RequireCounts("dat/11-surf_properties_all_volume_molecules/absorp.dat", [(f*1e-6,0,0,0) for f in range(0,101)], "# Seconds A_diff B_diff C_diff"))
  444. t.add_extra_check(RequireCountsPositive("dat/11-surf_properties_all_volume_molecules/transp.dat","# Seconds A_diff B_diff C_diff"))
  445. t.invoke(get_output_dir())
  446. def test_all_enclosed(self):
  447. # The test is done on the collection of two cubes, one enclosed inside
  448. # the another. The grid molecules A are placed on the surfaces of
  449. # both cubes. The statement COUNT[A,outer[whole_mesh], ALL_ENCLOSED]
  450. # counts number of molecules A on the "inner" cube.
  451. #
  452. # Failure: The count of molecules A is incorrect.
  453. # Success: The count of molecules A is correct.
  454. t = McellTest("reactions", "12-all_enclosed_test.mdl", ["-quiet"])
  455. t.add_extra_check(RequireCounts("dat/12-all_enclosed_test/A.dat", [(f*1e-6,100) for f in range(0,101)]))
  456. t.invoke(get_output_dir())
  457. def test_restricted_borders_reactions(self):
  458. # The test is done on five cubes with simple region border geometry.
  459. # For bimolecular reaction molecules b_A are placed on the RIGHT
  460. # side of the cubes, and molecules b_B are placed on the TOP side.
  461. # For trimolecular reaction molecules t_A and t_B are placed
  462. # on RIGHT side of the cube and molecules t_C are placed on
  463. # TOP side of the cube. We declare the region
  464. # border between TOP and RIGHT restrictive in several different
  465. # ways. There should be no reactions and therefore no reaction
  466. # products D for boxes 1-4. For box_5 the region border is not
  467. # restrictive and so reactions happened and reaction products
  468. # are created.
  469. t = McellTest("reactions", "13-restricted_border_reaction.mdl", ["-quiet"])
  470. t.add_extra_check(RequireCounts("dat/13-restricted_border_reaction/box_1.dat", [(f*1e-6,0) for f in range(0,101)], "# Seconds D"))
  471. t.add_extra_check(RequireCounts("dat/13-restricted_border_reaction/box_2.dat", [(f*1e-6,0) for f in range(0,101)], "# Seconds D"))
  472. t.add_extra_check(RequireCounts("dat/13-restricted_border_reaction/box_3.dat", [(f*1e-6,0) for f in range(0,101)], "# Seconds D"))
  473. t.add_extra_check(RequireCounts("dat/13-restricted_border_reaction/box_4.dat", [(f*1e-6,0) for f in range(0,101)], "# Seconds D"))
  474. t.add_extra_check(RequireCounts("dat/13-restricted_border_reaction/box_6.dat", [(f*1e-6,0) for f in range(0,101)], "# Seconds D"))
  475. t.add_extra_check(RequireCounts("dat/13-restricted_border_reaction/box_7.dat", [(f*1e-6,0) for f in range(0,101)], "# Seconds D"))
  476. t.add_extra_check(RequireCountsPositive("dat/13-restricted_border_reaction/box_5.dat", [(f*1e-6,0) for f in range(90,101)]))
  477. t.add_extra_check(RequireCountsPositive("dat/13-restricted_border_reaction/box_8.dat", [(f*1e-6,0) for f in range(90,101)]))
  478. def test_restricted_borders_product_placement(self):
  479. # The test is done on 19 cubes with simple region border geometry.
  480. # Unimolecular reaction is tested on the boxes 1 and 2, bimolecular
  481. # reaction is tested on boxes 3 and 4, and trimolecular reaction
  482. # on boxes 5 and 6. For these boxes we define region border properties
  483. # as restrictive for some reaction products and in some cases
  484. # for the reactant(s). For boxes 1, 3, and 5 there should be
  485. # no products outside restrictive region r1 boundary.
  486. # For boxes 2, 4, and 6 products F and G should be placed
  487. # outside region r1 since its borders are not restrictive
  488. # for them.
  489. t = McellTest("reactions", "14-restricted_border_product_placement.mdl", ["-quiet"])
  490. t.add_extra_check(RequireCountsPositive("dat/14-restricted_border_product_placement/box_1_r1.dat", "# Iteration_# r1_D r1_E r1_F r1_G"))
  491. t.add_extra_check(RequireCounts("dat/14-restricted_border_product_placement/box_1_r3.dat", [(f,0,0,0,0) for f in range(90,101)], "# Iteration_# r3_D r3_E r3_F r3_G"))
  492. t.add_extra_check(RequireCounts("dat/14-restricted_border_product_placement/box_2_r2.dat", [(f,0,0,0,0) for f in range(90,101)], "# Iteration_# r2_D r2_E r2_F r2_G"))
  493. t.add_extra_check(RequireCountsPositive("dat/14-restricted_border_product_placement/box_2_r3.dat", "# Iteration_# r3_D r3_E r3_F r3_G"))
  494. t.add_extra_check(RequireCountsPositive("dat/14-restricted_border_product_placement/box_3_r1.dat", "# Iteration_# r1_D r1_E r1_F r1_G"))
  495. t.add_extra_check(RequireCountsPositive("dat/14-restricted_border_product_placement/box_3_r2.dat", "# Iteration_# r2_D r2_E r2_F r2_G"))
  496. t.add_extra_check(RequireCountsPositive("dat/14-restricted_border_product_placement/box_4_r1.dat", "# Iteration_# r1_D r1_E r1_F r1_G"))
  497. t.add_extra_check(RequireCounts("dat/14-restricted_border_product_placement/box_4_r2.dat", [(f,0,0,0,0) for f in range(90,101)], "# Iteration_# r2_D r2_E r2_F r2_G"))
  498. t.add_extra_check(RequireCountsPositive("dat/14-restricted_border_product_placement/box_5_r3.dat", "# Iteration_# r3_D r3_E r3_F r3_G"))
  499. t.add_extra_check(RequireCounts("dat/14-restricted_border_product_placement/box_5_r4.dat", [(f,0,0,0,0) for f in range(90,101)], "# Iteration_# r4_D r4_E r4_F r4_G"))
  500. t.add_extra_check(RequireCountsPositive("dat/14-restricted_border_product_placement/box_6_r1.dat", "# Iteration_# r1_D r1_E r1_F r1_G"))
  501. t.add_extra_check(RequireCounts("dat/14-restricted_border_product_placement/box_6_r5.dat", [(f,0,0,0,0) for f in range(90,101)], "# Iteration_# r5_D r5_E r5_F r5_G"))
  502. t.add_extra_check(RequireCountsPositive("dat/14-restricted_border_product_placement/box_7_r1.dat", "# Iteration_# r1_D r1_E r1_F r1_G"))
  503. t.add_extra_check(RequireCounts("dat/14-restricted_border_product_placement/box_7_r3.dat", [(f,0,0,0,0) for f in range(90,101)], "# Iteration_# r3_D r3_E r3_F r3_G"))
  504. t.add_extra_check(RequireCountsPositive("dat/14-restricted_border_product_placement/box_8_r1.dat", "# Iteration_# r1_D r1_E r1_F r1_G"))
  505. t.add_extra_check(RequireCounts("dat/14-restricted_border_product_placement/box_8_r4.dat", [(f,0,0,0,0) for f in range(90,101)], "# Iteration_# r4_D r4_E r4_F r4_G"))
  506. t.add_extra_check(RequireCountsPositive("dat/14-restricted_border_product_placement/box_9_r1.dat", "# Iteration_# r1_D r1_E r1_F r1_G"))
  507. t.add_extra_check(RequireCounts("dat/14-restricted_border_product_placement/box_9_r2.dat", [(f,0,0,0,0) for f in range(90,101)], "# Iteration_# r2_D r2_E r2_F r2_G"))
  508. t.add_extra_check(RequireCountsPositive("dat/14-restricted_border_product_placement/box_10_r1.dat", "# Iteration_# r1_D r1_E r1_F r1_G"))
  509. t.add_extra_check(RequireCountsPositive("dat/14-restricted_border_product_placement/box_10_r2.dat", "# Iteration_# r2_D r2_E r2_F r2_G"))
  510. t.add_extra_check(RequireCountsPositive("dat/14-restricted_border_product_placement/box_11_r1.dat", "# Iteration_# r1_D r1_E r1_F r1_G r1_K r1_L"))
  511. t.add_extra_check(RequireCounts("dat/14-restricted_border_product_placement/box_11_r2.dat", [(f,0,0,0,0,0,0) for f in range(90,101)], "# Iteration_# r2_D r2_E r2_F r2_G r2_K r2_L"))
  512. t.add_extra_check(RequireCountsPositiveOrZero("dat/14-restricted_border_product_placement/box_12_r5.dat", "# Iteration_# r5_D r5_E r5_F r5_G r5_K r5_L"))
  513. t.add_extra_check(RequireCounts("dat/14-restricted_border_product_placement/box_12_r6.dat", [(f,0,0,0,0,0,0) for f in range(90,101)], "# Iteration_# r6_D r6_E r6_F r6_G r6_K r6_L"))
  514. t.add_extra_check(RequireCountsPositive("dat/14-restricted_border_product_placement/box_13_r1.dat", "# Iteration_# r1_D r1_E r1_F r1_G r1_K r1_L"))
  515. t.add_extra_check(RequireCounts("dat/14-restricted_border_product_placement/box_13_r3.dat", [(f,0,0,0,0,0,0) for f in range(90,101)], "# Iteration_# r3_D r3_E r3_F r3_G r3_K r3_L"))
  516. t.add_extra_check(RequireCountsPositive("dat/14-restricted_border_product_placement/box_14_r1.dat", "# Iteration_# r1_D r1_E r1_F r1_G r1_K r1_L"))
  517. t.add_extra_check(RequireCounts("dat/14-restricted_border_product_placement/box_14_r3.dat", [(f,0,0,0,0,0,0) for f in range(90,101)], "# Iteration_# r3_D r3_E r3_F r3_G r3_K r3_L"))
  518. t.add_extra_check(RequireCountsPositive("dat/14-restricted_border_product_placement/box_15_r1.dat", "# Iteration_# r1_D r1_E r1_F r1_G r1_K r1_L"))
  519. t.add_extra_check(RequireCounts("dat/14-restricted_border_product_placement/box_15_r2.dat", [(f,0,0,0,0,0,0) for f in range(90,101)], "# Iteration_# r2_D r2_E r2_F r2_G r2_K r2_L"))
  520. t.add_extra_check(RequireCountsPositive("dat/14-restricted_border_product_placement/box_16_r1.dat", "# Iteration_# r1_D r1_E r1_F r1_G r1_K r1_L"))
  521. t.add_extra_check(RequireCounts("dat/14-restricted_border_product_placement/box_16_r2.dat", [(f,0,0,0,0,0,0) for f in range(90,101)], "# Iteration_# r2_D r2_E r2_F r2_G r2_K r2_L"))
  522. t.add_extra_check(RequireCountsPositive("dat/14-restricted_border_product_placement/box_17_r1.dat", "# Iteration_# r1_D r1_E r1_F r1_G r1_K r1_L"))
  523. t.add_extra_check(RequireCounts("dat/14-restricted_border_product_placement/box_17_r2.dat", [(f,0,0,0,0,0,0) for f in range(90,101)], "# Iteration_# r2_D r2_E r2_F r2_G r2_K r2_L"))
  524. t.add_extra_check(RequireCountsPositive("dat/14-restricted_border_product_placement/box_18_r1.dat", "# Iteration_# r1_D r1_E r1_F r1_G r1_K r1_L"))
  525. t.add_extra_check(RequireCounts("dat/14-restricted_border_product_placement/box_18_r2.dat", [(f,0,0,0,0,0,0) for f in range(90,101)], "# Iteration_# r2_D r2_E r2_F r2_G r2_K r2_L"))
  526. t.add_extra_check(RequireCountsPositive("dat/14-restricted_border_product_placement/box_19_r1.dat", "# Iteration_# r1_D r1_E r1_F r1_G r1_K r1_L"))
  527. t.add_extra_check(RequireCounts("dat/14-restricted_border_product_placement/box_19_r2.dat", [(f,0,0,0,0,0,0) for f in range(90,101)], "# Iteration_# r2_D r2_E r2_F r2_G r2_K r2_L"))
  528. t.invoke(get_output_dir())
  529. def test_restricted_borders_reactions(self):
  530. # The test is done is done on sphere with three overlapping regions.
  531. # Here we test the surface products placement that should follow
  532. # the established policy.
  533. t = McellTest("reactions", "15-overlappingSRs.mdl", ["-quiet"])
  534. t.add_extra_check(RequireCountsPositive("dat/15-overlappingSRs/r4.dat", "# Iteration_# r4_B r4_C r4_D"))
  535. t.add_extra_check(RequireCounts("dat/15-overlappingSRs/r5.dat", [(f,0,0,0) for f in range(90,101)], "# Iteration_# r5_B r5_C r5_D"))
  536. t.invoke(get_output_dir())
  537. def test_surface_products_replace_reactants(self):
  538. # The test is done is done on the number of cubes
  539. # Here we test how surface products replace surface reactants
  540. # that should follow the established policy.
  541. # Mostly here we look into product generation and no segfaults
  542. # during simulation.
  543. t = McellTest("reactions", "16-surf_products_replace_reactants.mdl", ["-quiet"])
  544. t.add_extra_check(RequireCountsPositive("dat/16-surf_products_replace_reactants/box_1.dat"))
  545. t.add_extra_check(RequireCountsPositive("dat/16-surf_products_replace_reactants/box_2.dat"))
  546. t.add_extra_check(RequireCountsPositive("dat/16-surf_products_replace_reactants/box_3.dat"))
  547. t.add_extra_check(RequireCountsPositive("dat/16-surf_products_replace_reactants/box_4_I.dat"))
  548. t.add_extra_check(RequireCountsPositive("dat/16-surf_products_replace_reactants/box_4_b_A3.dat"))
  549. t.add_extra_check(RequireCountsPositive("dat/16-surf_products_replace_reactants/box_5.dat"))
  550. t.add_extra_check(RequireCountsPositive("dat/16-surf_products_replace_reactants/box_6.dat"))
  551. t.add_extra_check(RequireCountsPositive("dat/16-surf_products_replace_reactants/box_7.dat"))
  552. t.add_extra_check(RequireCountsPositive("dat/16-surf_products_replace_reactants/box_8.dat"))
  553. t.add_extra_check(RequireCountsPositive("dat/16-surf_products_replace_reactants/box_9.dat"))
  554. t.add_extra_check(RequireCountsPositive("dat/16-surf_products_replace_reactants/box_10.dat"))
  555. t.add_extra_check(RequireCountsPositive("dat/16-surf_products_replace_reactants/box_11.dat"))
  556. t.add_extra_check(RequireCountsPositive("dat/16-surf_products_replace_reactants/box_12.dat"))
  557. t.invoke(get_output_dir())
  558. ###################################################################
  559. # Generate a test suite for all numeric tests
  560. ###################################################################
  561. def numericsuite():
  562. return unittest.makeSuite(TestReactionsNumeric, "test")
  563. ###################################################################
  564. # Default use of this file will invoke all tests
  565. ###################################################################
  566. if __name__ == "__main__":
  567. cleandir(get_output_dir())
  568. unittest.main()