예제 #1
0
파일: mezeipro.py 프로젝트: lidaobing/itcc
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
예제 #2
0
파일: mezei.py 프로젝트: lidaobing/itcc
 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
예제 #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)
예제 #4
0
파일: mezeipro2.py 프로젝트: lidaobing/itcc
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
예제 #5
0
파일: sidechain.py 프로젝트: lidaobing/itcc
 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)