musica 0.12.0__cp312-cp312-win32.whl → 0.12.2__cp312-cp312-win32.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of musica might be problematic. Click here for more details.

Files changed (76) hide show
  1. musica/CMakeLists.txt +28 -2
  2. musica/__init__.py +9 -49
  3. musica/_musica.cp312-win32.pyd +0 -0
  4. musica/_version.py +1 -1
  5. musica/backend.py +41 -0
  6. musica/binding_common.cpp +23 -6
  7. musica/carma.cpp +911 -0
  8. musica/carma.py +1729 -0
  9. musica/constants.py +1 -1
  10. musica/cpu_binding.cpp +2 -1
  11. musica/cuda.py +4 -1
  12. musica/examples/__init__.py +1 -0
  13. musica/examples/carma_aluminum.py +124 -0
  14. musica/examples/carma_sulfate.py +246 -0
  15. musica/examples/examples.py +165 -0
  16. musica/examples/sulfate_box_model.py +439 -0
  17. musica/examples/ts1_latin_hypercube.py +245 -0
  18. musica/gpu_binding.cpp +2 -1
  19. musica/main.py +89 -0
  20. musica/mechanism_configuration/__init__.py +1 -1
  21. musica/mechanism_configuration/aqueous_equilibrium.py +227 -54
  22. musica/mechanism_configuration/arrhenius.py +228 -42
  23. musica/mechanism_configuration/branched.py +249 -66
  24. musica/mechanism_configuration/condensed_phase_arrhenius.py +243 -50
  25. musica/mechanism_configuration/condensed_phase_photolysis.py +16 -19
  26. musica/mechanism_configuration/emission.py +10 -6
  27. musica/mechanism_configuration/first_order_loss.py +133 -26
  28. musica/mechanism_configuration/henrys_law.py +7 -48
  29. musica/mechanism_configuration/mechanism_configuration.py +114 -41
  30. musica/mechanism_configuration/phase.py +6 -2
  31. musica/mechanism_configuration/photolysis.py +12 -7
  32. musica/mechanism_configuration/reactions.py +20 -8
  33. musica/mechanism_configuration/simpol_phase_transfer.py +180 -51
  34. musica/mechanism_configuration/species.py +23 -4
  35. musica/mechanism_configuration/surface.py +14 -9
  36. musica/mechanism_configuration/ternary_chemical_activation.py +352 -0
  37. musica/mechanism_configuration/troe.py +259 -44
  38. musica/mechanism_configuration/tunneling.py +196 -49
  39. musica/mechanism_configuration/user_defined.py +9 -4
  40. musica/mechanism_configuration/wet_deposition.py +11 -8
  41. musica/mechanism_configuration.cpp +184 -95
  42. musica/musica.cpp +48 -61
  43. musica/test/examples/v1/full_configuration/full_configuration.json +39 -22
  44. musica/test/examples/v1/full_configuration/full_configuration.yaml +29 -20
  45. musica/test/{test_analytical.py → integration/test_analytical.py} +0 -1
  46. musica/test/integration/test_carma.py +227 -0
  47. musica/test/integration/test_carma_aluminum.py +12 -0
  48. musica/test/integration/test_carma_sulfate.py +17 -0
  49. musica/test/integration/test_sulfate_box_model.py +34 -0
  50. musica/test/integration/test_tuvx.py +62 -0
  51. musica/test/unit/test_parser.py +64 -0
  52. musica/test/{test_serializer.py → unit/test_serializer.py} +2 -2
  53. musica/test/unit/test_state.py +325 -0
  54. musica/test/{test_util_full_mechanism.py → unit/test_util_full_mechanism.py} +152 -122
  55. musica/tools/prepare_build_environment_linux.sh +23 -34
  56. musica/tools/prepare_build_environment_macos.sh +1 -0
  57. musica/tuvx.cpp +93 -0
  58. musica/tuvx.py +199 -0
  59. musica/types.py +120 -73
  60. {musica-0.12.0.dist-info → musica-0.12.2.dist-info}/METADATA +41 -39
  61. musica-0.12.2.dist-info/RECORD +70 -0
  62. {musica-0.12.0.dist-info → musica-0.12.2.dist-info}/WHEEL +1 -1
  63. musica-0.12.2.dist-info/entry_points.txt +3 -0
  64. musica/test/examples/v0/config.json +0 -7
  65. musica/test/examples/v0/config.yaml +0 -3
  66. musica/test/examples/v0/reactions.json +0 -193
  67. musica/test/examples/v0/reactions.yaml +0 -142
  68. musica/test/examples/v0/species.json +0 -40
  69. musica/test/examples/v0/species.yaml +0 -19
  70. musica/test/test_parser.py +0 -57
  71. musica/test/tuvx.py +0 -10
  72. musica/tools/prepare_build_environment_windows.sh +0 -22
  73. musica-0.12.0.dist-info/RECORD +0 -57
  74. /musica/test/{test_chapman.py → integration/test_chapman.py} +0 -0
  75. {musica-0.12.0.dist-info → musica-0.12.2.dist-info}/licenses/AUTHORS.md +0 -0
  76. {musica-0.12.0.dist-info → musica-0.12.2.dist-info}/licenses/LICENSE +0 -0
