예제 #1
0
def build_flow(options):
    # Working directory (default is the name of the script with '.py' removed and "run_" replaced by "flow_")
    workdir = options.workdir
    if not options.workdir:
        workdir = os.path.basename(__file__).replace(".py", "").replace(
            "run_", "flow_")

    # Initialize pseudos and Structure.
    pseudos = abidata.pseudos("14si.pspnc")
    structure = abilab.Structure.from_file(abidata.cif_file("si.cif"))

    kppa = scf_kppa = 1
    nscf_nband = 6
    nscf_ngkpt = [4, 4, 4]
    nscf_shiftk = [0.1, 0.2, 0.3]
    bs_loband = 2
    bs_nband = nscf_nband
    mbpt_sciss = 0.7
    mdf_epsinf = 12
    ecuteps = 2
    ecut = 12

    flow = flowtk.Flow(workdir=workdir,
                       manager=options.manager,
                       remove=options.remove)

    # BSE calculation with model dielectric function.
    multi = abilab.bse_with_mdf_inputs(
        structure,
        pseudos,
        scf_kppa,
        nscf_nband,
        nscf_ngkpt,
        nscf_shiftk,
        ecuteps,
        bs_loband,
        bs_nband,
        mbpt_sciss,
        mdf_epsinf,
        ecut=ecut,  #$ pawecutdg=None, 
        exc_type="TDA",
        bs_algo="haydock",
        accuracy="normal",
        spin_mode="unpolarized",
        smearing=None)
    #smearing="fermi_dirac:0.1 eV", charge=0.0, scf_algorithm=None)

    work = flowtk.BseMdfWork(scf_input=multi[0],
                             nscf_input=multi[1],
                             bse_inputs=multi[2:])

    #from pymatgen.io.abinit.calculations import bse_with_mdf_work
    #work = bse_with_mdf_work(structure, pseudos, scf_kppa, nscf_nband, nscf_ngkpt, nscf_shiftk,
    #                         ecuteps, bs_loband, bs_nband, mbpt_sciss, mdf_epsinf,
    #                         accuracy="normal", spin_mode="unpolarized", smearing=None,
    #                         charge=0.0, scf_solver=None, **extra_abivars)

    flow.register_work(work)
    return flow
예제 #2
0
def raman_work(structure, pseudos, shiftk, paral_kgb=1):
    # Generate 3 different input files for computing optical properties with BSE.

    # Global variables
    global_vars = dict(
        ecut=8,
        istwfk="*1",
        chksymbreak=0,
        #nstep=4,
        nstep=10,
        paral_kgb=paral_kgb,
    )

    # GS run
    scf_inp = abilab.AbinitInput(structure, pseudos=pseudos)
    scf_inp.set_vars(global_vars)
    scf_inp.set_kmesh(ngkpt=[2, 2, 2], shiftk=shiftk)
    scf_inp["tolvrs"] = 1e-6

    # NSCF run
    nscf_inp = abilab.AbinitInput(structure, pseudos=pseudos)
    nscf_inp.set_vars(global_vars)
    nscf_inp.set_kmesh(ngkpt=[2, 2, 2], shiftk=shiftk)

    nscf_inp.set_vars(
        tolwfr=1e-8,
        nband=12,
        nbdbuf=4,
        iscf=-2,
    )

    # BSE run with Model dielectric function and Haydock (only resonant + W + v)
    # Note that SCR file is not needed here
    bse_inp = abilab.AbinitInput(structure, pseudos=pseudos)
    bse_inp.set_vars(global_vars)
    bse_inp.set_kmesh(ngkpt=[2, 2, 2], shiftk=shiftk)

    bse_inp.set_vars(
        optdriver=99,
        ecutwfn=global_vars["ecut"],
        ecuteps=3,
        inclvkb=2,
        bs_algorithm=2,  # Haydock
        bs_haydock_niter=4,  # No. of iterations for Haydock
        bs_exchange_term=1,
        bs_coulomb_term=21,  # Use model W and full W_GG.
        mdf_epsinf=12.0,
        bs_calctype=1,  # Use KS energies and orbitals to construct L0
        mbpt_sciss="0.8 eV",
        bs_coupling=0,
        bs_loband=2,
        nband=6,
        #bs_freq_mesh="0 10 0.1 eV",
        bs_hayd_term=0,  # No terminator
    )

    # Build the work representing a BSE run with model dielectric function.
    return flowtk.BseMdfWork(scf_inp, nscf_inp, bse_inp)
