Exemplo n.º 1
0
    def fun(args, consts):
        log = {}
        # get uuid
        calc_uuid = uuid.uuid4().hex[:8]
        # logging
        log["uuid"] = calc_uuid
        # make directories for the calculation
        dirname = os.path.join(calc["element"], calc_uuid)
        if not os.path.exists(dirname):
            os.makedirs(dirname)

        os.chdir(dirname)
        # generate radii iterable 
        radii = list(args) + list(consts)
        log["radii"] = radii
        pseudo_file, log["err_pseudo"] = generate_pseudo(calc, electrons, radii)
        log["err_mean"], log["err_max"] = test_pseudo(calc, configs)
        volumes = np.linspace(0.98, 1.02, 3)
        alats = (volumes * equil_volume * nat) ** (1./3.)
        x, y = [], []
        for alat in alats:
            prepare_siesta_calc(fdf_file, pseudo_file, alat, siesta_calc)
            run_siesta_calc(alat, siesta_calc)
            e = read_energy(alat)
            if e is not None:
                x.append(float(e[0]))
                y.append(e[1])
        os.chdir(cwd)
        # making x and y arrays
        x = (np.array(x) ** 3) / nat
        y = np.array(y)
        p = np.polyfit(x, y, 2)
        min_p = -p[1] / (2*p[0])
        log["min_p"] = min_p
        x_p = np.linspace(0.94*min_p, 1.06*min_p, 7)
        y_p = np.polyval(p, x_p)
        vol, bulk_mod, bulk_deriv, res = BM(np.vstack((x_p, y_p)).T)
        our_data = np.core.records.fromrecords([(element, vol, bulk_mod, bulk_deriv), ], names=('element', 'V0', 'B0', 'BP'))
        delta, delta_rel, delta1 = calcDelta_one(our_data, ref_data_el, useasymm=False)
        log["delta"] = delta
        log["delta_rel"] = delta_rel
        log["delta1"] = delta1
        log_entry(log, element)
        return delta
Exemplo n.º 2
0
    calc_uuid = uuid.uuid4().hex[:8]
    # calc_uuid = "4ce268f7"
    # logging
    log["uuid"] = calc_uuid
    # get reference data
    ref_data = read_ref_data("delta/WIEN2k.txt")
    ref_data_el = ref_data[ref_data['element'] == element]
    # make directories for the calculation
    dirname = os.path.join(element, calc_uuid)
    if not os.path.exists(dirname):
        os.makedirs(dirname)

    os.chdir(dirname)
    log["radii"] = radii
    pseudo_file, log["err_pseudo"] = generate_pseudo(calc, electrons, radii)
    log["err_mean"], log["err_max"] = test_pseudo(calc, configs)
    volumes = np.linspace(0.98, 1.02, 3)
    # possible alats (3 points near Wien2K equilibrium)
    alats = (volumes * equil_volume * nat) ** (1./3.)    
    x, y = [], []
    for alat in alats:
        prepare_siesta_calc(fdf_file, pseudo_file, alat, siesta_calc)
        run_siesta_calc(alat, siesta_calc)
        e = read_energy(alat)
        if e is not None:
            x.append(float(e[0]))
            y.append(e[1])
    os.chdir(cwd)
    # making x and y arrays
    x = (np.array(x) ** 3) / nat
    y = np.array(y)