Beispiel #1
0
def movesidechain(fromcoords, tocoords, refidxs, sidechain):
    assert len(refidxs) == 3
    reffrom = [fromcoords[idx] for idx in refidxs]
    refto = [tocoords[idx] for idx in refidxs]
    trans1, _ = pyramid.construct_both_transform_matrix(*reffrom)
    _, trans2 = pyramid.construct_both_transform_matrix(*refto)
    totaltrans = trans2 * trans1
    result = {}
    for idx in sidechain:
        result[idx] = totaltrans(fromcoords[idx])
    return result
Beispiel #2
0
    def test_1(self):
        A = numpy.array((1.0, 2.0, 3.0))
        B = numpy.array((5.0, 4.0, 7.0))
        C = numpy.array((-1.0, 2.0, 0.5))

        trans, revtrans = pyramid.construct_both_transform_matrix(A, B, C)
        A2 = trans(A)
        B2 = trans(B)
        C2 = trans(C)
        
        self.assertAlmostEqual(A2[0], 0.0)
        self.assertAlmostEqual(A2[1], 0.0)
        self.assertAlmostEqual(A2[2], 0.0)
        self.assertAlmostEqual(B2[1], 0.0)
        self.assertAlmostEqual(B2[2], 0.0)
        self.assertAlmostEqual(C2[2], 0.0)

        A3 = revtrans(A2)
        B3 = revtrans(B2)
        C3 = revtrans(C2)
        for i in range(3):
            self.assertAlmostEqual(A[i], A3[i])
            self.assertAlmostEqual(B[i], B3[i])
            self.assertAlmostEqual(C[i], C3[i])