예제 #3
0
def build_flow(options):
    # Working directory (default is the name of the script with '.py' removed and "run_" replaced by "flow_")
    if not options.workdir:
        if os.getenv("READTHEDOCS", False):
            __file__ = os.path.join(os.getcwd(), "run_ht_si_bsemdf.py")
        options.workdir = os.path.basename(__file__).replace(
            ".py", "").replace("run_", "flow_")

    # Initialize pseudos and Structure.
    pseudos = abidata.pseudos("14si.pspnc")
    structure = abilab.Structure.from_file(abidata.cif_file("si.cif"))

    kppa = scf_kppa = 1
    nscf_nband = 6
    nscf_ngkpt = [4, 4, 4]
    nscf_shiftk = [0.1, 0.2, 0.3]
    bs_loband = 2
    bs_nband = nscf_nband
    mbpt_sciss = 0.7 * abilab.units.eV_to_Ha
    mdf_epsinf = 12
    ecuteps = 2
    ecut = 12

    flow = flowtk.Flow(workdir=options.workdir, manager=options.manager)

    # BSE calculation with model dielectric function.
    multi = abilab.bse_with_mdf_inputs(
        structure,
        pseudos,
        scf_kppa,
        nscf_nband,
        nscf_ngkpt,
        nscf_shiftk,
        ecuteps,
        bs_loband,
        bs_nband,
        mbpt_sciss,
        mdf_epsinf,
        ecut=ecut,  # pawecutdg=None,
        exc_type="TDA",
        bs_algo="haydock",
        accuracy="normal",
        spin_mode="unpolarized",
        smearing=None)
    #smearing="fermi_dirac:0.1 eV", charge=0.0, scf_algorithm=None)

    work = flowtk.BseMdfWork(scf_input=multi[0],
                             nscf_input=multi[1],
                             bse_inputs=multi[2:])

    flow.register_work(work)
    return flow
예제 #4
0
파일: run_flow.py 프로젝트: zbwang/abipy
def build_flow(options):
    # Working directory (default is the name of the script with '.py' removed and "run_" replaced by "flow_")
    workdir = options.workdir
    if not options.workdir:
        workdir = os.path.basename(__file__).replace(".py", "").replace("run_", "flow_")

    flow = flowtk.Flow(workdir=workdir)

    for nk in [4, 6, 8]:
        scf_inp, nscf_inp, bse_inp = make_scf_nscf_bse_inputs(ngkpt=3 * [nk], ecut=6, ecuteps=3)
        work = flowtk.BseMdfWork(scf_inp, nscf_inp, bse_inp)
        flow.register_work(work)

    return flow
예제 #5
0
def build_bse_flow(options):
    """
    Build a flow to solve the BSE with default parameters.

    Args:
        options: Command line options.

    Return:
        Flow object.
    """
    workdir = options.workdir if (options and options.workdir) else "flow_bse"
    flow = flowtk.Flow(workdir=workdir)

    # Build a Work for BSE calculation with the model dielectric function ...
    scf_inp, nscf_inp, bse_inp = make_scf_nscf_bse_inputs()

    work = flowtk.BseMdfWork(scf_inp, nscf_inp, bse_inp)

    # and add it to the flow
    flow.register_work(work)

    return flow
예제 #6
0
def build_bse_kconv_flow(options):
    """
    Build a flow to analyze the convergence of the BSE spectrum wrt k-point sampling.

    Args:
        options: Command line options.

    Return:
        Flow object.
    """
    workdir = options.workdir if (options
                                  and options.workdir) else "flow_bse_kconv"
    flow = flowtk.Flow(workdir=workdir)

    # 3 works with differet ngkpt.
    for nk in [4, 6, 8]:
        scf_inp, nscf_inp, bse_inp = make_scf_nscf_bse_inputs(ngkpt=3 * [nk],
                                                              ecut=6,
                                                              ecuteps=3)
        work = flowtk.BseMdfWork(scf_inp, nscf_inp, bse_inp)
        flow.register_work(work)

    return flow
예제 #7
0
def build_bse_metallicW_flow(options):
    """
    Build a flow to solve the BSE with metallic screening.
    Note the value of `mdf_epsinf`.

    Args:
        options: Command line options.

    Return:
        Flow object.
    """
    workdir = options.workdir if (
        options and options.workdir) else "flow_bse_metallicW"
    flow = flowtk.Flow(workdir=workdir)

    # Model dielectric function with metallic screening
    scf_inp, nscf_inp, bse_inp = make_scf_nscf_bse_inputs(ngkpt=(4, 4, 4),
                                                          ecut=6,
                                                          ecuteps=3,
                                                          mdf_epsinf=1.0e+12)

    flow.register_work(flowtk.BseMdfWork(scf_inp, nscf_inp, bse_inp))

    return flow