def test_dojoreport_plots(self): """Testing dojoreport plotting methods""" if not self.has_matplotlib(): raise unittest.SkipTest("Skipping matplotlib tests") oxygen = pdj_data.pseudo("O.psp8") report = oxygen.dojo_report assert report.plot_deltafactor_convergence(xc=oxygen.xc, show=False) assert report.plot_deltafactor_convergence(xc=oxygen.xc, code="VASP", with_soc=False, show=False) assert report.plot_deltafactor_convergence( xc=oxygen.xc, with_soc=True, show=False) is None assert report.plot_deltafactor_eos(show=False) assert report.plot_deltafactor_eos(with_soc=True, show=False) is None assert report.plot_etotal_vs_ecut(show=False) assert report.plot_etotal_vs_ecut(inv_ecut=True, show=False) assert report.plot_etotal_vs_ecut(with_soc=True, show=False) is None assert report.plot_gbrv_convergence(show=False) assert report.plot_gbrv_convergence(with_soc=True, show=False) is None assert report.plot_gbrv_eos('bcc', show=False) assert report.plot_gbrv_eos('fcc', show=False) assert report.plot_gbrv_eos('fcc', with_soc=True, show=False) is None assert report.plot_phonon_convergence(show=False) assert report.plot_phonon_convergence(with_soc=True, show=False) is None assert report.plot_ebands(show=False) assert report.plot_ebands(with_soc=True, show=False) is None
def itest_ghosts_gga_pawxml_flow(fwp, tvars): """Testing the ghosts flow for PAW-XML""" pseudo = pdj_data.pseudo("Si.GGA_PBE-JTH-paw.xml").as_tmpfile(tmpdir=fwp.workdir) assert pseudo is not None print(pseudo) assert pseudo.has_dojo_report assert not pseudo.dojo_report.exceptions flow = abilab.Flow(workdir=fwp.workdir, manager=fwp.manager) factory = GhostsFactory(xc=pseudo.xc) ecut = 10 pawecutdg = 2 * ecut if pseudo.ispaw else None # maxene 200 will make the task restart. work = factory.work_for_pseudo(pseudo, kppa=20, maxene=200, ecut=ecut, pawecutdg=pawecutdg, spin_mode="unpolarized") assert work.dojo_trial == "ghosts" 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 assert not pseudo.dojo_report.exceptions assert pseudo.dojo_report.has_trial("ghosts", ecut=ecut) key = "%.1f" % ecut data = pseudo.dojo_report["ghosts"][key] assert data["dojo_status"] == 0 assert data["ecut"] == ecut ebands = abilab.ElectronBands.from_dict(data["ebands"])
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_lantanides_gga_flow(fwp, tvars): """Testing the ghosts flow for NC+SOC pseudos.""" pseudo = pdj_data.pseudo("Lu-sp.psp8").as_tmpfile(tmpdir=fwp.workdir) assert pseudo is not None print(pseudo) assert pseudo.has_dojo_report assert not pseudo.supports_soc assert not pseudo.dojo_report.exceptions flow = abilab.Flow(workdir=fwp.workdir, manager=fwp.manager) factory = RocksaltRelaxationFactory(xc=pseudo.xc) ecut_list = [33] ngkpt = [1, 1, 1] #pawecutdg = 2 * ecut if pseudo.ispaw else None work = factory.work_for_pseudo(pseudo, ecut_list, pawecutdg=None, ngkpt=ngkpt, include_soc=False) assert work.dojo_trial == "raren_relax" flow.register_work(work) #flow.build_and_pickle_dump(abivalidate=True) assert flow.make_scheduler().start() == 0 flow.check_status(show=True, verbose=1) assert all(work.finalized for work in flow) assert flow.all_ok
def test_oncvpsp_dojo_report(self): """Testing pseudopotentials with dojo report""" h_wdr = pdj_data.pseudo("H-wdr.psp8") # Test DOJO REPORT and md5 assert h_wdr.symbol == "H" assert h_wdr.xc == "PBE" ref_md5 = "8db4531eb441143fdda8032d237d0769" assert h_wdr.compute_md5() == ref_md5 assert h_wdr.md5 == ref_md5 assert "md5" in h_wdr.dojo_report and h_wdr.dojo_report[ "md5"] == ref_md5 repr(h_wdr) str(h_wdr) assert isinstance(h_wdr.as_dict(), dict) # Test DojoReport #report = h_wdr.read_dojo_report() #report = h_wdr.read_dojo_report() assert h_wdr.has_dojo_report report = h_wdr.dojo_report #print(report) assert report.symbol == "H" assert report.element.symbol == "H" assert report["pseudo_type"] == "NC" assert report["version"] == "1.0" assert not report.has_hints # Basic consistency tests. missings = report.find_missing_entries() assert "ghosts" in missings assert not report.has_trial("foo") for trial in report.trials: assert report.has_trial(trial) assert report.has_trial("deltafactor", ecut=32) # Test deltafactor entry. self.assert_almost_equal(report["deltafactor"][32]["etotals"][1], -63.503524424394556) self.assert_almost_equal(report["deltafactor"][32]["volumes"][1], 66.80439150995784) assert not report.has_trial("deltafactor", ecut=-1) assert not report.has_trial("deafactor", ecut="32.00") # Test GBRV entries self.assert_almost_equal(report["gbrv_bcc"][32]["a0"], 1.8069170394120007) self.assert_almost_equal(report["gbrv_fcc"][34]["a0_rel_err"], 0.044806085362549146) # Test Phonon entry self.assert_almost_equal(report["phgamma"][36][-1], 528.9531110978663) # Test API to add ecuts and find missing entries. assert np.all( report.ecuts == [32.0, 34.0, 36.0, 38.0, 40.0, 42.0, 52.0])
def itest_nc_phonons_gamma(fwp, tvars): """Testing the calculation of phonons at Gamma with/without the Asr (NC pseudos).""" #pseudo = pdj_data.pseudo("Si.GGA_PBE-JTH-paw.xml").as_tmpfile(fwp.workdir) pseudo = pdj_data.pseudo("Si.psp8").as_tmpfile(fwp.workdir) assert pseudo is not None assert pseudo.has_dojo_report assert not pseudo.dojo_report.exceptions flow = abilab.Flow(workdir=fwp.workdir, manager=fwp.manager) ecut = 8 pawecutdg = 2 * ecut if pseudo.ispaw else None # This one requires deltafactor! factory = GammaPhononFactory(xc=pseudo.xc) work = factory.work_for_pseudo(pseudo, kppa=20, ecut=ecut, pawecutdg=pawecutdg) flow.register_work(work) flow.build_and_pickle_dump(abivalidate=True) #return 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 assert not pseudo.dojo_report.exceptions assert pseudo.dojo_report.has_trial("phgamma", ecut=ecut)
def test_dojoreport_plots(self): """Testing dojoreport plotting methods""" h_wdr = pdj_data.pseudo("H-wdr.psp8") report = h_wdr.dojo_report assert isinstance(report.plot_deltafactor_convergence(xc=h_wdr.xc, show=False), Fig) assert report.plot_deltafactor_convergence(xc=h_wdr.xc, with_soc=True, show=False) is None assert isinstance(report.plot_deltafactor_eos(show=False), Fig) assert isinstance(report.plot_etotal_vs_ecut(show=False), Fig) assert isinstance(report.plot_gbrv_convergence(show=False), Fig) assert isinstance(report.plot_gbrv_eos('bcc', show=False), Fig) assert isinstance(report.plot_gbrv_eos('fcc', show=False), Fig) assert isinstance(report.plot_phonon_convergence(show=False), Fig)
def test_oncvpsp_dojo_report(self): """Testing pseudopotentials with dojo report""" h_wdr = pdj_data.pseudo("H-wdr.psp8") # Test DOJO REPORT and md5 assert h_wdr.symbol == "H" assert h_wdr.xc == "PBE" ref_md5 = "8db4531eb441143fdda8032d237d0769" assert h_wdr.compute_md5() == ref_md5 assert h_wdr.md5 == ref_md5 assert "md5" in h_wdr.dojo_report and h_wdr.dojo_report["md5"] == ref_md5 repr(h_wdr); str(h_wdr) assert isinstance(h_wdr.as_dict(), dict) # Test DojoReport #report = h_wdr.read_dojo_report() #report = h_wdr.read_dojo_report() assert h_wdr.has_dojo_report report = h_wdr.dojo_report #print(report) assert report.symbol == "H" assert report.element.symbol == "H" assert report["pseudo_type"] == "NC" assert report["version"] == "1.0" assert not report.has_hints # Basic consistency tests. missings = report.find_missing_entries() assert "ghosts" in missings assert not report.has_trial("foo") for trial in report.trials: assert report.has_trial(trial) assert report.has_trial("deltafactor", ecut=32) # Test deltafactor entry. self.assert_almost_equal(report["deltafactor"][32]["etotals"][1], -63.503524424394556) self.assert_almost_equal(report["deltafactor"][32]["volumes"][1], 66.80439150995784) assert not report.has_trial("deltafactor", ecut=-1) assert not report.has_trial("deafactor", ecut="32.00") # Test GBRV entries self.assert_almost_equal(report["gbrv_bcc"][32]["a0"], 1.8069170394120007) self.assert_almost_equal(report["gbrv_fcc"][34]["a0_rel_err"], 0.044806085362549146) # Test Phonon entry self.assert_almost_equal(report["phgamma"][36][-1], 528.9531110978663) # Test API to add ecuts and find missing entries. assert np.all(report.ecuts == [32.0, 34.0, 36.0, 38.0, 40.0, 42.0, 52.0])
def test_nc_silicon_gammaphonon_factory(self): """Testing GammaPhononFactory for NC silicon.""" pseudo = pdj_data.pseudo("Si.psp8") phgamma_factory = GammaPhononFactory(xc=pseudo.xc) flow = abilab.Flow.temporary_flow() work = phgamma_factory.work_for_pseudo(pseudo, ecut=3, pawecutdg=None) flow.register_work(work) flow.build_and_pickle_dump(abivalidate=True) flow.check_status(show=True) flow.rmtree()
def test_dojo_report_base_api(self): """Testing dojo report low-level API.""" #report = DojoReport.from_hints(10, "Si") pseudo = pdj_data.pseudo("Si.psp8") ppgen_hints = { "low": { "ecut": 8.0, "pawecutdg": 8.0 }, "normal": { "ecut": 10.0, "pawecutdg": 10.0 }, "high": { "ecut": 16.0, "pawecutdg": 16.0 }, } report = DojoReport.empty_from_pseudo(pseudo, ppgen_hints, devel=False) repr(repr) str(report) assert report.symbol == "Si" assert report.element.symbol == "Si" assert report.ecuts assert not report.trials for trial in report.ALL_TRIALS: assert not report.has_trial(trial) assert not report.has_hints assert report.check() #prev_ecuts = copy(report.ecuts) #report.add_ecuts(10000) #assert np.all(report.ecuts == prev_ecuts + [10000]) report.add_hints([10, 20, 30]) assert report.has_hints assert report["hints"]["low"]["ecut"] == 10 assert report["hints"]["high"]["ecut"] == 30 assert not report.isvalidated #assert not report.md5 # Test add_entry with self.assertRaises(ValueError): report.add_entry("foobar", ecut=10, entry={}) assert not report.has_trial("deltafactor", ecut=10) report.add_entry("deltafactor", ecut=10, entry={}) repr(report) str(report) assert report.has_trial("deltafactor", ecut=10)
def test_nc_silicon_gbrv_factory(self): """Testing GBRV work for NC silicon.""" pseudo = pdj_data.pseudo("Si.psp8") gbrv_factory = GbrvFactory(xc=pseudo.xc) flow = abilab.Flow.temporary_flow() for struct_type in ("fcc", "bcc"): work = gbrv_factory.relax_and_eos_work(pseudo, struct_type, ecut=3, pawecutdg=None) flow.register_work(work) flow.build_and_pickle_dump(abivalidate=True) flow.check_status(show=True) assert len(flow[0]) == 1 flow.rmtree()
def itest_deltafactor_gga_pawxml(fwp, tvars): """ Testing the flow used for the computation of the deltafactor with PAW and GGA XC. """ # Path of the pseudopotential to test. 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 flow = abilab.Flow(workdir=fwp.workdir, manager=fwp.manager) # Build the workflow for the computation of the deltafactor. # The workflow will produce a pdf file with the equation of state # and a file deltafactor.txt with the final results in the # outdir directory DELTAFACTOR/work_0/outdir. kppa = 20 # this value is for testing purpose (6570 is the correct one) ecut = 2 pawecutdg = ecut * 2 if pseudo.ispaw else None assert not pseudo.dojo_report.has_trial("deltafactor", ecut=ecut) work = DeltaFactory(pseudo.xc).work_for_pseudo(pseudo, kppa=kppa, ecut=ecut, pawecutdg=pawecutdg, include_soc=False, paral_kgb=tvars.paral_kgb) # Register the workflow. flow.register_work(work) flow.build_and_pickle_dump(abivalidate=True) for task in flow[0]: task.start_and_wait() flow.check_status(show=True) assert flow.all_ok assert all(work.finalized for work in flow) results = flow[0].get_results() #20.453 ang^3 88.545 GPa 4.31 20.8658081501 336.680999051 GPa -35.681897152 #delta Equation of State: deltafactor_polyfit #Minimum volume = 20.87 Ang^3 #modulus = 2.10 eV/Ang^3 = 336.68 GPa, b1 = -35.68 #Deltafactor = 15.681 meV assert pseudo.dojo_report.has_trial("deltafactor", ecut=ecut) assert not pseudo.dojo_report.exceptions
def itest_deltafactor_gga_ncsoc(fwp, tvars): """ Testing the flow used for the computation of the deltafactor with GGA and NC+SOC. """ # return # Path of the pseudopotential to test. pseudo = pdj_data.pseudo("Pb-d-3_r.psp8").as_tmpfile(tmpdir=fwp.workdir) assert pseudo.has_dojo_report assert pseudo.supports_soc assert not pseudo.dojo_report.exceptions flow = abilab.Flow(workdir=fwp.workdir, manager=fwp.manager) # Build the workflow for the computation of the deltafactor. # The workflow will produce a pdf file with the equation of state # and a file deltafactor.txt with the final results in the # outdir directory DELTAFACTOR/work_0/outdir. kppa = 40 # this value is for testing purpose (6570 is the correct one) ecut = 8 pawecutdg = ecut * 2 if pseudo.ispaw else None assert pseudo.dojo_report.has_trial("deltafactor", ecut=12) assert not pseudo.dojo_report.has_trial("deltafactor_soc", ecut=ecut) work = DeltaFactory(pseudo.xc).work_for_pseudo(pseudo, kppa=kppa, ecut=ecut, pawecutdg=pawecutdg, include_soc=True, paral_kgb=tvars.paral_kgb) # Register the workflow. flow.register_work(work) flow.build_and_pickle_dump(abivalidate=True) for task in flow[0]: task.start_and_wait() flow.check_status(show=True) assert flow.all_ok assert all(work.finalized for work in flow) results = flow[0].get_results() assert pseudo.dojo_report.has_trial("deltafactor_soc", ecut=ecut) assert not pseudo.dojo_report.exceptions
def itest_deltafactor_gga_pawxml(fwp, tvars): """ Testing the flow used for the computation of the deltafactor with PAW and GGA XC. """ # Path of the pseudopotential to test. 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 flow = abilab.Flow(workdir=fwp.workdir, manager=fwp.manager) # Build the workflow for the computation of the deltafactor. # The workflow will produce a pdf file with the equation of state # and a file deltafactor.txt with the final results in the # outdir directory DELTAFACTOR/work_0/outdir. kppa = 20 # this value is for testing purpose (6570 is the correct one) ecut = 2 pawecutdg = ecut * 2 if pseudo.ispaw else None assert not pseudo.dojo_report.has_trial("deltafactor", ecut=ecut) work = DeltaFactory(pseudo.xc).work_for_pseudo(pseudo, kppa=kppa, ecut=ecut, pawecutdg=pawecutdg, include_soc=False, paral_kgb=tvars.paral_kgb) # Register the workflow. flow.register_work(work) flow.build_and_pickle_dump(abivalidate=True) for task in flow[0]: task.start_and_wait() flow.check_status(show=True) assert flow.all_ok assert all(work.finalized for work in flow) results = flow[0].get_results() #20.453 ang^3 88.545 GPa 4.31 20.8658081501 336.680999051 GPa -35.681897152 #delta Equation of State: deltafactor_polyfit #Minimum volume = 20.87 Ang^3 #modulus = 2.10 eV/Ang^3 = 336.68 GPa, b1 = -35.68 #Deltafactor = 15.681 meV assert pseudo.dojo_report.has_trial("deltafactor", ecut=ecut) assert not pseudo.dojo_report.exceptions
def test_nc_silicon_df(self): """Testing df factory for NC silicon.""" pseudo = pdj_data.pseudo("Si.psp8") df_factory = DeltaFactory(xc=pseudo.xc) extra_abivars = { "mem_test": 0, "fband": 2, "nstep": 100, "paral_kgb": 0, } flow = abilab.Flow.temporary_flow() work = df_factory.work_for_pseudo(pseudo, kppa=1, ecut=2, pawecutdg=None, **extra_abivars) flow.register_work(work) flow.build_and_pickle_dump(abivalidate=True) flow.check_status(show=True) flow.rmtree()
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_ghosts_gga_ncsoc_flow(fwp, tvars): """Testing the ghosts flow for NC+SOC pseudos.""" pseudo = pdj_data.pseudo("Pb-d-3_r.psp8").as_tmpfile(tmpdir=fwp.workdir) assert pseudo is not None print(pseudo) assert pseudo.has_dojo_report assert pseudo.supports_soc assert not pseudo.dojo_report.exceptions flow = abilab.Flow(workdir=fwp.workdir, manager=fwp.manager) factory = GhostsFactory(xc=pseudo.xc) ecut = 4 pawecutdg = 2 * ecut if pseudo.ispaw else None kppa = 20 # this value is for testing purpose work = factory.work_for_pseudo(pseudo, kppa=kppa, maxene=2, ecut=ecut, pawecutdg=pawecutdg, spin_mode="spinor", include_soc=True) assert work.dojo_trial == "ghosts_soc" 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 # Reconstruct ElectronBands from JSON. assert not pseudo.dojo_report.exceptions print(list(pseudo.dojo_report.keys())) assert pseudo.dojo_report.has_trial("ghosts_soc", ecut=ecut) key = "%.1f" % ecut data = pseudo.dojo_report["ghosts_soc"][key] assert data["dojo_status"] == 0 assert data["ecut"] == ecut ebands = abilab.ElectronBands.from_dict(data["ebands"])
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 test_dojo_report_base_api(self): """Testing dojo report low-level API.""" #report = DojoReport.from_hints(10, "Si") pseudo = pdj_data.pseudo("Si.psp8") ppgen_hints = { "low": {"ecut": 8.0, "pawecutdg": 8.0}, "normal": {"ecut": 10.0, "pawecutdg": 10.0}, "high": { "ecut": 16.0, "pawecutdg": 16.0}, } report = DojoReport.empty_from_pseudo(pseudo, ppgen_hints, devel=False) repr(repr); str(report) assert report.symbol == "Si" assert report.element.symbol == "Si" assert report.ecuts assert not report.trials for trial in report.ALL_TRIALS: assert not report.has_trial(trial) assert not report.has_hints assert report.check() #prev_ecuts = copy(report.ecuts) #report.add_ecuts(10000) #assert np.all(report.ecuts == prev_ecuts + [10000]) report.add_hints([10, 20, 30]) assert report.has_hints assert report["hints"]["low"]["ecut"] == 10 assert report["hints"]["high"]["ecut"] == 30 assert not report.isvalidated #assert not report.md5 # Test add_entry with self.assertRaises(ValueError): report.add_entry("foobar", ecut=10, entry={}) assert not report.has_trial("deltafactor", ecut=10) report.add_entry("deltafactor", ecut=10, entry={}) repr(report); str(report) assert report.has_trial("deltafactor", ecut=10)
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 test_dojoreport_plots(self): """Testing dojoreport plotting methods""" if not self.has_matplotlib(): raise unittest.SkipTest("Skipping matplotlib tests") oxygen = pdj_data.pseudo("O.psp8") report = oxygen.dojo_report assert report.plot_deltafactor_convergence(xc=oxygen.xc, show=False) assert report.plot_deltafactor_convergence(xc=oxygen.xc, code="VASP", with_soc=False, show=False) assert report.plot_deltafactor_convergence(xc=oxygen.xc, with_soc=True, show=False) is None assert report.plot_deltafactor_eos(show=False) assert report.plot_deltafactor_eos(with_soc=True, show=False) is None assert report.plot_etotal_vs_ecut(show=False) assert report.plot_etotal_vs_ecut(inv_ecut=True, show=False) assert report.plot_etotal_vs_ecut(with_soc=True, show=False) is None assert report.plot_gbrv_convergence(show=False) assert report.plot_gbrv_convergence(with_soc=True, show=False) is None assert report.plot_gbrv_eos('bcc', show=False) assert report.plot_gbrv_eos('fcc', show=False) assert report.plot_gbrv_eos('fcc', with_soc=True, show=False) is None assert report.plot_phonon_convergence(show=False) assert report.plot_phonon_convergence(with_soc=True, show=False) is None assert report.plot_ebands(show=False) assert report.plot_ebands(with_soc=True, show=False) is None