Exemplo n.º 1
0
    def _test_CEM_Parser(self):
        """
        CEM Parser をテストする
        """
        path = "/Users/enoki/Researches/analysis/codes/01_testRun/montecarlo/AlCu/warren/150910_recalc"
        CEMParser.from_dirc_std(path, QuadSite)

        path = os.path.join(self.PATH, "AlCu/wien/TO")
        CEMParser.from_dirc_std(path, QuadSite)
        path = os.path.join(self.PATH, "AlCu/tetra_2R2N")
        CEMParser.from_dirc_prim_fcc(path, QuadSite)
        path = os.path.join(self.PATH, "i-s/fcci/Ti0C1/R4N4")
        CEMParser.from_dirc_2sub(path, NaClSite)
        # path = os.path.join(self.PATH, "i-s/bcci/CrC")
        # CEMParser.from_dirc_2sub(path, NaClSite)
        path = os.path.join(self.PATH, "i-s/bcci/TiC_R6N4_330str")
        CEMParser.from_dirc_2sub(path, NaClSite)
Exemplo n.º 2
0
    def _test_bcci3(self):
        path = os.path.join(self.PATH, "i-s/bcci/TiC_spin_r_R6N4")
        path = os.path.join(self.PATH, "i-s/bcci/TiC_R6N4_330str")
        clus = CEMParser.parse_logtxt_bcci(os.path.join(path, 'log.txt'))
        # print(clus[2])
        # CEMParser.symm_cubic_bcci(clus[0], BcciOctaSite)
        clusters = []
        for c in clus:
            clusters.append(CEMParser.symm_cubic_bcci(c, BcciOctaSite))
        ecis = CEMParser.parse_ecitxt(os.path.join(path, 'eci.txt'))
        out = {}
        for label in ['C', 'A1', 'A2', 'A3']:
            tmp_clus = []
            tmp_ecis = []
            for i in sorted(ecis.keys()):
                if clusters[i][label]:
                    tmp_clus.append(
                        np.array([[BcciOctaSite.conv_site2idex(site)
                                   for site in cluster]
                                  for cluster in clusters[i][label]]))
                    tmp_ecis.append(ecis[i])
            out.update({label:[tmp_clus, tmp_ecis]})
        # print(out['C'])

        print(SubLattXtal(1, out, BcciOctaSite, arrange='A3C').get_energy() - 7962.21404)
        print(SubLattXtal(1, out, BcciOctaSite, arrange='A2C').get_energy() - 7962.21404)
        print(SubLattXtal(1, out, BcciOctaSite, arrange='A1C').get_energy() - 7962.21404)
        print(SubLattXtal(1, out, BcciOctaSite, arrange='BCC_u').get_energy() - 7962.21404)
        print(SubLattXtal(1, out, BcciOctaSite, arrange='A3D').get_energy() - 7962.21404)
        print(SubLattXtal(1, out, BcciOctaSite, arrange='A2D').get_energy() - 7962.21404)

        print(SubLattXtal(1, out, BcciOctaSite, arrange='A1D').get_energy() - 7962.21404)

        print(SubLattXtal(1, out, BcciOctaSite, arrange='BCC_d').get_energy() - 7962.21404)

        print(SubLattXtal(4, out, BcciOctaSite, arrange='ACD').get_energy() - 7962.21404)

        CrC = SubLattXtal(4, out, BcciOctaSite, arrange='BCC_u')
        CrC.cell[0,0,0,2] = 1
        CrC.cell[0,0,0,0] = 0
        crc1 = CrC.get_energy()
        CrC.cell[0,0,0,2] = 0
        CrC.cell[2,2,2,7] = 1
        crc2 = CrC.get_energy()
        print((crc1 - crc2)*4**3*8)
Exemplo n.º 3
0
 def _test_compare_pos_vs_clus_bcci(self):
     """
     bcciにて
     log.txtから与えられた元素種と site 位置から判別した元素種とが一致するか
     check 用の method
     """
     path = os.path.join(self.PATH, "i-s/bcci/CrC")
     judges = CEMParser.compare_pos_vs_clus(
         os.path.join(path, 'log.txt'), BcciOctaSite)
     for judge in judges:
         assert judge
