Skip to content

Commit 0740bb6

Browse files
committed
1 parent 7743ac7 commit 0740bb6

File tree

10 files changed

+37
-56
lines changed

10 files changed

+37
-56
lines changed

src/pymatgen/analysis/chemenv/connectivity/connected_components.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -211,9 +211,6 @@ def __init__(
211211
environments_data: Data of environment nodes.
212212
links_data: Data of links between environment nodes.
213213
graph: Graph of the connected component.
214-
215-
Returns:
216-
ConnectedComponent: Instance of this class
217214
"""
218215
self._periodicity_vectors: list[list] | None = None
219216
self._primitive_reduced_connected_subgraph = None

src/pymatgen/analysis/chemenv/coordination_environments/voronoi.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -563,14 +563,14 @@ def maps_and_surfaces(
563563
maps_and_surfaces = []
564564
for cn, value in self._unique_coordinated_neighbors_parameters_indices[isite].items():
565565
for imap, list_parameters_indices in enumerate(value):
566-
thissurf = 0.0
566+
this_surf = 0.0
567567
for idp, iap, iacb in list_parameters_indices:
568568
if iacb in additional_conditions:
569-
thissurf += surfaces[idp, iap]
569+
this_surf += surfaces[idp, iap]
570570
maps_and_surfaces.append(
571571
{
572572
"map": (cn, imap),
573-
"surface": thissurf,
573+
"surface": this_surf,
574574
"parameters_indices": list_parameters_indices,
575575
}
576576
)
@@ -596,14 +596,14 @@ def maps_and_surfaces_bounded(self, isite, surface_calculation_options=None, add
596596
maps_and_surfaces = []
597597
for cn, value in self._unique_coordinated_neighbors_parameters_indices[isite].items():
598598
for imap, list_parameters_indices in enumerate(value):
599-
thissurf = 0.0
599+
this_surf = 0.0
600600
for idp, iap, iacb in list_parameters_indices:
601601
if iacb in additional_conditions:
602-
thissurf += surfaces[idp, iap]
602+
this_surf += surfaces[idp, iap]
603603
maps_and_surfaces.append(
604604
{
605605
"map": (cn, imap),
606-
"surface": thissurf,
606+
"surface": this_surf,
607607
"parameters_indices": list_parameters_indices,
608608
}
609609
)

src/pymatgen/analysis/interfaces/zsl.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ def __init__(
108108
self.max_angle_tol = max_angle_tol
109109
self.bidirectional = bidirectional
110110

111-
def generate_sl_transformation_sets(self, film_area, substrate_area):
111+
def generate_sl_transformation_sets(self, film_area: int, substrate_area: int) -> Iterator[tuple]:
112112
"""Generate transformation sets for film/substrate pair given the
113113
area of the unit cell area for the film and substrate. The
114114
transformation sets map the film and substrate unit cells to super
@@ -118,7 +118,7 @@ def generate_sl_transformation_sets(self, film_area, substrate_area):
118118
film_area (int): the unit cell area for the film
119119
substrate_area (int): the unit cell area for the substrate
120120
121-
Returns:
121+
Yields:
122122
transformation_sets: a set of transformation_sets defined as:
123123
1.) the transformation matrices for the film to create a
124124
super lattice of area i*film area

src/pymatgen/analysis/piezo_sensitivity.py

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -178,25 +178,24 @@ def __init__(self, structure: Structure, ist, pointops, tol: float = 1e-3):
178178
self.structure = structure
179179
self.ist = ist
180180
self.pointops = pointops
181-
self.IST_operations = None
181+
self.IST_operations: list[list[list]] = []
182182

183183
obj = self.ist
184184
if not (obj - np.transpose(obj, (0, 1, 3, 2)) < tol).all():
185185
warnings.warn("Input internal strain tensor does not satisfy standard symmetries")
186186

