예제 #1
0
def ParseOUTCAR(OUTCAR):
    outcar = outputs.Outcar(OUTCAR)
    run_stats = outcar.run_stats

    with open(OUTCAR, 'r') as f:
        version = f.readline()
        f.readline()
        plat = re.findall('\s+(\w+)\s+', f.readline())[1]
    return run_stats, version, plat, outcar
예제 #2
0
def ParseOUTCAR(OUTCAR):
    outcar = outputs.Outcar(OUTCAR)
    run_stats = outcar.run_stats

    with open(OUTCAR, 'r') as f:
        version = f.readline()
        f.readline()
        plat = re.findall('\s+(\w+)\s+', f.readline())[1]

        # LOOP+  画图部分的数据, 得到一个list, 里面是 元祖数据, 一个元祖包括两个字符串, 第一个数据是CPU Time , 第二个是 real time 。 类型是字符串,还需要转换为 float
        cpuTime = re.findall('LOOP\+.+([0-9].+\.[0-9]+).+([0-9].+\.[0-9]+)',
                             f.read())

    # 将cpuTime 中  String 转换为  Float

    cputime = []
    realtime = []
    for i in list(map(list, cpuTime)):
        cputime.append(float(i[0]))
        realtime.append(float(i[1]))

    return run_stats, version, plat, cputime, realtime
예제 #3
0
masterdir = os.getcwd()
z_list = []
for f_master in fname:
    E0 = []  # the list of energies
    m = re.search('verticals', f_master)
    iend = m.span()[0]
    pattern = f_master[0:iend]
    for f in fname_all:
        subdir = vasp_dir + f
        if f[0:len(pattern)] == pattern:

            os.chdir(os.getcwd() + subdir)
            print(os.getcwd())
            if os.path.exists("OUTCAR"):
                outcar = outputs.Outcar("OUTCAR")
                if outcar.final_energy is not None:
                    E0.append(outcar.final_energy)
            os.chdir(masterdir)

    if len(E0) == nz:  # if the run is finished
        print(E0)
        E_list = E0 - np.min(E0)
        #ind = np.argmin(E0)
        #zmin_tmp = z[ind]
        # popt,pcov = curve_fit(func,z,E_list,bounds=([0,zmin_tmp-0.07,0],[0.05,zmin_tmp+0.07,1]),p0=(0.01,zmin_tmp,0))
        zarr = np.linspace(np.min(z), np.max(z), 500)
        p = np.polyfit(z, E_list, 10)
        print(p)
        fit = np.poly1d(p)
        earr = fit(zarr)