Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FIX: Reporting when only PDOS is calculated #207

Merged
merged 1 commit into from
Feb 25, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 10 additions & 9 deletions aiidalab_qe/node_view.py
Original file line number Diff line number Diff line change
Expand Up @@ -116,12 +116,14 @@ def export_bands_data(work_chain_node):
)[0]
)
data["fermi_level"] = work_chain_node.outputs.band_parameters["fermi_energy"]
return jsanitize(data)
return [
jsanitize(data),
]


def export_pdos_data(work_chain_node):
if "dos" in work_chain_node.outputs:
fermi_energy = work_chain_node.outputs.band_parameters["fermi_energy"]
fermi_energy = work_chain_node.outputs.nscf_parameters["fermi_energy"]
x_label, energy_dos, energy_units = work_chain_node.outputs.dos.get_x()
tdos_values = {
f"{n} | {u}": v for n, v, u in work_chain_node.outputs.dos.get_y()
Expand Down Expand Up @@ -483,12 +485,11 @@ def _update_view(self):
self._show_structure()
self._results_shown.add("structure")

if (
"band_structure" not in self._results_shown
and "band_structure" in self.node.outputs
if "electronic_structure" not in self._results_shown and (
"band_structure" in self.node.outputs or "dos" in self.node.outputs
):
self._show_band_structure()
self._results_shown.add("band_structure")
self._show_electronic_structure()
self._results_shown.add("electronic_structure")

def _show_structure(self):
self._structure_view = StructureDataViewer(
Expand All @@ -497,12 +498,12 @@ def _show_structure(self):
self.result_tabs.children[1].children = [self._structure_view]
self.result_tabs.set_title(1, "Final Geometry")

def _show_band_structure(self):
def _show_electronic_structure(self):
data = export_data(self.node)
bands_data = data.get("bands", None)
dos_data = data.get("dos", None)
self._bands_plot_view = BandsPlotWidget(
bands=[bands_data], dos=dos_data, plot_fermilevel=True
bands=bands_data, dos=dos_data, plot_fermilevel=True
)
self.result_tabs.children[2].children = [self._bands_plot_view]
self.result_tabs.set_title(2, "Electronic Structure")
Expand Down
6 changes: 6 additions & 0 deletions aiidalab_qe/report.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,12 @@ def _generate_report_dict(qeapp_wc):
scf_kpoints_distance = qeapp_wc.inputs.bands.scf.kpoints_distance.value
bands_kpoints_distance = qeapp_wc.inputs.bands.bands_kpoints_distance.value
if run_pdos:
scf_kpoints_distance = (
scf_kpoints_distance or qeapp_wc.inputs.pdos.scf.kpoints_distance.value
)
pw_parameters = (
pw_parameters or qeapp_wc.inputs.pdos.scf.pw.parameters.get_dict()
)
nscf_kpoints_distance = qeapp_wc.inputs.pdos.nscf.kpoints_distance.value

if pw_parameters:
Expand Down