Loading gb_code/csl_generator.py +18 −18 Changes for gb_code/csl_generator.py: 18 added lines, 18 removed lines. Original line number Diff line number Diff line Loading @@ -235,7 +235,7 @@ def Create_Possible_GB_Plane_List(uvw, m=5, n=1, lim=5): ], dtype='float') # Find GB plane coordinates: for i in range(len(indice_0)): if (CommonDivisor(indice_0[i])[1] <= 1): if CommonDivisor(indice_0[i])[1] <= 1: V1[i, :] = (indice_0[i, 0] * Min_1[:, 0] + indice_0[i, 1] * Min_1[:, 1] + indice_0[i, 2] * Min_1[:, 2]) Loading @@ -252,12 +252,12 @@ def Create_Possible_GB_Plane_List(uvw, m=5, n=1, lim=5): if ang(V1[i], uvw) < tol: for j in range(len(SymmEquivalent(MP))): if (1 - ang(MeanPlanes[i], SymmEquivalent(MP)[j]) < tol): if 1 - ang(MeanPlanes[i], SymmEquivalent(MP)[j]) < tol: GBtype.append('Symmetric Tilt') break else: GBtype.append('Tilt') elif (1 - ang(V1[i], uvw) < tol): elif 1 - ang(V1[i], uvw) < tol: GBtype.append('Twist') else: GBtype.append('Mixed') Loading Loading @@ -308,7 +308,7 @@ def MiniCell_search(indices, MiniCell_1, R, sigma): Found = False count = 0 while (not Found) and count < len(TestVecs) - 1: if (1 - ang(TestVecs[count], MiniCell_1[:, 2]) > tol): if 1 - ang(TestVecs[count], MiniCell_1[:, 2]) > tol: # and (ang(TestVecs[i],uvw) > tol): MiniCell_1[:, 1] = (TestVecs[count]) count += 1 Loading @@ -333,9 +333,9 @@ def MiniCell_search(indices, MiniCell_1, R, sigma): Found = True break if Found: return (MiniCell_1, MiniCell_2) return MiniCell_1, MiniCell_2 else: return (Found) return Found def Basis(basis): """ Loading Loading @@ -366,7 +366,7 @@ def Basis(basis): print('Sorry! For now only works for cubic lattices ...') sys.exit() return (basis) return basis def Find_Orthogonal_cell(basis, uvw, m, n, GB1): """ Loading Loading @@ -433,7 +433,7 @@ def Find_Orthogonal_cell(basis, uvw, m, n, GB1): ortho1, ortho2 = Ortho_fcc_bcc(basis, OrthoCell_1, OrthoCell_2) Volume_1 = (round(det(ortho1), 5)) Num = Volume_1 * len(Basis(basis)) * 2 return ((ortho1, ortho2, Num.astype(int))) return (ortho1, ortho2, Num.astype(int)) else: return None Loading @@ -446,7 +446,7 @@ def print_list_GB_Planes(uvw, basis, m, n, lim=3): V1, V2, Mean, Type = Create_Possible_GB_Plane_List(uvw, m, n, lim) for i in range(len(V1)): Or = Find_Orthogonal_cell(basis, uvw, m, n, V1[i]) if (Or): if Or: print ("{0:<20s} {1:<20s} {2:<20s} {3:<10s}" .format(str(V1[i]), str(V2[i]), Type[i], str(Or[2]))) Loading @@ -469,7 +469,7 @@ def odd_even(M1): d_e[i][j] = 'e' else: d_e[i][j] = 'd' return (d_e) return d_e def self_test_b(a): Loading @@ -480,7 +480,7 @@ def self_test_b(a): z_b[i][i] = 0.5 break return (z_b) return z_b def binary_test_b(a): Loading @@ -495,7 +495,7 @@ def binary_test_b(a): count = count + 1 z_b[i][j] = 0.5 z_b[j][j] = 0.5 return (z_b) return z_b def tertiary_test_b(a): Loading @@ -508,7 +508,7 @@ def tertiary_test_b(a): z_b[1][k] = 0.5 z_b[2][k] = 0.5 break return (z_b) return z_b def body_centering(b): Loading @@ -526,7 +526,7 @@ def body_centering(b): if det(tertiary_test_b(b)) == 0.5: z_b = tertiary_test_b(b) break return (z_b) return z_b def face_centering(a): Loading Loading @@ -557,7 +557,7 @@ def face_centering(a): z_f[i][j] = 0.5 z_f[j][j] = 0.5 return (z_f if det(z_f) == 0.25 else None) return z_f if det(z_f) == 0.25 else None def DSC_vec(basis, sigma, minicell): """ Loading @@ -571,7 +571,7 @@ def DSC_vec(basis, sigma, minicell): D = dot(D_sc, body_centering(D_sc)) if basis == 'fcc' or basis == 'diamond': D = dot(D_sc, face_centering(D_sc)) return (D) return D def CSL_vec(basis, minicell): """ Loading @@ -584,7 +584,7 @@ def CSL_vec(basis, minicell): C = dot(C_sc, body_centering(C_sc)) if basis == 'fcc': C = dot(C_sc, face_centering(C_sc)) return (C) return C def DSC_on_plane(D, Pnormal): """ Loading @@ -595,7 +595,7 @@ def DSC_on_plane(D, Pnormal): for i in range(3): D_proj[:, i] = (D[:, i] - (dot(D[:, i], Pnormal) / norm(Pnormal)) * Pnormal/norm(Pnormal)) return (D_proj) return D_proj def CSL_density(basis, minicell, plane): Loading Loading
gb_code/csl_generator.py +18 −18 Changes for gb_code/csl_generator.py: 18 added lines, 18 removed lines. Original line number Diff line number Diff line Loading @@ -235,7 +235,7 @@ def Create_Possible_GB_Plane_List(uvw, m=5, n=1, lim=5): ], dtype='float') # Find GB plane coordinates: for i in range(len(indice_0)): if (CommonDivisor(indice_0[i])[1] <= 1): if CommonDivisor(indice_0[i])[1] <= 1: V1[i, :] = (indice_0[i, 0] * Min_1[:, 0] + indice_0[i, 1] * Min_1[:, 1] + indice_0[i, 2] * Min_1[:, 2]) Loading @@ -252,12 +252,12 @@ def Create_Possible_GB_Plane_List(uvw, m=5, n=1, lim=5): if ang(V1[i], uvw) < tol: for j in range(len(SymmEquivalent(MP))): if (1 - ang(MeanPlanes[i], SymmEquivalent(MP)[j]) < tol): if 1 - ang(MeanPlanes[i], SymmEquivalent(MP)[j]) < tol: GBtype.append('Symmetric Tilt') break else: GBtype.append('Tilt') elif (1 - ang(V1[i], uvw) < tol): elif 1 - ang(V1[i], uvw) < tol: GBtype.append('Twist') else: GBtype.append('Mixed') Loading Loading @@ -308,7 +308,7 @@ def MiniCell_search(indices, MiniCell_1, R, sigma): Found = False count = 0 while (not Found) and count < len(TestVecs) - 1: if (1 - ang(TestVecs[count], MiniCell_1[:, 2]) > tol): if 1 - ang(TestVecs[count], MiniCell_1[:, 2]) > tol: # and (ang(TestVecs[i],uvw) > tol): MiniCell_1[:, 1] = (TestVecs[count]) count += 1 Loading @@ -333,9 +333,9 @@ def MiniCell_search(indices, MiniCell_1, R, sigma): Found = True break if Found: return (MiniCell_1, MiniCell_2) return MiniCell_1, MiniCell_2 else: return (Found) return Found def Basis(basis): """ Loading Loading @@ -366,7 +366,7 @@ def Basis(basis): print('Sorry! For now only works for cubic lattices ...') sys.exit() return (basis) return basis def Find_Orthogonal_cell(basis, uvw, m, n, GB1): """ Loading Loading @@ -433,7 +433,7 @@ def Find_Orthogonal_cell(basis, uvw, m, n, GB1): ortho1, ortho2 = Ortho_fcc_bcc(basis, OrthoCell_1, OrthoCell_2) Volume_1 = (round(det(ortho1), 5)) Num = Volume_1 * len(Basis(basis)) * 2 return ((ortho1, ortho2, Num.astype(int))) return (ortho1, ortho2, Num.astype(int)) else: return None Loading @@ -446,7 +446,7 @@ def print_list_GB_Planes(uvw, basis, m, n, lim=3): V1, V2, Mean, Type = Create_Possible_GB_Plane_List(uvw, m, n, lim) for i in range(len(V1)): Or = Find_Orthogonal_cell(basis, uvw, m, n, V1[i]) if (Or): if Or: print ("{0:<20s} {1:<20s} {2:<20s} {3:<10s}" .format(str(V1[i]), str(V2[i]), Type[i], str(Or[2]))) Loading @@ -469,7 +469,7 @@ def odd_even(M1): d_e[i][j] = 'e' else: d_e[i][j] = 'd' return (d_e) return d_e def self_test_b(a): Loading @@ -480,7 +480,7 @@ def self_test_b(a): z_b[i][i] = 0.5 break return (z_b) return z_b def binary_test_b(a): Loading @@ -495,7 +495,7 @@ def binary_test_b(a): count = count + 1 z_b[i][j] = 0.5 z_b[j][j] = 0.5 return (z_b) return z_b def tertiary_test_b(a): Loading @@ -508,7 +508,7 @@ def tertiary_test_b(a): z_b[1][k] = 0.5 z_b[2][k] = 0.5 break return (z_b) return z_b def body_centering(b): Loading @@ -526,7 +526,7 @@ def body_centering(b): if det(tertiary_test_b(b)) == 0.5: z_b = tertiary_test_b(b) break return (z_b) return z_b def face_centering(a): Loading Loading @@ -557,7 +557,7 @@ def face_centering(a): z_f[i][j] = 0.5 z_f[j][j] = 0.5 return (z_f if det(z_f) == 0.25 else None) return z_f if det(z_f) == 0.25 else None def DSC_vec(basis, sigma, minicell): """ Loading @@ -571,7 +571,7 @@ def DSC_vec(basis, sigma, minicell): D = dot(D_sc, body_centering(D_sc)) if basis == 'fcc' or basis == 'diamond': D = dot(D_sc, face_centering(D_sc)) return (D) return D def CSL_vec(basis, minicell): """ Loading @@ -584,7 +584,7 @@ def CSL_vec(basis, minicell): C = dot(C_sc, body_centering(C_sc)) if basis == 'fcc': C = dot(C_sc, face_centering(C_sc)) return (C) return C def DSC_on_plane(D, Pnormal): """ Loading @@ -595,7 +595,7 @@ def DSC_on_plane(D, Pnormal): for i in range(3): D_proj[:, i] = (D[:, i] - (dot(D[:, i], Pnormal) / norm(Pnormal)) * Pnormal/norm(Pnormal)) return (D_proj) return D_proj def CSL_density(basis, minicell, plane): Loading