Code is from MDTRAJ (https://github.com/mdtraj/mdtraj), commit aa1c91f3ab6b0f9e9f1d0c790d2b5bff7c83ece4
