Skip to content

Commit

Permalink
fdfit: switch twlc to rootfinding for performance
Browse files Browse the repository at this point in the history
At f_min = 0, numerical difficulties ensue. Considering that the model isn't valid in this range to begin with, we limit the minimum.
  • Loading branch information
JoepVanlier committed Feb 24, 2024
1 parent 1e7ad6b commit 5b35980
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion lumicks/pylake/fitting/detail/model_implementation.py
Original file line number Diff line number Diff line change
Expand Up @@ -725,7 +725,7 @@ def twlc_solve_force(d, Lp, Lc, St, C, g0, g1, Fc, kT=4.11):
"Persistence length, contour length, stretch modulus and kT must be bigger than 0"
)

f_min = 0
f_min = 1e-6
f_max = (-g0 + np.sqrt(St * C)) / g1 # Above this force the model loses its validity

return invert_function_interpolation(
Expand All @@ -735,6 +735,8 @@ def twlc_solve_force(d, Lp, Lc, St, C, g0, g1, Fc, kT=4.11):
f_max,
lambda f_trial: twlc_distance(f_trial, Lp, Lc, St, C, g0, g1, Fc, kT),
lambda f_trial: twlc_distance_derivative(f_trial, Lp, Lc, St, C, g0, g1, Fc, kT),
dx=1e-2,
rootfinding=True,
)


Expand Down

0 comments on commit 5b35980

Please sign in to comment.