From 066b02d64ad1dc3945d6d7b8a5251925ac500520 Mon Sep 17 00:00:00 2001 From: Ryan Kingsbury Date: Tue, 16 Jul 2024 10:45:41 -0400 Subject: [PATCH] revert reordered energy levels --- src/pymatgen/analysis/magnetism/jahnteller.py | 2 +- tests/io/vasp/test_inputs.py | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/pymatgen/analysis/magnetism/jahnteller.py b/src/pymatgen/analysis/magnetism/jahnteller.py index ae53c08473b..90727f19e15 100644 --- a/src/pymatgen/analysis/magnetism/jahnteller.py +++ b/src/pymatgen/analysis/magnetism/jahnteller.py @@ -345,7 +345,7 @@ def _get_number_of_d_electrons(species: Species) -> float: # taken from get_crystal_field_spin elec = species.element.full_electronic_structure - if len(elec) < 4 or elec[-2][1] != "s" or elec[-1][1] != "d": + if len(elec) < 4 or elec[-1][1] != "s" or elec[-2][1] != "d": raise AttributeError(f"Invalid element {species.symbol} for crystal field calculation.") n_electrons = int(elec[-1][2] + elec[-2][2] - species.oxi_state) # type: ignore[operator] if n_electrons < 0 or n_electrons > 10: diff --git a/tests/io/vasp/test_inputs.py b/tests/io/vasp/test_inputs.py index 4ce0c20e95f..aba859bea1f 100644 --- a/tests/io/vasp/test_inputs.py +++ b/tests/io/vasp/test_inputs.py @@ -1099,8 +1099,8 @@ def test_nelectrons(self): assert self.psingle_Fe.nelectrons == 8 def test_electron_config(self): - assert self.psingle_Mn_pv.electron_configuration == [(3, "d", 5), (4, "s", 2), (3, "p", 6)] - assert self.psingle_Fe.electron_configuration == [(3, "d", 6), (4, "s", 2)] + assert self.psingle_Mn_pv.electron_configuration == [(4, "s", 2), (3, "d", 5), (3, "p", 6)] + assert self.psingle_Fe.electron_configuration == [(4, "s", 2), (3, "d", 6)] def test_attributes(self): for key, val in self.Mn_pv_attrs.items():