rmcgibbo/mdtraj — pull request #125 by rmcgibbo (2013-07-31 06:21:48+00:00)
Title: Stuff for topology

1. add `to_openmm` and `from_openmm`, addressing issue #105
2. add `to_dataframe and `from_dataframe`, addressing some of #119
3. add methods to get a specific atom, residue, or chain by index.

@kyleabeauchamp: what do you think about the dataframe methods? I'm not sure how to represent all of the information in a single dataframe. you can put all of the atoms in there (and the residues/chains, etc), but what about the bonds?

```
In [3]: atoms, bonds = md.load('MDTraj/testing/reference/native.pdb').topology.to_dataframe()

In [4]: print atoms
index atom element rindex residue chain
0 0 H1 H 0 ACE 0
1 1 CH3 C 0 ACE 0
2 2 H2 H 0 ACE 0
3 3 H3 H 0 ACE 0
4 4 C C 0 ACE 0
5 5 O O 0 ACE 0
6 6 N N 1 ALA 0
7 7 H H 1 ALA 0
8 8 CA C 1 ALA 0
9 9 HA H 1 ALA 0
10 10 CB C 1 ALA 0
11 11 HB1 H 1 ALA 0
12 12 HB2 H 1 ALA 0
13 13 HB3 H 1 ALA 0
14 14 C C 1 ALA 0
15 15 O O 1 ALA 0
16 16 N N 2 NME 0
17 17 H H 2 NME 0
18 18 C C 2 NME 0
19 19 H1 H 2 NME 0
20 20 H2 H 2 NME 0
21 21 H3 H 2 NME 0

In [5]: print bonds
[[ 4 1]
[ 4 5]
[ 1 0]
[ 1 2]
[ 1 3]
[ 4 6]
[14 8]
[14 15]
[ 8 10]
[ 8 9]
[ 8 6]
[10 11]
[10 12]
[10 13]
[ 7 6]
[14 16]
[18 19]
[18 20]
[18 21]
[18 16]
[17 16]]
```