def test_cco(): """Tests of base centered orthorhombic lattice identification.""" A = np.transpose([[0.5,1,0],[0.5,-1,0],[0,0,3]]) lat_t, nig_n, lat_f, basis = niggli_id(A) assert nig_n == 38 A = np.transpose([[1,1,1],[1,-1,-1], [0,-1.73205,1.73205]]) lat_t, nig_n, lat_f, basis = niggli_id(A) assert nig_n == 13 A = np.transpose([[1,1,1],[2,-1,-1], [-0.3333333,-1.54116,1.87449]]) lat_t, nig_n, lat_f, basis = niggli_id(A) assert nig_n == 23 A = np.transpose([[1,1,1], [1.61803,-0.618034,-1], [-1.05557,1.99895,-0.943376]]) lat_t, nig_n, lat_f, basis = niggli_id(A) assert nig_n == 40 A = np.transpose([[1, 1, 1], [1.41421, -1.41421, 0], [-1.43541, -1.43541, 1.37083]]) lat_t, nig_n, lat_f, basis = niggli_id(A) assert nig_n == 36
def test_tric(): """Test the triclinic littice identification.""" A = [[1,0,0],[0,1,0],[0,0,1]] lat_t, nig_n, lat_f, basis = niggli_id(A,G=[1, 2, 3, .1, .2, .3]) assert nig_n == 31 A = [[1,0,0],[0,1,0],[0,0,1]] lat_t, nig_n, lat_f, basis = niggli_id(A,G=[1, 2, 3, -.1, -.2, -.3]) assert nig_n == 44
def test_fco(): """Tests of face centered orthorhombic lattice identification.""" A = np.transpose([[0,1,1.5],[0.5,0,1.5],[0,0,3]]) lat_t, nig_n, lat_f, basis = niggli_id(A) assert nig_n == 26 A = np.transpose([[1,1,-1],[0.779796,-1.1798,1], [-1.04442,-1.43973,-1.68415]]) lat_t, nig_n, lat_f, basis = niggli_id(A) assert nig_n == 16
def test_hex(): A = np.transpose([[1,0,0],[0.5,-0.8660254037844386,0], [0,0,2]]) lat_t, nig_n, lat_f, basis = niggli_id(A,G=[1.0, 0.99999999999999989, 4.0, 0.0, 0.0, -0.5]) assert nig_n == 12 A = np.transpose([[0,0,-0.5],[1,0,0], [-0.5,0.8660254037844386,0]]) lat_t, nig_n, lat_f, basis = niggli_id(A) assert nig_n == 22
def _test_case(U,Nu,Cu,O,No,Co,crystal_fam,HNFs): """Tests a set of HNFs to see if they preserve the symmetry of the desired crystal family. Args: U (numpy array): The users cell as a column matrix. Nu (numpy array): The users niggli cell as a column matrix. Cu (numpy array): The transformation from the users niggli cell to the users cell. No (numpy array): Our niggli cell as a column matrix. Co (numpy array): The transformation from our niggli cell to our. O (numpy array): Our cell as a column matrix. crystal_fam (int): An integer indicating the crystal family of the users cell. HNFs (list of lists): A list of the HNF matrices to be testsed. Returns: True if the parent cell symmetry is preserved. False otherwise. """ Bs = transform_supercells(HNFs,No,Nu,Co,Cu,O) for i in range(len(Bs)): B = Bs[i] # if crystal_fam in [3]: lat_name, niggli_n, lat_fam, c_b = niggli_id(B,eps_=1E-2) # else: # lat_name, niggli_n, lat_fam, c_b = niggli_id(B) r = np.linalg.inv(np.transpose(U)) g = np.linalg.inv(np.transpose(B)) temp = np.round(np.dot(np.linalg.inv(g),r),3) if lat_fam > crystal_fam or not np.allclose(temp%1,0): print('lf',lat_fam,'cf',crystal_fam,'com',temp%1,"HNF",HNFs[i]) print("B",np.transpose(B)) return False return True
def test_stet(): """Tests of simple tet lattice identification.""" a1 = np.array([1,0,0]) a2 = np.array([0,1,0]) a3 = np.array([0,0,2]) As = [[a1+a2,a2,a3+a1],[a1+a2+a3,a2+a3,a1+a2],[a1,a2+a1,a3+a3],[-a1,-a2+a3,a3]] As = [np.transpose(i) for i in As] for A in As: lat_t, nig_n, lat_f, basis = niggli_id(A) assert nig_n == 11 A = np.transpose([[0,0,0.5],[1,0,0],[0,1,0]]) lat_t, nig_n, lat_f, basis = niggli_id(A) assert nig_n == 21
def test_sm(): """Tests of the simple monoclinic lattice identification.""" A = np.transpose([[2,0,0], [0,2,0], [0.5,0,2]]) lat_t, nig_n, lat_f, basis = niggli_id(A) assert nig_n == 33 A = np.transpose([[1,1,1], [1.61803,-0.618034,-1], [-0.668912,1.96676,-1.29785]]) lat_t, nig_n, lat_f, basis = niggli_id(A) assert nig_n == 35 A = np.transpose([[1,1,1], [1.22474487,-1.22474487,-1], [-0.165985087,-1.64308297,1.80906806]]) lat_t, nig_n, lat_f, basis = niggli_id(A) assert nig_n == 34
def test_bctet(): """Tests of body centered tetragonal lattice identification.""" A = np.transpose([[-1,1,2],[1,-1,2],[1,1,-2]]) lat_t, nig_n, lat_f, basis = niggli_id(A) assert nig_n == 15 A = np.transpose([[-1, 1, 2],[1, 1.60788, -1.55394], [1.95095, -1.41625, 0.433603]]) lat_t, nig_n, lat_f, basis = niggli_id(A) assert nig_n == 7 A = np.transpose([[-1, 1, 2],[1, 1.60788, -1.55394], [1.80278, -1.47253, 0.762655]]) lat_t, nig_n, lat_f, basis = niggli_id(A) assert nig_n == 6 A = np.transpose([[0,0,2],[1,-2,1], [-2,-1,1]]) lat_t, nig_n, lat_f, basis = niggli_id(A) assert nig_n == 18
def test_rhom(): """Tests of rhombohedral lattice identification.""" A = np.transpose([[1,2,2],[2,1,2],[4,3,3]]) lat_t, nig_n, lat_f, basis = niggli_id(A) assert nig_n == 9 A = np.transpose([[-1,0,-1],[1.51184,0,-0.845178], [-0.255922,-1.44338,0.92259]]) lat_t, nig_n, lat_f, basis = niggli_id(A) assert nig_n == 24 A = np.transpose([[-1, 0,-1],[0, -1.32288, -0.5], [-1.11652, -0.610985, 0.616515]]) lat_t, nig_n, lat_f, basis = niggli_id(A) assert nig_n == 2 A = np.transpose([[-1,0,-1],[0, -1.32288, 0.5], [-0.548584, 0.774292, 1.04858]]) lat_t, nig_n, lat_f, basis = niggli_id(A) assert nig_n == 4
def test_bo(): """Tests of body centered orthorhombic lattice identiication.""" A = np.transpose([[-0.5,1,1.5],[0.5,-1,1.5],[0.5,1,-1.5]]) lat_t, nig_n, lat_f, basis = niggli_id(A) assert nig_n == 19 A = np.transpose([[1, 1, 2],[1.41144,0.0885622,-2], [-1.99868,1.21232,-0.731822]]) lat_t, nig_n, lat_f, basis = niggli_id(A) assert nig_n == 8 A = np.transpose([[1, 1, 1],[1.61803,-0.61803,-1], [-1.53633,1.36706,-1.33073]]) lat_t, nig_n, lat_f, basis = niggli_id(A) assert nig_n == 42 # Test of failed case. A = [[ 0.07364488, 0. , 0. ], [ 0. , 0.06377834, 0. ], [ 0.48104638, 0.48104638, 0.96209276]] lat_t, nig_n, lat_f, basis = niggli_id(A,eps_=1E-10) assert lat_t == 'face centered orthorhombic' assert lat_f == 5
def test_so(): """Tests of simple orthorhombic lattice identification.""" As = [[[1.00000000, 0.00000000, 0.00000000], [0.00000000, 1.73205080, 0.00000000], [0.00000000, 0.00000000, 3.26598640]], [[0.50000000, 0.50000000, 0.00000000], [0.00000000, 0.00000000, 1.00000000], [1.50000000, -1.50000000, 0.00000000]], [[0.50000000, 0.50000000, 0.00000000], [0.00000000, 0.00000000, 1.00000000], [2.00000000, -2.00000000, 0.00000000]]] As = [np.transpose(i) for i in As] for A in As: lat_t, nig_n, lat_f, basis = niggli_id(A) assert nig_n == 32
def test_bcc(): """Tests of bcc lattice identification.""" A = [[-1,1,1],[1,-1,1],[1,1,-1]] lat_t, nig_n, lat_f, basis = niggli_id(A) assert nig_n == 5
def test_sc(): """Tests of sc lattice identification.""" A = np.transpose([[1,0,0],[1,1,0],[0,0,1]]) lat_t, nig_n, lat_f, basis = niggli_id(A) assert nig_n == 3
def test_fcc(): """Tests of fcc lattice identification.""" A = np.transpose([[0.5,0,0.5],[0.5,0.5,0],[0,0,1]]) lat_t, nig_n, lat_f, basis = niggli_id(A) assert nig_n == 1
def cell_test(U,count,max_kpd_=None): """Tests the ability of the niggli basis to preserve the symmetry of the parent cell under action of the HNF. Args: U (numpy array): The parent lattice as columns of vector. count (dict): A dictionary to count how many times each niggli cell is used. max_kpd_ (optional int): The largest k-point to use. Returns: False if symmetry is not preserved, true if it is. Also returns the count of the niggli basis used. """ if max_kpd_ is None: max_kpd = 100000 else: max_kpd = max_kpd_ temp = reduced_cell(U) Nu = temp.niggli Cu = temp.C U_lat_name, U_niggli_n, U_lat_fam, O = niggli_id(U) if O is not None: tempo = reduced_cell(O) No = tempo.niggli Co = tempo.C count[str(U_niggli_n)] += 1 if U_niggli_n == 1: kpds = fcc_kps(max_kpd) for kpd in kpds: HNFs = fcc.fcc_1(kpd) test = _test_case(U,Nu,Cu,O,No,Co,U_lat_fam,HNFs) if not test: return False, count if U_niggli_n == 2: for kpd in range(max_kpd): HNFs = rhom.rhom_4_2(kpd) test = _test_case(U,Nu,Cu,O,No,Co,U_lat_fam,HNFs) if not test: return False, count if U_niggli_n == 3: kpds = sc_and_bcc_kps(max_kpd) for kpd in kpds: HNFs = sc.sc_3(kpd) test = _test_case(U,Nu,Cu,O,No,Co,U_lat_fam,HNFs) if not test: return False, count if U_niggli_n == 4: for kpd in range(max_kpd): HNFs = rhom.rhom_4_2(kpd) test = _test_case(U,Nu,Cu,O,No,Co,U_lat_fam,HNFs) if not test: return False, count if U_niggli_n == 5: kpds = sc_and_bcc_kps(max_kpd) for kpd in kpds: HNFs = bcc.bcc_5(kpd) test = _test_case(U,Nu,Cu,O,No,Co,U_lat_fam,HNFs) if not test: return False, count if U_niggli_n == 6: for kpd in range(max_kpd): HNFs = bct.body_tet_6(kpd) test = _test_case(U,Nu,Cu,O,No,Co,U_lat_fam,HNFs) if not test: return False, count if U_niggli_n == 7: for kpd in range(max_kpd): HNFs = bct.body_tet_7(kpd) test = _test_case(U,Nu,Cu,O,No,Co,U_lat_fam,HNFs) if not test: return False, count if U_niggli_n == 8: for kpd in range(max_kpd): HNFs = bco.body_ortho_8(kpd) test = _test_case(U,Nu,Cu,O,No,Co,U_lat_fam,HNFs) if not test: return False, count if U_niggli_n == 9: for kpd in range(max_kpd): HNFs = rhom.rhom_9(kpd) test = _test_case(U,Nu,Cu,O,No,Co,U_lat_fam,HNFs) if not test: return False, count if U_niggli_n == 10: for kpd in range(max_kpd): HNFs = ccm.base_mono_10_17(kpd) test = _test_case(U,Nu,Cu,O,No,Co,U_lat_fam,HNFs) if not test: return False, count if U_niggli_n == 11: for kpd in range(max_kpd): HNFs = st.stet_11(kpd) test = _test_case(U,Nu,Cu,O,No,Co,U_lat_fam,HNFs) if not test: return False, count if U_niggli_n == 12: for kpd in range(max_kpd): HNFs = hx.hex_12(kpd) test = _test_case(U,Nu,Cu,O,No,Co,U_lat_fam,HNFs) if not test: return False, count if U_niggli_n == 13: for kpd in range(max_kpd): HNFs = cco.base_ortho_38_13(kpd) test = _test_case(U,Nu,Cu,O,No,Co,U_lat_fam,HNFs) if not test: return False, count if U_niggli_n == 14: for kpd in range(max_kpd): HNFs = ccm.base_mono_14(kpd) test = _test_case(U,Nu,Cu,O,No,Co,U_lat_fam,HNFs) if not test: return False, count if U_niggli_n == 15: for kpd in range(max_kpd): HNFs = bct.body_tet_15(kpd) test = _test_case(U,Nu,Cu,O,No,Co,U_lat_fam,HNFs) if not test: return False, count if U_niggli_n == 16: for kpd in range(max_kpd): HNFs = fco.face_ortho_16(kpd) test = _test_case(U,Nu,Cu,O,No,Co,U_lat_fam,HNFs) if not test: return False, count if U_niggli_n == 17: for kpd in range(max_kpd): HNFs = ccm.base_mono_10_17(kpd) test = _test_case(U,Nu,Cu,O,No,Co,U_lat_fam,HNFs) if not test: return False, count if U_niggli_n == 18: for kpd in range(max_kpd): HNFs = bct.body_tet_18(kpd) test = _test_case(U,Nu,Cu,O,No,Co,U_lat_fam,HNFs) if not test: return False, count if U_niggli_n == 19: for kpd in range(max_kpd): HNFs = bco.body_ortho_19(kpd) test = _test_case(U,Nu,Cu,O,No,Co,U_lat_fam,HNFs) if not test: return False, count if U_niggli_n == 20: for kpd in range(max_kpd): HNFs = ccm.base_mono_20_25(kpd) test = _test_case(U,Nu,Cu,O,No,Co,U_lat_fam,HNFs) if not test: return False, count if U_niggli_n == 21: for kpd in range(max_kpd): HNFs = st.stet_21(kpd) test = _test_case(U,Nu,Cu,O,No,Co,U_lat_fam,HNFs) if not test: return False, count if U_niggli_n == 22: for kpd in range(max_kpd): HNFs = hx.hex_22(kpd) test = _test_case(U,Nu,Cu,O,No,Co,U_lat_fam,HNFs) if not test: return False, count if U_niggli_n == 23: for kpd in range(max_kpd): HNFs = cco.base_ortho_23(kpd) test = _test_case(U,Nu,Cu,O,No,Co,U_lat_fam,HNFs) if not test: return False, count if U_niggli_n == 24: for kpd in range(max_kpd): HNFs = rhom.rhom_24(kpd) test = _test_case(U,Nu,Cu,O,No,Co,U_lat_fam,HNFs) if not test: return False, count if U_niggli_n == 25: for kpd in range(max_kpd): HNFs = ccm.base_mono_20_25(kpd) test = _test_case(U,Nu,Cu,O,No,Co,U_lat_fam,HNFs) if not test: return False, count if U_niggli_n == 26: for kpd in range(max_kpd): HNFs = fco.face_ortho_26(kpd) test = _test_case(U,Nu,Cu,O,No,Co,U_lat_fam,HNFs) if not test: return False, count if U_niggli_n == 27: for kpd in range(max_kpd): HNFs = ccm.base_mono_27(kpd) test = _test_case(U,Nu,Cu,O,No,Co,U_lat_fam,HNFs) if not test: return False, count if U_niggli_n == 28: for kpd in range(max_kpd): HNFs = ccm.base_mono_28(kpd) test = _test_case(U,Nu,Cu,O,No,Co,U_lat_fam,HNFs) if not test: return False, count if U_niggli_n == 29: for kpd in range(max_kpd): HNFs = ccm.base_mono_29_30(kpd) test = _test_case(U,Nu,Cu,O,No,Co,U_lat_fam,HNFs) if not test: return False, count if U_niggli_n == 30: for kpd in range(max_kpd): HNFs = ccm.base_mono_29_30(kpd) test = _test_case(U,Nu,Cu,O,No,Co,U_lat_fam,HNFs) if not test: return False, count if U_niggli_n == 31: # triclinic, nothing to do. return True, count if U_niggli_n == 32: for kpd in range(max_kpd): HNFs = so.so_32(kpd) test = _test_case(U,Nu,Cu,O,No,Co,U_lat_fam,HNFs) if not test: return False, count if U_niggli_n == 33: for kpd in range(max_kpd): HNFs = sm.sm_33(kpd) test = _test_case(U,Nu,Cu,O,No,Co,U_lat_fam,HNFs) if not test: return False, count if U_niggli_n == 34: for kpd in range(max_kpd): HNFs = sm.sm_34(kpd) test = _test_case(U,Nu,Cu,O,No,Co,U_lat_fam,HNFs) if not test: return False, count if U_niggli_n == 35: for kpd in range(max_kpd): HNFs = sm.sm_35(kpd) test = _test_case(U,Nu,Cu,O,No,Co,U_lat_fam,HNFs) if not test: return False, count if U_niggli_n == 36: for kpd in range(max_kpd): HNFs = cco.base_ortho_36(kpd) test = _test_case(U,Nu,Cu,O,No,Co,U_lat_fam,HNFs) if not test: return False, count if U_niggli_n == 37: for kpd in range(max_kpd): HNFs = ccm.base_mono_37_39(kpd) test = _test_case(U,Nu,Cu,O,No,Co,U_lat_fam,HNFs) if not test: return False, count if U_niggli_n == 38: for kpd in range(max_kpd): HNFs = cco.base_ortho_38_13(kpd) test = _test_case(U,Nu,Cu,O,No,Co,U_lat_fam,HNFs) if not test: return False, count if U_niggli_n == 39: for kpd in range(max_kpd): HNFs = ccm.base_mono_37_39(kpd) test = _test_case(U,Nu,Cu,O,No,Co,U_lat_fam,HNFs) if not test: return False, count if U_niggli_n == 40: for kpd in range(max_kpd): HNFs = cco.base_ortho_40(kpd) test = _test_case(U,Nu,Cu,O,No,Co,U_lat_fam,HNFs) if not test: return False, count if U_niggli_n == 41: for kpd in range(max_kpd): HNFs = ccm.base_mono_41(kpd) test = _test_case(U,Nu,Cu,O,No,Co,U_lat_fam,HNFs) if not test: return False, count if U_niggli_n == 42: for kpd in range(max_kpd): HNFs = bco.body_ortho_42(kpd) test = _test_case(U,Nu,Cu,O,No,Co,U_lat_fam,HNFs) if not test: return False, count if U_niggli_n == 43: for kpd in range(max_kpd): HNFs = ccm.base_mono_43(kpd) test = _test_case(U,Nu,Cu,O,No,Co,U_lat_fam,HNFs) if not test: return False, count if U_niggli_n == 44: #triclinic return True, count return True, count
def test_cm(): """Tests of the base centered monoclinic lattice identification.""" A = np.transpose([[1,1,0], [1,-1,0], [0.5,0,2]]) lat_t, nig_n, lat_f, basis = niggli_id(A) assert nig_n == 14 A = np.transpose([[1,1,1], [1,-1,1], [-1.46391,0,1.96391]]) lat_t, nig_n, lat_f, basis = niggli_id(A) assert nig_n == 10 A = np.transpose([[1,1,1], [0.809568,-1.15957,-1], [-1.05387,-1.61088,1.51474]]) lat_t, nig_n, lat_f, basis = niggli_id(A) assert nig_n == 17 A = np.transpose([[1,1,1], [1.70119,-1.45119,1], [-1.0034,0.0189395,2.23446]]) lat_t, nig_n, lat_f, basis = niggli_id(A) assert nig_n == 20 A = np.transpose([[1,1,1], [1.45119,-1.70119,-1], [-1.16241,-1.56776,1.48018]]) lat_t, nig_n, lat_f, basis = niggli_id(A) assert nig_n == 25 A = np.transpose([[1,1,0], [1.618033,-0.618033,1], [-0.464824,1.464824,1.907413]]) lat_t, nig_n, lat_f, basis = niggli_id(A) assert nig_n == 27 A = np.transpose([[1,1,0], [1.44896,-0.948958,1], [-0.342424,1.342424,2.02006]]) lat_t, nig_n, lat_f, basis = niggli_id(A) assert nig_n == 28 A = np.transpose([[1,1,0], [1.61803,-0.618034,1], [-0.666125,1.16613,2.04852]]) lat_t, nig_n, lat_f, basis = niggli_id(A) assert nig_n == 29 A = np.transpose([[1,1,0], [1.61803,-0.618034,1], [-0.0361373,0.536137,2.38982]]) lat_t, nig_n, lat_f, basis = niggli_id(A) assert nig_n == 30 A = np.transpose([[1,0,1], [1,-1.41421,-1], [-1.85397,-0.854143,1.35397]]) lat_t, nig_n, lat_f, basis = niggli_id(A) assert nig_n == 41 A = np.transpose([[1,0,1], [1,-1.41421,-1], [-1.79092,-1.47209,0.790922]]) lat_t, nig_n, lat_f, basis = niggli_id(A) assert nig_n == 37 A = np.transpose([[1,0,1], [0,-1.73205,-1], [-1.66542,-0.672857,1.66542]]) lat_t, nig_n, lat_f, basis = niggli_id(A) assert nig_n == 39 A = np.transpose([[1,1,1], [1.64194,-1.14194,-1], [-1.39716,-1.34718,1.49434]]) lat_t, nig_n, lat_f, basis = niggli_id(A) assert nig_n == 43
def find_supercells(U, kpt, exact=False): """Generates the symmetry preserving supercells for the users lattice and k-point density. Args: U (numpy.array): The lattice vectors as columns of a matrix. kpt (int): The target k-point density desired. exact (bool): True if only the target k-point density is to be used. Returns: supercells (numpy.array): list of symmetry preserving supercells. Raises: ValueError if the lattice type can't be identified. """ from opf_python.niggli_lat_id import niggli_id from opf_python.pyniggli import reduced_cell import numpy as np lat_name, nig_n, lat_fam, basis = niggli_id(U) Bu = reduced_cell(U) Nu = Bu.niggli Cu = Bu.C if nig_n in [31, 44]: basis = U Bo = reduced_cell(basis) No = Bo.niggli Co = Bo.C if not exact: ns, mult = find_volumes(nig_n, kpt) else: ns, mult = [kpt], 1.0 count = 0 spHNFs = [] if nig_n == 3: from opf_python.sc import sc_3 for n in ns: temp = sc_3(n) for t in temp: spHNFs.append(t) elif nig_n == 5: from opf_python.bcc import bcc_5 for n in ns: temp = bcc_5(n) for t in temp: spHNFs.append(t) elif nig_n == 1: from opf_python.fcc import fcc_1 for n in ns: temp = fcc_1(n) for t in temp: spHNFs.append(t) elif nig_n in [12, 22]: from opf_python.hx import hex_12, hex_22 for n in ns: if nig_n == 12: temp = hex_12(n) else: temp = hex_22(n) if len(temp) > 1 and not exact: count += 1 for t in temp: spHNFs.append(t) elif exact: for t in temp: spHNFs.append(t) if count == 5: break elif nig_n in [9, 4, 2, 24]: from opf_python.rhom import rhom_9_24, rhom_4_2 for n in ns: if nig_n == 9 or nig_n == 24: temp = rhom_9_24(n) else: temp = rhom_4_2(n) if len(temp) > 1 and not exact: count += 1 for t in temp: spHNFs.append(t) elif exact: for t in temp: spHNFs.append(t) if count == 5: break elif nig_n in [11, 21]: from opf_python.stet import stet_11, stet_21 for n in ns: if nig_n == 11: temp = stet_11(n) else: temp = stet_21(n) if len(temp) > 1 and not exact: count += 1 for t in temp: spHNFs.append(t) elif exact: for t in temp: spHNFs.append(t) if count == 5: break elif nig_n in [15, 7, 6, 18]: from opf_python.body_tet import body_tet_6_7_15_18 for n in ns: temp = body_tet_6_7_15_18(n) if len(temp) > 1 and not exact: count += 1 for t in temp: spHNFs.append(t) elif exact: for t in temp: spHNFs.append(t) if count == 5: break elif nig_n == 32: from opf_python.so import so_32 for n in ns: temp = so_32(n) if len(temp) > 1 and not exact: count += 1 for t in temp: spHNFs.append(t) elif exact: for t in temp: spHNFs.append(t) if count == 5: break elif nig_n in [ 38, 13, 23, 40, 36, ]: from opf_python.base_ortho import base_ortho_38_13, base_ortho_23, base_ortho_36, base_ortho_40 for n in ns: if nig_n == 23: temp = base_ortho_23(n) elif nig_n == 36: temp = base_ortho_36(n) elif nig_n == 40: temp = base_ortho_40(n) else: temp = base_ortho_38_13(n) if len(temp) > 1 and not exact: count += 1 for t in temp: spHNFs.append(t) elif exact: for t in temp: spHNFs.append(t) if count == 5: break elif nig_n in [19, 8, 42]: from opf_python.body_ortho import body_ortho_19, body_ortho_8, body_ortho_42 for n in ns: if nig_n == 19: temp = body_ortho_19(n) elif nig_n == 8: temp = body_ortho_8(n) else: temp = body_ortho_42(n) if len(temp) > 1 and not exact: count += 1 for t in temp: spHNFs.append(t) elif exact: for t in temp: spHNFs.append(t) if count == 5: break elif nig_n in [26, 16]: from opf_python.face_ortho import face_ortho_26, face_ortho_16 for n in ns: if nig_n == 26: temp = face_ortho_26(n) else: temp = face_ortho_16(n) if len(temp) > 1 and not exact: count += 1 for t in temp: spHNFs.append(t) elif exact: for t in temp: spHNFs.append(t) if count == 5: break elif nig_n in [33, 34, 35]: from opf_python.sm import sm_33, sm_34, sm_35 for n in ns: if nig_n == 33: temp = sm_33(n) elif nig_n == 34: temp = sm_34(n) else: temp = sm_35(n) if len(temp) > 1 and not exact: count += 1 for t in temp: spHNFs.append(t) elif exact: for t in temp: spHNFs.append(t) if count == 5: break elif nig_n in [14, 10, 17, 20, 25, 27, 28, 29, 30, 41, 37, 39, 43]: from opf_python.base_mono import base_mono_28, base_mono_43, base_mono_20_25, base_mono_29_30, base_mono_10_14_17_27_37_39_41 for n in ns: if nig_n == 28: temp = base_mono_28(n) elif nig_n == 43: temp = base_mono_43(n) elif nig_n in [20, 25]: temp = base_mono_20_25(n) elif nig_n in [29, 30]: temp = base_mono_29_30(n) else: temp = base_mono_10_14_17_27_37_39_41(n) if len(temp) > 1 and not exact: count += 1 for t in temp: spHNFs.append(t) elif exact: for t in temp: spHNFs.append(t) if count == 5: break elif nig_n in [31, 44]: for n in ns: diags = get_HNF_diagonals(n) for diag in diags: a = diag[0] c = diag[1] f = diag[2] for b in range(c): for d in range(f): for e in range(f): HNF = np.array([[a, 0, 0], [b, c, 0], [d, e, f]]) spHNFs.append(HNF * mult) count += 1 else: # pragma: no cover raise ValueError("ERROR: unrecognized lattice type") supercells = transform_supercells(spHNFs, No, Nu, Co, Cu, basis) return supercells