Skip to content

Commit

Permalink
fix describe module bug
Browse files Browse the repository at this point in the history
  • Loading branch information
naik-aakash committed Aug 18, 2023
1 parent 7e358cb commit a3e5591
Showing 1 changed file with 60 additions and 57 deletions.
117 changes: 60 additions & 57 deletions lobsterpy/cohp/describe.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"])
Expand All @@ -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]
Expand Down Expand Up @@ -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]
Expand Down

0 comments on commit a3e5591

Please sign in to comment.