Example #1
0
def align(system, coords1, coords2):
    c1 = system.coords_adapter(coords1)
    c2 = system.coords_adapter(coords2)
    R = findrotation_kabsch(c2.posRigid, c1.posRigid).transpose()
    #R = rotations.aa2mx(p)
    for x, p in zip(c2.posRigid, c2.rotRigid):
        x[:] = np.dot(R, x)
        p[:] = rotations.rotate_aa(p, rotations.mx2aa(R))

    # now account for symmetry in water
    for p1, p2 in zip(c1.rotRigid, c2.rotRigid):
        theta1 = np.linalg.norm(rotations.rotate_aa(p2, -p1))
        p2n = rotations.rotate_aa(np.array([0., 0., pi]), p2)
        theta2 = np.linalg.norm(rotations.rotate_aa(p2n, -p1))
        theta1 -= int(theta1 / 2. / pi) * 2. * pi
        theta2 -= int(theta2 / 2. / pi) * 2. * pi
        if (theta2 < theta1):
            p2[:] = p2n
Example #2
0
def align(system, coords1, coords2):
    c1 = system.coords_adapter(coords1)
    c2 = system.coords_adapter(coords2)
    R = findrotation_kabsch(c2.posRigid, c1.posRigid).transpose()
    #R = rotations.aa2mx(p)
    for x, p in zip(c2.posRigid, c2.rotRigid):
        x[:] = np.dot(R, x)
        p[:] = rotations.rotate_aa(p, rotations.mx2aa(R))
    
    # now account for symmetry in water
    for p1, p2 in zip(c1.rotRigid,c2.rotRigid):
        theta1 = np.linalg.norm(rotations.rotate_aa(p2,-p1))
        p2n = rotations.rotate_aa(np.array([0., 0., pi]), p2)
        theta2 = np.linalg.norm(rotations.rotate_aa(p2n,-p1))
        theta1 -= int(theta1/2./pi)*2.*pi
        theta2 -= int(theta2/2./pi)*2.*pi
        if(theta2 < theta1): 
            p2[:]=p2n
Example #3
0
e1 = []
e2 = []

e1.append(pot.getEnergy(path[0]))
e2.append(pot.getEnergy(path[0]))

#for i in xrange(1):
for i in xrange(len(path) - 1):
    e1.append(pot.getEnergy(path[i + 1]))
    c1 = CoordsAdapter(nrigid=13, coords=path[i])
    c2 = CoordsAdapter(nrigid=13, coords=path[i + 1])
    com1 = np.sum(c1.posRigid, axis=0) / float(13)
    com2 = np.sum(c1.posRigid, axis=0) / float(13)
    c1.posRigid -= com1
    c2.posRigid -= com2
    mx = findrotation_kabsch(c2.posRigid, c1.posRigid).transpose()
    # print mx
    c2.posRigid[:] = np.dot(mx, c2.posRigid.transpose()).transpose()
    for p in c2.rotRigid:
        p[:] = rotations.rotate_aa(p, rotations.mx2aa(mx))
    e2.append(pot.getEnergy(path[i + 1]))

    for p1, p2 in zip(c1.rotRigid, c2.rotRigid):
        n2 = p2 / np.linalg.norm(p2) * 2. * pi

        while True:
            p2n = p2 + n2
            if (np.linalg.norm(p2n - p1) > np.linalg.norm(p2 - p1)):
                break
            p2[:] = p2n
Example #4
0
e1 = []
e2 = []

e1.append(pot.getEnergy(path[0]))
e2.append(pot.getEnergy(path[0]))

#for i in xrange(1):
for i in range(len(path) - 1):
    e1.append(pot.getEnergy(path[i + 1]))
    c1 = CoordsAdapter(nrigid=13, coords=path[i])
    c2 = CoordsAdapter(nrigid=13, coords=path[i + 1])
    com1 = np.sum(c1.posRigid, axis=0) / float(13)
    com2 = np.sum(c1.posRigid, axis=0) / float(13)
    c1.posRigid -= com1
    c2.posRigid -= com2
    mx = findrotation_kabsch(c2.posRigid, c1.posRigid).transpose()
    # print mx
    c2.posRigid[:] = np.dot(mx, c2.posRigid.transpose()).transpose()
    for p in c2.rotRigid:
        p[:] = rotations.rotate_aa(p, rotations.mx2aa(mx))
    e2.append(pot.getEnergy(path[i + 1]))

    for p1, p2 in zip(c1.rotRigid, c2.rotRigid):
        n2 = old_div(p2, np.linalg.norm(p2) * 2. * pi)

        while True:
            p2n = p2 + n2
            if (np.linalg.norm(p2n - p1) > np.linalg.norm(p2 - p1)):
                break
            p2[:] = p2n