Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
kavanase committed Mar 1, 2024
2 parents 1356aa3 + 2d31951 commit 1ab1303
Show file tree
Hide file tree
Showing 12 changed files with 27 additions and 28 deletions.
28 changes: 14 additions & 14 deletions doped/thermodynamics.py
Original file line number Diff line number Diff line change
Expand Up @@ -724,17 +724,17 @@ def _parse_transition_levels(self):
interior_point = [self.band_gap / 2, min(midgap_formation_energies) - 1.0] # type: ignore
hs_ints = HalfspaceIntersection(hs_hyperplanes, np.array(interior_point))

# Group the intersections and corresponding limits
ints_and_limits_zip = zip(hs_ints.intersections, hs_ints.dual_facets)
# Only include the limits corresponding to entries, not the boundaries
# Group the intersections and corresponding facets
ints_and_facets_zip = zip(hs_ints.intersections, hs_ints.dual_facets)
# Only include the facets corresponding to entries, not the boundaries
total_entries = len(sorted_defect_entries)
ints_and_limits_filter = filter(
lambda int_and_limit: all(np.array(int_and_limit[1]) < total_entries),
ints_and_limits_zip,
ints_and_facets_filter = filter(
lambda int_and_facet: all(np.array(int_and_facet[1]) < total_entries),
ints_and_facets_zip,
)
# sort based on transition level
ints_and_limits_list = sorted(
ints_and_limits_filter, key=lambda int_and_limit: int_and_limit[0][0]
ints_and_facets_list = sorted(
ints_and_facets_filter, key=lambda int_and_facet: int_and_facet[0][0]
)

# take simplest (shortest) possible defect name, with lowest energy, as the name for that group
Expand All @@ -752,16 +752,16 @@ def _parse_transition_levels(self):
)
transition_level_map, all_entries, stable_entries, defect_charge_map = output_dicts

if len(ints_and_limits_list) > 0: # unpack into lists
_, limits = zip(*ints_and_limits_list)
if len(ints_and_facets_list) > 0: # unpack into lists
_, facets = zip(*ints_and_facets_list)
transition_level_map[defect_name_wout_charge] = { # map of transition level: charge states
intersection[0]: sorted(
[sorted_defect_entries[i].charge_state for i in limit], reverse=True
[sorted_defect_entries[i].charge_state for i in facet], reverse=True
)
for intersection, limit in ints_and_limits_list
for intersection, facet in ints_and_facets_list
}
stable_entries[defect_name_wout_charge] = [
sorted_defect_entries[i] for dual in limits for i in dual
sorted_defect_entries[i] for dual in facets for i in dual
]
defect_charge_map[defect_name_wout_charge] = sorted(
[entry.charge_state for entry in sorted_defect_entries], reverse=True
Expand All @@ -772,7 +772,7 @@ def _parse_transition_levels(self):
stable_entries[defect_name_wout_charge] = [sorted_defect_entries[0]]
defect_charge_map[defect_name_wout_charge] = [sorted_defect_entries[0].charge_state]

else: # if ints_and_limits is empty, then there is likely only one defect...
else: # if ints_and_facets is empty, then there is likely only one defect...
# confirm formation energies dominant for one defect over other identical defects
name_set = [entry.name for entry in sorted_defect_entries]
vb_list = [
Expand Down
2 changes: 1 addition & 1 deletion examples/CdTe/CdTe_example_defect_dict.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion examples/CdTe/CdTe_example_thermo.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion examples/Sb2Si2Te6/Sb2Si2Te6_example_defect_dict.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion examples/Sb2Si2Te6/Sb2Si2Te6_example_thermo.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion examples/YTOS/YTOS_example_defect_dict.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion examples/YTOS/YTOS_example_thermo.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion tests/data/Sb2Se3/Sb2Se3_O_example_thermo.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion tests/data/Sb2Se3/defect/Sb2Se3_O_example_defect_dict.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion tests/data/V2O5/V2O5_example_defect_dict.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion tests/data/V2O5/V2O5_example_thermo.json

Large diffs are not rendered by default.

7 changes: 3 additions & 4 deletions tests/test_thermodynamics.py
Original file line number Diff line number Diff line change
Expand Up @@ -260,8 +260,7 @@ def _check_defect_thermo(
assert isinstance(df, pd.DataFrame)
if chempots is not None:
assert any(
"No limit (chemical potential limit) specified! Using" in str(warn.message)
for warn in conc_w
"No chemical potential limit specified! Using" in str(warn.message) for warn in conc_w
)

df_or_list, form_e_output, form_e_w = _run_func_and_capture_stdout_warnings(
Expand Down Expand Up @@ -869,7 +868,7 @@ def _check_formation_energy_methods(form_en_df_row, thermo_obj, fermi_level):
assert len(w) == 2
assert "No chemical potentials supplied" in str(w[0].message)
assert (
"You have specified a limit (chemical potential limit) but no chemical potentials "
"You have specified a chemical potential limit but no chemical potentials "
"(`chempots`) were supplied, so `limit` will be ignored." in str(w[-1].message)
)

Expand All @@ -884,7 +883,7 @@ def _check_formation_energy_methods(form_en_df_row, thermo_obj, fermi_level):
)
assert len(w) == 1
assert (
"No limit (chemical potential limit) specified! Using Cd-CdTe for computing "
"No chemical potential limit specified! Using Cd-CdTe for computing "
"the formation energy" in str(w[0].message)
)
limits = ["CdTe-Te", "Te-rich"]
Expand Down

0 comments on commit 1ab1303

Please sign in to comment.