Пример #1
0
    def rotate(self, quaternion):
        """
        Rotate the particle with the specified quaternion

        :param quaternion:
        :return: None
        """
        rot3d = quaternion2rot3d(quaternion)
        new_pos = np.dot(self.atom_pos, rot3d.T)
        self.set_atom_pos(new_pos)
Пример #2
0
def rotate_particle(quaternion, particle):
    """
    Apply one quaternion to rotate the particle.

    :param quaternion:
    :param particle:
    :return:
    """
    rot3d = quaternion2rot3d(quaternion)
    new_pos = np.dot(particle.atom_pos, rot3d.T)
    particle.set_atom_pos(new_pos)