Skip to content

Commit

Permalink
Bugfix for Interstitial Oxidation States (#208)
Browse files Browse the repository at this point in the history
* Update `core.py`

* Update core.py

* Update test_core.py
  • Loading branch information
kavanase authored Nov 4, 2024
1 parent 18dcfb6 commit f5f3089
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions pymatgen/analysis/defects/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -706,9 +706,9 @@ def name(self) -> str:
def defect_structure(self) -> Structure:
"""Returns the defect structure."""
struct: Structure = self.structure.copy()
# use the highest value oxidation state among the two most popular ones
# use the highest value oxidation state among the most popular ones
# found in the ICSD
inter_states = self.site.specie.icsd_oxidation_states[:2]
inter_states = self.site.specie.common_oxidation_states
if len(inter_states) == 0:
_logger.warning(
"No oxidation states found for %s. "
Expand Down
4 changes: 2 additions & 2 deletions tests/test_core.py
Original file line number Diff line number Diff line change
Expand Up @@ -119,8 +119,8 @@ def test_interstitial(gan_struct) -> None:
inter_fpos = [0, 0, 0.75]
n_site = PeriodicSite(Specie("N"), inter_fpos, s.lattice)
inter = Interstitial(s, n_site)
assert inter.oxi_state == 3
assert inter.get_charge_states() == [-1, 0, 1, 2, 3, 4]
assert inter.oxi_state == 5
assert inter.get_charge_states() == [-1, 0, 1, 2, 3, 4, 5, 6]
assert np.allclose(inter.defect_structure[0].frac_coords, inter_fpos)
sc = inter.get_supercell_structure()
assert sc.formula == "Ga64 N65"
Expand Down

0 comments on commit f5f3089

Please sign in to comment.