Hi,
indices = (self.indices if self.indices[0] < self.indices[-1] else self.indices[::-1])
why do we reverse the order?
I found it quite confusing when I looked at a Dihedral object and the order of atoms was different from my carefully crafted order to define the dihedral:
>>> dih = u.atoms[[10, 0, 1, 3]].dihedral
>>> list(dih.atoms)
[<Atom 11: C5 of type opls_135 of resname V36, resid 1 and segid V36>,
<Atom 1: C1 of type opls_465 of resname V36, resid 1 and segid V36>,
<Atom 2: O2 of type opls_467 of resname V36, resid 1 and segid V36>,
<Atom 4: C3 of type opls_468 of resname V36, resid 1 and segid V36>]
>>> repr(dih)
'<Dihedral between: Atom 3, Atom 1, Atom 0, Atom 10>'
I’d much rather have the actual order output, but I was wondering if there was any specific reason why we decided to manipulate the printed order?
Oliver
--
Oliver Beckstein (he/his/him)
GitHub: @orbeckst
MDAnalysis – a NumFOCUS fiscally sponsored project