# Determining the persistence length of a polymer¶

Here we determine the persistence length of a polymer.

Last executed: May 18, 2021 with MDAnalysis 1.1.1

Last updated: January 2020

Minimum version of MDAnalysis: 1.0.0

Packages required:

:

import MDAnalysis as mda
from MDAnalysis.tests.datafiles import TRZ_psf, TRZ
from MDAnalysis.analysis import polymer
%matplotlib inline


The test files we will be working with here feature a pure polymer melt of a polyamide.

:

u = mda.Universe(TRZ_psf, TRZ)


## Choosing the chains and backbone atoms¶

We can define the chains of polyamide to be the common definition of a molecule: where each atom is bonded to at least one other in the group, and not bonded to any atom outside the group. MDAnalysis provides these as fragments.

:

chains = u.atoms.fragments


We then want to select only the backbone atoms for each chain, i.e. only the carbons and nitrogens.

:

backbones = [ch.select_atoms('not name O* H*') for ch in chains]


This should give us AtomGroups where the spatial arrangement is linear. However, the atoms are in index order. We can use sort_backbone to arrange our atom groups into their linear arrangement order.

:

sorted_bb = [polymer.sort_backbone(bb) for bb in backbones]


## Calculating the persistence length¶

The persistence length is the length at which two points on the polymer chain become decorrelated. This is determined by first measuring the autocorrelation $$C(n)$$ of two bond vectors $$(\mathbf{a}_i, \mathbf{a}_{i + n})$$ separated by $$n$$ bonds, where

$C(n) = \langle \cos\theta_{i, i+n} \rangle = \langle \mathbf{a_i} \cdot \mathbf{a_{i+n}} \rangle$

An exponential decay is then fitted to this, which yields the persistence length $$l_P$$ from the average bond length $$\bar{l_B}$$.

$C(n) \approx \exp\left( - \frac{n \bar{l_B}}{l_P} \right)$

We set up our PersistenceLength class (API docs). Note that every chain we pass into it must have the same length.

:

plen = polymer.PersistenceLength(sorted_bb)
plen.run()

/Users/lily/anaconda3/envs/mda-user-guide/lib/python3.7/site-packages/MDAnalysis/analysis/polymer.py:240: DeprecationWarning: The structure of the results array will change in MDAnalysis version 2.0.
category=DeprecationWarning

:

<MDAnalysis.analysis.polymer.PersistenceLength at 0x7f969102d0d0>


The average bond length is found at plen.lb, the calculated persistence length at plen.lp, the measured autocorrelation at plen.results and the modelled decorrelation fit at plen.fit.

:

print(plen.results.shape)
print('The persistence length is {}'.format(plen.lp))

(179,)
The persistence length is 6.917464580166461


MDAnalysis.analysis.polymer.PersistenceLength provides a convenience method to plot the results.

:

plen.plot()

:

<matplotlib.axes._subplots.AxesSubplot at 0x7f9691028f10> 