def itest_g0w0_flow(fwp, tvars): """Test flow for G0W0 calculations.""" scf, nscf, scr, sig = make_g0w0_inputs(ngkpt=[2, 2, 2], tvars=tvars) flow = abilab.g0w0_flow(fwp.workdir, scf, nscf, scr, sig, manager=fwp.manager) # Will remove output files at run-time. flow.set_garbage_collector() flow.build_and_pickle_dump(abivalidate=True) for task in flow[0]: task.start_and_wait() flow.check_status() flow.show_status() assert all(work.finalized for work in flow) assert flow.all_ok scf_task = flow[0][0] nscf_task = flow[0][1] scr_task = flow[0][2] sig_task = flow[0][3] # Test garbage)_collector # The WFK|SCR file should have been removed because we call set_garbage_collector assert not scf_task.outdir.has_abiext("WFK") assert not nscf_task.outdir.has_abiext("WFK") assert not scr_task.outdir.has_abiext("SCR") assert not scr_task.outdir.has_abiext("SUS") # The sigma task should produce a SIGRES file. sigfile = sig_task.outdir.list_filepaths(wildcard="*SIGRES.nc")[0] assert sigfile with abilab.abiopen(sigfile) as sigres: assert sigres.nsppol == 1 # Test SigmaTask inspect method #if has_matplotlib #sig_task.inspect(show=False) # Test get_results for Sigma and Scr scr_task.get_results() sig_task.get_results() # Test SCR.nc file (this is optional) if scr_task.scr_path: with scr_task.open_scr() as scr: print(scr) assert len(scr.wpts) == 2 assert scr.nwre == 1 and scr.nwim == 1 for iq, qpoint in enumerate(scr.qpoints[:2]): print(qpoint) qpt, iqcheck = scr.reader.find_qpoint_fileindex(qpoint) assert iqcheck == iq em1 = scr.get_em1(qpoint) print(em1)
def itest_g0w0_flow(fwp, tvars): """Test flow for G0W0 calculations.""" scf, nscf, scr, sig = make_g0w0_inputs(ngkpt=[2, 2, 2], tvars=tvars) flow = abilab.g0w0_flow(fwp.workdir, scf, nscf, scr, sig, manager=fwp.manager) # Will remove output files at run-time. flow.set_cleanup_exts() flow.build_and_pickle_dump() for task in flow[0]: task.start_and_wait() flow.check_status() flow.show_status() assert all(work.finalized for work in flow) assert flow.all_ok scf_task = flow[0][0] nscf_task = flow[0][1] scr_task = flow[0][2] sig_task = flow[0][3] # Test set_cleanup_exts # The WFK|SCR file should have been removed because we call set_cleanup_exts assert not scf_task.outdir.has_abiext("WFK") assert not nscf_task.outdir.has_abiext("WFK") assert not scr_task.outdir.has_abiext("SCR") assert not scr_task.outdir.has_abiext("SUS") # The sigma task should produce a SIGRES file. sigfile = sig_task.outdir.list_filepaths(wildcard="*SIGRES.nc")[0] assert sigfile with abilab.abiopen(sigfile) as sigres: assert sigres.nsppol == 1
def si_g0w0_flow(workdir="tmp_si_g0w0"): # Change the value of ngkpt below to perform a GW calculation with a different k-mesh. scf, nscf, scr, sig1, sig2, sig3 = make_inputs(ngkpt=[2,2,2]) # Create the task defining the calculation and run it. manager = abilab.TaskManager.from_user_config() flow = abilab.g0w0_flow(workdir, manager, scf, nscf, scr, [sig1, sig2, sig3]) return flow
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_") # Change the value of ngkpt below to perform a GW calculation with a different k-mesh. scf, nscf, scr, sig1, sig2, sig3 = make_inputs(ngkpt=[2,2,2]) return abilab.g0w0_flow(workdir, scf, nscf, scr, [sig1, sig2, sig3], manager=options.manager)
def itest_g0w0_flow(fwp, tvars): """Test flow for G0W0 calculations.""" scf, nscf, scr, sig = make_g0w0_inputs(ngkpt=[2, 2, 2], tvars=tvars) flow = abilab.g0w0_flow(fwp.workdir, scf, nscf, scr, sig, manager=fwp.manager) # Will remove output files at run-time. flow.set_garbage_collector() flow.build_and_pickle_dump() for task in flow[0]: task.start_and_wait() flow.check_status() flow.show_status() assert all(work.finalized for work in flow) assert flow.all_ok scf_task = flow[0][0] nscf_task = flow[0][1] scr_task = flow[0][2] sig_task = flow[0][3] # Test garbage)_collector # The WFK|SCR file should have been removed because we call set_garbage_collector assert not scf_task.outdir.has_abiext("WFK") assert not nscf_task.outdir.has_abiext("WFK") assert not scr_task.outdir.has_abiext("SCR") assert not scr_task.outdir.has_abiext("SUS") # The sigma task should produce a SIGRES file. sigfile = sig_task.outdir.list_filepaths(wildcard="*SIGRES.nc")[0] assert sigfile with abilab.abiopen(sigfile) as sigres: assert sigres.nsppol == 1 # Test SigmaTask inspect method #if has_matplotlib #sig_task.inspect(show=False) # Test get_results for Sigma and Scr scr_task.get_results() sig_task.get_results()
def itest_g0w0_flow(fwp, tvars): """Test flow for G0W0 calculations.""" scf, nscf, scr, sig = make_g0w0_inputs(ngkpt=[2, 2, 2], tvars=tvars) flow = abilab.g0w0_flow(fwp.workdir, fwp.manager, scf, nscf, scr, sig) flow.build_and_pickle_dump() for task in flow[0]: task.start_and_wait() flow.check_status() flow.show_status() assert all(work.finalized for work in flow) assert flow.all_ok # The sigma task should produce a SIGRES file. sigfile = flow[0][-1].outdir.list_filepaths(wildcard="*SIGRES.nc")[0] assert sigfile # TODO Add more tests sigres = abilab.abiopen(sigfile) assert sigres.nsppol == 1
def gw_flow(workdir): inps = make_input(); manager = abilab.TaskManager.from_user_config() flow = abilab.g0w0_flow(workdir, manager, inps[0], inps[1], inps[2], [inps[3]]) return flow