From f5f3089c92ecc8ae4f4a369ee30ee9b9f70547ad Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Se=C3=A1n=20Kavanagh?= <51478689+kavanase@users.noreply.github.com> Date: Mon, 4 Nov 2024 12:26:05 -0500 Subject: [PATCH] Bugfix for Interstitial Oxidation States (#208) * Update `core.py` * Update core.py * Update test_core.py --- pymatgen/analysis/defects/core.py | 4 ++-- tests/test_core.py | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/pymatgen/analysis/defects/core.py b/pymatgen/analysis/defects/core.py index 705a4b02..1db501d9 100644 --- a/pymatgen/analysis/defects/core.py +++ b/pymatgen/analysis/defects/core.py @@ -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. " diff --git a/tests/test_core.py b/tests/test_core.py index 811418ba..600cba6f 100644 --- a/tests/test_core.py +++ b/tests/test_core.py @@ -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"