remove code repitition with mdtraj.topology