diff --git a/first-gen-filler.py b/first-gen-filler.py index c47db35..8b1e204 100644 --- a/first-gen-filler.py +++ b/first-gen-filler.py @@ -28,10 +28,12 @@ import pymatgen.io.vasp import pymatgen.symmetry.analyzer + def chi(x): - out = integrate.quad(lambda t: math.exp(-((t ** 2)/2)), 0, x) + out = integrate.quad(lambda t: math.exp(-((t ** 2)/2)), 0, x) return out[0] + CU_OCC = 18 CU_AV = 108 AG_OCC = 9 @@ -56,11 +58,11 @@ def chi(x): arg_parser.add_argument("-n", "--number", type=int, default=100, help="Specifies how many configurations there will be\ in the generation. Default 100.") -arg_parser.add_argument("-a", "--aggressiveness", type=float, default=3, help=\ - "Specifies how aggressively biased the binning will be\ - towards higher order space groups. Mathematically, this\ - is specifying a z-score as a cutoff on the curve\ - that is being sampled. Default 3.") +arg_parser.add_argument("-a", "--aggressiveness", type=float, default=3, + help="Specifies how aggressively biased the binning\ + will be towards higher order space groups.\ + Mathematically, this is specifying a z-score as a\ + cutoff on the curve that is being sampled. Default 3.") args = arg_parser.parse_args() @@ -81,7 +83,8 @@ def chi(x): # A: 0, B: 1, C: 2 LatticeMatrix = [index[i] for i in range(2, 5)] -Elements = [i for i in zip(index[5].split(), [int(x) for x in index[6].split()])] +Elements = [i for i in zip(index[5].split(), [int(x) for x in index[6] + .split()])] # Just making sure that the file is in the correct format :) assert len(Elements) == 3 assert index[7].strip() == "Direct" @@ -119,13 +122,13 @@ def chi(x): # Calculate the distribution of space groups into bins on a normal # distribution if args.aggressiveness == 0: - Bins = [round((SPACE_GROUPS * i) / args.bins) for i in\ + Bins = [round((SPACE_GROUPS * i) / args.bins) for i in range(1, args.bins + 1)] else: - Bins = [round(SPACE_GROUPS *\ - ((chi((args.aggressiveness * i) / args.bins)) /\ - (chi(args.aggressiveness)))) for i in\ - range(1, args.bins + 1)] + Bins = [round(SPACE_GROUPS * + ((chi((args.aggressiveness * i) / args.bins)) / + (chi(args.aggressiveness)))) for i in + range(1, args.bins + 1)] BinSize = [0] * args.bins MAX_BIN_SIZE = args.number // args.bins @@ -167,7 +170,7 @@ def chi(x): # returned 1 ever. Am I just not scanning enough input or is there actually # a problem with the system? spacegroup = pymatgen.symmetry.analyzer.\ - SpacegroupAnalyzer(poscar.structure, symprec=R_TOL,\ + SpacegroupAnalyzer(poscar.structure, symprec=R_TOL, angle_tolerance=A_TOL).get_space_group_number() vasp_file = open(file_path, "r") @@ -192,5 +195,5 @@ def chi(x): break os.remove(file_path) break - + attempt += 1 diff --git a/spacegroup-sym.py b/spacegroup-sym.py index a802c01..e47e107 100644 --- a/spacegroup-sym.py +++ b/spacegroup-sym.py @@ -1,7 +1,7 @@ import yaml import argparse import sympy -import pdb +import math x, y, z = sympy.symbols('x, y, z') @@ -25,6 +25,7 @@ input = yaml.safe_load(input) # Big ass for loop - determine symmetry operations +passing_list = [1] for spacegroup in input.items(): if spacegroup[0] == 1: print(f"Group {spacegroup[0]} is closed") @@ -59,11 +60,11 @@ # Now run each site through the same set of ops and see if we get the # same site back for op in symmetry_ops: - # TODO: make sure that this will result in N vectors (okay bc will run N times) + if op == sympy.Matrix([[x], [y], [z]]): + continue sym_op_alt = [] compose = [(x, op[0]), (y, op[1]), (z, op[2])] for op2 in symmetry_ops: - breakpoint() new_vec = sympy.Matrix([op2[0].subs(compose), op2[1].subs(compose), op2[2].subs(compose)]) sym_op_alt.append(new_vec) @@ -80,14 +81,31 @@ op.simplify() # Now check to see if all operations are contained within the original # list - while isClosed: - for op2 in sym_op_alt: - if op2 not in symmetry_ops: - isClosed = False - break + for op2 in sym_op_alt: + if op2 not in symmetry_ops: + isClosed = False + break + + if not isClosed: + break - # Print whether or not the space group is closed - if isClosed: - print(f"Group {spacegroup[0]} is closed") + # Print whether or not the space group is closed + if isClosed: + print(f"Group {spacegroup[0]} is closed") + if len(symmetry_ops) > 9: + print(f"Group {spacegroup[0]} fails") else: - print(f"Group {spacegroup[0]} is open") + if 9 % len(symmetry_ops) == 0: + print(f"Group {spacegroup[0]} passes") + passing_list.append(spacegroup[0]) + else: + print(f"Group {spacegroup[0]} fails") + else: + print(f"Group {spacegroup[0]} is open") + if math.gcd(len(symmetry_ops), 9) != 1: + print(f"Group {spacegroup[0]} passes") + passing_list.append(spacegroup[0]) + else: + print(f"Group {spacegroup[0]} fails") + +print(passing_list) diff --git a/spacegroup-sym.yml b/spacegroup-sym.yml index d7d8a3b..981703b 100644 --- a/spacegroup-sym.yml +++ b/spacegroup-sym.yml @@ -13,7 +13,8 @@ M: [[-1, 0, 0], [0, 1, 0], [0, 0, -1]] T: [0, 0.5, 0] 5: - +: [0.5, 0.5, 0] + +: + - [0.5, 0.5, 0] 1: M: [[-1, 0, 0], [0, 1, 0], [0, 0, -1]] 6: @@ -24,11 +25,13 @@ M: [[1, 0, 0], [0, -1, 0], [0, 0, 1]] T: [0, 0, 0.5] 8: - +: [0.5, 0.5, 0] + +: + - [0.5, 0.5, 0] 1: M: [[1, 0, 0], [0, -1, 0], [0, 0, 1]] 9: - +: [0.5, 0.5, 0] + +: + - [0.5, 0.5, 0] 1: M: [[1, 0, 0], [0, -1, 0], [0, 0, 1]] T: [0, 0, 0.5] @@ -49,7 +52,8 @@ M: [[1, 0, 0], [0, -1, 0], [0, 0, 1]] T: [0, 0.5, 0] 12: - +: [0.5, 0.5, 0] + +: + - [0.5, 0.5, 0] 1: M: [[-1, 0, 0], [0, 1, 0], [0, 0, -1]] 2: @@ -75,7 +79,8 @@ M: [[1, 0, 0], [0, -1, 0], [0, 0, 1]] T: [0, 0.5, 0.5] 15: - +: [0.5, 0.5, 0] + +: + - [0.5, 0.5, 0] 1: M: [[-1, 0, 0], [0, 1, 0], [0, 0, -1]] T: [0, 0, 0.5] @@ -120,7 +125,8 @@ M: [[-1, 0, 0], [0, -1, 0], [0, 0, 1]] T: [0.5, 0, 0.5] 20: - +: [0.5, 0.5, 0] + +: + - [0.5, 0.5, 0] 1: M: [[1, 0, 0], [0, -1, 0], [0, 0, -1]] 2: @@ -130,7 +136,8 @@ M: [[-1, 0, 0], [0, -1, 0], [0, 0, 1]] T: [0, 0, 0.5] 21: - +: [0.5, 0.5, 0] + +: + - [0.5, 0.5, 0] 1: M: [[1, 0, 0], [0, -1, 0], [0, 0, -1]] 2: @@ -149,7 +156,8 @@ 3: M: [[-1, 0, 0], [0, -1, 0], [0, 0, 1]] 23: - +: [0.5, 0.5, 0.5] + +: + - [0.5, 0.5, 0.5] 1: M: [[1, 0, 0], [0, -1, 0], [0, 0, -1]] 2: @@ -157,7 +165,8 @@ 3: M: [[-1, 0, 0], [0, -1, 0], [0, 0, 1]] 24: - +: [0.5, 0.5, 0.5] + +: + - [0.5, 0.5, 0.5] 1: M: [[1, 0, 0], [0, -1, 0], [0, 0, -1]] T: [0, 0, 0.5] @@ -258,7 +267,8 @@ 3: M: [[-1, 0, 0], [0, -1, 0], [0, 0, 1]] 35: - +: [0.5, 0.5, 0] + +: + - [0.5, 0.5, 0] 1: M: [[-1, 0, 0], [0, 1, 0], [0, 0, 1]] 2: @@ -266,7 +276,8 @@ 3: M: [[-1, 0, 0], [0, -1, 0], [0, 0, 1]] 36: - +: [0.5, 0.5, 0] + +: + - [0.5, 0.5, 0] 1: M: [[-1, 0, 0], [0, 1, 0], [0, 0, 1]] 2: @@ -276,7 +287,8 @@ M: [[-1, 0, 0], [0, -1, 0], [0, 0, 1]] T: [0, 0, 0.5] 37: - +: [0.5, 0.5, 0] + +: + - [0.5, 0.5, 0] 1: M: [[-1, 0, 0], [0, 1, 0], [0, 0, 1]] T: [0, 0, 0.5] @@ -286,7 +298,8 @@ 3: M: [[-1, 0, 0], [0, -1, 0], [0, 0, 1]] 38: - +: [0, 0.5, 0.5] + +: + - [0, 0.5, 0.5] 1: M: [[-1, 0, 0], [0, 1, 0], [0, 0, 1]] 2: @@ -294,7 +307,8 @@ 3: M: [[-1, 0, 0], [0, -1, 0], [0, 0, 1]] 39: - +: [0, 0.5, 0.5] + +: + - [0, 0.5, 0.5] 1: M: [[-1, 0, 0], [0, 1, 0], [0, 0, 1]] T: [0, 0.5, 0] @@ -304,7 +318,8 @@ 3: M: [[-1, 0, 0], [0, -1, 0], [0, 0, 1]] 40: - +: [0, 0.5, 0.5] + +: + - [0, 0.5, 0.5] 1: M: [[-1, 0, 0], [0, 1, 0], [0, 0, 1]] T: [0.5, 0, 0] @@ -314,7 +329,8 @@ 3: M: [[-1, 0, 0], [0, -1, 0], [0, 0, 1]] 41: - +: [0, 0.5, 0.5] + +: + - [0, 0.5, 0.5] 1: M: [[-1, 0, 0], [0, 1, 0], [0, 0, 1]] T: [0.5, 0.5, 0] @@ -348,7 +364,8 @@ 3: M: [[-1, 0, 0], [0, -1, 0], [0, 0, 1]] 44: - +: [0.5, 0.5, 0.5] + +: + - [0.5, 0.5, 0.5] 1: M: [[-1, 0, 0], [0, 1, 0], [0, 0, 1]] 2: @@ -356,7 +373,8 @@ 3: M: [[-1, 0, 0], [0, -1, 0], [0, 0, 1]] 45: - +: [0.5, 0.5, 0.5] + +: + - [0.5, 0.5, 0.5] 1: M: [[-1, 0, 0], [0, 1, 0], [0, 0, 1]] T: [0, 0, 0.5] @@ -366,7 +384,8 @@ 3: M: [[-1, 0, 0], [0, -1, 0], [0, 0, 1]] 46: - +: [0.5, 0.5, 0.5] + +: + - [0.5, 0.5, 0.5] 1: M: [[-1, 0, 0], [0, 1, 0], [0, 0, 1]] T: [0.5, 0, 0] @@ -623,7 +642,7 @@ T: [0.5, 0.5, 0] 6: M: [[-1, 0, 0], [0, 1, 0], [0, 0, -1]] - T: [0.5 0.5, 0] + T: [0.5, 0.5, 0] 7: M: [[-1, 0, 0], [0, -1, 0], [0, 0, 1]] 60: @@ -690,7 +709,8 @@ M: [[-1, 0, 0], [0, -1, 0], [0, 0, 1]] T: [0.5, 0, 0.5] 63: - +: [0.5, 0.5, 0] + +: + - [0.5, 0.5, 0] 1: M: [[-1, 0, 0], [0, 1, 0], [0, 0, 1]] 2: @@ -710,7 +730,8 @@ M: [[-1, 0, 0], [0, -1, 0], [0, 0, 1]] T: [0, 0, 0.5] 64: - +: [0.5, 0.5, 0] + +: + - [0.5, 0.5, 0] 1: M: [[-1, 0, 0], [0, 1, 0], [0, 0, 1]] 2: @@ -730,7 +751,8 @@ M: [[-1, 0, 0], [0, -1, 0], [0, 0, 1]] T: [0, 0.5, 0.5] 65: - +: [0.5, 0.5, 0] + +: + - [0.5, 0.5, 0] 1: M: [[-1, 0, 0], [0, 1, 0], [0, 0, 1]] 2: @@ -746,7 +768,8 @@ 7: M: [[-1, 0, 0], [0, -1, 0], [0, 0, 1]] 66: - +: [0.5, 0.5, 0] + +: + - [0.5, 0.5, 0] 1: M: [[-1, 0, 0], [0, 1, 0], [0, 0, 1]] T: [0, 0, 0.5] @@ -766,7 +789,8 @@ 7: M: [[-1, 0, 0], [0, -1, 0], [0, 0, 1]] 67: - +: [0.5, 0.5, 0] + +: + - [0.5, 0.5, 0] 1: M: [[-1, 0, 0], [0, 1, 0], [0, 0, 1]] 2: @@ -786,7 +810,8 @@ M: [[-1, 0, 0], [0, -1, 0], [0, 0, 1]] T: [0, 0.5, 0] 68: - +: [0.5, 0.5, 0] + +: + - [0.5, 0.5, 0] 1: M: [[-1, 0, 0], [0, 1, 0], [0, 0, 1]] T: [0, 0.5, 0.5] @@ -848,7 +873,8 @@ 7: M: [[-1, 0, 0], [0, -1, 0], [0, 0, 1]] 71: - +: [0.5, 0.5, 0.5] + +: + - [0.5, 0.5, 0.5] 1: M: [[-1, 0, 0], [0, 1, 0], [0, 0, 1]] 2: @@ -864,7 +890,8 @@ 7: M: [[-1, 0, 0], [0, -1, 0], [0, 0, 1]] 72: - +: [0.5, 0.5, 0.5] + +: + - [0.5, 0.5, 0.5] 1: M: [[-1, 0, 0], [0, 1, 0], [0, 0, 1]] T: [0, 0, 0.5] @@ -884,7 +911,8 @@ 7: M: [[-1, 0, 0], [0, -1, 0], [0, 0, 1]] 73: - +: [0.5, 0.5, 0.5] + +: + - [0.5, 0.5, 0.5] 1: M: [[-1, 0, 0], [0, 1, 0], [0, 0, 1]] T: [0, 0, 0.5] @@ -906,7 +934,8 @@ M: [[-1, 0, 0], [0, -1, 0], [0, 0, 1]] T: [0, 0.5, 0] 74: - +: [0.5, 0.5, 0.5] + +: + - [0.5, 0.5, 0.5] 1: M: [[-1, 0, 0], [0, 1, 0], [0, 0, 1]] 2: @@ -962,7 +991,8 @@ M: [[0, 1, 0], [-1, 0, 0], [0, 0, 1]] T: [0, 0, 0.25] 79: - +: [0.5, 0.5, 0.5] + +: + - [0.5, 0.5, 0.5] 1: M: [[-1, 0, 0], [0, -1, 0], [0, 0, 1]] 2: @@ -970,7 +1000,8 @@ 3: M: [[0, 1, 0], [-1, 0, 0], [0, 0, 1]] 80: - +: [0.5, 0.5, 0.5] + +: + - [0.5, 0.5, 0.5] 1: M: [[-1, 0, 0], [0, -1, 0], [0, 0, 1]] 2: @@ -987,7 +1018,8 @@ 3: M: [[0, -1, 0], [1, 0, 0], [0, 0, -1]] 82: - +: [0.5, 0.5, 0.5] + +: + - [0.5, 0.5, 0.5] 1: M: [[-1, 0, 0], [0, -1, 0], [0, 0, 1]] 2: @@ -1067,7 +1099,8 @@ 7: M: [[0, -1, 0], [1, 0, 0], [0, 0, -1]] 87: - +: [0.5, 0.5, 0.5] + +: + - [0.5, 0.5, 0.5] 1: M: [[-1, 0, 0], [0, -1, 0], [0, 0, 1]] 2: @@ -1083,7 +1116,8 @@ 7: M: [[0, -1, 0], [1, 0, 0], [0, 0, -1]] 88: - +: [0.5, 0.5, 0.5] + +: + - [0.5, 0.5, 0.5] 1: M: [[-1, 0, 0], [0, -1, 0], [0, 0, 1]] 2: @@ -1259,7 +1293,8 @@ 7: M: [[0, 1, 0], [1, 0, 0], [0, 0, -1]] 97: - +: [0.5, 0.5, 0.5] + +: + - [0.5, 0.5, 0.5] 1: M: [[-1, 0, 0], [0, -1, 0], [0, 0, 1]] 2: @@ -1275,7 +1310,8 @@ 7: M: [[0, 1, 0], [1, 0, 0], [0, 0, -1]] 98: - +: [0.5, 0.5, 0.5] + +: + - [0.5, 0.5, 0.5] 1: M: [[-1, 0, 0], [0, -1, 0], [0, 0, 1]] 2: @@ -1445,7 +1481,8 @@ M: [[0, -1, 0], [-1, 0, 0], [0, 0, 1]] T: [0.5, 0.5, 0.5] 107: - +: [0.5, 0.5, 0.5] + +: + - [0.5, 0.5, 0.5] 1: M: [[-1, 0, 0], [0, -1, 0], [0, 0, 1]] 2: @@ -1461,7 +1498,8 @@ 7: M: [[0, -1, 0], [-1, 0, 0], [0, 0, 1]] 108: - +: [0.5, 0.5, 0.5] + +: + - [0.5, 0.5, 0.5] 1: M: [[-1, 0, 0], [0, -1, 0], [0, 0, 1]] 2: @@ -1481,7 +1519,8 @@ M: [[0, -1, 0], [-1, 0, 0], [0, 0, 1]] T: [0, 0, 0.5] 109: - +: [0.5, 0.5, 0.5] + +: + - [0.5, 0.5, 0.5] 1: M: [[-1, 0, 0], [0, -1, 0], [0, 0, 1]] 2: @@ -1501,7 +1540,8 @@ M: [[0, -1, 0], [-1, 0, 0], [0, 0, 1]] T: [0, 0.5, 0.25] 110: - +: [0.5, 0.5, 0.5] + +: + - [0.5, 0.5, 0.5] 1: M: [[-1, 0, 0], [0, -1, 0], [0, 0, 1]] 2: @@ -1667,7 +1707,8 @@ M: [[0, 1, 0], [1, 0, 0], [0, 0, -1]] T: [0.5, 0.5, 0.5] 119: - +: [0.5, 0.5, 0.5] + +: + - [0.5, 0.5, 0.5] 1: M: [[-1, 0, 0], [0, -1, 0], [0, 0, 1]] 2: @@ -1683,7 +1724,8 @@ 7: M: [[0, 1, 0], [1, 0, 0], [0, 0, -1]] 120: - +: [0.5, 0.5, 0.5] + +: + - [0.5, 0.5, 0.5] 1: M: [[-1, 0, 0], [0, -1, 0], [0, 0, 1]] 2: @@ -1703,7 +1745,8 @@ M: [[0, 1, 0], [1, 0, 0], [0, 0, -1]] T: [0, 0, 0.5] 121: - +: [0.5, 0.5, 0.5] + +: + - [0.5, 0.5, 0.5] 1: M: [[-1, 0, 0], [0, -1, 0], [0, 0, 1]] 2: @@ -1719,7 +1762,8 @@ 7: M: [[0, -1, 0], [-1, 0, 0], [0, 0, 1]] 122: - +: [0.5, 0.5, 0.5] + +: + - [0.5, 0.5, 0.5] 1: M: [[-1, 0, 0], [0, -1, 0], [0, 0, 1]] 2: @@ -2371,7 +2415,8 @@ M: [[0, 1, 0], [1, 0, 0], [0, 0, -1]] T: [0, 0, 0.5] 139: - +: [0.5, 0.5, 0.5] + +: + - [0.5, 0.5, 0.5] 1: M: [[-1, 0, 0], [0, -1, 0], [0, 0, 1]] 2: @@ -2403,7 +2448,8 @@ 15: M: [[0, 1, 0], [1, 0, 0], [0, 0, -1]] 140: - +: [0.5, 0.5, 0.5] + +: + - [0.5, 0.5, 0.5] 1: M: [[-1, 0, 0], [0, -1, 0], [0, 0, 1]] 2: @@ -2443,7 +2489,8 @@ M: [[0, 1, 0], [1, 0, 0], [0, 0, -1]] T: [0, 0, 0.5] 141: - +: [0.5, 0.5, 0.5] + +: + - [0.5, 0.5, 0.5] 1: M: [[-1, 0, 0], [0, -1, 0], [0, 0, 1]] 2: @@ -2483,7 +2530,8 @@ 15: M: [[0, 1, 0], [1, 0, 0], [0, 0, -1]] 142: - +: [0.5, 0.5, 0.5] + +: + - [0.5, 0.5, 0.5] 1: M: [[-1, 0, 0], [0, -1, 0], [0, 0, 1]] 2: