Skip to content

Commit

Permalink
clarify valence elec config
Browse files Browse the repository at this point in the history
  • Loading branch information
DanielYang59 committed Feb 1, 2025
1 parent 050d0af commit 5efb71d
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/pymatgen/io/vasp/inputs.py
Original file line number Diff line number Diff line change
Expand Up @@ -2128,7 +2128,11 @@ def __repr__(self) -> str:

@property
def electron_configuration(self) -> list[tuple[int, str, int]] | None:
"""Electronic configuration of the PotcarSingle."""
"""Valence electronic configuration corresponding to the ZVAL.
If the POTCAR defines a non-integer number of electrons,
the configuration is not well-defined, and None is returned.
"""
if not self.nelectrons.is_integer():
warnings.warn(
"POTCAR has non-integer charge, electron configuration not well-defined.",
Expand All @@ -2139,9 +2143,9 @@ def electron_configuration(self) -> list[tuple[int, str, int]] | None:
el: Element = Element.from_Z(self.atomic_no)
full_config: list[tuple[int, str, int]] = el.full_electronic_structure
nelect: float = self.nelectrons
config = []
config: list[tuple[int, str, int]] = []
while nelect > 0:
e = full_config.pop(-1)
e: tuple[int, str, int] = full_config.pop(-1)
config.append(e)
nelect -= e[-1]
return config
Expand Down

0 comments on commit 5efb71d

Please sign in to comment.