Skip to content

Commit c735cca

Browse files
committed
clarify valence elec config
1 parent 050d0af commit c735cca

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

src/pymatgen/io/vasp/inputs.py

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2128,7 +2128,11 @@ def __repr__(self) -> str:
21282128

21292129
@property
21302130
def electron_configuration(self) -> list[tuple[int, str, int]] | None:
2131-
"""Electronic configuration of the PotcarSingle."""
2131+
"""Valence electronic configuration corresponding to the ZVAL.
2132+
2133+
If the POTCAR defines a non-integer number of electrons,
2134+
the configuration is not well-defined, and None is returned.
2135+
"""
21322136
if not self.nelectrons.is_integer():
21332137
warnings.warn(
21342138
"POTCAR has non-integer charge, electron configuration not well-defined.",
@@ -2139,11 +2143,11 @@ def electron_configuration(self) -> list[tuple[int, str, int]] | None:
21392143
el: Element = Element.from_Z(self.atomic_no)
21402144
full_config: list[tuple[int, str, int]] = el.full_electronic_structure
21412145
nelect: float = self.nelectrons
2142-
config = []
2146+
config: list[tuple[int, str, int]] = []
21432147
while nelect > 0:
2144-
e = full_config.pop(-1)
2145-
config.append(e)
2146-
nelect -= e[-1]
2148+
e_config: tuple[int, str, int] = full_config.pop(-1)
2149+
config.append(e_config)
2150+
nelect -= e_config[-1]
21472151
return config
21482152

21492153
@property

0 commit comments

Comments
 (0)