Skip to content

Commit 5d925fe

Browse files
DanielYang59janosh
andauthored
Correct method get_projection_on_elements docstring under Procar class (#3945)
* correct Procar docs * more specific get_projection_on_elements return type --------- Co-authored-by: Janosh Riebesell <[email protected]>
1 parent 44b8c6e commit 5d925fe

File tree

2 files changed

+9
-9
lines changed

2 files changed

+9
-9
lines changed

.pre-commit-config.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ ci:
88

99
repos:
1010
- repo: https://github.com/astral-sh/ruff-pre-commit
11-
rev: v0.5.0
11+
rev: v0.5.4
1212
hooks:
1313
- id: ruff
1414
args: [ --fix, --unsafe-fixes ]
@@ -22,7 +22,7 @@ repos:
2222
- id: trailing-whitespace
2323

2424
- repo: https://github.com/pre-commit/mirrors-mypy
25-
rev: v1.10.1
25+
rev: v1.11.0
2626
hooks:
2727
- id: mypy
2828

@@ -65,6 +65,6 @@ repos:
6565
args: [ --drop-empty-cells, --keep-output ]
6666

6767
- repo: https://github.com/RobertCraigie/pyright-python
68-
rev: v1.1.369
68+
rev: v1.1.373
6969
hooks:
7070
- id: pyright

src/pymatgen/io/vasp/outputs.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3889,31 +3889,31 @@ def __init__(self, filename: PathLike) -> None:
38893889
self.data = data
38903890
self.phase_factors = phase_factors
38913891

3892-
def get_projection_on_elements(self, structure: Structure) -> dict[Spin, list]:
3892+
def get_projection_on_elements(self, structure: Structure) -> dict[Spin, list[list[dict[str, float]]]]:
38933893
"""Get a dict of projections on elements.
38943894
38953895
Args:
38963896
structure (Structure): Input structure.
38973897
38983898
Returns:
3899-
A dict as {Spin.up: [k index][b index][{Element: values}]].
3899+
A dict as {Spin: [band index][kpoint index][{Element: values}]].
39003900
"""
39013901
assert self.data is not None, "Data cannot be None."
39023902
assert self.nkpoints is not None
39033903
assert self.nbands is not None
39043904
assert self.nions is not None
39053905

3906-
dico: dict[Spin, list] = {}
3906+
elem_proj: dict[Spin, list] = {}
39073907
for spin in self.data:
3908-
dico[spin] = [[defaultdict(float) for _ in range(self.nkpoints)] for _ in range(self.nbands)]
3908+
elem_proj[spin] = [[defaultdict(float) for _ in range(self.nkpoints)] for _ in range(self.nbands)]
39093909

39103910
for iat in range(self.nions):
39113911
name = structure.species[iat].symbol
39123912
for spin, data in self.data.items():
39133913
for kpoint, band in itertools.product(range(self.nkpoints), range(self.nbands)):
3914-
dico[spin][band][kpoint][name] += np.sum(data[kpoint, band, iat, :])
3914+
elem_proj[spin][band][kpoint][name] += np.sum(data[kpoint, band, iat, :])
39153915

3916-
return dico
3916+
return elem_proj
39173917

39183918
def get_occupation(self, atom_index: int, orbital: str) -> dict:
39193919
"""Get the occupation for a particular orbital of a particular atom.

0 commit comments

Comments
 (0)