Exemplo n.º 1
0
    def set_condition(self, r, n):
        """
        path 中に originals ファイルをコピーして rmax, nmax を def.txt にセットする
        """
        if not self.distances:
            self.current_label = "RmaxN2"
            rmax = r
        else:
            self.current_label = "R{0}N{1}".format(r, n)
            rmax = self.distances[r-1]+0.005
        dst = os.path.join(self.seq_dirc, self.current_label)
        Bash.copy_dir(os.path.join(self.seq_dirc, "originals"), dst)

        deftxt = os.path.join(dst, "def.txt")
        with open(deftxt, 'r') as rfile:
            lines = rfile.readlines()
        meta = re.compile(r"^{0}\s*.*".format(self.clus_name))
        i = 0
        # print(self.clus_name)
        while not meta.match(lines[i]):
            # print(i)
            # print(lines[i])
            i += 1
        lines[i] = "{0}      RMAX={1} NSMAX={2}  PRNTMAXCL=T NMAX=0\n".format(
            self.clus_name, rmax, n)
        with open(os.path.join(dst, "def.txt"), 'w') as wfile:
            wfile.write("".join(lines))
Exemplo n.º 2
0
 def all(cls, path, incar_obj=None, kp_rx=0.15, kp_soc=0.11):
     """
     All pattern of INCAR files are prepared.
     それぞれのパラメータの変更は
     class method "cls_add_fixedtag"や"cls_add_extratag"を使うか
     incar_objに書き替えたincarを入力
     省略した場合、path中のPOSCARをbaseに作成
     """
     if not incar_obj:
         incar_obj = IncarReadPoscar(os.path.join(path, 'POSCAR'))
     cls.make_potcar_kpoints(path, kp_rx, kp_soc)
     methods = ['relax', 'cell', 'volume', 'volumeE', 'presoc', 'presoc_nc',
                'ibzkp', 'soc',
                'dos', 'band', 'static']
     for method in methods:
         getattr(cls, method)(path, incar_obj)
     src_dir = os.path.join(MODULE_DIR, '../sorce/originalsVASP', 'Calc')
     dst_dir = os.path.join(path, 'Calc')
     Bash.copy_dir(src_dir, dst_dir)