def on_bz_border(self): """ True if the k-point is on the border of the BZ. """ frac_coords = np.array(self.kpoint) kreds = wrap_to_ws(frac_coords) diff = np.abs(np.abs(kreds) - 0.5) return np.any(diff < 1e-8)
def rotate_k(self, frac_coords, wrap_tows=True): """ Apply the symmetry operation to the k-point given in reduced coordinates. Sk is wrapped to the first Brillouin zone if wrap_tows is True. """ sk = np.dot(self.rot_g, frac_coords) * self.time_sign return wrap_to_ws(sk) if wrap_tows else sk
def test_wrap_to_ws(self): """Testing wrap_to_ws""" self.assert_almost_equal(wrap_to_ws(0.5), 0.5) self.assert_almost_equal(wrap_to_ws(-0.5), 0.5) self.assert_almost_equal(wrap_to_ws(0.2), 0.2) self.assert_almost_equal(wrap_to_ws(-0.3), -0.3) self.assert_almost_equal(wrap_to_ws(0.7), -0.3) self.assert_almost_equal(wrap_to_ws(2.3), 0.3) self.assert_almost_equal(wrap_to_ws(-1.2), -0.2) self.assert_almost_equal(wrap_to_ws(np.array([0.5, 2.3, -1.2])), np.array([0.5, 0.3, -0.2]))
def test_wrap_to_ws(self): """Testing wrap_to_ws""" self.assert_almost_equal(wrap_to_ws( 0.5), 0.5) self.assert_almost_equal(wrap_to_ws(-0.5), 0.5) self.assert_almost_equal(wrap_to_ws( 0.2), 0.2) self.assert_almost_equal(wrap_to_ws(-0.3),-0.3) self.assert_almost_equal(wrap_to_ws( 0.7),-0.3) self.assert_almost_equal(wrap_to_ws( 2.3), 0.3) self.assert_almost_equal(wrap_to_ws(-1.2),-0.2) self.assert_almost_equal(wrap_to_ws(np.array([0.5,2.3,-1.2])), np.array([0.5,0.3,-0.2]))
def rotate_k(self, frac_coords, wrap_tows=False): """ Apply the symmetry operation to the k-point given in reduced coordinates. Sk is wrapped to the first Brillouin zone if wrap_tows is True. """ sk = np.dot(self.rot_g, frac_coords) * self.time_sign return wrap_to_ws(sk) if wrap_tows else sk