From 93770f116a0a922025d5dc85e2a6b6791b2b0d0e Mon Sep 17 00:00:00 2001 From: Brian Drawert Date: Wed, 5 Oct 2022 08:12:22 -0700 Subject: [PATCH 1/2] fixing home-dimer reaction propentiy --- spatialpy/core/reaction.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spatialpy/core/reaction.py b/spatialpy/core/reaction.py index cad800c9..e8591195 100644 --- a/spatialpy/core/reaction.py +++ b/spatialpy/core/reaction.py @@ -293,7 +293,7 @@ def _create_mass_action(self): reactant = reactant.name # Case 1: 2X -> Y if stoichiometry == 2: - propensity_function = f"0.5 * {propensity_function} * {reactant} * ({reactant} - 1) / vol" + propensity_function = f"{propensity_function} * {reactant} * ({reactant} - 1) / vol" ode_propensity_function += f" * {reactant} * {reactant}" else: # Case 3: X1, X2 -> Y; From 480b813deb2621a6f349c3607d9cb93111dc362c Mon Sep 17 00:00:00 2001 From: Brian Drawert Date: Wed, 5 Oct 2022 08:13:35 -0700 Subject: [PATCH 2/2] fixed unit tests --- test/unit_tests/test_reaction.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/unit_tests/test_reaction.py b/test/unit_tests/test_reaction.py index d32e51b5..3220fb22 100644 --- a/test/unit_tests/test_reaction.py +++ b/test/unit_tests/test_reaction.py @@ -450,7 +450,7 @@ def test__create_mass_action__2X_to_Y(self): self.valid_ma_reaction.reactants = {"X": 2} self.valid_ma_reaction.products = {"Y": 1} self.valid_ma_reaction._create_mass_action() - self.assertEqual(self.valid_ma_reaction.propensity_function, "((((0.5*k1)*X)*(X-1))/vol)") + self.assertEqual(self.valid_ma_reaction.propensity_function, "(((k1*X)*(X-1))/vol)") self.assertEqual(self.valid_ma_reaction.ode_propensity_function, "((k1*X)*X)") def test__create_mass_action__species_obj_reactant(self): @@ -581,7 +581,7 @@ def test_add_reactant__massaction_reaction_stoich_0_to_2(self): self.valid_ma_reaction.add_reactant("X", 2) self.assertIn("X", self.valid_ma_reaction.reactants) self.assertEqual(self.valid_ma_reaction.reactants["X"], 2) - self.assertEqual(self.valid_ma_reaction.propensity_function, "((((0.5*k1)*X)*(X-1))/vol)") + self.assertEqual(self.valid_ma_reaction.propensity_function, "(((k1*X)*(X-1))/vol)") self.assertEqual(self.valid_ma_reaction.ode_propensity_function, "((k1*X)*X)") def test_add_reactant__invalid_species(self):