Skip to content

Commit ec73bac

Browse files
committed
up_sample
1 parent c03d2e4 commit ec73bac

File tree

4 files changed

+23
-17
lines changed

4 files changed

+23
-17
lines changed

pymatgen/analysis/defects/corrections/freysoldt.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -412,8 +412,8 @@ def plot_plnr_avg(plot_data, title=None, saved=False, ax=None):
412412
)
413413

414414
ax.set_xlim(round(x[0]), round(x[-1]))
415-
ymin = min(min(v_R), min(dft_diff), min(short_range))
416-
ymax = max(max(v_R), max(dft_diff), max(short_range))
415+
ymin = min(v_R + dft_diff + short_range)
416+
ymax = max(v_R + dft_diff + short_range)
417417
ax.set_ylim(-0.2 + ymin, 0.2 + ymax)
418418
ax.set_xlabel(r"distance along axis ($\AA$)", fontsize=15)
419419
ax.set_ylabel("Potential (V)", fontsize=15)

pymatgen/analysis/defects/generators.py

+12-6
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@
2121
from pymatgen.symmetry.analyzer import SpacegroupAnalyzer
2222

2323
if TYPE_CHECKING:
24+
from typing import Sequence
25+
2426
from pymatgen.analysis.defects.core import Defect
2527
from pymatgen.io.vasp import VolumetricData
2628

@@ -86,7 +88,10 @@ def __init__(
8688
self.angle_tolerance = angle_tolerance
8789

8890
def generate(
89-
self, structure: Structure, rm_species: list[str | Species] = None, **kwargs
91+
self,
92+
structure: Structure,
93+
rm_species: list[str | Species] | None = None,
94+
**kwargs,
9095
) -> Generator[Vacancy, None, None]:
9196
"""Generate a vacancy defects.
9297
@@ -254,9 +259,10 @@ def __init__(self, min_dist: float = 0.5) -> None:
254259
def generate(
255260
self,
256261
structure: Structure,
257-
insertions: dict[str, list[list[float]]],
258-
multiplicities: dict[str, list[int]] | None = None,
259-
equivalent_positions: dict[str, list[list[list[float]]]] | None = None,
262+
insertions: dict[str, Sequence[Sequence[float]]],
263+
multiplicities: dict[str, Sequence[int]] | None = None,
264+
equivalent_positions: dict[str, Sequence[Sequence[Sequence[float]]]]
265+
| None = None,
260266
**kwargs,
261267
) -> Generator[Interstitial, None, None]:
262268
"""Generate interstitials.
@@ -306,8 +312,8 @@ def generate(
306312
)
307313

308314
def _filter_colliding(
309-
self, fcoords: list[list[float]], structure: Structure
310-
) -> Generator[tuple[int, list[float]], None, None]:
315+
self, fcoords: Sequence[Sequence[float]], structure: Structure
316+
) -> Generator[tuple[int, Sequence[float]], None, None]:
311317
"""Check the sites for collisions.
312318
313319
Args:

pymatgen/analysis/defects/plotting/optics.py

+6-6
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,9 @@ def plot_optical_transitions(
2727
kpt_index: int = 0,
2828
band_window: int = 5,
2929
user_defect_band: tuple = tuple(),
30-
other_defect_bands: list[int] = None,
31-
ijdirs: list[tuple] = None,
32-
shift_eig: dict[tuple, float] = None,
30+
other_defect_bands: list[int] | None = None,
31+
ijdirs: list[tuple] | None = None,
32+
shift_eig: dict[tuple, float] | None = None,
3333
x0: float = 0,
3434
x_width: float = 2,
3535
ax=None,
@@ -118,9 +118,9 @@ def get_bs_eigenvalues(
118118
defect: HarmonicDefect,
119119
kpt_index: int = 0,
120120
band_window: int = 5,
121-
user_defect_band: tuple = None,
122-
other_defect_bands: list[int] = None,
123-
shift_eig: dict[tuple, float] = None,
121+
user_defect_band: tuple | None = None,
122+
other_defect_bands: list[int] | None = None,
123+
shift_eig: dict[tuple, float] | None = None,
124124
) -> dict[tuple, float]:
125125
"""Read the eigenvalues from `HarmonicDefect.relaxed_bandstructure`.
126126

pymatgen/analysis/defects/thermo.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -879,7 +879,7 @@ def ensure_stable_bulk(
879879
stable_entry = ComputedEntry(
880880
entry.composition, pd.get_hull_energy(entry.composition) - threshold
881881
)
882-
pd = PhaseDiagram(pd.all_entries + [stable_entry])
882+
pd = PhaseDiagram([*pd.all_entries, stable_entry])
883883
return pd
884884

885885

@@ -1200,8 +1200,8 @@ def plot_formation_energy_diagrams(
12001200
)
12011201
)
12021202
trans_y = trans[:, 1]
1203-
ymin = min(ymin, min(trans_y))
1204-
ymax = max(ymax, max(trans_y))
1203+
ymin = min(ymin, *trans_y)
1204+
ymax = max(ymax, *trans_y)
12051205

12061206
dfct: Defect = single_fed.defect_entries[0].defect
12071207
latexname = dfct.latex_name

0 commit comments

Comments
 (0)