Added atan2 based function for calculating dihedral angles