Beispiel #1
0
def R6(coords, atmidx, dismat, shakedata):
    '''Wrapped R6 algorithm, include R6 and shakeH'''
    shakes = [shakedata[idx] for idx in atmidx[1:-1]]
    for baseresult in R6a(coords, atmidx, dismat):
        newcoords = coords.copy()
        for idx, newcoord in baseresult.items():
            newcoords[idx] = newcoord
        for refidxs, sidechain_ in shakes:
            baseresult.update(sidechain.movesidechain(coords, newcoords,
                                                      refidxs, sidechain_))
        yield baseresult
Beispiel #2
0
 def R6(self, coords, atmidx, dismat, shakedata):
     '''Wrapped R6 algorithm, include R6 and shakeH'''
     shakes = [shakedata[idx] for idx in atmidx[1:-1]]
     for baseresult in self.__R6(coords, atmidx, dismat):
         newcoords = coords.copy()
         abs_dist = 0.0 
         for idx, newcoord in baseresult.items():
             newcoords[idx] = newcoord
             abs_dist += sum(abs(newcoord - coords[idx]))
         if abs_dist < self.min_abs_dist:
             continue
         for refidxs, sidechain_ in shakes:
             baseresult.update(sidechain.movesidechain(coords, newcoords, refidxs, sidechain_))
         yield baseresult
Beispiel #3
0
 def test_1(self):
     fromcoords = numpy.array(((-1.0, 0.0, 0.0),
                               (0.0, 0.0, 0.0),
                               (0.0, -1.0, 0.0),
                               (1.0, 1.0, 0.0)))
     tocoords = numpy.array(((-1.0, 0.0, 0.0),
                             (-1.0, -1.0, 0.0),
                             (0.0, -1.0, 0.0),
                             (1.0, 1.0, 0.0)))
     refidxs = (0, 1, 2)
     s = (3,)
     res = sidechain.movesidechain(fromcoords, tocoords, refidxs, s)
     self.assertAlmostEqual(distance(res[3], numpy.array((-2.0, -2.0, 0))),
                            0.0)
Beispiel #4
0
def R6(coords, atmidx, dismat, shakedata):
    '''Wrapped R6 algorithm, include R6 and shakeH'''
    shakes = [shakedata[idx] for idx in atmidx[1:-1]]
    mezeipro2 = Mezeipro2(coords, dismat, atmidx)
    for result in mezeipro2():
        baseresult = {}
        for i in range(2,8):
            baseresult[atmidx[i]] = result[i-2]
        newcoords = coords.copy()
        for idx, newcoord in baseresult.items():
            newcoords[idx] = newcoord
        for refidxs, sidechain_ in shakes:
            baseresult.update(sidechain.movesidechain(coords, newcoords,
                                                      refidxs, sidechain_))
        yield baseresult
Beispiel #5
0
 def testsidechain(self):
     import StringIO
     mol = read.readxyz(StringIO.StringIO(test_in))
     coords1 = mol.coords
     coords2 = coords1.copy()
     coords2[1] = coords1[3]
     coords2[2] = coords1[4]
     coords2[3] = coords1[1]
     coords2[4] = coords1[2]
     newcoords = sidechain.movesidechain(coords1, coords2,
                                         (0, 1, 2),
                                         (3, 4))
     for key in newcoords:
         coord = newcoords[key]
         assert isinstance(coord, numpy.ndarray) and coord.shape == (3,) and coord.dtype == float, (coord, coord.shape, coord.dtype)
     self.assertAlmostEqual(tools.length(newcoords[3] - coords2[3]), 0, 4)
     self.assertAlmostEqual(tools.length(newcoords[4] - coords2[4]), 0, 4)