def __init__(self, path_x, path_y, path_z): self.dat_x = SpinIO.load_pickle(os.path.join(path_x, 'TB2J_results'), 'TB2J.pickle') self.dat_y = SpinIO.load_pickle(os.path.join(path_y, 'TB2J_results'), 'TB2J.pickle') self.dat_z = SpinIO.load_pickle(os.path.join(path_z, 'TB2J_results'), 'TB2J.pickle') self.dat = copy.copy(self.dat_z)
def __init__(self, path_x, path_y, path_z, method='structure'): assert (method in ['structure', 'spin']) self.dat_x = SpinIO.load_pickle(os.path.join(path_x, 'TB2J_results'), 'TB2J.pickle') self.dat_y = SpinIO.load_pickle(os.path.join(path_y, 'TB2J_results'), 'TB2J.pickle') self.dat_z = SpinIO.load_pickle(os.path.join(path_z, 'TB2J_results'), 'TB2J.pickle') self.dat = copy.copy(self.dat_z) self.paths = [path_x, path_y, path_z] self.method = method
def read_pickle(path): p1 = os.path.join(path, 'TB2J_results', 'TB2J.pickle') p2 = os.path.join(path, 'TB2J.pickle') if os.path.exists(p1) and os.path.exists(p2): print(f" WARNING!: Both file {p1} and {p2} exist. Use default {p1}.") if os.path.exists(p1): ret = SpinIO.load_pickle(os.path.join(path, 'TB2J_results')) elif os.path.exists(p2): ret = SpinIO.load_pickle(path) else: raise FileNotFoundError(f"Cannot find either file {p1} or {p2}") return ret