Skip to content

Commit

Permalink
Fix #2582: polymer persistence length example fix (#2589)
Browse files Browse the repository at this point in the history
* Fix #2582 
* fix polymer persistence length example fix
* Added name to AUTHOR file
* Update CHANGELOG

Co-authored-by: Richard Gowers <[email protected]>
  • Loading branch information
ss62171 and richardjgowers authored Mar 7, 2020
1 parent 1f4e492 commit 82e0d6d
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 6 deletions.
1 change: 1 addition & 0 deletions package/AUTHORS
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,7 @@ Chronological list of authors
- Hao Tian
- Hugo MacDermott-Opeskin
- Anshul Angaria
- Shubham Sharma



Expand Down
4 changes: 3 additions & 1 deletion package/CHANGELOG
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@ The rules for this file:
------------------------------------------------------------------------------
mm/dd/yy richardjgowers, kain88-de, lilyminium, p-j-smith, bdice, joaomcteixeira,
PicoCentauri, davidercruz, jbarnoud, RMeli, IAlibay, mtiberti, CCook96,
Yuan-Yu, xiki-tempula, HTian1997, Iv-Hristov, hmacdope, AnshulAngaria
Yuan-Yu, xiki-tempula, HTian1997, Iv-Hristov, hmacdope, AnshulAngaria,
ss62171

* 0.21.0

Expand Down Expand Up @@ -58,6 +59,7 @@ Fixes
argument. The directives parsed into bonds, angles, impropers, and dihedrals now
match TPRParser. (PR #2408)
* Added parmed to setup.py
* Fixed example docs for polymer persistence length (#2582)

Enhancements
* New analysis.hole2 module for HOLE interfacing. Contains a function (hole)
Expand Down
10 changes: 5 additions & 5 deletions package/MDAnalysis/analysis/polymer.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,16 +48,16 @@
# so we can select the chains by using the .fragments attribute
chains = u.atoms.fragments
# select only the backbone atoms for each chain
backbones = [chain.select_atoms('not name O* H') for chain in chains]
backbones = [chain.select_atoms('not name O* H*') for chain in chains]
# sort the chains, removing any non-backbone atoms
sorted_backbones = [polymer.sort_backbone(bb) for bb in backbones]
lp = polymer.PersistenceLength(sorted_backbones)
persistence_length = polymer.PersistenceLength(sorted_backbones)
# Run the analysis, this will average over all polymer chains
# and all timesteps in trajectory
lp = lp.run()
print('The persistence length is: {}'.format(lp.pl))
persistence_length = persistence_length.run()
print('The persistence length is: {}'.format(persistence_length.lp))
# always check the visualisation of this:
lp.plot()
persistence_length.plot()
"""
from __future__ import division, absolute_import
Expand Down

0 comments on commit 82e0d6d

Please sign in to comment.