예제 #1
0
    def test_right_type_impropers(self):
        assert_equal(self.igroup.torsions(),
                     calc_torsions(self.igroup.atom1.positions,
                                   self.igroup.atom2.positions,
                                   self.igroup.atom3.positions,
                                   self.igroup.atom4.positions))

        assert_equal(self.igroup.torsions(pbc=True),
                     calc_torsions(self.igroup.atom1.positions,
                                   self.igroup.atom2.positions,
                                   self.igroup.atom3.positions,
                                   self.igroup.atom4.positions,
                                   box=self.u.dimensions))
예제 #2
0
    def test_right_type_impropers(self):
        assert_equal(
            self.igroup.torsions(),
            calc_torsions(self.igroup.atom1.positions,
                          self.igroup.atom2.positions,
                          self.igroup.atom3.positions,
                          self.igroup.atom4.positions))

        assert_equal(
            self.igroup.torsions(pbc=True),
            calc_torsions(self.igroup.atom1.positions,
                          self.igroup.atom2.positions,
                          self.igroup.atom3.positions,
                          self.igroup.atom4.positions,
                          box=self.u.dimensions))
예제 #3
0
    def test_torsions(self):
        from MDAnalysis.core.distances import calc_torsions

        a2 = (self.a + self.box * (-1, 0, 0)).astype(np.float32)
        b2 = (self.b + self.box * (1, 0, 1)).astype(np.float32)
        c2 = (self.c + self.box * (-2, 5, -7)).astype(np.float32)
        d2 = (self.d + self.box * (0, -5, 0)).astype(np.float32)

        ref = calc_torsions(self.a, self.b, self.c, self.d)

        test1 = calc_torsions(a2, self.b, self.c, self.d, box=self.box)
        test2 = calc_torsions(self.a, b2, self.c, self.d, box=self.box)
        test3 = calc_torsions(self.a, self.b, c2, self.d, box=self.box)
        test4 = calc_torsions(self.a, self.b, self.c, d2, box=self.box)
        test5 = calc_torsions(a2, b2, c2, d2, box=self.box)

        for val in [test1, test2, test3, test4, test5]:
            assert_almost_equal(ref, val, self.prec, err_msg="Min image in torsion calculation failed")