Transform the frame to a new basis.

        This function transforms the cartesian coordinates from an
        old basis to a new one. Please note that old_basis and
        new_basis are supposed to have full Rank and consist of
        three linear independent vectors. If rotate_only is True,
        it is asserted, that both bases are orthonormal and right
        handed. Besides all involved matrices are transposed
        instead of inverted.
        In some applications this may require the function
        :func:`xyz_functions.orthonormalize` as a previous step.

        Args:
            old_basis (np.array):
            new_basis (np.array):
            rotate_only (bool):

        Returns:
            Cartesian: The transformed molecule.

def basistransform(self, new_basis, old_basis=None,
                       orthonormalize=True):
        """Transform the frame to a new basis.

        This function transforms the cartesian coordinates from an
        old basis to a new one. Please note that old_basis and
        new_basis are supposed to have full Rank and consist of
        three linear independent vectors. If rotate_only is True,
        it is asserted, that both bases are orthonormal and right
        handed. Besides all involved matrices are transposed
        instead of inverted.
        In some applications this may require the function
        :func:`xyz_functions.orthonormalize` as a previous step.

        Args:
            old_basis (np.array):
            new_basis (np.array):
            rotate_only (bool):

        Returns:
            Cartesian: The transformed molecule.
        """
        if old_basis is None:
            old_basis = np.identity(3)

        is_rotation_matrix = np.isclose(np.linalg.det(new_basis), 1)
        if not is_rotation_matrix and orthonormalize:
            new_basis = xyz_functions.orthonormalize_righthanded(new_basis)
            is_rotation_matrix = True

        if is_rotation_matrix:
            return dot(np.dot(new_basis.T, old_basis), self)
        else:
            return dot(np.dot(np.linalg.inv(new_basis), old_basis), self)