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: options.workdir = os.path.basename(sys.argv[0]).replace( ".py", "").replace("run_", "flow_") structure = abidata.structure_from_ucell("MgB2") # Get pseudos from a table. table = abilab.PseudoTable(abidata.pseudos("12mg.pspnc", "5b.pspnc")) pseudos = table.get_pseudos_for_structure(structure) flow = flowtk.Flow(workdir=options.workdir) # Build work of GS task. Each gs_task uses different (ngkpt, tsmear) values # and represent the starting point of the phonon works. scf_work = flowtk.Work() ngkpt_list = [[4, 4, 4], [8, 8, 8]] #, [12, 12, 12]] tsmear_list = [0.01, 0.02] # , 0.04] for ngkpt in ngkpt_list: for tsmear in tsmear_list: scf_input = make_scf_input(structure, ngkpt, tsmear, pseudos) scf_work.register_scf_task(scf_input) flow.register_work(scf_work) # This call uses the information reported in the GS task to # compute all the independent atomic perturbations corresponding to a [2, 2, 2] q-mesh. # For each GS task, construct a phonon work that will inherit (ngkpt, tsmear) from scf_task. for scf_task in scf_work: ph_work = flowtk.PhononWork.from_scf_task(scf_task, qpoints=[2, 2, 2], is_ngqpt=True) flow.register_work(ph_work) return flow.allocate(use_smartio=True)
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_") #pseudos = abidata.pseudos("12mg.pspnc", "5b.pspnc") structure = abidata.structure_from_ucell("MgB2") # Get pseudos from a table. table = abilab.PseudoTable(abidata.pseudos("12mg.pspnc", "5b.pspnc")) pseudos = table.get_pseudos_for_structure(structure) nval = structure.num_valence_electrons(pseudos) #print(nval) inputs = make_scf_nscf_inputs(structure, pseudos) scf_input, nscf_input, dos_inputs = inputs[0], inputs[1], inputs[2:] #print(scf_input.pseudos) return abilab.bandstructure_flow(workdir, scf_input, nscf_input, dos_inputs=dos_inputs, manager=options.manager)
def make_ecut_flow(structure_file=None, ecut_list = (10, 12, 14, 16, 18)): """ Build and return a `Flow` to perform a convergence study wrt to ecut. Args: structure_file: (optional) file containing the crystalline structure. If None, crystalline silicon structure. ecut_list: List of cutoff energies to be investigated. """ # Define the structure and add the necessary pseudos: if structure_file is None: multi = abilab.MultiDataset(structure=abidata.cif_file("si.cif"), pseudos=abidata.pseudos("14si.pspnc"), ndtset=len(ecut_list)) workdir = "flow_Si_ecut_convergence" else: structure = abilab.Structure.from_file(structure_file) pseudos = abilab.PseudoTable() ## todo fix this multi = abilab.MultiDataset(structure, pseudos=pseudos, ndtset=len(ecut_list)) workdir = "flow_" + structure.composition.reduced_formula + "_ecut_convergence" # Add mnemonics to the input files. multi.set_mnemonics(True) # Global variables multi.set_vars(tolvrs=1e-9) multi.set_kmesh(ngkpt=[4, 4, 4], shiftk=[0, 0, 0]) # Here we set the value of ecut used by the i-th task. for i, ecut in enumerate(ecut_list): multi[i].set_vars(ecut=ecut) return abilab.Flow.from_inputs(workdir=workdir, inputs=multi.split_datasets())
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: options.workdir = os.path.basename(sys.argv[0]).replace( ".py", "").replace("run_", "flow_") # Init structure from internal database. structure = abidata.structure_from_ucell("MgB2") # Our pseudopotentials. pseudos = abilab.PseudoTable(["Mg-low.psp8", "B.psp8"]) flow = flowtk.Flow(workdir=options.workdir) # Build work of GS task. Each gs_task uses different (ngkpt, tsmear) values # and represent the starting point of the phonon works. ngkpt = [12, 12, 12] tsmear = 0.02 scf_input, nscf_input = make_scf_nscf_inputs(structure, ngkpt, tsmear, pseudos) gs_work = flowtk.Work() scf_task = gs_work.register_scf_task(scf_input) nscf_task = gs_work.register_nscf_task(nscf_input, deps={scf_task: "DEN"}) flow.register_work(gs_work) # This call uses the information reported in the GS task to # compute all the independent atomic perturbations corresponding to a [6, 6, 6] q-mesh. ph_work = flowtk.PhononWork.from_scf_task(scf_task, qpoints=[4, 4, 4], is_ngqpt=True) flow.register_work(ph_work) return flow.allocate(use_smartio=True)
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: options.workdir = os.path.basename(__file__).replace(".py", "").replace("run_", "flow_") structure = abidata.structure_from_ucell("MgB2") # Get pseudos from a table. table = abilab.PseudoTable(abidata.pseudos("12mg.pspnc", "5b.pspnc")) pseudos = table.get_pseudos_for_structure(structure) nval = structure.num_valence_electrons(pseudos) #print(nval) flow = flowtk.Flow(workdir=options.workdir) scf_work = flowtk.Work() ngkpt_list = [[4, 4, 4], [8, 8, 8], [12, 12, 12]] tsmear_list = [0.01, 0.02, 0.04] for ngkpt in ngkpt_list: for tsmear in tsmear_list: scf_input = make_scf_input(structure, ngkpt, tsmear, pseudos) scf_work.register_scf_task(scf_input) flow.register_work(scf_work) # This call uses the information reported in the GS task to # compute all the independent atomic perturbations corresponding to a [4, 4, 4] q-mesh. for scf_task in scf_work: ph_work = flowtk.PhononWork.from_scf_task(scf_task, qpoints=[4, 4, 4], is_ngqpt=True) flow.register_work(ph_work) return flow.allocate(use_smartio=True)