Exemplo n.º 1
0
    def setUp(self):
        self.host = load_structure()
        self.guest = load_molecule()
        self.complex = Complex(self.host, self.guest)
        self.fitness = MinDistanceFitness(threshold=1.5)

        self.num_steps = 100
        self.temperature = 0.1

        self.mcdocker = MonteCarloDocker(
            self.host, self.guest,
            fitness=self.fitness, temperature=self.temperature
        )
Exemplo n.º 2
0
class TestMCDocker(ut.TestCase):
    def setUp(self):
        self.host = load_structure()
        self.guest = load_molecule()
        self.complex = Complex(self.host, self.guest)
        self.fitness = MinDistanceFitness(threshold=1.5)

        self.num_steps = 100
        self.temperature = 0.1

        self.mcdocker = MonteCarloDocker(
            self.host, self.guest,
            fitness=self.fitness, temperature=self.temperature
        )

    def test_run(self):
        cpx = self.mcdocker.run(self.complex.copy(), self.num_steps)
        self.assertTrue(cpx.distance_matrix.min() > 1.5)

    def test_dock(self):
        cpxs = self.mcdocker.dock(self.num_steps)
        self.assertIsInstance(cpxs, list)
        self.assertIsInstance(cpxs[0], Complex)

    def test_copy(self):
        newdocker = self.mcdocker.copy()

        self.assertEqual(newdocker.temperature, self.mcdocker.temperature)
        self.assertEqual(newdocker.host, self.mcdocker.host)
        self.assertEqual(newdocker.guest, self.mcdocker.guest)
Exemplo n.º 3
0
    def dock_at_point(self, point, attempts):
        hcoords = self.translate_host(point)

        complexes = [
            Complex(self.new_host(newcoords=hcoords),
                    self.new_guest(newcoords=self.rotate_guest()))
            for _ in range(attempts)
        ]

        return complexes
Exemplo n.º 4
0
    def dock(self, attempts):
        cpx = Complex(self.host.copy(), self.guest.copy())

        for trial in range(attempts):
            cpx = self.run(cpx, 1)

            if self.fitness(cpx) >= 0:
                print(f"{trial + 1} attempts to success")
                return [cpx]

        return []
Exemplo n.º 5
0
 def setUp(self):
     self.host = load_structure()
     self.guest = load_molecule()
     self.complex = Complex(self.host.copy(), self.guest.copy())
Exemplo n.º 6
0
 def create_new_complex(self, host_coords, guest_coords):
     return Complex(self.new_host(newcoords=host_coords),
                    self.new_guest(newcoords=guest_coords),
                    add_transform=False)
Exemplo n.º 7
0
    def dock(self, attempts):
        cpx = Complex(self.host.copy(), self.guest.copy())
        cpx = self.run(cpx, attempts)

        return self.rank_complexes([cpx])