Skip to content

Commit 6c42cfe

Browse files
committed
More typing fixes.
1 parent 86df8a6 commit 6c42cfe

File tree

1 file changed

+12
-12
lines changed

1 file changed

+12
-12
lines changed

src/pymatgen/core/structure.py

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -3787,7 +3787,7 @@ def get_distance(self, i: int, j: int) -> float:
37873787
"""
37883788
return self[i].distance(self[j])
37893789

3790-
def get_sites_in_sphere(self, pt: NDArray, r: float) -> list[Neighbor]:
3790+
def get_sites_in_sphere(self, pt: ArrayLike, r: float) -> list[Neighbor]:
37913791
"""Find all sites within a sphere from a point.
37923792
37933793
Args:
@@ -3827,7 +3827,7 @@ def get_neighbors(self, site: Site, r: float) -> list[Neighbor]:
38273827
nns = self.get_sites_in_sphere(site.coords, r)
38283828
return [nn for nn in nns if nn != site]
38293829

3830-
def get_neighbors_in_shell(self, origin: NDArray, r: float, dr: float) -> list[Neighbor]:
3830+
def get_neighbors_in_shell(self, origin: ArrayLike, r: float, dr: float) -> list[Neighbor]:
38313831
"""Get all sites in a shell centered on origin (coords) between radii
38323832
r-dr and r+dr.
38333833
@@ -4136,9 +4136,9 @@ class Structure(IStructure, collections.abc.MutableSequence):
41364136

41374137
def __init__(
41384138
self,
4139-
lattice: NDArray | Lattice,
4139+
lattice: ArrayLike | Lattice,
41404140
species: Sequence[CompositionLike],
4141-
coords: Sequence[NDArray] | NDArray,
4141+
coords: Sequence[ArrayLike] | ArrayLike,
41424142
charge: float | None = None,
41434143
validate_proximity: bool = False,
41444144
to_unit_cell: bool = False,
@@ -4290,7 +4290,7 @@ def lattice(self, lattice: ArrayLike | Lattice) -> None:
42904290
def append( # type:ignore[override]
42914291
self,
42924292
species: CompositionLike,
4293-
coords: NDArray,
4293+
coords: ArrayLike,
42944294
coords_are_cartesian: bool = False,
42954295
validate_proximity: bool = False,
42964296
properties: dict | None = None,
@@ -4322,7 +4322,7 @@ def insert( # type:ignore[override]
43224322
self,
43234323
idx: int,
43244324
species: CompositionLike,
4325-
coords: NDArray,
4325+
coords: ArrayLike,
43264326
coords_are_cartesian: bool = False,
43274327
validate_proximity: bool = False,
43284328
properties: dict | None = None,
@@ -4360,7 +4360,7 @@ def replace(
43604360
self,
43614361
idx: int,
43624362
species: CompositionLike,
4363-
coords: NDArray | None = None,
4363+
coords: ArrayLike | None = None,
43644364
coords_are_cartesian: bool = False,
43654365
properties: dict | None = None,
43664366
label: str | None = None,
@@ -4837,7 +4837,7 @@ def merge_sites(
48374837
if mode.lower()[0] not in {"s", "d", "a"}:
48384838
raise ValueError(f"Illegal {mode=}, should start with a/d/s.")
48394839

4840-
dist_mat: NDArray = self.distance_matrix
4840+
dist_mat: NDArray[np.float64] = self.distance_matrix
48414841
np.fill_diagonal(dist_mat, 0)
48424842

48434843
if dist_mat.shape == (1, 1):
@@ -4849,7 +4849,7 @@ def merge_sites(
48494849
for cluster in np.unique(clusters):
48504850
indexes = np.where(clusters == cluster)[0]
48514851
species: Composition = self[indexes[0]].species
4852-
coords: NDArray = self[indexes[0]].frac_coords
4852+
coords: NDArray[np.float64] = self[indexes[0]].frac_coords
48534853
props: dict = self[indexes[0]].properties
48544854

48554855
for site_idx, clust_idx in enumerate(indexes[1:]):
@@ -5064,7 +5064,7 @@ class Molecule(IMolecule, collections.abc.MutableSequence):
50645064
def __init__(
50655065
self,
50665066
species: Sequence[SpeciesLike],
5067-
coords: Sequence[NDArray] | NDArray,
5067+
coords: Sequence[ArrayLike] | ArrayLike,
50685068
charge: float = 0.0,
50695069
spin_multiplicity: int | None = None,
50705070
validate_proximity: bool = False,
@@ -5163,7 +5163,7 @@ def __delitem__(self, idx: SupportsIndex | slice) -> None:
51635163
def append( # type:ignore[override]
51645164
self,
51655165
species: CompositionLike,
5166-
coords: NDArray,
5166+
coords: ArrayLike,
51675167
validate_proximity: bool = False,
51685168
properties: dict | None = None,
51695169
) -> Self:
@@ -5230,7 +5230,7 @@ def insert( # type:ignore[override]
52305230
self,
52315231
idx: int,
52325232
species: CompositionLike,
5233-
coords: NDArray[np.float64],
5233+
coords: ArrayLike,
52345234
validate_proximity: bool = False,
52355235
properties: dict | None = None,
52365236
label: str | None = None,

0 commit comments

Comments
 (0)