Python code for calculating backbone dihedrals