# Path: upho/structure/unfolder_symmetry.py
# class UnfolderSymmetry(Symmetry):
#     def create_little_group(self, kpoint):
#         rotations = self._symmetry_operations["rotations"]
#         translations = self._symmetry_operations["translations"]
#         lattice = self._cell.get_cell()
# 
#         rotations_kpoint = []
#         translations_kpoint = []
#         for r, t in zip(rotations, translations):
#             diff = np.dot(kpoint, r) - kpoint
#             diff -= np.rint(diff)
#             dist = np.linalg.norm(np.dot(np.linalg.inv(lattice), diff))
#             if dist < self._symprec:
#                 rotations_kpoint.append(r)
#                 translations_kpoint.append(t)
# 
#         return np.array(rotations_kpoint), np.array(translations_kpoint)
# 
#     get_group_of_wave_vector = create_little_group
# 
#     def create_star(self, kpoint):
#         """
#         Create the star of the given kpoint
# 
#         Parameters
#         ----------
#         kpoint : Reciprocal space point
# 
#         Returns
#         -------
#         star : n x 3 array
#             Star of the given kpoint.
#         transformation_matrices : n x 3 x 3 array
#             Matrices to obtain arms of the star from the given kpoint.
#         """
#         rotations = self._symmetry_operations["rotations"]
#         lattice = self._cell.get_cell()
# 
#         def get_dist(tmp, arm):
#             diff = tmp - arm
#             # diff -= np.rint(diff)  # TODO(ikeda): Check definition.
#             dist = np.linalg.norm(np.dot(np.linalg.inv(lattice), diff))
#             return dist
# 
#         star = []
#         transformation_matrices = []
#         for r in rotations:
#             tmp = np.dot(kpoint, r)
#             if all(get_dist(tmp, arm) > self._symprec for arm in star):
#                 star.append(tmp)
#                 transformation_matrices.append(r)
# 
#         return np.array(star), np.array(transformation_matrices)


import unittest
import os
import numpy as np
from phonopy.interface.vasp import read_vasp
from upho.structure.unfolder_symmetry import UnfolderSymmetry
        self.assertEqual(len(rotations_kpoint), 16)

    def test_111(self):
        kpoint = np.array([0.5, 0.5, 0.5])  # R: O_h
        (rotations_kpoint,
         translations_kpoint) = self._symmetry.create_little_group(kpoint)

        self.assertEqual(len(rotations_kpoint), 48)

    def test_star_000(self):
        symmetry = self._symmetry
        prec = 1e-9
        kpoint = np.array([0.0, 0.0, 0.0])
        star, transformation_matrices = symmetry.create_star(kpoint)

        star_exp = [
            [0.0, 0.0, 0.0],
        ]

        self.assertTrue(np.all(np.abs(star - star_exp) < prec))

    def test_star_100(self):
        symmetry = self._symmetry
        prec = 1e-9
        kpoint = np.array([0.5, 0.0, 0.0])
        star, transformation_matrices = symmetry.create_star(kpoint)

        self.assertEqual(len(star), 6)

    def test_star_110(self):

# Path: upho/structure/unfolder_symmetry.py
# class UnfolderSymmetry(Symmetry):
#     def create_little_group(self, kpoint):
#         rotations = self._symmetry_operations["rotations"]
#         translations = self._symmetry_operations["translations"]
#         lattice = self._cell.get_cell()
# 
#         rotations_kpoint = []
#         translations_kpoint = []
#         for r, t in zip(rotations, translations):
#             diff = np.dot(kpoint, r) - kpoint
#             diff -= np.rint(diff)
#             dist = np.linalg.norm(np.dot(np.linalg.inv(lattice), diff))
#             if dist < self._symprec:
#                 rotations_kpoint.append(r)
#                 translations_kpoint.append(t)
# 
#         return np.array(rotations_kpoint), np.array(translations_kpoint)
# 
#     get_group_of_wave_vector = create_little_group
# 
#     def create_star(self, kpoint):
#         """
#         Create the star of the given kpoint
# 
#         Parameters
#         ----------
#         kpoint : Reciprocal space point
# 
#         Returns
#         -------
#         star : n x 3 array
#             Star of the given kpoint.
#         transformation_matrices : n x 3 x 3 array
#             Matrices to obtain arms of the star from the given kpoint.
#         """
#         rotations = self._symmetry_operations["rotations"]
#         lattice = self._cell.get_cell()
# 
#         def get_dist(tmp, arm):
#             diff = tmp - arm
#             # diff -= np.rint(diff)  # TODO(ikeda): Check definition.
#             dist = np.linalg.norm(np.dot(np.linalg.inv(lattice), diff))
#             return dist
# 
#         star = []
#         transformation_matrices = []
#         for r in rotations:
#             tmp = np.dot(kpoint, r)
#             if all(get_dist(tmp, arm) > self._symprec for arm in star):
#                 star.append(tmp)
#                 transformation_matrices.append(r)
# 
#         return np.array(star), np.array(transformation_matrices)


# Path: tests/test_unfolder_symmetry.py
import unittest
import os
import numpy as np
from phonopy.interface.vasp import read_vasp
from upho.structure.unfolder_symmetry import UnfolderSymmetry

        self.assertEqual(len(rotations_kpoint), 16)

    def test_111(self):
        kpoint = np.array([0.5, 0.5, 0.5])  # R: O_h
        (rotations_kpoint,
         translations_kpoint) = self._symmetry.create_little_group(kpoint)

        self.assertEqual(len(rotations_kpoint), 48)

    def test_star_000(self):
        symmetry = self._symmetry
        prec = 1e-9
        kpoint = np.array([0.0, 0.0, 0.0])
        star, transformation_matrices = symmetry.create_star(kpoint)

        star_exp = [
            [0.0, 0.0, 0.0],
        ]

        self.assertTrue(np.all(np.abs(star - star_exp) < prec))

    def test_star_100(self):
        symmetry = self._symmetry
        prec = 1e-9
        kpoint = np.array([0.5, 0.0, 0.0])
        star, transformation_matrices = symmetry.create_star(kpoint)

        self.assertEqual(len(star), 6)

    def test_star_110(self):

        symmetry = self._symmetry