Freely jointed chain
Usage examples and full code reference for
FreelyJointedChain. For the underlying theory, see
Freely jointed chain.
Quick start
from afrc.polymer_models.fjc import FreelyJointedChain
# default segment length b = 3.8 A (one Cα-Cα virtual bond per residue)
model = FreelyJointedChain('MASNDYTQQATQSYGAYPTQPGQGYSQQSSQPYG')
model.get_mean_end_to_end_distance()
model.get_root_mean_squared_end_to_end_distance()
model.get_mean_radius_of_gyration()
# full end-to-end distribution (distances, probabilities)
r, p = model.get_end_to_end_distribution()
# draw a size-matched sample
samples = model.sample_end_to_end_distribution(n=1000)
Change the segment length to make the chain stiffer or more flexible:
stiff = FreelyJointedChain('MASNDYTQQATQSYG', b=4.5)
stiff.get_root_mean_squared_end_to_end_distance()
See also the demo/demo_FreelyJointedChain.ipynb notebook for a worked, plotted example.
Code reference
- class afrc.polymer_models.fjc.FreelyJointedChain(seq, p_of_r_resolution=0.05, b=3.8)
This class generates an object that returns polymer statistics consistent with a freely jointed chain (FJC) of
Nrigid segments each of lengthb.Unlike the (Gaussian) Analytical Flory Random Coil, the end-to-end distance distribution used here is the non-Gaussian Kuhn-Grün distribution [1], which is exact in the long-chain limit and - crucially - respects the finite extensibility of the chain (the end-to-end distance can never exceed the contour length \(L = Nb\)). At small fractional extensions it reduces smoothly to the Gaussian result, so for typical IDP-length chains the bulk of the distribution is close to the AFRC, with deviations appearing in the tail.
This is a composition-independent model: the sequence is used only to set the number of segments. It is included as an additional reference model.
[1] Kuhn, W., & Grün, F. (1942). Beziehungen zwischen elastischen Konstanten und Dehnungsdoppelbrechung hochelastischer Stoffe. Kolloid-Zeitschrift, 101(3), 248-271.
[2] Cohen, A. (1991). A Padé approximant to the inverse Langevin function. Rheologica Acta, 30(3), 270-273.
- __init__(seq, p_of_r_resolution=0.05, b=3.8)
Method to create a FreelyJointedChain object. Seq should be a valid upper-case amino acid sequence and p_of_r_resolution defines the resolution (in angstroms) to be used for distributions.
By default p_of_r_resolution is taken from the config.py file in the afrc package which defines the resolution at 0.05 A.
- Parameters:
seq (str) – Amino acid sequence (used only to calculate the number of segments).
p_of_r_resolution (float) – Bin width for building probability distributions. In Angstroms.
b (float) – Segment (Kuhn) length, in Angstroms. This is the FJC analogue of the
aa_sizeparameter used by the worm-like chain models. The default of 3.8 A corresponds to the Cα-Cα distance.
- get_end_to_end_distribution()
Defines the end-to-end distribution based on the freely jointed chain (FJC) using the non-Gaussian Kuhn-Grün distribution.
This is a composition independent model for which the end-to-end distance depends solely on the number of amino acids. It is included here as an additional reference model.
- Returns:
A 2-pair tuple of numpy arrays where the first is the distance (in Angstroms) and the second array is the probability of that distance.
- Return type:
tuple of arrays
- get_mean_end_to_end_distance()
Returns the mean end-to-end distance (\(R_e\)) for the freely jointed chain.
The mean is computed by integrating over the \(P(r)\) vs. \(r\) distribution (i.e. \(\sum r \cdot P(r)\)), consistent with the convention used by the other models in this package.
- Returns:
Value equal to the mean end-to-end distance.
- Return type:
float
- get_mean_radius_of_gyration()
Returns the mean radius of gyration (\(R_g\)) for the freely jointed chain.
For an ideal chain the radius of gyration is related to the root-mean-square end-to-end distance by \(R_g = \sqrt{\langle R_e^2 \rangle / 6}\), and this relationship is used here.
- Returns:
Value equal to the mean radius of gyration.
- Return type:
float
- get_root_mean_squared_end_to_end_distance()
Returns the root-mean-square end-to-end distance (\(\sqrt{\langle R_e^2 \rangle}\)) for the freely jointed chain.
The value is computed by taking the square root after integrating over \(P(r)\) vs. \(r^2\). In the long-chain (Gaussian) limit this approaches the ideal-chain result \(b\sqrt{N}\).
- Returns:
Value equal to the root-mean-square end-to-end distance.
- Return type:
float
- sample_end_to_end_distribution(n=1000)
Subsamples from the end-to-end distance distribution to generate an uncorrelated ‘trajectory’ of points. Useful for creating a sized-match sample to compare with simulation data.
- Parameters:
n (int) – Number of random values to sample (default = 1000)
- Returns:
Returns an n-length array with n independent values (floats)
- Return type:
np.ndarray