def write(self): line(**self.kwargs) print_label("Symmetry analysis", **self.kwargs) line(**self.kwargs) for i, record in enumerate(self.data): self.write_single( i, crystal=[ periodicTableElement[record['std_types'][mapping] - 1] for mapping in record['mapping_to_primitive'] ])
def print_crystal_info(**kwargs): try: print_label(kwargs['title']) except KeyError: print("placeholder", end="") try: print_label("Size: %dx%dx%d" % (kwargs['copies']), labelStyle=Color.bold) except KeyError: print_label("Size: 1x1x1", labelStyle=Color.bold) try: print_crystal(kwargs['crystal'], directions=kwargs['directions']) except KeyError: print("", end="") try: print_label("Reference atom in the system is No. %d:" % (kwargs['reference'] + 1), atoms=[kwargs['crystal'][kwargs['reference']]], vectorStyle=Color.darkcyan, labelStyle=Color.bold) except KeyError: print("", end="") try: print_moments(kwargs['moments'], cell=kwargs['crystal']) except KeyError: print("", end="")
def print_equations(equations, isNotRedundant=False): print_label("System of equations:", labelStyle=Color.bold) for equation in equations: print_vector(equation) if not isNotRedundant: print_label("Redundant system of equations.", labelStyle=Color.bold) print_label( "Least square method is to be used to obtain Heisenberg model.", labelStyle=Color.bold) print_label("It may be better. But it may also mess everything.", labelStyle=Color.bold) else: print_label("det SoE = %.1e" % np.linalg.det(equations), labelStyle=Color.bold)
def print_solver_status(configs): if configs > 1e6: try: print_label("Checking total number of configurations: %.2e" % float(configs), labelStyle=Color.bold + Color.darkred) except OverflowError: print_label( "Checking total number of configurations: incomprehensible", labelStyle=Color.bold + Color.darkred) else: print_label("Checking total number of configurations: %d" % configs, labelStyle=Color.bold + Color.darkred) print_label("Preparing and running ASA-solver...", labelStyle=Color.bold + Color.blue)
def __del__(self): print_label("Found %d unique configurations"%len(np.loadtxt('best.flips',bool)), labelStyle=Color.bold+Color.darkgreen) del self.tmpFiles del self.builder