def test_base(self): """Testing DielectricTensor""" anaddbnc_fname = abidata.ref_file("AlAs_nl_dte_anaddb.nc") phbstnc_fname = abidata.ref_file("AlAs_nl_dte_PHBST.nc") d = DielectricTensorGenerator.from_files(phbstnc_fname, anaddbnc_fname) assert d.eps0.shape == (3, 3) df = d.epsinf.get_dataframe() assert d.epsinf._repr_html_() repr(d); str(d) assert d.to_string(verbose=2) df = d.get_oscillator_dataframe(reim="all", tol=1e-8) df = d.get_oscillator_dataframe(reim="im", tol=1e-8) df = d.get_oscillator_dataframe(reim="re", tol=1e-8) self.assertAlmostEqual(d.tensor_at_frequency(0.001, units='Ha', gamma_ev=0.0)[0, 0], 11.917178540635028) d = DielectricTensorGenerator.from_objects(PhononBands.from_file(phbstnc_fname), AnaddbNcFile.from_file(anaddbnc_fname)) self.assertAlmostEqual(d.tensor_at_frequency(0.001, units='Ha', gamma_ev=0.0)[0, 0], 11.917178540635028) if self.has_matplotlib(): assert d.plot_vs_w(w_min=0.0001, w_max=0.01, num=10, units="Ha", show=False) assert d.plot_vs_w(w_min=0, w_max=None, num=10, units="cm-1", show=False) for comp in ["diag", "all", "diag_av"]: assert d.plot_vs_w(num=10, component=comp, units="cm-1", show=False)
def run_anaddb(self, item, workdir): """ Runs anaddb an reads the outputs """ anaddb_inp, labels_list = self.get_anaddb_input(item) #TODO should this be an input? tm = TaskManager.from_user_config() ddb_path = item["ddb_path"] task = AnaddbTask.temp_shell_task(anaddb_inp, ddb_node=ddb_path, workdir=workdir, manager=tm) # Run the task here. task.start_and_wait(autoparal=False) report = task.get_event_report() if not report.run_completed: raise AnaddbError(task=task, report=report) phbst_file = task.open_phbst() phdos_file = task.open_phdos() ananc_file = AnaddbNcFile.from_file(os.path.join(workdir, "anaddb.nc")) return phbst_file, phdos_file, ananc_file, labels_list
def test_base(self): """Testing DielectricTensor""" anaddbnc_fname = abidata.ref_file("AlAs_nl_dte_anaddb.nc") phbstnc_fname = abidata.ref_file("AlAs_nl_dte_PHBST.nc") d = DielectricTensorGenerator.from_files(phbstnc_fname, anaddbnc_fname) repr(d) str(d) self.assertAlmostEqual( d.tensor_at_frequency(0.001, units='Ha')[0, 0], 11.917178540635028) d = DielectricTensorGenerator.from_objects( PhononBands.from_file(phbstnc_fname), AnaddbNcFile.from_file(anaddbnc_fname)) self.assertAlmostEqual( d.tensor_at_frequency(0.001, units='Ha')[0, 0], 11.917178540635028) if self.has_matplotlib(): assert d.plot_vs_w(w_min=0.0001, w_max=0.01, num=10, units="Ha", show=False) assert d.plot_vs_w(w_min=0, w_max=None, num=10, units="cm-1", show=False) for comp in ["diag", "all", "diag_av"]: assert d.plot_vs_w(num=10, component=comp, units="cm-1", show=False)