@@ -1,14 +1,13 @@
1
- from musica.mechanism_configuration import *
2
- from musica import _ReactionType
1
+ import musica.mechanism_configuration as mc
3
2
 
4
3
 
5
4
  def get_fully_defined_mechanism():
6
5
  # Chemical species
7
- A = Species(name="A", other_properties={"__absolute tolerance": "1.0e-30"})
8
- B = Species(name="B", tracer_type="AEROSOL")
9
- C = Species(name="C", tracer_type="THIRD_BODY")
10
- M = Species(name="M")
11
- H2O2 = Species(
6
+ A = mc.Species(name="A", other_properties={"__absolute tolerance": "1.0e-30"})
7
+ B = mc.Species(name="B", tracer_type="AEROSOL")
8
+ C = mc.Species(name="C", tracer_type="THIRD_BODY")
9
+ M = mc.Species(name="M")
10
+ H2O2 = mc.Species(
12
11
  name="H2O2",
13
12
  HLC_298K_mol_m3_Pa=1.011596348,
14
13
  HLC_exponential_factor_K=6340,
@@ -18,37 +17,37 @@ def get_fully_defined_mechanism():
18
17
  density_kg_m3=1000.0,
19
18
  other_properties={"__absolute tolerance": "1.0e-10"},
20
19
  )
21
- ethanol = Species(
20
+ ethanol = mc.Species(
22
21
  name="ethanol",
23
22
  diffusion_coefficient_m2_s=0.95e-05,
24
23
  N_star=2.55,
25
24
  molecular_weight_kg_mol=0.04607,
26
25
  other_properties={"__absolute tolerance": "1.0e-20"},
27
26
  )
28
- ethanol_aq = Species(
27
+ ethanol_aq = mc.Species(
29
28
  name="ethanol_aq",
30
29
  molecular_weight_kg_mol=0.04607,
31
30
  density_kg_m3=1000.0,
32
31
  other_properties={"__absolute tolerance": "1.0e-20"},
33
32
  )
34
- H2O2_aq = Species(
33
+ H2O2_aq = mc.Species(
35
34
  name="H2O2_aq",
36
35
  molecular_weight_kg_mol=0.0340147,
37
36
  density_kg_m3=1000.0,
38
37
  other_properties={"__absolute tolerance": "1.0e-10"},
39
38
  )
40
- H2O_aq = Species(
39
+ H2O_aq = mc.Species(
41
40
  name="H2O_aq",
42
41
  density_kg_m3=1000.0,
43
42
  molecular_weight_kg_mol=0.01801,
44
43
  )
45
- aerosol_stuff = Species(
44
+ aerosol_stuff = mc.Species(
46
45
  name="aerosol stuff",
47
46
  molecular_weight_kg_mol=0.5,
48
47
  density_kg_m3=1000.0,
49
48
  other_properties={"__absolute tolerance": "1.0e-20"},
50
49
  )
51
- more_aerosol_stuff = Species(
50
+ more_aerosol_stuff = mc.Species(
52
51
  name="more aerosol stuff",
53
52
  molecular_weight_kg_mol=0.2,
54
53
  density_kg_m3=1000.0,
@@ -56,29 +55,29 @@ def get_fully_defined_mechanism():
56
55
  )
57
56
 
58
57
  # Chemical phases
59
- gas = Phase(name="gas", species=[A, B, C, ethanol])
60
- aqueous_aerosol = Phase(
58
+ gas = mc.Phase(name="gas", species=[A, B, C, ethanol])
59
+ aqueous_aerosol = mc.Phase(
61
60
  name="aqueous aerosol",
62
61
  species=[H2O2_aq, H2O_aq, ethanol_aq, A, B, C],
63
- other_properties = {"__irrelevant": "2"},
62
+ other_properties={"__irrelevant": "2"},
64
63
  )
65
- surface_reacting_phase = Phase(
64
+ surface_reacting_phase = mc.Phase(
66
65
  name="surface reacting phase",
67
66
  species=[aerosol_stuff, more_aerosol_stuff]
68
67
  )
69
- cloud = Phase(name="cloud", species=[B, C])
68
+ cloud = mc.Phase(name="cloud", species=[B, C])
70
69
 
71
70
  # Reactions
72
- my_arrhenius = Arrhenius(
71
+ my_arrhenius = mc.Arrhenius(
73
72
  name="my arrhenius",
74
73
  A=32.1, B=-2.3, C=102.3, D=63.4, E=-1.3,
75
74
  gas_phase=gas,
76
75
  reactants=[B],
77
76
  products=[C],
78
- other_properties = {"__irrelevant": "2"},
77
+ other_properties={"__irrelevant": "2"},
79
78
  )
80
79
 
81
- my_other_arrhenius = Arrhenius(
80
+ my_other_arrhenius = mc.Arrhenius(
82
81
  name="my other arrhenius",
83
82
  A=29.3, B=-1.5, Ea=101.2, D=82.6, E=-0.98,
84
83
  gas_phase=gas,
@@ -86,10 +85,9 @@ def get_fully_defined_mechanism():
86
85
  products=[(1.2, B)]
87
86
  )
88
87
 
89
- my_condensed_arrhenius = CondensedPhaseArrhenius(
88
+ my_condensed_arrhenius = mc.CondensedPhaseArrhenius(
90
89
  name="my condensed arrhenius",
91
- aerosol_phase=aqueous_aerosol,
92
- aerosol_phase_water=H2O_aq,
90
+ condensed_phase=aqueous_aerosol,
93
91
  A=123.45,
94
92
  B=1.3,
95
93
  Ea=123.45,
@@ -97,13 +95,12 @@ def get_fully_defined_mechanism():
97
95
  E=0.6e-5,
98
96
  reactants=[H2O2_aq, H2O_aq],
99
97
  products=[ethanol_aq],
100
- other_properties = {"__irrelevant": "2"},
98
+ other_properties={"__irrelevant": "2"},
101
99
  )
102
100
 
103
- my_other_condensed_arrhenius = CondensedPhaseArrhenius(
101
+ my_other_condensed_arrhenius = mc.CondensedPhaseArrhenius(
104
102
  name="my other condensed arrhenius",
105
- aerosol_phase=aqueous_aerosol,
106
- aerosol_phase_water=H2O_aq,
103
+ condensed_phase=aqueous_aerosol,
107
104
  A=123.45,
108
105
  B=1.3,
109
106
  C=123.45,
@@ -113,7 +110,7 @@ def get_fully_defined_mechanism():
113
110
  products=[ethanol_aq]
114
111
  )
115
112
 
116
- my_troe = Troe(
113
+ my_troe = mc.Troe(
117
114
  name="my troe",
118
115
  gas_phase=gas,
119
116
  k0_A=1.2e-12,
@@ -126,10 +123,26 @@ def get_fully_defined_mechanism():
126
123
  N=0.8,
127
124
  reactants=[B, M],
128
125
  products=[C],
129
- other_properties = {"__irrelevant": "2"},
126
+ other_properties={"__irrelevant": "2"},
130
127
  )
131
128
 
132
- my_branched = Branched(
129
+ my_ternary = mc.TernaryChemicalActivation(
130
+ name="my ternary chemical activation",
131
+ gas_phase=gas,
132
+ k0_A=32.1,
133
+ k0_B=-2.3,
134
+ k0_C=102.3,
135
+ kinf_A=63.4,
136
+ kinf_B=-1.3,
137
+ kinf_C=908.5,
138
+ Fc=1.3,
139
+ N=32.1,
140
+ reactants=[B, M],
141
+ products=[C],
142
+ other_properties={"__irrelevant": "2"},
143
+ )
144
+
145
+ my_branched = mc.Branched(
133
146
  name="my branched",
134
147
  gas_phase=gas,
135
148
  reactants=[A],
@@ -139,10 +152,10 @@ def get_fully_defined_mechanism():
139
152
  Y=167,
140
153
  a0=0.15,
141
154
  n=9,
142
- other_properties = {"__irrelevant": "2"},
155
+ other_properties={"__irrelevant": "2"},
143
156
  )
144
157
 
145
- my_tunneling = Tunneling(
158
+ my_tunneling = mc.Tunneling(
146
159
  name="my tunneling",
147
160
  gas_phase=gas,
148
161
  reactants=[B],
@@ -150,115 +163,104 @@ def get_fully_defined_mechanism():
150
163
  A=123.45,
151
164
  B=1200.0,
152
165
  C=1.0e8,
153
- other_properties = {"__irrelevant": "2"},
166
+ other_properties={"__irrelevant": "2"},
154
167
  )
155
168
 
156
- my_surface = Surface(
169
+ my_surface = mc.Surface(
157
170
  name="my surface",
158
171
  gas_phase=gas,
159
172
  gas_phase_species=A,
160
173
  reaction_probability=2.0e-2,
161
174
  gas_phase_products=[B, C],
162
- aerosol_phase=surface_reacting_phase,
163
- other_properties = {"__irrelevant": "2"},
175
+ condensed_phase=surface_reacting_phase,
176
+ other_properties={"__irrelevant": "2"},
164
177
  )
165
178
 
166
- photo_B = Photolysis(
179
+ photo_B = mc.Photolysis(
167
180
  name="photo B",
168
181
  gas_phase=gas,
169
182
  reactants=[B],
170
183
  products=[C],
171
184
  scaling_factor=12.3,
172
- other_properties = {"__irrelevant": "2"},
185
+ other_properties={"__irrelevant": "2"},
173
186
  )
174
187
 
175
- condensed_photo_B = CondensedPhasePhotolysis(
188
+ condensed_photo_B = mc.CondensedPhasePhotolysis(
176
189
  name="condensed photo B",
177
- aerosol_phase=aqueous_aerosol,
178
- aerosol_phase_water=H2O_aq,
190
+ condensed_phase=aqueous_aerosol,
179
191
  reactants=[H2O2_aq],
180
192
  products=[ethanol_aq],
181
193
  scaling_factor=12.3,
182
- other_properties = {"__irrelevant": "2"},
194
+ other_properties={"__irrelevant": "2"},
183
195
  )
184
196
 
185
- my_emission = Emission(
197
+ my_emission = mc.Emission(
186
198
  name="my emission",
187
199
  gas_phase=gas,
188
200
  products=[B],
189
201
  scaling_factor=12.3,
190
- other_properties = {"__irrelevant": "2"},
202
+ other_properties={"__irrelevant": "2"},
191
203
  )
192
204
 
193
- my_first_order_loss = FirstOrderLoss(
205
+ my_first_order_loss = mc.FirstOrderLoss(
194
206
  name="my first order loss",
195
207
  gas_phase=gas,
196
208
  reactants=[C],
197
209
  scaling_factor=12.3,
198
- other_properties = {"__irrelevant": "2"},
210
+ other_properties={"__irrelevant": "2"},
199
211
  )
200
212
 
201
- my_aqueous_equilibrium = AqueousEquilibrium(
213
+ my_aqueous_equilibrium = mc.AqueousEquilibrium(
202
214
  name="my aqueous eq",
203
- aerosol_phase=aqueous_aerosol,
204
- aerosol_phase_water=H2O_aq,
215
+ condensed_phase=aqueous_aerosol,
216
+ condensed_phase_water=H2O_aq,
205
217
  A=1.14e-2,
206
218
  C=2300.0,
207
219
  k_reverse=0.32,
208
220
  reactants=[(2, A)],
209
221
  products=[B, C],
210
- other_properties = {"__irrelevant": "2"},
222
+ other_properties={"__irrelevant": "2"},
211
223
  )
212
224
 
213
- my_wet_deposition = WetDeposition(
225
+ my_wet_deposition = mc.WetDeposition(
214
226
  name="rxn cloud",
215
- aerosol_phase=cloud,
227
+ condensed_phase=cloud,
216
228
  scaling_factor=12.3,
217
- other_properties = {"__irrelevant": "2"},
229
+ other_properties={"__irrelevant": "2"},
218
230
  )
219
231
 
220
- my_henrys_law = HenrysLaw(
221
- name="my henry's law",
222
- gas_phase=gas,
223
- gas_phase_species=H2O2,
224
- aerosol_phase=aqueous_aerosol,
225
- aerosol_phase_species=H2O2_aq,
226
- aerosol_phase_water=H2O_aq,
227
- other_properties = {"__irrelevant": "2"},
228
- )
229
-
230
- my_simpol_phase_transfer = SimpolPhaseTransfer(
232
+ my_simpol_phase_transfer = mc.SimpolPhaseTransfer(
231
233
  name="my simpol",
232
234
  gas_phase=gas,
233
235
  gas_phase_species=ethanol,
234
- aerosol_phase=aqueous_aerosol,
235
- aerosol_phase_species=ethanol_aq,
236
+ condensed_phase=aqueous_aerosol,
237
+ condensed_phase_species=ethanol_aq,
236
238
  B=[-1.97e03, 2.91e00, 1.96e-03, -4.96e-01],
237
- other_properties = {"__irrelevant": "2"},
239
+ other_properties={"__irrelevant": "2"},
238
240
  )
239
241
 
240
- user_defined = UserDefined(
242
+ user_defined = mc.UserDefined(
241
243
  name="my user defined",
242
244
  gas_phase=gas,
243
245
  reactants=[A, B],
244
246
  products=[(1.3, C)],
245
247
  scaling_factor=12.3,
246
- other_properties = {"__irrelevant": "2"}
248
+ other_properties={"__irrelevant": "2"}
247
249
  )
248
250
 
249
251
  # Mechanism
250
- return Mechanism(
252
+ return mc.Mechanism(
251
253
  name="Full Configuration",
252
254
  species=[A, B, C, M, H2O2, ethanol, ethanol_aq, H2O2_aq, H2O_aq,
253
- aerosol_stuff, more_aerosol_stuff],
255
+ aerosol_stuff, more_aerosol_stuff],
254
256
  phases=[gas, aqueous_aerosol, surface_reacting_phase, cloud],
255
257
  reactions=[my_arrhenius, my_other_arrhenius, my_condensed_arrhenius,
256
- my_other_condensed_arrhenius, my_troe, my_branched,
257
- my_tunneling, my_surface, photo_B, condensed_photo_B,
258
- my_emission, my_first_order_loss, my_aqueous_equilibrium,
259
- my_wet_deposition, my_henrys_law, my_simpol_phase_transfer,
260
- user_defined],
261
- version=Version(1, 0, 0),
258
+ my_other_condensed_arrhenius, my_troe, my_ternary, my_branched,
259
+ my_tunneling, my_surface, photo_B, condensed_photo_B,
260
+ my_emission, my_first_order_loss, my_aqueous_equilibrium,
261
+ my_wet_deposition, my_simpol_phase_transfer,
262
+ user_defined],
263
+ version=mc.Version(1, 0, 0),
262
264
  )
263
265
 
264
266
 
@@ -369,8 +371,9 @@ def _extract_components(components):
369
371
  for component in components
370
372
  ]
371
373
 
374
+
372
375
  def _validate_arrhenius(reactions):
373
- assert reactions[0].type == ReactionType.Arrhenius
376
+ assert reactions[0].type == mc.ReactionType.Arrhenius
374
377
  assert _extract_components(reactions[0].reactants) == [
375
378
  {"species name": "B", "coefficient": 1}
376
379
  ]
@@ -384,7 +387,7 @@ def _validate_arrhenius(reactions):
384
387
  assert reactions[0].E == -1.3
385
388
  assert reactions[0].name == "my arrhenius"
386
389
  assert reactions[0].other_properties == {"__irrelevant": "2"}
387
- assert reactions[1].type == ReactionType.Arrhenius
390
+ assert reactions[1].type == mc.ReactionType.Arrhenius
388
391
  assert _extract_components(reactions[1].reactants) == [
389
392
  {"species name": "A", "coefficient": 1}
390
393
  ]
@@ -400,29 +403,14 @@ def _validate_arrhenius(reactions):
400
403
  assert reactions[1].other_properties == {}
401
404
 
402
405
 
403
- def _validate_henrys_law(reactions):
404
- assert reactions[0].type == ReactionType.HenrysLaw
405
- assert reactions[0].gas_phase == "gas"
406
- assert _extract_components([reactions[0].gas_phase_species]) == [
407
- {"species name": "H2O2", "coefficient": 1}
408
- ]
409
- assert reactions[0].aerosol_phase == "aqueous aerosol"
410
- assert _extract_components([reactions[0].aerosol_phase_species]) == [
411
- {"species name": "H2O2_aq", "coefficient": 1}
412
- ]
413
- assert reactions[0].aerosol_phase_water == "H2O_aq"
414
- assert reactions[0].name == "my henry's law"
415
- assert reactions[0].other_properties == {"__irrelevant": "2"}
416
-
417
-
418
406
  def _validate_simpol_phase_transfer(reactions):
419
- assert reactions[0].type == ReactionType.SimpolPhaseTransfer
407
+ assert reactions[0].type == mc.ReactionType.SimpolPhaseTransfer
420
408
  assert reactions[0].gas_phase == "gas"
421
409
  assert _extract_components([reactions[0].gas_phase_species]) == [
422
410
  {"species name": "ethanol", "coefficient": 1}
423
411
  ]
424
- assert reactions[0].aerosol_phase == "aqueous aerosol"
425
- assert _extract_components([reactions[0].aerosol_phase_species]) == [
412
+ assert reactions[0].condensed_phase == "aqueous aerosol"
413
+ assert _extract_components([reactions[0].condensed_phase_species]) == [
426
414
  {"species name": "ethanol_aq", "coefficient": 1}
427
415
  ]
428
416
  assert reactions[0].B == [-1.97e03, 2.91e00, 1.96e-03, -4.96e-01]
@@ -431,9 +419,9 @@ def _validate_simpol_phase_transfer(reactions):
431
419
 
432
420
 
433
421
  def _validate_aqueous_equilibrium(reactions):
434
- assert reactions[0].type == ReactionType.AqueousEquilibrium
435
- assert reactions[0].aerosol_phase == "aqueous aerosol"
436
- assert reactions[0].aerosol_phase_water == "H2O_aq"
422
+ assert reactions[0].type == mc.ReactionType.AqueousEquilibrium
423
+ assert reactions[0].condensed_phase == "aqueous aerosol"
424
+ assert reactions[0].condensed_phase_water == "H2O_aq"
437
425
  assert reactions[0].A == 1.14e-2
438
426
  assert reactions[0].C == 2300.0
439
427
  assert reactions[0].k_reverse == 0.32
@@ -450,9 +438,8 @@ def _validate_aqueous_equilibrium(reactions):
450
438
 
451
439
  def _validate_condensed_phase_arrhenius(reactions):
452
440
  for reaction in reactions:
453
- assert reaction.type == ReactionType.CondensedPhaseArrhenius
454
- assert reaction.aerosol_phase == "aqueous aerosol"
455
- assert reaction.aerosol_phase_water == "H2O_aq"
441
+ assert reaction.type == mc.ReactionType.CondensedPhaseArrhenius
442
+ assert reaction.condensed_phase == "aqueous aerosol"
456
443
  assert reaction.A == 123.45
457
444
  assert reaction.B == 1.3
458
445
  assert reaction.D == 300.0
@@ -472,9 +459,8 @@ def _validate_condensed_phase_arrhenius(reactions):
472
459
 
473
460
 
474
461
  def _validate_condensed_phase_photolysis(reactions):
475
- assert reactions[0].type == ReactionType.CondensedPhasePhotolysis
476
- assert reactions[0].aerosol_phase == "aqueous aerosol"
477
- assert reactions[0].aerosol_phase_water == "H2O_aq"
462
+ assert reactions[0].type == mc.ReactionType.CondensedPhasePhotolysis
463
+ assert reactions[0].condensed_phase == "aqueous aerosol"
478
464
  assert _extract_components(reactions[0].reactants) == [
479
465
  {"species name": "H2O2_aq", "coefficient": 1}
480
466
  ]
@@ -487,7 +473,7 @@ def _validate_condensed_phase_photolysis(reactions):
487
473
 
488
474
 
489
475
  def _validate_emission(reactions):
490
- assert reactions[0].type == ReactionType.Emission
476
+ assert reactions[0].type == mc.ReactionType.Emission
491
477
  assert reactions[0].gas_phase == "gas"
492
478
  assert _extract_components(reactions[0].products) == [
493
479
  {"species name": "B", "coefficient": 1}
@@ -498,7 +484,7 @@ def _validate_emission(reactions):
498
484
 
499
485
 
500
486
  def _validate_first_order_loss(reactions):
501
- assert reactions[0].type == ReactionType.FirstOrderLoss
487
+ assert reactions[0].type == mc.ReactionType.FirstOrderLoss
502
488
  assert reactions[0].gas_phase == "gas"
503
489
  assert _extract_components(reactions[0].reactants) == [
504
490
  {"species name": "C", "coefficient": 1}
@@ -509,7 +495,7 @@ def _validate_first_order_loss(reactions):
509
495
 
510
496
 
511
497
  def _validate_photolysis(reactions):
512
- assert reactions[0].type == ReactionType.Photolysis
498
+ assert reactions[0].type == mc.ReactionType.Photolysis
513
499
  assert reactions[0].gas_phase == "gas"
514
500
  assert _extract_components(reactions[0].reactants) == [
515
501
  {"species name": "B", "coefficient": 1}
@@ -523,7 +509,7 @@ def _validate_photolysis(reactions):
523
509
 
524
510
 
525
511
  def _validate_surface(reactions):
526
- assert reactions[0].type == ReactionType.Surface
512
+ assert reactions[0].type == mc.ReactionType.Surface
527
513
  assert reactions[0].gas_phase == "gas"
528
514
  assert _extract_components([reactions[0].gas_phase_species]) == [
529
515
  {"species name": "A", "coefficient": 1}
@@ -533,13 +519,13 @@ def _validate_surface(reactions):
533
519
  {"species name": "B", "coefficient": 1},
534
520
  {"species name": "C", "coefficient": 1},
535
521
  ]
536
- assert reactions[0].aerosol_phase == "surface reacting phase"
522
+ assert reactions[0].condensed_phase == "surface reacting phase"
537
523
  assert reactions[0].name == "my surface"
538
524
  assert reactions[0].other_properties == {"__irrelevant": "2"}
539
525
 
540
526
 
541
527
  def _validate_troe(reactions):
542
- assert reactions[0].type == ReactionType.Troe
528
+ assert reactions[0].type == mc.ReactionType.Troe
543
529
  assert reactions[0].gas_phase == "gas"
544
530
  assert _extract_components(reactions[0].reactants) == [
545
531
  {"species name": "B", "coefficient": 1},
@@ -560,8 +546,52 @@ def _validate_troe(reactions):
560
546
  assert reactions[0].other_properties == {"__irrelevant": "2"}
561
547
 
562
548
 
549
+ def _validate_ternary_chemical_activation(reactions):
550
+ assert reactions[0].type == mc.ReactionType.TernaryChemicalActivation
551
+ assert reactions[0].gas_phase == "gas"
552
+ assert _extract_components(reactions[0].reactants) == [
553
+ {"species name": "B", "coefficient": 1},
554
+ {"species name": "M", "coefficient": 1},
555
+ ]
556
+ assert _extract_components(reactions[0].products) == [
557
+ {"species name": "C", "coefficient": 1}
558
+ ]
559
+ assert reactions[0].k0_A == 32.1
560
+ assert reactions[0].k0_B == -2.3
561
+ assert reactions[0].k0_C == 102.3
562
+ assert reactions[0].kinf_A == 63.4
563
+ assert reactions[0].kinf_B == -1.3
564
+ assert reactions[0].kinf_C == 908.5
565
+ assert reactions[0].Fc == 1.3
566
+ assert reactions[0].N == 32.1
567
+ assert reactions[0].name == "my ternary chemical activation"
568
+ assert reactions[0].other_properties == {"__irrelevant": "2"}
569
+
570
+
571
+ def _validate_ternary_chemical_activation(reactions):
572
+ assert reactions[0].type == mc.ReactionType.TernaryChemicalActivation
573
+ assert reactions[0].gas_phase == "gas"
574
+ assert _extract_components(reactions[0].reactants) == [
575
+ {"species name": "B", "coefficient": 1},
576
+ {"species name": "M", "coefficient": 1},
577
+ ]
578
+ assert _extract_components(reactions[0].products) == [
579
+ {"species name": "C", "coefficient": 1}
580
+ ]
581
+ assert reactions[0].k0_A == 32.1
582
+ assert reactions[0].k0_B == -2.3
583
+ assert reactions[0].k0_C == 102.3
584
+ assert reactions[0].kinf_A == 63.4
585
+ assert reactions[0].kinf_B == -1.3
586
+ assert reactions[0].kinf_C == 908.5
587
+ assert reactions[0].Fc == 1.3
588
+ assert reactions[0].N == 32.1
589
+ assert reactions[0].name == "my ternary chemical activation"
590
+ assert reactions[0].other_properties == {"__irrelevant": "2"}
591
+
592
+
563
593
  def _validate_branched_no_ro2(reactions):
564
- assert reactions[0].type == ReactionType.Branched
594
+ assert reactions[0].type == mc.ReactionType.Branched
565
595
  assert reactions[0].gas_phase == "gas"
566
596
  assert _extract_components(reactions[0].reactants) == [
567
597
  {"species name": "A", "coefficient": 1}
@@ -581,7 +611,7 @@ def _validate_branched_no_ro2(reactions):
581
611
 
582
612
 
583
613
  def _validate_tunneling(reactions):
584
- assert reactions[0].type == ReactionType.Tunneling
614
+ assert reactions[0].type == mc.ReactionType.Tunneling
585
615
  assert reactions[0].gas_phase == "gas"
586
616
  assert _extract_components(reactions[0].reactants) == [
587
617
  {"species name": "B", "coefficient": 1}
@@ -597,15 +627,15 @@ def _validate_tunneling(reactions):
597
627
 
598
628
 
599
629
  def _validate_wet_deposition(reactions):
600
- assert reactions[0].type == ReactionType.WetDeposition
630
+ assert reactions[0].type == mc.ReactionType.WetDeposition
601
631
  assert reactions[0].name == "rxn cloud"
602
- assert reactions[0].aerosol_phase == "cloud"
632
+ assert reactions[0].condensed_phase == "cloud"
603
633
  assert reactions[0].scaling_factor == 12.3
604
634
  assert reactions[0].other_properties == {"__irrelevant": "2"}
605
635
 
606
636
 
607
637
  def _validate_user_defined(reactions):
608
- assert reactions[0].type == ReactionType.UserDefined
638
+ assert reactions[0].type == mc.ReactionType.UserDefined
609
639
  assert reactions[0].gas_phase == "gas"
610
640
  assert _extract_components(reactions[0].reactants) == [
611
641
  {"species name": "A", "coefficient": 1},
@@ -643,8 +673,6 @@ def validate_full_v1_mechanism(mechanism):
643
673
  _validate_emission(mechanism.reactions.emission)
644
674
  assert len(mechanism.reactions.first_order_loss) == 1
645
675
  _validate_first_order_loss(mechanism.reactions.first_order_loss)
646
- assert len(mechanism.reactions.henrys_law) == 1
647
- _validate_henrys_law(mechanism.reactions.henrys_law)
648
676
  assert len(mechanism.reactions.photolysis) == 1
649
677
  _validate_photolysis(mechanism.reactions.photolysis)
650
678
  assert len(mechanism.reactions.simpol_phase_transfer) == 1
@@ -653,6 +681,8 @@ def validate_full_v1_mechanism(mechanism):
653
681
  _validate_surface(mechanism.reactions.surface)
654
682
  assert len(mechanism.reactions.troe) == 1
655
683
  _validate_troe(mechanism.reactions.troe)
684
+ assert len(mechanism.reactions.ternary_chemical_activation) == 1
685
+ _validate_ternary_chemical_activation(mechanism.reactions.ternary_chemical_activation)
656
686
  assert len(mechanism.reactions.tunneling) == 1
657
687
  _validate_tunneling(mechanism.reactions.tunneling)
658
688
  assert len(mechanism.reactions.wet_deposition) == 1
@@ -662,7 +692,7 @@ def validate_full_v1_mechanism(mechanism):
662
692
  assert mechanism.version.major == 1
663
693
  assert mechanism.version.minor == 0
664
694
  assert mechanism.version.patch == 0
665
- assert len(mechanism.reactions) == 17
695
+ assert len(mechanism.reactions) == 16
666
696
  for reaction in mechanism.reactions:
667
697
  assert reaction is not None
668
- assert isinstance(reaction.type, _ReactionType)
698
+ assert isinstance(reaction.type, mc.ReactionType)
@@ -1,43 +1,32 @@
1
- #! /bin/bash
2
-
1
+ #!/bin/bash
3
2
  set -e
4
3
  set -x
5
4
 
6
- # Update the mirror list to use vault.centos.org
7
- sed -i s/mirror.centos.org/vault.centos.org/g /etc/yum.repos.d/*.repo
8
- sed -i s/^#.*baseurl=http/baseurl=http/g /etc/yum.repos.d/*.repo
9
- sed -i s/^mirrorlist=http/#mirrorlist=http/g /etc/yum.repos.d/*.repo
10
-
11
- sed -i 's/mirrorlist/#mirrorlist/g' /etc/yum.repos.d/CentOS-*
12
- sed -i 's|#baseurl=http://mirror.centos.org|baseurl=http://vault.centos.org|g' /etc/yum.repos.d/CentOS-*
5
+ target_arch="$(uname -m)"
6
+ echo "Detected target_arch: $target_arch"
13
7
 
14
- yum install -y zip tree wget
8
+ dnf -y update
15
9
 
16
- # Use CIBW_ARCHS or CIBW_ARCH if set, else fallback to uname -m
17
- if [ -n "$CIBW_ARCHS" ]; then
18
- target_arch="$CIBW_ARCHS"
19
- elif [ -n "$CIBW_ARCH" ]; then
20
- target_arch="$CIBW_ARCH"
21
- else
22
- target_arch="$(uname -m)"
10
+ # For 64 bit systems can enable our fortran components, but we require netcdf
11
+ if [[ "$target_arch" == "x86_64" || "$target_arch" == "aarch64" ]]; then
12
+ dnf install -y epel-release
13
+ dnf install -y netcdf-devel netcdf-fortran-devel
23
14
  fi
24
15
 
25
- echo "Detected target_arch: $target_arch"
16
+ dnf install -y tree wget zip lapack-devel
26
17
 
18
+ # 64 bit intel and amd systems support building cuda
27
19
  if [ "$target_arch" = "x86_64" ]; then
28
- # Install CUDA 12.2 for x86_64:
29
- yum-config-manager --add-repo https://developer.download.nvidia.com/compute/cuda/repos/rhel8/x86_64/cuda-rhel8.repo
30
- # error mirrorlist.centos.org doesn't exists anymore.
31
- sed -i s/mirror.centos.org/vault.centos.org/g /etc/yum.repos.d/*.repo
32
- sed -i s/^#.*baseurl=http/baseurl=http/g /etc/yum.repos.d/*.repo
33
- sed -i s/^mirrorlist=http/#mirrorlist=http/g /etc/yum.repos.d/*.repo
34
- yum install --setopt=obsoletes=0 -y \
35
- cuda-nvcc-12-2 \
36
- cuda-cudart-devel-12-2 \
37
- libcurand-devel-12-2 \
38
- libcublas-devel-12-2
39
- ln -s cuda-12.2 /usr/local/cuda
40
-
41
- # list the installed CUDA packages
42
- tree -L 4 /usr/local/cuda-12.2
43
- fi
20
+ # Install CUDA 12.8 for x86_64 on AlmaLinux 8 (manylinux_2_28) - supports GCC 14
21
+ dnf config-manager --add-repo https://developer.download.nvidia.com/compute/cuda/repos/rhel8/x86_64/cuda-rhel8.repo
22
+ dnf install --setopt=obsoletes=0 -y \
23
+ cuda-nvcc-12-8 \
24
+ cuda-cudart-devel-12-8 \
25
+ libcurand-devel-12-8 \
26
+ libcublas-devel-12-8
27
+ ln -sf cuda-12.8 /usr/local/cuda
28
+
29
+ # Verify CUDA installation
30
+ echo "=== CUDA Installation Verification ==="
31
+ /usr/local/cuda/bin/nvcc --version
32
+ fi
@@ -0,0 +1 @@
1
+ brew install netcdf netcdf-fortran lapack