Пример #1
0
    def setUp(self):
        self.precision = 3  # rather lenient but see #271
        self.u = mda.Universe(PSF, DCD)
        self.a1 = self.u.atoms[1:3]
        self.a2 = self.u.atoms[3:5]

        self.TO1 = TopologyObject(self.a1.indices, self.u)
        self.TO2 = TopologyObject(self.a2.indices, self.u)
        # this atom only has one bond, so the order bonds are done (random
        # because of sets) won't come back to bite us
        self.b = self.u.atoms[12].bonds[0]
Пример #2
0
    def setUp(self):
        self.precision = 3  # rather lenient but see #271
        self.u = MDAnalysis.Universe(PSF, DCD)
        self.u.build_topology()
        self.a1 = list(self.u.atoms[1:3])
        self.a2 = list(self.u.atoms[3:5])

        self.TO1 = TopologyObject(self.a1)
        self.TO2 = TopologyObject(self.a2)
        # this atom only has one bond, so the order bonds are done (random because of sets)
        # won't come back to bite us
        self.b = self.u.atoms[12].bonds[0]
Пример #3
0
    def test_hash(self, TO1, TO2, a1, PSFDCD):
        assert hash(TO1) != hash(TO2)

        # Different universe should yield different hash
        u = mda.Universe(PSF, DCD)
        ag = u.atoms[1:3]
        TO3 = TopologyObject(ag.indices, u)
        assert hash(TO1) != hash(TO3)

        # Different order should yield different hash
        u = mda.Universe(PSF, DCD)
        ag = u.atoms[[2, 1]]
        TO3 = TopologyObject(ag.indices, u)
        assert hash(TO1) != hash(TO3)

        # should work with TO from the same atomgroup
        TO3 = TopologyObject(a1.indices, PSFDCD)
        assert_equal(hash(TO1), hash(TO3))
Пример #4
0
    def test_ne(self, TO1, TO2, a1, PSFDCD):
        TO1_b = TopologyObject(a1.indices, PSFDCD)

        assert_equal(TO1 != TO1_b, False)
        assert_equal(TO1 != TO2, True)
Пример #5
0
 def TO2(a2):
     return TopologyObject(a2.indices, a2.universe)
Пример #6
0
 def TO1(a1):
     return TopologyObject(a1.indices, a1.universe)
Пример #7
0
    def test_ne(self):
        TO1_b = TopologyObject(self.a1)

        assert_equal(self.TO1 != TO1_b, False)
        assert_equal(self.TO1 != self.TO2, True)
Пример #8
0
    def test_eq(self):
        TO1_b = TopologyObject(self.a1)

        assert_equal(self.TO1 == TO1_b, True)
        assert_equal(self.TO1 == self.TO2, False)