187-
def get_IST_operations(self, opstol=1e-3):
187+
def get_IST_operations(self, opstol=1e-3) -> list[list[list]]:
188188
"""Get the symmetry operations which maps the tensors
189189
belonging to equivalent sites onto each other in the form
190-
[site index 1, site index 2, [Symmops mapping from site
190+
[site index 1, site index 2, [SymmOps mapping from site
191191
index 1 to site index 2]].
192192
193193
Args:
194194
opstol (float): tolerance for determining if a symmetry
195195
operation relates two sites
196196
197197
Returns:
198-
list of symmetry operations mapping equivalent sites and
199-
the indexes of those sites.
198+
list[list[list]]: symmetry operations mapping equivalent sites and the indexes of those sites.
200199
"""
201200
struct = self.structure
202201
ops = SpacegroupAnalyzer(struct).get_symmetry_operations(cartesian=True)
@@ -207,18 +206,19 @@ def get_IST_operations(self, opstol=1e-3):
207206
if op not in uniq_point_ops:
208207
uniq_point_ops.append(op)
209208

210-
IST_operations = []
211-
for atom in range(len(self.ist)):
209+
IST_operations: list[list[list]] = []
210+
for atom_idx in range(len(self.ist)):
212211
IST_operations.append([])
213-
for j in range(atom):
212+
for j in range(atom_idx):
214213
for op in uniq_point_ops:
215214
new = op.transform_tensor(self.ist[j])
216215

217216
# Check the matrix it references
218-
if np.allclose(new, self.ist[atom], atol=opstol):
219-
IST_operations[atom].append([j, op])
217+
if np.allclose(new, self.ist[atom_idx], atol=opstol):
218+
IST_operations[atom_idx].append([j, op])
220219

221220
self.IST_operations = IST_operations
221+
return IST_operations
222222

223223
def get_rand_IST(self, max_force=1):
224224
"""Generate a random internal strain tensor which obeys a structure's

src/pymatgen/core/composition.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1099,7 +1099,7 @@ def _comps_from_fuzzy_formula(
10991099
factor: Coefficient for this parse, e.g. (PO4)2 will feed in PO4
11001100
as the fuzzy_formula with a coefficient of 2.
11011101
1102-
Returns:
1102+
Yields:
11031103
list[tuple[Composition, int]]: A list of tuples, with the first element being a Composition
11041104
and the second element being the number of points awarded that Composition interpretation.
11051105
"""

src/pymatgen/ext/matproj_legacy.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1035,7 +1035,7 @@ def submit_structures(
10351035
data=None,
10361036
histories=None,
10371037
created_at=None,
1038-
):
1038+
) -> list[str]:
10391039
"""Submits a list of structures to the Materials Project as SNL files.
10401040
The argument list mirrors the arguments for the StructureNL object,
10411041
except that a list of structures with the same metadata is used as an
@@ -1065,7 +1065,7 @@ def submit_structures(
10651065
created_at (datetime): A datetime object
10661066
10671067
Returns:
1068-
A list of inserted submission ids.
1068+
list[str]: Inserted submission ids.
10691069
"""
10701070
from pymatgen.util.provenance import StructureNL
10711071

@@ -1079,7 +1079,7 @@ def submit_structures(
10791079
histories,
10801080
created_at,
10811081
)
1082-
self.submit_snl(snl_list)
1082+
return self.submit_snl(snl_list)
10831083

10841084
def submit_snl(self, snl):
10851085
"""Submits a list of StructureNL to the Materials Project site.
@@ -1093,10 +1093,10 @@ def submit_snl(self, snl):
10931093
of StructureNL objects
10941094
10951095
Returns:
1096-
A list of inserted submission ids.
1096+
list[str]: Inserted submission ids.
10971097
10981098
Raises:
1099-
MPRestError
1099+
MPRestError: If submission fails.
11001100
"""
11011101
snl = snl if isinstance(snl, list) else [snl]
11021102
json_data = [s.as_dict() for s in snl]

src/pymatgen/io/fiesta.py

Lines changed: 7 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -382,25 +382,18 @@ def set_bse_options(self, n_excitations=10, nit_bse=200):
382382
self.bse_tddft_options.update(npsi_bse=n_excitations, nit_bse=nit_bse)
383383

