Skip to content

Commit fb12044

Browse files
author
Blair Lyons
committed
fix reaction error
1 parent 0781c0c commit fb12044

File tree

1 file changed

+18
-12
lines changed

1 file changed

+18
-12
lines changed

simularium_readdy_models/actin/actin_util.py

Lines changed: 18 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -193,11 +193,6 @@ def get_actin_number(topology, vertex, offset):
193193
(i.e. return 3 for type = "actin#ATP_1" and offset = -1).
194194
"""
195195
pt = topology.particle_type_of_vertex(vertex)
196-
if "actin" not in pt:
197-
raise Exception(
198-
f"Failed to get actin number: {pt} is not actin\n"
199-
f"{ReaddyUtil.topology_to_string(topology)}"
200-
)
201196
return ReaddyUtil.calculate_polymer_number(
202197
int(pt[-1]), offset, ActinUtil.n_polymer_numbers()
203198
)
@@ -281,14 +276,15 @@ def get_next_actin(topology, v_actin, direction, error_if_not_found=False):
281276
get the next actin toward the pointed or barbed direction.
282277
"""
283278
n = ActinUtil.get_actin_number(topology, v_actin, direction)
284-
end_type = "barbed" if direction > 0 else "pointed"
285279
actin_types = [
286280
f"actin#ATP_{n}",
287281
f"actin#{n}",
288282
f"actin#mid_ATP_{n}",
289283
f"actin#mid_{n}",
290-
f"actin#{end_type}_ATP_{n}",
291-
f"actin#{end_type}_{n}",
284+
f"actin#barbed_ATP_{n}",
285+
f"actin#barbed_{n}",
286+
f"actin#pointed_ATP_{n}",
287+
f"actin#pointed_{n}",
292288
]
293289
if direction < 0 and n == 1:
294290
actin_types += ["actin#branch_1", "actin#branch_ATP_1"]
@@ -414,7 +410,7 @@ def set_end_vertex_position(topology, recipe, v_new, barbed):
414410
else ActinStructure.mother1_to_mother_vector()
415411
)
416412
at_branch = False
417-
direction = 1 if barbed else -1
413+
direction = -1 if barbed else 1
418414
vertices.append(
419415
ActinUtil.get_next_actin(topology, v_new, direction, False)
420416
)
@@ -1060,10 +1056,9 @@ def do_finish_binding_site_grow(topology):
10601056
error_msg=f"Failed to find neighbor of new {end_type} end",
10611057
)
10621058
v_neighbor = ActinUtil.get_next_actin(topology, v_barbed, -1, True)
1063-
bs_number = str(ActinUtil.get_actin_number(topology, v_barbed, 1))
1064-
recipe.change_particle_type(v_bs, f"binding_site#{bs_number}")
10651059
ActinUtil.set_end_vertex_position(topology, recipe, v_bs, True)
10661060
recipe.add_edge(v_bs, v_neighbor)
1061+
ReaddyUtil.set_flags(topology, recipe, v_neighbor, ["mid"], ["barbed"], True)
10671062
recipe.change_topology_type("Actin-Polymer")
10681063
return recipe
10691064

@@ -1804,6 +1799,16 @@ def add_bonds_between_actins(system, util, longitudinal_bonds, force_multiplier)
18041799
system,
18051800
n_polymer_numbers,
18061801
)
1802+
util.add_polymer_bond_1D(
1803+
["actin#barbed_", "actin#barbed_ATP_"],
1804+
0,
1805+
["actin#barbed_", "actin#barbed_ATP_"],
1806+
1,
1807+
lat_force_constant,
1808+
bond_length_lat,
1809+
system,
1810+
n_polymer_numbers,
1811+
)
18071812
print(f"Added lat bonds with fc = {lat_force_constant}")
18081813
if longitudinal_bonds:
18091814
print("Adding longitudinal bonds...")
@@ -3401,10 +3406,11 @@ def add_barbed_growth_reaction(system):
34013406
"""
34023407
for i in ActinUtil.polymer_number_range():
34033408
if parameters["barbed_binding_site"]:
3409+
bs_number = str(ReaddyUtil.calculate_polymer_number(i, 1, ActinUtil.n_polymer_numbers()))
34043410
system.topologies.add_spatial_reaction(
34053411
f"Barbed_Growth_BS{i}: Actin-Polymer(binding_site#{i}) + "
34063412
"Actin-Monomer-ATP(actin#free_ATP) -> "
3407-
f"Actin-Polymer#GrowingBarbed(actin#barbed_ATP_{i}--binding_site#{i})",
3413+
f"Actin-Polymer#GrowingBarbed(actin#barbed_ATP_{i}--binding_site#{bs_number})",
34083414
rate=parameters["barbed_growth_ATP_rate"],
34093415
radius=parameters["binding_site_reaction_distance"],
34103416
)

0 commit comments

Comments
 (0)