def test_hexa_cell_and_scale(celldim, A, expected_scale, C, c_over_a): from numpy import abs, allclose, sqrt namelist = get_namelist(4, celldm=celldim, a=A, c=C) cell, scale = sh.read_cell_and_scale(namelist, None) expected_cell = [[1, -0.5, 0], [0, sqrt(3.) / 2., 0], [0, 0, c_over_a]] assert allclose(cell, expected_cell) assert abs(scale - expected_scale) < 1e-8
def test_cubic_cell_and_scale(celldim, A, expected_scale): from numpy import abs, allclose namelist = get_namelist(1, celldm=celldim, A=A) cell, scale = sh.read_cell_and_scale(namelist, None) assert allclose(cell, [[1, 0, 0], [0, 1, 0], [0, 0, 1]]) assert abs(scale - expected_scale) < 1e-8
def test_bcc_cell_and_scale(celldim, A, expected_scale): from numpy import abs, allclose namelist = get_namelist(3, celldm=celldim, a=A) cell, scale = sh.read_cell_and_scale(namelist, None) assert allclose(2 * cell, [[1, -1, -1], [1, 1, -1], [1, 1, 1]]) assert abs(scale - expected_scale) < 1e-8