Skip to content

Commit 876b999

Browse files
authored
Clean up io.vasp.outputs.Outcar docstring (materialsproject#4160)
* improve docstring * relocate private parser method and as_dict * tweak class docstring * NEED CONFIRM: deprecate read_pattern, rename to _parse_pattern * update available readers * micro_pyawk doc clean up * schedule debug arg for removal * remove umask that is doing nothing * the docstring must be incorrect, tuple is not mutable * unpack tuple for readability * fix return type * use is to check None * Revert "NEED CONFIRM: deprecate read_pattern, rename to _parse_pattern" This reverts commit 6b80819. * relocate read_pattern * add type, use is to check None * enhance type * getattr default as False instead of None when using as condition * DEBUG: to be reverted, comment out isotope check * Revert "DEBUG: to be reverted, comment out isotope check" This reverts commit 4363d1b. * add test for make_symmetric_matrix_from_upper_tri * add shape require * simplify implementation * add tabledata type alias * revert unrelated changes * type and comment clean up * avoid np.array as type in docstring * clean up read_electrostatic_potential and read_freq_dielectric * fix a lot of NMR CS parser * more types * more type * fix the rest * finish read_igpar * fix mypy error
1 parent bd36001 commit 876b999

File tree

10 files changed

+419
-335
lines changed

10 files changed

+419
-335
lines changed

src/pymatgen/analysis/pourbaix_diagram.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ def __init__(
114114
self.uncorrected_energy = entry.energy
115115
if entry_id is not None:
116116
self.entry_id: str | None = entry_id
117-
elif getattr(entry, "entry_id", None):
117+
elif getattr(entry, "entry_id", False):
118118
self.entry_id = entry.entry_id
119119
else:
120120
self.entry_id = None

src/pymatgen/core/interface.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -916,7 +916,7 @@ def get_trans_mat(
916916
normal (bool): determine if need to require the c axis of one grain associated with
917917
the first transformation matrix perpendicular to the surface or not.
918918
default to false.
919-
trans_cry (np.array): shape 3x3. If the structure given are primitive cell in cubic system, e.g.
919+
trans_cry (NDArray): shape 3x3. If the structure given are primitive cell in cubic system, e.g.
920920
bcc or fcc system, trans_cry is the transformation matrix from its
921921
conventional cell to the primitive cell.
922922
lat_type (str): one character to specify the lattice type. Defaults to 'c' for cubic.

src/pymatgen/electronic_structure/boltztrap2.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -869,8 +869,8 @@ def compute_properties_doping(self, doping, temp_r=None) -> None:
869869
# Find the chemical potential (mu).
870870

871871
# Args:
872-
# epsilon (np.array): Array of energy values.
873-
# dos (np.array): Array of density of states values.
872+
# epsilon (NDArray): Array of energy values.
873+
# dos (NDArray): Array of density of states values.
874874
# N0 (float): Background carrier concentration.
875875
# T (float): Temperature in Kelvin.
876876
# dosweight (float, optional): Weighting factor for the density of states. Default is 2.0.

src/pymatgen/entries/computed_entries.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -469,7 +469,7 @@ def __eq__(self, other: object) -> bool:
469469
# However, if entry_id is same, they may have different corrections (e.g., due
470470
# to mixing scheme used) and thus should be compared on corrected energy.
471471

472-
if getattr(self, "entry_id", None) and getattr(other, "entry_id", None) and self.entry_id != other.entry_id:
472+
if getattr(self, "entry_id", False) and getattr(other, "entry_id", False) and self.entry_id != other.entry_id:
473473
return False
474474

475475
if not math.isclose(self.energy, other.energy):

src/pymatgen/io/common.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -70,11 +70,11 @@ def __init__(
7070
7171
Args:
7272
structure (Structure): associated with the volumetric data
73-
data (dict[str, np.array]): Actual volumetric data.
74-
distance_matrix (np.array): A pre-computed distance matrix if available.
73+
data (dict[str, NDArray]): Actual volumetric data.
74+
distance_matrix (NDArray): A pre-computed distance matrix if available.
7575
Useful so pass distance_matrices between sums,
7676
short-circuiting an otherwise expensive operation.
77-
data_aug (np.array): Any extra information associated with volumetric data
77+
data_aug (NDArray): Any extra information associated with volumetric data
7878
(typically augmentation charges)
7979
"""
8080
self.structure = structure

src/pymatgen/io/pwmat/inputs.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -495,7 +495,7 @@ def __init__(
495495
"""Initialization function.
496496
497497
Args:
498-
reciprocal_lattice (np.array): Reciprocal lattice with factor of 2*pi.
498+
reciprocal_lattice (NDArray): Reciprocal lattice with factor of 2*pi.
499499
kpoints (dict[str, np.array]): Kpoints and their corresponding fractional coordinates.
500500
kpath (list[list[str]]): All kpaths, with each list representing one kpath.
501501
density (float): The density of kpoints mesh with factor of 2*pi.

src/pymatgen/io/pwmat/outputs.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -341,7 +341,7 @@ def _parse(self):
341341
342342
Returns:
343343
labels (list[str]): The label of DOS, e.g. Total, Cr-3S, ...
344-
dos (np.array): Value of density of state.
344+
dos (NDArray): Value of density of state.
345345
"""
346346
labels: list[str] = []
347347
labels = linecache.getline(str(self.filename), 1).split()[1:]

src/pymatgen/io/vasp/outputs.py

Lines changed: 407 additions & 323 deletions
Large diffs are not rendered by default.

src/pymatgen/transformations/advanced_transformations.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -789,7 +789,7 @@ def _add_spin_magnitudes(self, structure: Structure):
789789
Structure: Structure with spin magnitudes added.
790790
"""
791791
for idx, site in enumerate(structure):
792-
if getattr(site.specie, "spin", None):
792+
if getattr(site.specie, "spin", False):
793793
spin = site.specie.spin
794794
spin = getattr(site.specie, "spin", None)
795795
sign = int(spin) if spin else 0

src/pymatgen/vis/structure_vtk.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -357,7 +357,7 @@ def add_partial_sphere(self, coords, radius, color, start=0, end=360, opacity=1.
357357
Adding a partial sphere (to display partial occupancies.
358358
359359
Args:
360-
coords (np.array): Coordinates
360+
coords (NDArray): Coordinates
361361
radius (float): Radius of sphere
362362
color (tuple): RGB color of sphere
363363
start (float): Starting angle.

0 commit comments

Comments
 (0)