def itest_gbrv_gga_pawxml_flow(fwp, tvars): """Testing the GBRV flow with GGA and PAW-XML (relaxation + EOS)""" pseudo = pdj_data.pseudo("Si.GGA_PBE-JTH-paw.xml").as_tmpfile(tmpdir=fwp.workdir) assert pseudo is not None assert pseudo.has_dojo_report assert not pseudo.dojo_report.exceptions factory = GbrvFactory(pseudo.xc) ecut = 4 pawecutdg = 2 * ecut if pseudo.ispaw else None flow = abilab.Flow(workdir=fwp.workdir, manager=fwp.manager) struct_types = ["fcc",] # "bcc"] assert not pseudo.dojo_report.has_trial("gbrv_fcc", ecut=ecut) for struct_type in struct_types: work = factory.relax_and_eos_work(pseudo, struct_type, ecut, pawecutdg=pawecutdg, paral_kgb=tvars.paral_kgb) flow.register_work(work) flow.build_and_pickle_dump(abivalidate=True) fwp.scheduler.add_flow(flow) assert fwp.scheduler.start() == 0 assert not fwp.scheduler.exceptions flow.check_status(show=True) assert all(work.finalized for work in flow) assert flow.all_ok print(pseudo.dojo_report) assert pseudo.dojo_report.has_trial("gbrv_fcc", ecut=ecut) assert not pseudo.dojo_report.exceptions
def add_pseudo(self, pseudo): """Add a pseudo to the Dojo.""" pseudo = Pseudo.as_pseudo(pseudo) dojo_report = pseudo.dojo_report # Construct the flow flow_workdir = os.path.join(self.workdir, pseudo.basename) flow = Flow(workdir=flow_workdir, manager=self.manager) # Construct the flow according to the info found in the dojo report. if not pseudo.has_hints: # We need the hints in order to run the other tests factory = PPConvergenceFactory() ecut_work = factory.work_for_pseudo(pseudo, ecut_slice=slice(4, None, 1), nlaunch=4) flow.register_work(ecut_work) else: # Hints are available --> construct a flow for the different trials. dojo_trial = "deltafactor" if dojo_trial in self.trials: # Do we have this element in the deltafactor database? #if not df_database().has_symbol(pseudo.symbol): # logger.warning("Cannot find %s in deltafactor database." % pseudo.symbol) delta_factory = DeltaFactory() kppa = 6750 # 6750 is the value used in the deltafactor code. kppa = 1 for accuracy in self.accuracies: if dojo_report.has_trial(dojo_trial, accuracy): continue ecut, pawecutdg = self._ecut_pawecutdg(pseudo, accuracy) work = delta_factory.work_for_pseudo(pseudo, accuracy=accuracy, kppa=kppa, ecut=ecut, pawecutdg=pawecutdg) logger.info("Adding work for %s with accuracy %s" % (dojo_trial, accuracy)) work.set_dojo_accuracy(accuracy) flow.register_work(work) # Test if GBRV tests are wanted. gbrv_structs = [s.split("_")[1] for s in self.trials if s.startswith("gbrv_")] if gbrv_structs: gbrv_factory = GbrvFactory() for struct_type in gbrv_structs: dojo_trial = "gbrv_" + struct_type for accuracy in self.accuracies: if dojo_report.has_trial(dojo_trial, accuracy): continue ecut, pawecutdg = self._ecut_pawecutdg(pseudo, accuracy) work = gbrv_factory.relax_and_eos_work(pseudo, struct_type, ecut=ecut, pawecutdg=pawecutdg) logger.info("Adding work for %s with accuracy %s" % (dojo_trial, accuracy)) work.set_dojo_accuracy(accuracy) flow.register_work(work) flow.allocate() self.pseudos.append(pseudo) self.flows.append(flow)
def itest_gbrv_flow(fwp, tvars): """The the GBRV flow: relaxation + EOS computation.""" factory = GbrvFactory() #pseudo = "si_pbe_v1_abinit.paw" pseudo = abidata.pseudo("Si.GGA_PBE-JTH-paw.xml") ecut = 2 pawecutdg = 2 * ecut if pseudo.ispaw else None flow = abilab.Flow(workdir=fwp.workdir, manager=fwp.manager, pickle_protocol=0) struct_types = ["fcc"] #, "bcc"] for struct_type in struct_types: work = factory.relax_and_eos_work(pseudo, struct_type, ecut, pawecutdg=pawecutdg, paral_kgb=tvars.paral_kgb) flow.register_work(work) flow.allocate() flow.build_and_pickle_dump() fwp.scheduler.add_flow(flow) assert fwp.scheduler.start() == 0 assert not fwp.scheduler.exceptions #work = flow[0] #t0 = work[0] #assert len(work) == 1 #t0.start_and_wait() #flow.check_status() # At this point on_all_ok is called. #assert t0.status == t0.S_OK #assert len(flow) == 2 #assert len(flow[1]) == 9 #assert not flow.all_ok #for task in flow[1]: # task.start_and_wait() flow.check_status() flow.show_status() assert all(work.finalized for work in flow) assert flow.all_ok
def itest_gbrv_flow(fwp, tvars): """Testing the GBRV flow: relaxation + EOS computation.""" factory = GbrvFactory() #pseudo = "si_pbe_v1_abinit.paw" pseudo = abidata.pseudo("Si.GGA_PBE-JTH-paw.xml").as_tmpfile() ecut = 4 pawecutdg = 2 * ecut if pseudo.ispaw else None flow = abilab.Flow(workdir=fwp.workdir, manager=fwp.manager) struct_types = ["fcc"] #, "bcc"] for struct_type in struct_types: work = factory.relax_and_eos_work(pseudo, struct_type, ecut, pawecutdg=pawecutdg, paral_kgb=tvars.paral_kgb) flow.register_work(work) flow.allocate() flow.build_and_pickle_dump() fwp.scheduler.add_flow(flow) assert fwp.scheduler.start() == 0 assert not fwp.scheduler.exceptions #work = flow[0] #t0 = work[0] #assert len(work) == 1 #t0.start_and_wait() #flow.check_status() # At this point on_all_ok is called. #assert t0.status == t0.S_OK #assert len(flow) == 2 #assert len(flow[1]) == 9 #assert not flow.all_ok #for task in flow[1]: # task.start_and_wait() flow.check_status() flow.show_status() assert all(work.finalized for work in flow) assert flow.all_ok
def itest_gbrv_gga_ncsoc_flow(fwp, tvars): """Testing the GBRV flow with GGA and ONCVPSP+SO (relaxation + EOS)""" #return pseudo = pdj_data.pseudo("Pb-d-3_r.psp8").as_tmpfile(tmpdir=fwp.workdir) assert pseudo is not None assert pseudo.supports_soc assert not pseudo.dojo_report.exceptions factory = GbrvFactory(pseudo.xc) ecut = 2 #ecut = 6 pawecutdg = 2 * ecut if pseudo.ispaw else None flow = abilab.Flow(workdir=fwp.workdir, manager=fwp.manager) struct_types = [ "fcc", ] # "bcc"] assert pseudo.dojo_report.has_trial("gbrv_fcc", ecut=4) assert not pseudo.dojo_report.has_trial("gbrv_fcc", ecut=ecut) for struct_type in struct_types: work = factory.relax_and_eos_work(pseudo, struct_type, ecut, pawecutdg=pawecutdg, include_soc=True, paral_kgb=tvars.paral_kgb) flow.register_work(work) flow.build_and_pickle_dump(abivalidate=True) fwp.scheduler.add_flow(flow) assert fwp.scheduler.start() == 0 assert not fwp.scheduler.exceptions flow.check_status(show=True) assert all(work.finalized for work in flow) assert flow.all_ok print(pseudo.dojo_report) assert pseudo.dojo_report.has_trial("gbrv_fcc_soc", ecut=ecut) assert not pseudo.dojo_report.exceptions
def itest_gbrv_gga_pawxml_flow(fwp, tvars): """Testing the GBRV flow with GGA and PAW-XML (relaxation + EOS)""" pseudo = pdj_data.pseudo("Si.GGA_PBE-JTH-paw.xml").as_tmpfile( tmpdir=fwp.workdir) assert pseudo is not None assert pseudo.has_dojo_report assert not pseudo.dojo_report.exceptions factory = GbrvFactory(pseudo.xc) ecut = 4 pawecutdg = 2 * ecut if pseudo.ispaw else None flow = abilab.Flow(workdir=fwp.workdir, manager=fwp.manager) struct_types = [ "fcc", ] # "bcc"] assert not pseudo.dojo_report.has_trial("gbrv_fcc", ecut=ecut) for struct_type in struct_types: work = factory.relax_and_eos_work(pseudo, struct_type, ecut, pawecutdg=pawecutdg, paral_kgb=tvars.paral_kgb) flow.register_work(work) flow.build_and_pickle_dump(abivalidate=True) fwp.scheduler.add_flow(flow) assert fwp.scheduler.start() == 0 assert not fwp.scheduler.exceptions flow.check_status(show=True) assert all(work.finalized for work in flow) assert flow.all_ok print(pseudo.dojo_report) assert pseudo.dojo_report.has_trial("gbrv_fcc", ecut=ecut) assert not pseudo.dojo_report.exceptions
def itest_gbrv_gga_ncsoc_flow(fwp, tvars): """Testing the GBRV flow with GGA and ONCVPSP+SO (relaxation + EOS)""" #return pseudo = pdj_data.pseudo("Pb-d-3_r.psp8").as_tmpfile(tmpdir=fwp.workdir) assert pseudo is not None assert pseudo.supports_soc assert not pseudo.dojo_report.exceptions factory = GbrvFactory(pseudo.xc) ecut = 2 #ecut = 6 pawecutdg = 2 * ecut if pseudo.ispaw else None flow = abilab.Flow(workdir=fwp.workdir, manager=fwp.manager) struct_types = ["fcc",] # "bcc"] assert pseudo.dojo_report.has_trial("gbrv_fcc", ecut=4) assert not pseudo.dojo_report.has_trial("gbrv_fcc", ecut=ecut) for struct_type in struct_types: work = factory.relax_and_eos_work(pseudo, struct_type, ecut, pawecutdg=pawecutdg, include_soc=True, paral_kgb=tvars.paral_kgb) flow.register_work(work) flow.build_and_pickle_dump(abivalidate=True) fwp.scheduler.add_flow(flow) assert fwp.scheduler.start() == 0 assert not fwp.scheduler.exceptions flow.check_status(show=True) assert all(work.finalized for work in flow) assert flow.all_ok print(pseudo.dojo_report) assert pseudo.dojo_report.has_trial("gbrv_fcc_soc", ecut=ecut) assert not pseudo.dojo_report.exceptions
def build_flow(pseudo, options): """Build the flow, returns None if no calculation must be performed.""" pseudo = Pseudo.as_pseudo(pseudo) workdir = pseudo.basename + "_DOJO" if os.path.exists(workdir): warn("Directory %s already exists" % workdir) return None #raise ValueError("%s exists" % workdir) flow = abilab.Flow(workdir=workdir, manager=options.manager) extra_abivars = { "mem_test": 0, "fband": 2, "nstep": 100, "paral_kgb": options.paral_kgb #"nsym": 1, } report = pseudo.read_dojo_report() #print(report) #hints = report["hints"] # Build ecut mesh. try: ppgen_ecut = int(report["ppgen_hints"]["high"]["ecut"]) ecut_list = copy.copy(report["ecuts"]) except KeyError: print('New pseudo without report from the generator, the convergence study is started from 16H') report["ppgen_hints"] = {} report["ppgen_hints"]["high"] = {} report["ppgen_hints"]["high"]["ecut"] = 16.0 report["ecuts"] = [16.0, 20.0, 24.0] pseudo.write_dojo_report(report) ppgen_ecut = int(report["ppgen_hints"]["high"]["ecut"]) ecut_list = copy.copy(report["ecuts"]) #if 'extend' in options: # next_ecut = max(ecut_list) + 2 # ecut_list.append(next_ecut) #if 'new-ecut' in options: # ecut_list.append(options['new-ecut']) add_ecuts = False if add_ecuts: #dense_right = np.linspace(ppgen_ecut, ppgen_ecut + 10, num=6) #dense_left = np.linspace(ppgen_ecut-8, ppgen_ecut, num=4, endpoint=False) #coarse_high = np.linspace(ppgen_ecut + 15, ppgen_ecut + 40, num=4) dense_right = np.arange(ppgen_ecut, ppgen_ecut + 6*2, step=2) dense_left = np.arange(max(ppgen_ecut-6, 2), ppgen_ecut, step=2) coarse_high = np.arange(ppgen_ecut + 15, ppgen_ecut + 35, step=5) ecut_list = list(dense_left) + list(dense_right) + list(coarse_high) # Computation of the deltafactor. if "df" in options.trials: #FIXME #factory = DeltaFactory(xc=pseudo.xc) if os.path.isfile('LDA'): factory = DeltaFactory(xc='LDA') else: factory = DeltaFactory() for ecut in ecut_list: if "deltafactor" in report and ecut in report["deltafactor"].keys(): continue pawecutdg = 2 * ecut if pseudo.ispaw else None # Build and register the workflow. work = factory.work_for_pseudo(pseudo, kppa=6750, ecut=ecut, pawecutdg=pawecutdg, **extra_abivars) flow.register_work(work, workdir='WDF' + str(ecut)) # GBRV tests. if "gbrv" in options.trials: gbrv_factory = GbrvFactory() gbrv_structs = ("fcc", "bcc") for struct_type in gbrv_structs: dojo_trial = "gbrv_" + struct_type for ecut in ecut_list: if dojo_trial in report and ecut in report[dojo_trial].keys(): continue pawecutdg = 2 * ecut if pseudo.ispaw else None # FIXME: we use ntime=3, because structure relaxations go bananas after the third step. work = gbrv_factory.relax_and_eos_work(pseudo, struct_type, ecut=ecut, ntime=5, pawecutdg=pawecutdg, **extra_abivars) flow.register_work(work, workdir="GBRV_" + struct_type + str(ecut)) # PHONON test if "phonon" in options.trials: phonon_factory = DFPTPhononFactory() for ecut in ecut_list: str_ecut = '%.1f' % ecut if "phonon" in report and str_ecut in report["phonon"].keys(): continue kppa = 1000 pawecutdg = 2 * ecut if pseudo.ispaw else None work = phonon_factory.work_for_pseudo(pseudo, accuracy="high", kppa=kppa, ecut=ecut, pawecutdg=pawecutdg, tolwfr=1.e-20, smearing="fermi_dirac:0.0005", qpt=[0,0,0], mem_test=0) if work is not None: flow.register_work(work, workdir='GammaPhononsAt'+str(ecut)) else: warn('cannot create GammaPhononsAt' + str(ecut) + ' work, factory returned None') # PHONON WihtOut Asr test if "phwoa" in options.trials: phonon_factory = DFPTPhononFactory() for ecut in [ecut_list[0], ecut_list[-1]]: str_ecut = '%.1f' % ecut if "phwoa" in report and str_ecut in report["phwoa"].keys(): continue print('phwoa') kppa = 1000 pawecutdg = 2 * ecut if pseudo.ispaw else None work = phonon_factory.work_for_pseudo(pseudo, accuracy="high", kppa=kppa, ecut=ecut, pawecutdg=pawecutdg, tolwfr=1.e-20, smearing="fermi_dirac:0.0005", qpt=[0,0,0], rfasr=0) if work is not None: flow.register_work(work, workdir='GammaPhononsAt'+str(ecut)+'WOA') else: warn('cannot create GammaPhononsAt' + str(ecut) + 'WOA work, factory returned None') if len(flow) > 0: return flow.allocate() else: # Empty flow since all trials have been already performed. return None
def build_flow(pseudo, options): """ Build the flow, returns None if the test has been already performed. """ print(pseudo) if not pseudo.has_dojo_report: raise ValueError("Cannot find dojo_report") if options.soc and not pseudo.supports_soc: raise TypeError( "SOC is on but pseudo does not support spin-orbit coupling") if not options.soc and pseudo.supports_soc and pseudo.path.endswith( "psp8"): cprint( "[STRANGE]: Your psp8 pseudo supports SOC but options.soc is off", "magenta") report = pseudo.dojo_report if options.verbose > 1: print(report) workdir = pseudo.basename + "_DOJO" if options.workdir is None else options.workdir if os.path.exists(workdir): cprint("Directory %s already exists" % workdir, "red") return None flow = abilab.Flow(workdir=workdir, manager=options.manager) extra_abivars = { "mem_test": 0, #"nstep": 100, "paral_kgb": options.paral_kgb } #flow.walknset_vars(extra_abivars) # Build ecut mesh. try: ppgen_ecut = int(report["ppgen_hints"]["high"]["ecut"]) ecut_list = copy.copy(report["ecuts"]) except KeyError: cprint( 'New pseudo without report from the generator, the convergence study is started from 16H', "yellow") #raise NotImplementedError() # TODO #report = DojoReport.from_pseudo(pseudo) report["ppgen_hints"] = {} report["ppgen_hints"]["high"] = {} report["ppgen_hints"]["high"]["ecut"] = 16.0 report["ecuts"] = [16.0, 20.0, 24.0] report.json_write(pseudo.djrepo_path) #pseudo.write_dojo_report(report) ppgen_ecut = int(report["ppgen_hints"]["high"]["ecut"]) ecut_list = copy.copy(report["ecuts"]) try: ecut_hint = int(report["hints"]["normal"]["ecut"]) except KeyError: try: ecut_hint = int(report["ppgen_hints"]["normal"]["ecut"]) except KeyError: ecut_hint = ppgen_ecut #if options.extend: # next_ecut = max(ecut_list) + 2 # ecut_list.append(next_ecut) #if options.new_ecut: # ecut_list.append(options['new-ecut']) add_ecuts = False if add_ecuts: #dense_right = np.linspace(ppgen_ecut, ppgen_ecut + 10, num=6) #dense_left = np.linspace(ppgen_ecut-8, ppgen_ecut, num=4, endpoint=False) #coarse_high = np.linspace(ppgen_ecut + 15, ppgen_ecut + 40, num=4) dense_right = np.arange(ppgen_ecut, ppgen_ecut + 6 * 2, step=2) dense_left = np.arange(max(ppgen_ecut - 6, 2), ppgen_ecut, step=2) coarse_high = np.arange(ppgen_ecut + 15, ppgen_ecut + 35, step=5) ecut_list = list(dense_left) + list(dense_right) + list(coarse_high) # Computation of the deltafactor. if "df" in options.trials or "deltafactor" in options.trials: factory = DeltaFactory(xc=pseudo.xc) dojo_trial = "deltafactor" if not options.soc else "deltafactor_soc" #ecut_list = [75] for ecut in ecut_list: if report.has_trial(dojo_trial, ecut=ecut): cprint( "[%s]: ignoring ecut=%s because it's already in the DOJO_REPORT" % (dojo_trial, ecut), "magenta") continue # Build and register the work. pawecutdg = 2 * ecut if pseudo.ispaw else None work = factory.work_for_pseudo(pseudo, kppa=6750, ecut=ecut, pawecutdg=pawecutdg, include_soc=options.soc, **extra_abivars) flow.register_work(work, workdir='WDF' + str(ecut)) # GBRV tests. if "gbrv" in options.trials: gbrv_factory = GbrvFactory(xc=pseudo.xc) gbrv_structs = ("fcc", "bcc") for struct_type in gbrv_structs: dojo_trial = "gbrv_" + struct_type if options.soc: dojo_trial += "_soc" for ecut in ecut_list: if report.has_trial(dojo_trial, ecut=ecut): cprint( "[gbrv]: ignoring ecut=%s because it's already in the DOJO_REPORT" % ecut, "magenta") continue # Build and register the work. pawecutdg = 2 * ecut if pseudo.ispaw else None work = gbrv_factory.relax_and_eos_work(pseudo, struct_type, ecut=ecut, pawecutdg=pawecutdg, include_soc=options.soc, ntime=50, **extra_abivars) flow.register_work(work, workdir="GBRV_" + struct_type + str(ecut)) # GHOSTS test if "ghosts" in options.trials: assert not options.soc dojo_trial = "ghosts" if not options.soc else "ghosts_soc" ghosts_factory = GhostsFactory(pseudo.xc) ecut = int(report["ppgen_hints"]["high"]["ecut"]) pawecutdg = None if not pseudo.ispaw else int( report["ppgen_hints"]["high"]["pawecutdg"]) #str_ecut = '%.1f' % ecut #print(report["ghosts"].pop(ecut, None)) if report.has_trial(dojo_trial, ecut=ecut): cprint( "[%s]: ignoring ecut=%s because it's already in the DOJO_REPORT" % (dojo_trial, ecut), "magenta") else: # Build and register the work. work = ghosts_factory.work_for_pseudo(pseudo, kppa=2000, maxene=250, ecut=ecut, pawecutdg=pawecutdg, **extra_abivars) if work is not None: flow.register_work(work, workdir='GhostsAt' + str(ecut)) else: cprint( 'Cannot create GhostsAt%s work, factory returned None' % str(ecut), "magenta") # phonons at gamma test. if "phgamma" in options.trials: phg_factory = GammaPhononFactory(pseudo.xc) dojo_trial = "phgamma" if not options.soc else "phgamma_soc" for ecut in ecut_list: if report.has_trial(dojo_trial, ecut=ecut): cprint( "[%s]: ignoring ecut=%s because it's already in the DOJO_REPORT" % (dojo_trial, ecut), "magenta") continue # Build and register the work. pawecutdg = 2 * ecut if pseudo.ispaw else None work = phg_factory.work_for_pseudo(pseudo, kppa=1000, ecut=ecut, pawecutdg=pawecutdg, include_soc=options.soc) if work is not None: flow.register_work(work) else: cprint( 'Cannot create phgamma work for ecut %s, factory returned None' % str(ecut), "magenta") if "raren_relax" in options.trials: nirer_factory = RocksaltRelaxationFactory(pseudo.xc) dojo_trial = "raren_relax" if not options.soc else "raren_relax_soc" l = [] for ecut in ecut_list: if report.has_trial(dojo_trial, ecut=ecut): cprint( "[%s]: ignoring ecut=%s because it's already in the DOJO_REPORT" % (dojo_trial, ecut), "magenta") continue l.append(ecut) ecut_list = l # Build and register the work. pawecutdg = 2 * ecut if pseudo.ispaw else None work = nirer_factory.work_for_pseudo(pseudo, ecut_list, pawecutdg=pawecutdg, include_soc=options.soc) if work is not None: flow.register_work(work) else: cprint('Cannot create nirer work, factory returned None', "magenta") if len(flow) > 0: return flow.allocate() else: # Empty flow since all trials have been already performed. return None
def build_flow(pseudo, options): """ Build the flow, returns None if the test has been already performed. """ print(pseudo) if not pseudo.has_dojo_report: raise ValueError("Cannot find dojo_report") if options.soc and not pseudo.supports_soc: raise TypeError("SOC is on but pseudo does not support spin-orbit coupling") if not options.soc and pseudo.supports_soc and pseudo.path.endswith("psp8"): cprint("[STRANGE]: Your psp8 pseudo supports SOC but options.soc is off", "magenta") report = pseudo.dojo_report if options.verbose > 1: print(report) workdir = pseudo.basename + "_DOJO" if options.workdir is None else options.workdir if os.path.exists(workdir): cprint("Directory %s already exists" % workdir, "red") return None flow = abilab.Flow(workdir=workdir, manager=options.manager) extra_abivars = { "mem_test": 0, #"nstep": 100, "paral_kgb": options.paral_kgb } #flow.walknset_vars(extra_abivars) # Build ecut mesh. try: ppgen_ecut = int(report["ppgen_hints"]["high"]["ecut"]) ecut_list = copy.copy(report["ecuts"]) except KeyError: cprint('New pseudo without report from the generator, the convergence study is started from 16H', "yellow") #raise NotImplementedError() # TODO #report = DojoReport.from_pseudo(pseudo) report["ppgen_hints"] = {} report["ppgen_hints"]["high"] = {} report["ppgen_hints"]["high"]["ecut"] = 16.0 report["ecuts"] = [16.0, 20.0, 24.0] report.json_write(pseudo.djrepo_path) #pseudo.write_dojo_report(report) ppgen_ecut = int(report["ppgen_hints"]["high"]["ecut"]) ecut_list = copy.copy(report["ecuts"]) try: ecut_hint = int(report["hints"]["normal"]["ecut"]) except KeyError: try: ecut_hint = int(report["ppgen_hints"]["normal"]["ecut"]) except KeyError: ecut_hint = ppgen_ecut #if options.extend: # next_ecut = max(ecut_list) + 2 # ecut_list.append(next_ecut) #if options.new_ecut: # ecut_list.append(options['new-ecut']) add_ecuts = False if add_ecuts: #dense_right = np.linspace(ppgen_ecut, ppgen_ecut + 10, num=6) #dense_left = np.linspace(ppgen_ecut-8, ppgen_ecut, num=4, endpoint=False) #coarse_high = np.linspace(ppgen_ecut + 15, ppgen_ecut + 40, num=4) dense_right = np.arange(ppgen_ecut, ppgen_ecut + 6*2, step=2) dense_left = np.arange(max(ppgen_ecut-6, 2), ppgen_ecut, step=2) coarse_high = np.arange(ppgen_ecut + 15, ppgen_ecut + 35, step=5) ecut_list = list(dense_left) + list(dense_right) + list(coarse_high) # Computation of the deltafactor. if "df" in options.trials or "deltafactor" in options.trials: factory = DeltaFactory(xc=pseudo.xc) dojo_trial = "deltafactor" if not options.soc else "deltafactor_soc" #ecut_list = [75] for ecut in ecut_list: if report.has_trial(dojo_trial, ecut=ecut): cprint("[%s]: ignoring ecut=%s because it's already in the DOJO_REPORT" % (dojo_trial, ecut), "magenta") continue # Build and register the work. pawecutdg = 2 * ecut if pseudo.ispaw else None work = factory.work_for_pseudo(pseudo, kppa=6750, ecut=ecut, pawecutdg=pawecutdg, include_soc=options.soc, **extra_abivars) flow.register_work(work, workdir='WDF' + str(ecut)) # GBRV tests. if "gbrv" in options.trials: gbrv_factory = GbrvFactory(xc=pseudo.xc) gbrv_structs = ("fcc", "bcc") for struct_type in gbrv_structs: dojo_trial = "gbrv_" + struct_type if options.soc: dojo_trial += "_soc" for ecut in ecut_list: if report.has_trial(dojo_trial, ecut=ecut): cprint("[gbrv]: ignoring ecut=%s because it's already in the DOJO_REPORT" % ecut, "magenta") continue # Build and register the work. pawecutdg = 2 * ecut if pseudo.ispaw else None work = gbrv_factory.relax_and_eos_work(pseudo, struct_type, ecut=ecut, pawecutdg=pawecutdg, include_soc=options.soc, ntime=50, **extra_abivars) flow.register_work(work, workdir="GBRV_" + struct_type + str(ecut)) # GHOSTS test if "ghosts" in options.trials: assert not options.soc dojo_trial = "ghosts" if not options.soc else "ghosts_soc" ghosts_factory = GhostsFactory(pseudo.xc) ecut = int(report["ppgen_hints"]["high"]["ecut"]) pawecutdg = None if not pseudo.ispaw else int(report["ppgen_hints"]["high"]["pawecutdg"]) #str_ecut = '%.1f' % ecut #print(report["ghosts"].pop(ecut, None)) if report.has_trial(dojo_trial, ecut=ecut): cprint("[%s]: ignoring ecut=%s because it's already in the DOJO_REPORT" % (dojo_trial, ecut), "magenta") else: # Build and register the work. work = ghosts_factory.work_for_pseudo(pseudo, kppa=2000, maxene=250, ecut=ecut, pawecutdg=pawecutdg, **extra_abivars) if work is not None: flow.register_work(work, workdir='GhostsAt' + str(ecut)) else: cprint('Cannot create GhostsAt%s work, factory returned None' % str(ecut), "magenta") # phonons at gamma test. if "phgamma" in options.trials: phg_factory = GammaPhononFactory(pseudo.xc) dojo_trial = "phgamma" if not options.soc else "phgamma_soc" for ecut in ecut_list: if report.has_trial(dojo_trial, ecut=ecut): cprint("[%s]: ignoring ecut=%s because it's already in the DOJO_REPORT" % (dojo_trial, ecut), "magenta") continue # Build and register the work. pawecutdg = 2 * ecut if pseudo.ispaw else None work = phg_factory.work_for_pseudo(pseudo, kppa=1000, ecut=ecut, pawecutdg=pawecutdg, include_soc=options.soc) if work is not None: flow.register_work(work) else: cprint('Cannot create phgamma work for ecut %s, factory returned None' % str(ecut), "magenta") if len(flow) > 0: return flow.allocate() else: # Empty flow since all trials have been already performed. return None