mythos.observables.stretch_torsion ================================== .. py:module:: mythos.observables.stretch_torsion .. autoapi-nested-parse:: Utility functions for computing stretch-torsion moduli. Classes ------- .. autoapisummary:: mythos.observables.stretch_torsion.TwistXY mythos.observables.stretch_torsion.ExtensionZ Functions --------- .. autoapisummary:: mythos.observables.stretch_torsion.single_angle_xy mythos.observables.stretch_torsion.single_extension_z mythos.observables.stretch_torsion.stretch mythos.observables.stretch_torsion.torsion mythos.observables.stretch_torsion.stretch_torsion Module Contents --------------- .. py:function:: single_angle_xy(quartet: jax.numpy.ndarray, base_sites: jax.numpy.ndarray, displacement_fn: collections.abc.Callable) -> mythos.utils.types.ARR_OR_SCALAR Computes the angle in the X-Y plane between adjacent base pairs. .. py:class:: TwistXY Bases: :py:obj:`mythos.observables.base.BaseObservable` Computes the total twist of a duplex in the X-Y plane in radians. The total twist of a duplex is defined as the sum of angles in the X-Y plane between adjacent base pairs. Args: - quartets: a (n_quartets, 2, 2) array containing the pairs of adjacent base pairs - displacement_fn: a function for computing displacements between two positions .. py:attribute:: quartets :type: jax.numpy.ndarray .. py:attribute:: displacement_fn :type: collections.abc.Callable .. py:method:: __post_init__() -> None Validate the input. .. py:method:: __call__(trajectory: mythos.simulators.io.SimulatorTrajectory) -> mythos.utils.types.ARR_OR_SCALAR Calculate the total twist in the X-Y plane in radians. :param trajectory: the trajectory :type trajectory: jd_traj.Trajectory :returns: the total twist in radians for each state, so expect a size of (n_states,) :rtype: jd_types.ARR_OR_SCALAR .. py:function:: single_extension_z(center: mythos.utils.types.Arr_Nucleotide_3, bp1: jax.numpy.ndarray, bp2: jax.numpy.ndarray, displacement_fn: collections.abc.Callable) -> mythos.utils.types.ARR_OR_SCALAR Computes the distance between the midpoints of two base pairs. .. py:class:: ExtensionZ Bases: :py:obj:`mythos.observables.base.BaseObservable` Computes the total extension of a duplex in the Z-direction in simulation units. The total extension of a duplex is defined as the distance between the midpoints of two pre-specified base pairs in the Z-direction. Args: - bp1: a (2,) array specifying the indices of the first base pair - bp2: a (2,) array specifying the indices of the second base pair - displacement_fn: a function for computing displacements between two positions .. py:attribute:: bp1 :type: jax.numpy.ndarray .. py:attribute:: bp2 :type: jax.numpy.ndarray .. py:attribute:: displacement_fn :type: collections.abc.Callable .. py:method:: __post_init__() -> None Validate the input. .. py:method:: __call__(trajectory: mythos.simulators.io.SimulatorTrajectory) -> mythos.utils.types.ARR_OR_SCALAR Calculate the total extension in simulation units. :param trajectory: the trajectory :type trajectory: jd_traj.Trajectory :returns: the total extension for each state, so expect a size of (n_states,) :rtype: jd_types.ARR_OR_SCALAR .. py:function:: stretch(forces: jax.numpy.ndarray, extensions: jax.numpy.ndarray) -> tuple[float, float, float] Computes the effective stretch modulus and relevant summary statistics from stretch experiments. Following Assenza and Perez (JCTC 2022), the effective stretch modulus can be computed as .. math:: \tilde{S} = \frac{L_0}{A_1} where `A_1` and `L_0` are the slope and offset, respectively, of a linear force-extension fit. :param forces: the forces applied to the polymer :type forces: jnp.ndarray :param extensions: the equilibrium extensions under the applied forces :type extensions: jnp.ndarray :returns: the slope and offset of the linear fit, and the effective stretch modulus :rtype: Tuple[float, float, float] .. py:function:: torsion(torques: jax.numpy.ndarray, extensions: jax.numpy.ndarray, twists: jax.numpy.ndarray) -> tuple[float, float] Computes the relevant summary statistics from torsion experiments. Following Assenza and Perez (JCTC 2022), the torsional modulus and twist-stretch coupling can be computed via linear fits to the extension and twist of a duplex under torque (when combined with similar statistics from stretching experiments). This function computes the slopes of these linear fits :param torques: the torques applied to the polymer :type torques: jnp.ndarray :param extensions: the equilibrium extensions under the applied torques :type extensions: jnp.ndarray :param twists: the equilibrium twists under the applied torques :type twists: jnp.ndarray :returns: the slopes of the linear fits to the extensions and twists, respectively :rtype: Tuple[float, float] .. py:function:: stretch_torsion(forces: jax.numpy.ndarray, force_extensions: jax.numpy.ndarray, torques: jax.numpy.ndarray, torque_extensions: jax.numpy.ndarray, torque_twists: jax.numpy.ndarray) -> tuple[float, float, float] Computes the effective stretch and torsion moduli, and twist-stretch coupling from stretch-torsion experiments. :param forces: the forces applied to the polymer :type forces: jnp.ndarray :param force_extensions: the equilibrium extensions under the applied forces :type force_extensions: jnp.ndarray :param torques: the torques applied to the polymer :type torques: jnp.ndarray :param torque_extensions: the equilibrium extensions under the applied torques :type torque_extensions: jnp.ndarray :param torque_twists: the equilibrium twists under the applied torques :type torque_twists: jnp.ndarray :returns: the effective stretch modulus, torsional modulus, and twist-stretch coupling :rtype: Tuple[float, float, float]