mythos.observables.wlc
Utility functions for computing worm-like chain (WLC) fit.
Functions
|
Hyperbolic cotangent function. |
|
Computes the extension under a specified force under the wormlike chain (WLC) model. |
|
An objective function for the WLC model compatible with JAX solvers. |
|
Fit the WLC model via nonlinear least squares given a set of forces and measured extensions. |
Module Contents
- mythos.observables.wlc.coth(x: mythos.utils.types.ARR_OR_SCALAR) mythos.utils.types.ARR_OR_SCALAR[source]
Hyperbolic cotangent function.
- mythos.observables.wlc.calculate_extension(force: mythos.utils.types.ARR_OR_SCALAR, l0: mythos.utils.types.ARR_OR_SCALAR, lp: mythos.utils.types.ARR_OR_SCALAR, k: mythos.utils.types.ARR_OR_SCALAR, kT: float) mythos.utils.types.ARR_OR_SCALAR[source]
Computes the extension under a specified force under the wormlike chain (WLC) model.
Via the model of Odijk, the extension of an extensible wormlike chain (WLC) under a force F can be computed as
\[x = L_0 \left (1 + \frac{F}{K} - \frac{kT}{2F} [1 + y\coth y] \right)\]where
\[y = \left( \frac{FL_0^2}{L_p kT} \right)^{1/2}\]where L_0 is the contour length and L_p is the persistence length. This function computes implements this model for computing the extension.
- Parameters:
force (jd_types.ARR_OR_SCALAR) – the force applied to the duplex
l0 (jd_types.ARR_OR_SCALAR) – the contour length
lp (jd_types.ARR_OR_SCALAR) – the persistence length
k (jd_types.ARR_OR_SCALAR) – the extensional modulus
kT (float) – the temperature
- Returns:
the predicted extension
- Return type:
jd_types.ARR_OR_SCALAR
- mythos.observables.wlc.loss(coeffs: jax.numpy.ndarray, extensions: jax.numpy.ndarray, forces: jax.numpy.ndarray, kT: float) jax.numpy.ndarray[source]
An objective function for the WLC model compatible with JAX solvers.
- Parameters:
coeffs (jnp.ndarray) – The parameters of the WLC model, ordered as [L_0, L_p, K]
extensions (jnp.ndarray) – The measured extensions (via simulation) to which we are fitting the model
forces (jnp.ndarray) – The forces under which the extensions were measured
kT (float) – the temperature
- Returns:
the residual for each measured extension
- Return type:
jnp.ndarray
- mythos.observables.wlc.fit_wlc(extensions: jax.numpy.ndarray, forces: jax.numpy.ndarray, init_guess: jax.numpy.ndarray, kT: float, *, implicit_diff: bool = True) jax.numpy.ndarray[source]
Fit the WLC model via nonlinear least squares given a set of forces and measured extensions.
- Parameters:
extensions (jnp.ndarray) – The measured extensions (via simulation) to which we are fitting the model
forces (jnp.ndarray) – The forces under which the extensions were measured
init_guess (jnp.ndarray) – An initial guess for the parameters of the WLC model, ordered as [L_0, L_p, K]
kT (float) – the temperature
implicit_diff (bool) – Whether or not to use implicit differentiation for the numerical solver
- Returns:
the fit parameters of the WLC model, ordered as [L_0, L_p, K]
- Return type:
jnp.ndarray