def test_find_indexing_with_non_orthogonal_cell(self): cell = UnitCell(1, 1, 1, 90, 95, 103) cart_cell = cell.getB() qs = np.array([ [.5, 0, 0], [0, .5, 0], [0, 0, .5], [0, 0, .25], ]) qs = np.dot(qs, cart_cell) indices = indexing.index_q_vectors(qs) expected_indexing = np.array([[0, 0, 1], [0, 1, 0], [2, 0, 0], [1, 0, 0]]) npt.assert_equal(indices, expected_indexing, err_msg="Indexing does not match expected.")
def test_find_bases_with_non_orthogonal_cell(self): cell = UnitCell(1, 1, 1, 90, 95, 103) cart_cell = cell.getB() qs = np.array([ [.5, 0, 0], [0, .5, 0], [0, 0, .5], [0, 0, .25], ]) qs = np.dot(qs, cart_cell) ndim, bases = indexing.find_bases(qs, 1e-5) self.assertEqual(ndim, 3, "Number of dimensions must be 3") expected_bases = np.array([[0., 0., 0.25], [0., .5, 0.], [0.51521732, 0.11589868, 0.04490415]]) npt.assert_almost_equal(bases, expected_bases, err_msg="Basis vectors do not match")
def test_find_bases_with_non_orthogonal_cell(self): cell = UnitCell(1, 1, 1, 90, 95, 103) cart_cell = cell.getB() qs = np.array([ [.5, 0, 0], [0, .5, 0], [0, 0, .5], [0, 0, .25], ]) qs = np.dot(qs, cart_cell) ndim, bases = indexing.find_bases(qs, 1e-5) self.assertEqual(ndim, 3, "Number of dimensions must be 3") expected_bases = np.array([ [0., 0., 0.25], [0., .5, 0.], [0.51521732, 0.11589868, 0.04490415] ]) npt.assert_almost_equal(bases, expected_bases, err_msg="Basis vectors do not match")
def test_find_indexing_with_non_orthogonal_cell(self): cell = UnitCell(1, 1, 1, 90, 95, 103) cart_cell = cell.getB() qs = np.array([ [.5, 0, 0], [0, .5, 0], [0, 0, .5], [0, 0, .25], ]) qs = np.dot(qs, cart_cell) indices = indexing.index_q_vectors(qs) expected_indexing = np.array([ [0, 0, 1], [0, 1, 0], [2, 0, 0], [1, 0, 0] ]) npt.assert_equal(indices, expected_indexing, err_msg="Indexing does not match expected.")