SimTk/mdtraj — pull request #585 by swails (2014-09-08 17:23:33+00:00)
Title: PSF file support

Adds support for instantiating a `Topology` from CHARMM PSF files. This is a very stripped-down version of what is in ParmEd and OpenMM. It only parses the two sections it needs (`NATOM` and `NBOND`) and ignores the rest.

This PR also includes some other, small, unrelated fixes since I didn't feel like creating separate branches for each small change. Also included in this PR:

- Port the fix from simtk/openmm#538 to the `unit` package here
- Added a `getByMass` staticmethod to `mdtraj.core.element.Element`, copied from the one in OpenMM (although this is used by the PSF file parsing). This function may be worth using in the prmtop parser, although all "modern" prmtop files have an ATOMIC_NUMBER section that renders element guessing irrelevant.
- Fixed a few small warnings pyflakes brought to my attention in `mdtraj.formats`, including one that would have caused a fatal `NameError` (the `warnings` package was not imported, but `warnings.warn` was called if a specific filename suffix was not `.lh5`)