Exemplo n.º 1
0
 def test_shooting_move(self):
     self.shooter = ForwardShootMover(ensemble=self.ens,
                                      selector=FirstFrameSelector(),
                                      engine=self.dyn)
     change = self.shooter.move(self.gs)
     samples = change.trials
     assert len(samples) == 1
     assert change.accepted is True
     truth = [-0.5, -0.4, -0.3, -0.2, -0.1]
     assert truth == [s.coordinates[0][0] for s in samples[0].trajectory]
Exemplo n.º 2
0
 def test_shooting_move(self):
     self.shooter = ForwardShootMover(ensemble=self.ens,
                                      selector=FirstFrameSelector(),
                                      engine=self.dyn)
     change = self.shooter.move(self.gs)
     samples = change.trials
     assert_equal(len(samples), 1)
     assert_equal(change.accepted, True)
     assert_items_equal(
         [-0.5, -0.4, -0.3, -0.2, -0.1],
         [s.coordinates[0][0] for s in samples[0].trajectory])
Exemplo n.º 3
0
 def test_shooting_move(self):
     self.shooter = ForwardShootMover(ensemble=self.ens, selector=FirstFrameSelector(), engine=self.dyn)
     change = self.shooter.move(self.gs)
     samples = change.trials
     assert_equal(len(samples), 1)
     assert_equal(change.accepted, True)
     assert_items_equal([-0.5, -0.4, -0.3, -0.2, -0.1], [s.coordinates[0][0] for s in samples[0].trajectory])
Exemplo n.º 4
0
class TestFirstFrameSelector(SelectorTest):
    def test_pick(self):
        sel = FirstFrameSelector()
        sp = sel.pick(self.mytraj)
        assert sp == 0
        snap = self.mytraj[sp]
        assert snap.coordinates[0][0] == -0.5

    def test_shooting_move(self):
        self.shooter = ForwardShootMover(
            ensemble=self.ens,
            selector=FirstFrameSelector(),
            engine=self.dyn
        )
        change = self.shooter.move(self.gs)
        samples = change.trials
        assert len(samples) == 1
        assert change.accepted is True
        truth = [-0.5, -0.4, -0.3, -0.2, -0.1]
        assert truth == [s.coordinates[0][0] for s in samples[0].trajectory]

    def test_f(self):
        sel = FirstFrameSelector()
        assert sel.f(self.mytraj[0], self.mytraj) == 1
        for frame in self.mytraj[1:]:
            assert sel.f(frame, self.mytraj) == 0
Exemplo n.º 5
0
class TestFirstFrameSelector(SelectorTest):
    def test_pick(self):
        sel = FirstFrameSelector()
        sp = sel.pick(self.mytraj)
        assert_equal(sp, 0)
        snap = self.mytraj[sp]
        assert_equal(snap.coordinates[0][0], -0.5)

    def test_shooting_move(self):
        self.shooter = ForwardShootMover(ensemble=self.ens,
                                         selector=FirstFrameSelector(),
                                         engine=self.dyn)
        change = self.shooter.move(self.gs)
        samples = change.trials
        assert_equal(len(samples), 1)
        assert_equal(change.accepted, True)
        assert_items_equal(
            [-0.5, -0.4, -0.3, -0.2, -0.1],
            [s.coordinates[0][0] for s in samples[0].trajectory])

    def test_f(self):
        sel = FirstFrameSelector()
        assert sel.f(self.mytraj[0], self.mytraj) == 1
        for frame in self.mytraj[1:]:
            assert sel.f(frame, self.mytraj) == 0
Exemplo n.º 6
0
class TestFirstFrameSelector(SelectorTest):
    def test_pick(self):
        sel = FirstFrameSelector()
        sp = sel.pick(self.mytraj)
        assert_equal(sp, 0)
        snap = self.mytraj[sp]
        assert_equal(snap.coordinates[0][0], -0.5)

    def test_shooting_move(self):
        self.shooter = ForwardShootMover(
            ensemble=self.ens,
            selector=FirstFrameSelector(),
            engine=self.dyn
        )
        change = self.shooter.move(self.gs)
        samples = change.trials
        assert_equal(len(samples), 1)
        assert_equal(change.accepted, True)
        assert_items_equal(
            [-0.5, -0.4, -0.3, -0.2, -0.1],
            [s.coordinates[0][0] for s in samples[0].trajectory]
        )

    def test_f(self):
        sel = FirstFrameSelector()
        assert sel.f(self.mytraj[0], self.mytraj) == 1
        for frame in self.mytraj[1:]:
            assert sel.f(frame, self.mytraj) == 0
Exemplo n.º 7
0
class testFirstFrameSelector(SelectorTest):
    def test_pick(self):
        sel = FirstFrameSelector()
        sp = sel.pick(self.mytraj)
        assert_equal(sp.selector, sel)
        assert_equal(sp.trajectory, self.mytraj)
        assert_equal(sp.index, 0)
        assert_equal(sp.f, 1.0)
        assert_equal(sp.sum_bias, 1.0)
        snap = sp.snapshot
        assert_equal(snap.coordinates[0][0], -0.5)

    def test_shooting_move(self):
        self.shooter = ForwardShootMover(
            ensemble=self.ens,
            selector=FirstFrameSelector()
        )
        change = self.shooter.move(self.gs)
        samples = change.trials
        assert_equal(len(samples), 1)
        assert_equal(change.accepted, True)
        assert_items_equal([-0.5, -0.4, -0.3, -0.2, -0.1],
                           [s.coordinates[0][0] for s in samples[0].trajectory]
                          )