Loading gb_code/csl_generator.py +25 −2 Changes for gb_code/csl_generator.py: 25 added lines, 2 removed lines. Original line number Diff line number Diff line Loading @@ -157,6 +157,24 @@ def SmallestInteger(a): break return (testV, i) if integer_array(testV) else None def integerMatrix(a): """ returns an integer matrix from row vectors. """ Found = True b = np.zeros((3,3)) a = np.array(a) for i in range(3): for j in range(1, 2000): testV = j * a[i] if integer_array(testV): b[i] = testV break if all(b[i] == 0): Found = False print("Can not make integer matrix!") return (b) if Found else None def SymmEquivalent(arr): """ returns cubic symmetric eqivalents of the given 2 dimensional vector. Loading Loading @@ -419,8 +437,13 @@ def Find_Orthogonal_cell(basis, uvw, m, n, GB1): Min_1, Min_2 = Create_minimal_cell_Method_1(Sigma, uvw, R) # Find Ortho vectors: tol = 0.001 Found = False if ang(OrthoCell_1[:, 0], uvw) < tol: OrthoCell_1[:, 1] = uvw OrthoCell_2[:, 1] = uvw else: for i in range(len(indice_0)): v1 = (indice_0[i, 0] * Min_1[:, 0] + indice_0[i, 1] * Min_1[:, 1] + indice_0[i, 2] * Min_1[:, 2]) Loading @@ -430,7 +453,6 @@ def Find_Orthogonal_cell(basis, uvw, m, n, GB1): if ang(v1, OrthoCell_1[:, 0]) < tol: OrthoCell_1[:, 1] = v1 OrthoCell_2[:, 1] = v2 Found = True break OrthoCell_1[:, 2] = np.cross(OrthoCell_1[:, 0], OrthoCell_1[:, 1]) OrthoCell_2[:, 2] = np.cross(OrthoCell_2[:, 0], OrthoCell_2[:, 1]) Loading @@ -452,6 +474,7 @@ def Find_Orthogonal_cell(basis, uvw, m, n, GB1): OrthoCell_2 = OrthoCell_2.astype(float) if basis == 'sc' or basis == 'diamond' : return ((OrthoCell_1.astype(float), OrthoCell_2.astype(float), Num.astype(int))) Loading gb_code/gb_generator.py +2 −1 Changes for gb_code/gb_generator.py: 2 added lines, 1 removed line. Original line number Diff line number Diff line Loading @@ -174,13 +174,14 @@ class GB_character: populates a unitcell from the orthogonal vectors. """ Or = self.ortho.T Orint = cslgen.integerMatrix(Or) LoopBound = np.zeros((3, 2), dtype=float) transformed = [] CubeCoords = np.array([[1, 0, 0], [0, 1, 0], [0, 0, 1], [1, 1, 0], [0, 1, 1], [1, 0, 1], [1, 1, 1], [0, 0, 0]], dtype=float) for i in range(len(CubeCoords)): transformed.append(np.dot(Or.T, CubeCoords[i])) transformed.append(np.dot(Orint.T, CubeCoords[i])) # Finding bounds for atoms in a CSL unitcell: Loading Loading
gb_code/csl_generator.py +25 −2 Changes for gb_code/csl_generator.py: 25 added lines, 2 removed lines. Original line number Diff line number Diff line Loading @@ -157,6 +157,24 @@ def SmallestInteger(a): break return (testV, i) if integer_array(testV) else None def integerMatrix(a): """ returns an integer matrix from row vectors. """ Found = True b = np.zeros((3,3)) a = np.array(a) for i in range(3): for j in range(1, 2000): testV = j * a[i] if integer_array(testV): b[i] = testV break if all(b[i] == 0): Found = False print("Can not make integer matrix!") return (b) if Found else None def SymmEquivalent(arr): """ returns cubic symmetric eqivalents of the given 2 dimensional vector. Loading Loading @@ -419,8 +437,13 @@ def Find_Orthogonal_cell(basis, uvw, m, n, GB1): Min_1, Min_2 = Create_minimal_cell_Method_1(Sigma, uvw, R) # Find Ortho vectors: tol = 0.001 Found = False if ang(OrthoCell_1[:, 0], uvw) < tol: OrthoCell_1[:, 1] = uvw OrthoCell_2[:, 1] = uvw else: for i in range(len(indice_0)): v1 = (indice_0[i, 0] * Min_1[:, 0] + indice_0[i, 1] * Min_1[:, 1] + indice_0[i, 2] * Min_1[:, 2]) Loading @@ -430,7 +453,6 @@ def Find_Orthogonal_cell(basis, uvw, m, n, GB1): if ang(v1, OrthoCell_1[:, 0]) < tol: OrthoCell_1[:, 1] = v1 OrthoCell_2[:, 1] = v2 Found = True break OrthoCell_1[:, 2] = np.cross(OrthoCell_1[:, 0], OrthoCell_1[:, 1]) OrthoCell_2[:, 2] = np.cross(OrthoCell_2[:, 0], OrthoCell_2[:, 1]) Loading @@ -452,6 +474,7 @@ def Find_Orthogonal_cell(basis, uvw, m, n, GB1): OrthoCell_2 = OrthoCell_2.astype(float) if basis == 'sc' or basis == 'diamond' : return ((OrthoCell_1.astype(float), OrthoCell_2.astype(float), Num.astype(int))) Loading
gb_code/gb_generator.py +2 −1 Changes for gb_code/gb_generator.py: 2 added lines, 1 removed line. Original line number Diff line number Diff line Loading @@ -174,13 +174,14 @@ class GB_character: populates a unitcell from the orthogonal vectors. """ Or = self.ortho.T Orint = cslgen.integerMatrix(Or) LoopBound = np.zeros((3, 2), dtype=float) transformed = [] CubeCoords = np.array([[1, 0, 0], [0, 1, 0], [0, 0, 1], [1, 1, 0], [0, 1, 1], [1, 0, 1], [1, 1, 1], [0, 0, 0]], dtype=float) for i in range(len(CubeCoords)): transformed.append(np.dot(Or.T, CubeCoords[i])) transformed.append(np.dot(Orint.T, CubeCoords[i])) # Finding bounds for atoms in a CSL unitcell: Loading