384384
def dump_bse_data_in_gw_run(self, BSE_dump=True):
385-
"""
386-
Args:
387-
BSE_dump: bool.
385+
"""Set the "do_bse" variable to 1 or 0 in cell.in.
388386
389-
Returns:
390-
set the "do_bse" variable to one in cell.in
387+
Args:
388+
BSE_dump (bool): Defaults to True.
391389
"""
392-
if BSE_dump:
393-
self.bse_tddft_options.update(do_bse=1, do_tddft=0)
394-
else:
395-
self.bse_tddft_options.update(do_bse=0, do_tddft=0)
390+
self.bse_tddft_options.update(do_bse=int(BSE_dump), do_tddft=0)
396391

397392
def dump_tddft_data_in_gw_run(self, tddft_dump: bool = True):
398-
"""
399-
Args:
400-
TDDFT_dump: bool.
393+
"""Set the do_tddft variable to 1 or 0 in cell.in.
401394
402-
Returns:
403-
set the do_tddft variable to one in cell.in
395+
Args:
396+
tddft_dump (bool): Defaults to True.
404397
"""
405398
self.bse_tddft_options.update(do_bse="0", do_tddft="1" if tddft_dump else "0")
406399

src/pymatgen/io/icet.py

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -79,9 +79,6 @@ def __init__(
7979
"monte carlo" otherwise.
8080
sqs_kwargs (dict): kwargs to pass to the icet SQS generators.
8181
See self.sqs_kwarg_names for possible options.
82-
83-
Returns:
84-
None
8582
"""
8683
if ClusterSpace is None:
8784
raise ImportError("IcetSQS requires the icet package. Use `pip install icet`")
@@ -173,25 +170,24 @@ def run(self) -> Sqs:
173170
clusters=str(self._get_cluster_space()),
174171
)
175172

176-
def _get_site_composition(self) -> None:
173+
def _get_site_composition(self) -> dict[str, dict]:
177174
"""Get Icet-format composition from structure.
178175
179176
Returns:
180177
Dict with sublattice compositions specified by uppercase letters,
181-
e.g. In_x Ga_1-x As becomes:
182-
{
178+
e.g. In_x Ga_1-x As becomes: {
183179
"A": {"In": x, "Ga": 1 - x},
184180
"B": {"As": 1}
185181
}
186182
"""
187183
uppercase_letters = list(ascii_uppercase)
188-
idx = 0
189184
self.composition: dict[str, dict] = {}
190185
for idx, site in enumerate(self._structure):
191186
site_comp = site.species.as_dict()
192187
if site_comp not in self.composition.values():
193188
self.composition[uppercase_letters[idx]] = site_comp
194-
idx += 1
189+
190+
return self.composition
195191

196192
def _get_cluster_space(self) -> ClusterSpace:
197193
"""Generate the ClusterSpace object for icet."""

src/pymatgen/io/vasp/outputs.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2486,10 +2486,8 @@ def read_cs_core_contribution(self) -> None:
24862486
self.data["cs_core_contribution"] = core_contrib
24872487

24882488
def read_cs_raw_symmetrized_tensors(self) -> None:
2489-
"""Parse the matrix form of NMR tensor before corrected to table.
2490-
2491-
Returns:
2492-
nsymmetrized tensors list in the order of atoms.
2489+
"""Parse the matrix form of NMR tensor before corrected to table
2490+
and set as self.data["unsym_cs_tensor"].
24932491
"""
24942492
header_pattern = r"\s+-{50,}\s+\s+Absolute Chemical Shift tensors\s+\s+-{50,}$"
24952493
first_part_pattern = r"\s+UNSYMMETRIZED TENSORS\s+$"

src/pymatgen/transformations/advanced_transformations.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1370,9 +1370,6 @@ def __init__(
13701370
will be removed. Default to 0.7.
13711371
quick_gen (bool): whether to quickly generate a supercell, if set to true, no need to
13721372
find the smallest cell.
1373-
1374-
Returns:
1375-
Grain boundary structure (gb (Structure) object).
13761373
"""
13771374
self.rotation_axis = rotation_axis
13781375
self.rotation_angle = rotation_angle

0 commit comments

Comments
 (0)