Exemplo n.º 4
0
    def _test_get_cluser_energy(self):
        """
        全てのクラスターを作成分解してエネルギーを出す
        """
        path = os.path.join(self.PATH, "i-s/fcci/Ti1C1/R6N4")
        # path = os.path.join(self.PATH, "i-s/fcci/Ti0C1/R4N4")
        # path = os.path.join(self.PATH, "i-s/fcci/Ti1C1/R4N4")
        clus = CEMParser.parse_logtxt_2sub(os.path.join(path, 'log.txt'))
        print(clus[0])
        clus_idxs = (
            np.array([[NaClSite.conv_site2idx(site) for site in cluster]
                for cluster in clus[0]]))
        fcci_xtal = NaClXtal.from_pickle_ecis(os.path.join(path, 'cluster.pickle'),
                                             size=5)
        # 全ての POSCAR を作成
        # for i in range(len(clus_idxs)):
        #     fcci_xtal.cell[:, :, :, :] = 0
        #     fcci_xtal.cell[tuple(np.array(clus_idxs[i]).T)] = 1
        #     fcci_xtal.make_poscar(os.path.join(path, 'POSCAR_{0}'.format(i)), 1, 1)

        # 全てのエネルギーを計算
        # fcci_xtal.sub_ecis[3] = 0
        # fcci_xtal.int_ecis[3] = 0
        # fcci_xtal.sub_ecis[4] = 0
        print(fcci_xtal.int_ecis)

        c_spin = 1
        a_spin = 1
        fcci_xtal.cell[:, :, :, :] = 0
        fcci_xtal.cell[:, :, :, 0:4] = 1 - c_spin
        ref_null = fcci_xtal.get_energy() * fcci_xtal.size ** 3 * 8
        print(ref_null )

        fcci_xtal.cell[:, :, :, :] = 0
        fcci_xtal.cell[tuple(np.array(clus_idxs[0]).T)] = 1
        fcci_xtal.cell[:, :, :, 0:4] = \
            (1 - fcci_xtal.cell[:, :, :, 0:4]) * (1 - c_spin) + \
            fcci_xtal.cell[:, :, :, 0:4] * c_spin
        ref_i = fcci_xtal.get_energy() * fcci_xtal.size ** 3 * 8 - ref_null

        fcci_xtal.cell[:, :, :, :] = 0
        fcci_xtal.cell[tuple(np.array(clus_idxs[1]).T)] = 1
        fcci_xtal.cell[:, :, :, 0:4] = \
            (1 - fcci_xtal.cell[:, :, :, 0:4]) * (1 - c_spin) + \
            fcci_xtal.cell[:, :, :, 0:4] * c_spin
        ref_s = fcci_xtal.get_energy() * fcci_xtal.size ** 3 * 8 - ref_null

        for i in range(len(clus_idxs)):
            fcci_xtal.cell[:, :, :, :] = 0
            fcci_xtal.cell[tuple(np.array(clus_idxs[i]).T)] = 1
            fcci_xtal.cell[:, :, :, 0:4] = \
                (1 - fcci_xtal.cell[:, :, :, 0:4]) * (1 - c_spin) + \
                fcci_xtal.cell[:, :, :, 0:4] * c_spin
            fcci_xtal.make_poscar(os.path.join(path, 'POSCAR_{0}'.format(i+1)), 1, 1)
            fcci_xtal.cell[:, :, :, :] = c_spin
            fcci_xtal.cell[:, :, :, 4:] = 1
            tot_e = fcci_xtal.get_energy() * fcci_xtal.size ** 3 * 8
            num_s = ((1 - fcci_xtal.get_conc()['subs']) * (1 - c_spin) +
                     fcci_xtal.get_conc()['subs'] * c_spin) * fcci_xtal.size ** 3 * 4
            num_i = fcci_xtal.get_conc()['inter'] * fcci_xtal.size ** 3 * 4
            num = (num_s + num_i)
            clus_e = (tot_e - num_s * ref_s - num_i * ref_i - ref_null) / num
            print(i+1, num_s, num_i, clus_e)
            # clus_e2 = (tot_e - )
        fcci_xtal.cell[:, :, :, :] = 1
Exemplo n.º 5
0
 def _test_mc_bcci2(self):
     path = os.path.join(self.PATH, "i-s/bcci/TiC_R6N4_330str")
     CEMParser.from_dirc_bcci(path, BcciOctaSite)