From a3e55914c122150bbcb98456ada89fc9d904921a Mon Sep 17 00:00:00 2001 From: anaik Date: Fri, 18 Aug 2023 14:48:26 +0200 Subject: [PATCH] fix describe module bug --- lobsterpy/cohp/describe.py | 117 +++++++++++++++++++------------------ 1 file changed, 60 insertions(+), 57 deletions(-) diff --git a/lobsterpy/cohp/describe.py b/lobsterpy/cohp/describe.py index ae8f2859..91a4ded6 100644 --- a/lobsterpy/cohp/describe.py +++ b/lobsterpy/cohp/describe.py @@ -77,26 +77,27 @@ def set_description(self): + properties["ICOHP_mean"] + " eV, 0.0 percent antibonding interaction below EFermi)" ) - if properties["orbital_data"]: - orb_names = [] - orb_contri = [] - for orb, data in properties["orbital_data"].items(): - orb_names.append(orb) - orb_contri.append( - str(data["orb_contribution_mean_perc"] * 100) + if self.analysis_object.orbital_resolved: + if properties["orbital_data"]: + orb_names = [] + orb_contri = [] + for orb, data in properties["orbital_data"].items(): + orb_names.append(orb) + orb_contri.append( + str(data["orb_contribution_mean_perc"] * 100) + ) + orb_info.append( + "The orbitals " + + ", ".join(orb_names) + + " contribute " + + ", ".join(orb_contri) + + " percent in this bond, respectively." + ) + else: + orb_info.append( + "No individual orbital interactions detected above 10 percent" + " with summed ICOHP as reference for this bond." ) - orb_info.append( - "The orbitals " - + ", ".join(orb_names) - + " contribute " - + ", ".join(orb_contri) - + " percent in this bond, respectively." - ) - else: - orb_info.append( - "No individual orbital interactions detected above 10 percent" - " with summed ICOHP as reference for this bond." - ) else: bond_info.append( str(properties["number_of_bonds"]) @@ -111,26 +112,27 @@ def set_description(self): + str(round(properties["antibonding"]["perc"] * 100, 3)) + " percent antibonding interaction below EFermi)" ) - if properties["orbital_data"]: - orb_names = [] - orb_contri = [] - for orb, data in properties["orbital_data"].items(): - orb_names.append(orb) - orb_contri.append( - str(data["orb_contribution_mean_perc"] * 100) + if self.analysis_object.orbital_resolved: + if properties["orbital_data"]: + orb_names = [] + orb_contri = [] + for orb, data in properties["orbital_data"].items(): + orb_names.append(orb) + orb_contri.append( + str(data["orb_contribution_mean_perc"] * 100) + ) + orb_info.append( + "The orbitals " + + ", ".join(orb_names) + + " contribute " + + ", ".join(orb_contri) + + " percent in this bond, respectively." + ) + else: + orb_info.append( + "No individual orbital interactions detected above 10 percent" + " with summed ICOHP as reference for this bond." ) - orb_info.append( - "The orbitals " - + ", ".join(orb_names) - + " contribute " - + ", ".join(orb_contri) - + " percent in this bond, respectively." - ) - else: - orb_info.append( - "No individual orbital interactions detected above 10 percent" - " with summed ICOHP as reference for this bond." - ) if len(bond_info) > 1: bonds = ",".join(bond_info[0:-1]) + ", and " + bond_info[-1] @@ -239,26 +241,27 @@ def set_description(self): + " percent antibonding interaction below EFermi)" ) - if properties["orbital_data"]: - orb_names = [] - orb_contri = [] - for orb, data in properties["orbital_data"].items(): - orb_names.append(orb) - orb_contri.append( - str(data["orb_contribution_mean_perc"] * 100) + if self.analysis_object.orbital_resolved: + if properties["orbital_data"]: + orb_names = [] + orb_contri = [] + for orb, data in properties["orbital_data"].items(): + orb_names.append(orb) + orb_contri.append( + str(data["orb_contribution_mean_perc"] * 100) + ) + orb_info.append( + "The orbitals " + + ", ".join(orb_names) + + " contribute " + + ", ".join(orb_contri) + + " percent in this bond, respectively." + ) + else: + orb_info.append( + "No individual orbital interactions detected above 10 percent" + " with summed ICOHP as reference for this bond." ) - orb_info.append( - "The orbitals " - + ", ".join(orb_names) - + " contribute " - + ", ".join(orb_contri) - + " percent in this bond, respectively." - ) - else: - orb_info.append( - "No individual orbital interactions detected above 10 percent" - " with summed ICOHP as reference for this bond." - ) if len(bond_info) > 1: bonds = ",".join(bond_info[0:-1]) + ", and " + bond_info[-1]