def test_dihedral(self):
    p0 = Position(24.969, 13.428, 30.692)
    p1 = Position(24.044, 12.661, 29.808)
    p2 = Position(22.785, 13.482, 29.543)
    p3 = Position(21.951, 13.67, 30.431)
    p4 = Position(23.672, 11.328, 30.466)
    p5 = Position(22.881, 10.326, 29.62)
    p6 = Position(23.691, 9.935, 28.389)
    p7 = Position(22.557, 9.096, 30.459)

    def check_dihedral(a, b, c, d, angle):
        deg = ((gemmi.calculate_dihedral(a, b, c, d) * 180) / pi)
        self.assertAlmostEqual(deg, angle, places=4)
    check_dihedral(p0, p1, p2, p3, (- 71.21515))
    check_dihedral(p0, p1, p4, p5, (- 171.94319))
    check_dihedral(p1, p4, p5, p6, 60.82226)
    check_dihedral(p1, p4, p5, p7, (- 177.63641))
def test_dihedral(self):
    p0 = Position(24.969, 13.428, 30.692)
    p1 = Position(24.044, 12.661, 29.808)
    p2 = Position(22.785, 13.482, 29.543)
    p3 = Position(21.951, 13.67, 30.431)
    p4 = Position(23.672, 11.328, 30.466)
    p5 = Position(22.881, 10.326, 29.62)
    p6 = Position(23.691, 9.935, 28.389)
    p7 = Position(22.557, 9.096, 30.459)

    def check_dihedral(a, b, c, d, angle):
        deg = ((gemmi.calculate_dihedral(a, b, c, d) * 180) / pi)
        self.assertAlmostEqual(deg, angle, places=4)
    check_dihedral(p0, p1, p2, p3, (- 71.21515))
    check_dihedral(p0, p1, p4, p5, (- 171.94319))
    check_dihedral(p1, p4, p5, p6, 60.82226)
    check_dihedral(p1, p4, p5, p7, (- 177.63641))