diff --git a/pymatgen/analysis/chemenv/coordination_environments/coordination_geometries.py b/pymatgen/analysis/chemenv/coordination_environments/coordination_geometries.py index d6e1f7347f6..b818cf46d92 100644 --- a/pymatgen/analysis/chemenv/coordination_environments/coordination_geometries.py +++ b/pymatgen/analysis/chemenv/coordination_environments/coordination_geometries.py @@ -850,12 +850,12 @@ def get_pmeshes(self, sites, permutation=None): # _vertices = [site.coords for site in sites] _vertices = [site.coords for site in sites] if permutation is None else [sites[ii].coords for ii in permutation] _face_centers = [] - number_of_faces = 0 + n_faces = 0 for face in self._faces: if len(face) in [3, 4]: - number_of_faces += 1 + n_faces += 1 else: - number_of_faces += len(face) + n_faces += len(face) _face_centers.append( np.array([np.mean([_vertices[face_vertex][ii] for face_vertex in face]) for ii in range(3)]) @@ -866,7 +866,7 @@ def get_pmeshes(self, sites, permutation=None): out += f"{vv[0]:15.8f} {vv[1]:15.8f} {vv[2]:15.8f}\n" for fc in _face_centers: out += f"{fc[0]:15.8f} {fc[1]:15.8f} {fc[2]:15.8f}\n" - out += f"{number_of_faces}\n" + out += f"{n_faces}\n" for iface, face in enumerate(self._faces): if len(face) == 3: out += "4\n" diff --git a/pymatgen/analysis/chempot_diagram.py b/pymatgen/analysis/chempot_diagram.py index 6b0b85a5446..f4fbdbd2355 100644 --- a/pymatgen/analysis/chempot_diagram.py +++ b/pymatgen/analysis/chempot_diagram.py @@ -118,10 +118,7 @@ def __init__( self._min_entries, self._el_refs = self._get_min_entries_and_el_refs(self.entries) self._entry_dict = {e.composition.reduced_formula: e for e in self._min_entries} self._border_hyperplanes = self._get_border_hyperplanes() - ( - self._hyperplanes, - self._hyperplane_entries, - ) = self._get_hyperplanes_and_entries() + self._hyperplanes, self._hyperplane_entries = self._get_hyperplanes_and_entries() if self.dim < 2: raise ValueError("ChemicalPotentialDiagram currently requires phase diagrams with 2 or more elements!") diff --git a/pymatgen/analysis/graphs.py b/pymatgen/analysis/graphs.py index c3d99c32a48..e8eddb2d0f4 100644 --- a/pymatgen/analysis/graphs.py +++ b/pymatgen/analysis/graphs.py @@ -785,8 +785,8 @@ def get_coordination_of_site(self, n): :param n: index of site :return (int): """ - number_of_self_loops = sum(1 for n, v in self.graph.edges(n) if n == v) - return self.graph.degree(n) - number_of_self_loops + n_self_loops = sum(1 for n, v in self.graph.edges(n) if n == v) + return self.graph.degree(n) - n_self_loops def draw_graph_to_file( self, @@ -2440,8 +2440,8 @@ def get_coordination_of_site(self, n): :param n: index of site :return (int): """ - number_of_self_loops = sum(1 for n, v in self.graph.edges(n) if n == v) - return self.graph.degree(n) - number_of_self_loops + n_self_loops = sum(1 for n, v in self.graph.edges(n) if n == v) + return self.graph.degree(n) - n_self_loops def draw_graph_to_file( self, diff --git a/pymatgen/analysis/wulff.py b/pymatgen/analysis/wulff.py index de16c0776e5..3f8a1d760aa 100644 --- a/pymatgen/analysis/wulff.py +++ b/pymatgen/analysis/wulff.py @@ -416,13 +416,7 @@ def get_plot( from mpl_toolkits.mplot3d import Axes3D, art3d colors = self._get_colors(color_set, alpha, off_color, custom_colors=custom_colors or {}) - ( - color_list, - color_proxy, - color_proxy_on_wulff, - miller_on_wulff, - e_surf_on_wulff, - ) = colors + color_list, color_proxy, color_proxy_on_wulff, miller_on_wulff, e_surf_on_wulff = colors if not direction: # If direction is not specified, use the miller indices of @@ -539,13 +533,9 @@ def get_plotly( (plotly.graph_objs.Figure) """ units = "Jm⁻²" if units_in_JPERM2 else "eVÅ⁻²" - ( - color_list, - color_proxy, - color_proxy_on_wulff, - miller_on_wulff, - e_surf_on_wulff, - ) = self._get_colors(color_set, alpha, off_color, custom_colors=custom_colors or {}) + color_list, color_proxy, color_proxy_on_wulff, miller_on_wulff, e_surf_on_wulff = self._get_colors( + color_set, alpha, off_color, custom_colors=custom_colors or {} + ) planes_data, color_scale, ticktext, tickvals = [], [], [], [] for plane in self.facets: diff --git a/pymatgen/apps/battery/insertion_battery.py b/pymatgen/apps/battery/insertion_battery.py index 6192454ee96..cee284154af 100644 --- a/pymatgen/apps/battery/insertion_battery.py +++ b/pymatgen/apps/battery/insertion_battery.py @@ -441,10 +441,7 @@ def from_entries(cls, entry1, entry2, working_ion_entry): valence_list = Element(ion_sym).oxidation_states working_ion_valence = abs(max(valence_list)) - ( - framework, - norm_charge, - ) = frame_charge_comp.get_reduced_composition_and_factor() + framework, norm_charge = frame_charge_comp.get_reduced_composition_and_factor() norm_discharge = frame_discharge_comp.get_reduced_composition_and_factor()[1] # Initialize normalized properties diff --git a/pymatgen/electronic_structure/boltztrap.py b/pymatgen/electronic_structure/boltztrap.py index e33309a737e..7068dfa6121 100644 --- a/pymatgen/electronic_structure/boltztrap.py +++ b/pymatgen/electronic_structure/boltztrap.py @@ -1931,13 +1931,7 @@ def from_files(path_dir, dos_spin=1): Returns: a BoltztrapAnalyzer object """ - ( - run_type, - warning, - efermi, - gap, - doping_levels, - ) = BoltztrapAnalyzer.parse_outputtrans(path_dir) + run_type, warning, efermi, gap, doping_levels = BoltztrapAnalyzer.parse_outputtrans(path_dir) vol = BoltztrapAnalyzer.parse_struct(path_dir) diff --git a/pymatgen/electronic_structure/boltztrap2.py b/pymatgen/electronic_structure/boltztrap2.py index 87867742210..52ebe7f363b 100644 --- a/pymatgen/electronic_structure/boltztrap2.py +++ b/pymatgen/electronic_structure/boltztrap2.py @@ -719,12 +719,9 @@ def __init__( ) # Compute the Onsager coefficients from those Fermi integrals - ( - self.Conductivity_mu, - self.Seebeck_mu, - self.Kappa_mu, - Hall_mu, - ) = BL.calc_Onsager_coefficients(L0, L1, L2, self.mu_r, temp_r, self.volume, Lm11=Lm11) + self.Conductivity_mu, self.Seebeck_mu, self.Kappa_mu, Hall_mu = BL.calc_Onsager_coefficients( + L0, L1, L2, self.mu_r, temp_r, self.volume, Lm11=Lm11 + ) # Common properties rescaling self.Conductivity_mu *= CRTA # S / m @@ -785,12 +782,7 @@ def compute_properties_doping(self, doping, temp_r=None): if temp_r is None: temp_r = self.temp_r - ( - self.Conductivity_doping, - self.Seebeck_doping, - self.Kappa_doping, - self.Carriers_conc_doping, - ) = ({}, {}, {}, {}) + self.Conductivity_doping, self.Seebeck_doping, self.Kappa_doping, self.Carriers_conc_doping = {}, {}, {}, {} self.Power_Factor_doping, self.Effective_mass_doping = {}, {} diff --git a/pymatgen/io/lobster/lobsterenv.py b/pymatgen/io/lobster/lobsterenv.py index e0155abb989..e481018f877 100644 --- a/pymatgen/io/lobster/lobsterenv.py +++ b/pymatgen/io/lobster/lobsterenv.py @@ -484,14 +484,9 @@ def get_info_cohps_to_neighbors( as given by isites and the other parameters """ # TODO: add options for orbital-resolved cohps - ( - summed_icohps, - list_icohps, - number_bonds, - labels, - atoms, - final_isites, - ) = self.get_info_icohps_to_neighbors(isites=isites, onlycation_isites=onlycation_isites) + summed_icohps, list_icohps, number_bonds, labels, atoms, final_isites = self.get_info_icohps_to_neighbors( + isites=isites, onlycation_isites=onlycation_isites + ) import tempfile @@ -720,14 +715,9 @@ def _evaluate_ce( raise ValueError("Please give two limits or leave them both at None") # find environments based on ICOHP values - ( - list_icohps, - list_keys, - list_lengths, - list_neighisite, - list_neighsite, - list_coords, - ) = self._find_environments(additional_condition, lowerlimit, upperlimit, only_bonds_to) + list_icohps, list_keys, list_lengths, list_neighisite, list_neighsite, list_coords = self._find_environments( + additional_condition, lowerlimit, upperlimit, only_bonds_to + ) self.list_icohps = list_icohps self.list_lengths = list_lengths diff --git a/pymatgen/io/lobster/outputs.py b/pymatgen/io/lobster/outputs.py index c3f5f1eb889..b8e7abd6bc5 100644 --- a/pymatgen/io/lobster/outputs.py +++ b/pymatgen/io/lobster/outputs.py @@ -762,11 +762,7 @@ def __init__(self, filename="lobsterout"): self.charge_spilling = chargespilling self.total_spilling = totalspilling - ( - elements, - basistype, - basisfunctions, - ) = self._get_elements_basistype_basisfunctions(data=data) + elements, basistype, basisfunctions = self._get_elements_basistype_basisfunctions(data=data) self.elements = elements self.basis_type = basistype self.basis_functions = basisfunctions @@ -1440,14 +1436,7 @@ def __init__(self, filename, structure): """ self.filename = filename self.structure = structure - - ( - self.grid, - self.points, - self.real, - self.imaginary, - self.distance, - ) = Wavefunction._parse_file(filename) + self.grid, self.points, self.real, self.imaginary, self.distance = Wavefunction._parse_file(filename) @staticmethod def _parse_file(filename): diff --git a/pymatgen/io/vasp/outputs.py b/pymatgen/io/vasp/outputs.py index 6eda7ffc3fc..baeb62989dc 100644 --- a/pymatgen/io/vasp/outputs.py +++ b/pymatgen/io/vasp/outputs.py @@ -1573,10 +1573,7 @@ def __init__( elif tag == "eigenvalues": self.eigenvalues = self._parse_eigen(elem) elif parse_projected_eigen and tag == "projected": - ( - self.projected_eigenvalues, - self.projected_magnetisation, - ) = self._parse_projected_eigen(elem) + self.projected_eigenvalues, self.projected_magnetisation = self._parse_projected_eigen(elem) elif tag == "structure" and elem.attrib.get("name") == "finalpos": self.final_structure = self._parse_structure(elem) self.vasp_version = self.generator["version"]