Skip to content

Commit

Permalink
update config
Browse files Browse the repository at this point in the history
  • Loading branch information
boulderdaze committed May 16, 2024
1 parent 86494d5 commit 112232d
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 4 deletions.
23 changes: 22 additions & 1 deletion configs/analytical/reactions.json
Original file line number Diff line number Diff line change
@@ -1 +1,22 @@
{"camp-data": [{"type": "MECHANISM", "name": "music box interactive configuration", "reactions": [{"type": "ARRHENIUS", "A": 0.00012, "B": 7, "C" : 75, "D": 50, "E": 0.5, "reactants": {"B": {"qty": 1}}, "products": {"C": {"yield": 1}, "irr__089f1f45-4cd8-4278-83d5-d638e98e4315": {"yield": 1}}}, {"type": "ARRHENIUS", "A": 0.004, "C" : 50, "reactants": {"A": {"qty": 1}}, "products": {"B": {"yield": 1}, "irr__2a109b21-bb24-41ae-8f06-7485fd36f1a7": {"yield": 1}}}]}]}
{
"camp-data":
[
{
"type": "MECHANISM",
"name": "music box interactive configuration",
"reactions":
[
{
"type": "ARRHENIUS", "A": 0.00012, "B": 7, "C" : 75, "D": 50, "E": 0.5,
"reactants": {"B": {"qty": 1}},
"products": {"C": {"yield": 1}}
},
{
"type": "ARRHENIUS", "A": 0.004, "C" : 50,
"reactants": {"A": {"qty": 1}},
"products": {"B": {"yield": 1}}
}
]
}
]
}
15 changes: 14 additions & 1 deletion configs/analytical/species.json
Original file line number Diff line number Diff line change
@@ -1 +1,14 @@
{"camp-data": [{"name": "A", "type": "CHEM_SPEC"}, {"name": "B", "type": "CHEM_SPEC"}, {"name": "C", "type": "CHEM_SPEC"}, {"name": "irr__089f1f45-4cd8-4278-83d5-d638e98e4315", "type": "CHEM_SPEC"}, {"name": "irr__2a109b21-bb24-41ae-8f06-7485fd36f1a7", "type": "CHEM_SPEC"}]}
{
"camp-data":
[
{
"name": "A", "type": "CHEM_SPEC"
},
{
"name": "B", "type": "CHEM_SPEC"
},
{
"name": "C", "type": "CHEM_SPEC"
}
]
}
5 changes: 3 additions & 2 deletions python/wrapper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,25 +25,26 @@ PYBIND11_MODULE(musica, m)
"micm_solve", [](musica::MICM *micm, double time_step, double temperature, double pressure, py::list concentrations, py::object custom_rate_parameters = py::none())
{
std::vector<double> concentrations_cpp;
concentrations_cpp.reserve(len(concentrations));
for (auto item : concentrations) {
concentrations_cpp.push_back(item.cast<double>());
}

std::vector<double> custom_rate_parameters_cpp;
if (!custom_rate_parameters.is_none()) {
py::list parameters = custom_rate_parameters.cast<py::list>();
custom_rate_parameters_cpp.reserve(len(parameters));
for (auto item : parameters) {
custom_rate_parameters_cpp.push_back(item.cast<double>());
}
}

musica::Error error;
musica::micm_solve(micm, time_step, temperature, pressure,
concentrations_cpp.size(), concentrations_cpp.data(),
custom_rate_parameters_cpp.size(), custom_rate_parameters_cpp.data(),
&error);

// Update the concentrations list after solving
// Update the concentrations list after solving
for (size_t i = 0; i < concentrations_cpp.size(); ++i) {
concentrations[i] = concentrations_cpp[i];
} },
Expand Down

0 comments on commit 112232d

Please sign in to comment.