15
15
from pymatgen .apps .battery .battery_abc import AbstractElectrode , AbstractVoltagePair
16
16
from pymatgen .core import Composition , Element
17
17
from pymatgen .core .units import Charge , Time
18
- from pymatgen .entries .computed_entries import ComputedEntry , ComputedStructureEntry
18
+ from pymatgen .entries .computed_entries import ComputedEntry
19
19
20
20
if TYPE_CHECKING :
21
21
from collections .abc import Iterable
22
22
23
23
from typing_extensions import Self
24
24
25
+ from pymatgen .entries import Entry
26
+
25
27
__author__ = "Anubhav Jain, Shyue Ping Ong"
26
28
__copyright__ = "Copyright 2012, The Materials Project"
27
29
@@ -33,14 +35,14 @@ class InsertionElectrode(AbstractElectrode):
33
35
insertion battery electrode.
34
36
"""
35
37
36
- stable_entries : Iterable [ComputedEntry ]
37
- unstable_entries : Iterable [ComputedEntry ]
38
+ stable_entries : Iterable [Entry ]
39
+ unstable_entries : Iterable [Entry ]
38
40
39
41
@classmethod
40
42
def from_entries (
41
43
cls ,
42
- entries : Iterable [ComputedEntry | ComputedStructureEntry ],
43
- working_ion_entry : ComputedEntry | ComputedStructureEntry | PDEntry ,
44
+ entries : Iterable [Entry ],
45
+ working_ion_entry : Entry ,
44
46
strip_structures : bool = False ,
45
47
) -> Self :
46
48
"""Create a new InsertionElectrode.
@@ -80,15 +82,15 @@ def from_entries(
80
82
# Set an artificial high energy for each element for convex hull generation
81
83
element_energy = max (entry .energy_per_atom for entry in entries ) + 10
82
84
83
- pdentries : list [ComputedEntry | ComputedStructureEntry | PDEntry ] = []
85
+ pdentries : list [Entry ] = []
84
86
pdentries .extend (entries )
85
87
pdentries .extend ([PDEntry (Composition ({el : 1 }), element_energy ) for el in elements ])
86
88
87
89
# Make phase diagram to determine which entries are stable vs. unstable.
88
90
# For each working ion concentration, we want one stable entry
89
91
# to use in forming voltage pairs. PhaseDiagram allows for easy comparison
90
92
# of entry energies.
91
- pd = PhaseDiagram (pdentries )
93
+ pd = PhaseDiagram (pdentries ) # type:ignore[arg-type]
92
94
93
95
def lifrac (e ):
94
96
return e .composition .get_atomic_fraction (_working_ion )
@@ -364,7 +366,7 @@ def from_dict_legacy(cls, dct) -> Self:
364
366
Returns:
365
367
InsertionElectrode
366
368
"""
367
- return InsertionElectrode (
369
+ return InsertionElectrode ( # type:ignore[return-value,call-arg]
368
370
MontyDecoder ().process_decoded (dct ["entries" ]),
369
371
MontyDecoder ().process_decoded (dct ["working_ion_entry" ]),
370
372
)
@@ -387,7 +389,7 @@ class InsertionVoltagePair(AbstractVoltagePair):
387
389
entry_discharge : ComputedEntry
388
390
389
391
@classmethod
390
- def from_entries (cls , entry1 , entry2 , working_ion_entry ) -> Self :
392
+ def from_entries (cls , entry1 , entry2 , working_ion_entry ) -> InsertionVoltagePair :
391
393
"""
392
394
Args:
393
395
entry1: Entry corresponding to one of the entries in the voltage step.
0 commit comments