def test_Ecis(self): """ Ecis """ path = os.path.join(self.PATH, "Ecis") unitcell = UnitCell.from_file(os.path.join(path, "log.txt")) # parse_ecitxt ## 160305 ecis = Ecis.parse_ecitxt(os.path.join(path, "eci.txt")) out = {0: 0.680236051, 1: -673.192307, 2: -208.572905, 3: 1752.08986, 4: 306.073297, 5: 147.11169, 6: 129.361349, 7: 233.347231, 8: 237.242402, 9: -4.14835143, 10: -44.2051374, 11: -1652.97108, 12: -286.755208, 13: -668.664112, 14: -714.67382, 16: 1227.364, 17: -707.7569, 19: -8.39681819, 20: -20.1496428, 22: 26.7883166, 24: -118.547219, 26: -6.21356756, 27: 1404.19369, 28: 1180.73395, 29: 95.1228157, 31: 100.481087, 35: -1089.71922, 36: 150.635303, 38: -845.97957, 44: -312.645058, 45: -134.730871, 47: -244.485361, 48: -117.505334, 49: 444.617266, 52: 294.931568, 53: -274.314461, 54: 407.711243} assert ecis == out # parse_logtxt ## 160305 clus = Ecis.parse_logtxt(os.path.join(path, "log.txt")) assert len(clus) == 54 out = np.array([[0.75, 0.5, 0.25], [0.5, 0.25, -0.25]]) assert (clus[3] == out).all() # get_clusters_from_logtxt ## 160306 clus = Ecis.get_clusters_from_logtxt(os.path.join(path, "log.txt")) assert len(clus) == 54 for i in range(len(clus)): for idx in clus[i]: equiv = unitcell.symm['equivalent_atoms'][idx] assert len(clus[i][idx]) == len(clus[i][equiv]) # get_diff_clusters ## 160306 out = Ecis.get_diff_clusters(os.path.join(path, "eci.txt"), os.path.join(path, "log.txt"), os.path.join(path, "logN6.txt"), msg=False) test = ("16 13 11 0 44 3 17 24 7 29 2 4 19 34 45 36 9 21 1 54 \n" "26 5 6 49 15 48 8 10 53 52 27 12 28 47 20 38 31 \n") assert out.split() == test.split() # form_dirc ## 160308 ecis = Ecis.from_dirc(path) # Al-Cu_TO_P ## 160330 """ BRAV=F の構造だとうまくいかない log.txt の構造表記の部分は P, F で変化しないが、 cluster を記述する後半の部分が変わるので、そこで齟齬が生じる """ path = os.path.join(self.PATH, "Ecis", "Al-Cu_TO_P") # path = os.path.join(self.PATH, "Ecis", "Al-Cu_TO_F") unitcell = UnitCell.from_file(os.path.join(path, "log.txt")) ecis = Ecis.parse_ecitxt(os.path.join(path, "eci.txt")) clus = Ecis.parse_logtxt(os.path.join(path, "log.txt")) # print(clus) clus = Ecis.get_clusters_from_logtxt(os.path.join(path, "log.txt"))