예제 #1
0
def rotate_3D(atom, source_atom):
    """
    Rotates the ADP of 'atom' to match the orientation
    of 'source_atom.
    """
    from lauescript.cryst.match import get_transform

    lst2 = [np.array([0, 0, 0]), source_atom.orientation[0], source_atom.orientation[1]]
    lst1 = [np.array([0, 0, 0]), atom.orientation[0], atom.orientation[1]]

    matrix = get_transform(lst1, lst2, matrix=True)

    adp = source_atom.adp['cart_int']

    atom.adp['cart_int'] = rotate_adp(adp, matrix)
예제 #2
0
def rotate_ADP_about_axis(ADP, angle, axisDirection):
    """
    Rotates an ADP about an axis by a given angle.
    :param ADP: list type containing six floats representing an ADP in XD format. (U11, U22, U33, U12, U13, U23)
    :param angle: float representing the angle the point is about to be rotated in degree.
    :param axisDirection: list type containing three floats representing the direction of the vector
    the point is rotated about. (x, y, z)
    :return: tuple containing six floats representing the rotated ADP.
    """
    adp = get_adp_as_matrix(ADP)
    u, v = np.linalg.eig(adp)
    startPoints = [v[:, i].flatten().tolist()[0] for i in range(3)]
    endPoints = [rotate_point_about_axis(point, angle, axisDirection, (0, 0, 0)) for point in startPoints]
    rotMat = get_transform(startPoints, endPoints, matrix=True).transpose()
    newadp = np.dot(rotMat.transpose(), np.dot(adp, rotMat))
    return newadp[0, 0], newadp[1, 1], newadp[2, 2], newadp[0, 1], newadp[0, 2], newadp[1, 2]
예제 #3
0
 def _trust_molecules(self):
     cloud1 = self['exp'].coords()[:3]
     cloud2 = self['micro'].coords()[:3]
     transformation = get_transform(cloud1, cloud2, matrix=True)
     for i, atom in enumerate(self['exp'].atoms):
         atom.transfer_matched_ADP(self['micro'].atoms[i], transformation)