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 = flowtk.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 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_") # 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 flowtk.g0w0_flow(options.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 = flowtk.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(show=True) 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: sigres.to_string(verbose=2) 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: scr.to_string(verbose=2) 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)