Skip to content

Commit

Permalink
Merge 756013e into 0a66334
Browse files Browse the repository at this point in the history
  • Loading branch information
janosh committed Feb 1, 2023
2 parents 0a66334 + 756013e commit 5fdebc9
Show file tree
Hide file tree
Showing 144 changed files with 201 additions and 549 deletions.
10 changes: 5 additions & 5 deletions .pre-commit-config.yaml
Expand Up @@ -6,7 +6,7 @@ ci:

repos:
- repo: https://github.com/PyCQA/autoflake
rev: v2.0.0
rev: v2.0.1
hooks:
- id: autoflake

Expand All @@ -25,13 +25,13 @@ repos:
- id: trailing-whitespace

- repo: https://github.com/PyCQA/isort
rev: 5.11.4
rev: 5.12.0
hooks:
- id: isort
args: [--profile, black]

- repo: https://github.com/psf/black
rev: 22.12.0
rev: 23.1.0
hooks:
- id: black

Expand Down Expand Up @@ -65,13 +65,13 @@ repos:
args: [--ignore-words-list, 'titel,titels,reson,rute,pres,kno,coo']

- repo: https://github.com/PyCQA/pydocstyle
rev: 6.1.1
rev: 6.3.0
hooks:
- id: pydocstyle
exclude: tests

- repo: https://github.com/MarcoGorelli/cython-lint
rev: v0.10.1
rev: v0.11.1
hooks:
- id: cython-lint
args: [--no-pycodestyle]
Expand Down
1 change: 0 additions & 1 deletion dev_scripts/chemenv/equivalent_indices.py
Expand Up @@ -17,7 +17,6 @@
__date__ = "Feb 20, 2016"

if __name__ == "__main__":

cg_symbol = "O:6"
equiv_list = []

Expand Down
1 change: 0 additions & 1 deletion dev_scripts/chemenv/explicit_permutations.py
Expand Up @@ -36,7 +36,6 @@ class Algo:


if __name__ == "__main__":

# Choose the geometry
allcg = AllCoordinationGeometries()
while True:
Expand Down
Expand Up @@ -23,7 +23,6 @@
from pymatgen.analysis.chemenv.utils.coordination_geometry_utils import Plane, collinear

if __name__ == "__main__":

# Choose the geometry
allcg = AllCoordinationGeometries()
while True:
Expand Down
1 change: 0 additions & 1 deletion dev_scripts/chemenv/get_plane_permutations_optimized.py
Expand Up @@ -343,7 +343,6 @@ def random_permutations_iterator(initial_permutation, n_permutations):
t0 = time.process_time()
timeleft = "Unknown"
for indices_perm in perms_iterator:

prt1(
string=f"Perm # {iperm:d}/{npermutations:d} : "
f"{'-'.join(map(str, indices_perm))} "
Expand Down
1 change: 0 additions & 1 deletion dev_scripts/chemenv/plane_multiplicity.py
Expand Up @@ -19,7 +19,6 @@
__date__ = "Feb 20, 2016"

if __name__ == "__main__":

allcg = AllCoordinationGeometries()

cg_symbol = "I:12"
Expand Down
2 changes: 0 additions & 2 deletions dev_scripts/chemenv/test_algos.py
Expand Up @@ -30,7 +30,6 @@
__date__ = "Feb 20, 2016"

if __name__ == "__main__":

allcg = AllCoordinationGeometries()

while True:
Expand Down Expand Up @@ -68,7 +67,6 @@
iperm = 1
t1 = time.clock()
for indices_perm in perms_iterator:

lgf.setup_test_perfect_environment(cg_symbol, indices=indices_perm)

lgf.perfect_geometry = AbstractGeometry.from_cg(cg=cg)
Expand Down
2 changes: 0 additions & 2 deletions dev_scripts/chemenv/test_algos_all_geoms.py
Expand Up @@ -27,7 +27,6 @@
__date__ = "Feb 20, 2016"

if __name__ == "__main__":

allcg = AllCoordinationGeometries()

test = input('Standard ("s", all permutations for cn <= 6, 500 random permutations for cn > 6) or on demand')
Expand Down Expand Up @@ -96,7 +95,6 @@
# Loop on the permutations
iperm = 1
for indices_perm in perms_iterator:

lgf.setup_test_perfect_environment(
cg_symbol,
indices=indices_perm,
Expand Down
1 change: 0 additions & 1 deletion pymatgen/analysis/adsorption.py
Expand Up @@ -496,7 +496,6 @@ def adsorb_both_surfaces(

new_ad_slabss = []
for ad_slabs in ad_slabss:

# Find the adsorbate sites and indices in each slab
_, adsorbates, indices = False, [], []
for i, site in enumerate(ad_slabs.sites):
Expand Down
2 changes: 1 addition & 1 deletion pymatgen/analysis/bond_valence.py
Expand Up @@ -286,7 +286,7 @@ def get_valences(self, structure):
all_prob.append(prob)
full_all_prob.extend(prob.values())
vals = []
for (elsp, _) in get_z_ordered_elmap(test_site.species):
for elsp, _ in get_z_ordered_elmap(test_site.species):
val = list(prob[elsp.symbol])
# Sort valences in order of decreasing probability.
val = sorted(val, key=lambda v: -prob[elsp.symbol][v])
Expand Down
Expand Up @@ -41,7 +41,7 @@ def draw_network(env_graph, pos, ax, sg=None, periodicity_vectors=None):
ax.annotate(str(n), pos[n], ha="center", va="center", xycoords="data")
seen = {}
e = None
for (u, v, d) in env_graph.edges(data=True):
for u, v, d in env_graph.edges(data=True):
n1 = env_graph.node[u]["patch"]
n2 = env_graph.node[v]["patch"]
rad = 0.1
Expand Down Expand Up @@ -147,7 +147,7 @@ def make_supergraph(graph, multiplicity, periodicity_vectors):
edges = graph.edges(data=True, keys=True)
connecting_edges = []
other_edges = []
for (n1, n2, key, data) in edges:
for n1, n2, key, data in edges:
print(n1, n2, key, data)
if np.all(np.array(data["delta"]) == np.array(periodicity_vectors[0])):
connecting_edges.append((n1, n2, key, data))
Expand Down Expand Up @@ -457,7 +457,7 @@ def compute_periodicity_all_simple_paths_algorithm(self):
# TODO: there are some paths that appears twice for cycles, and there are some paths that should
# probably not be considered
this_path_deltas = [np.zeros(3, int)]
for (node1, node2) in [(node1, path[inode1 + 1]) for inode1, node1 in enumerate(path[:-1])]:
for node1, node2 in [(node1, path[inode1 + 1]) for inode1, node1 in enumerate(path[:-1])]:
this_path_deltas_new = []
for edge_data in self._connected_subgraph[node1][node2].values():
delta = get_delta(node1, node2, edge_data)
Expand Down Expand Up @@ -496,7 +496,7 @@ def compute_periodicity_cycle_basis(self):
mycyc = list(cyc)
mycyc.append(cyc[0])
this_cycle_deltas = [np.zeros(3, int)]
for (node1, node2) in [(node1, mycyc[inode1 + 1]) for inode1, node1 in enumerate(mycyc[:-1])]:
for node1, node2 in [(node1, mycyc[inode1 + 1]) for inode1, node1 in enumerate(mycyc[:-1])]:
this_cycle_deltas_new = []
for edge_data in self._connected_subgraph[node1][node2].values():
delta = get_delta(node1, node2, edge_data)
Expand Down
Expand Up @@ -122,7 +122,7 @@ def add_bonds(self, isite, site_neighbors_set):
break
else:
if isite == nb_index_unitcell:
for (isite1, ineighb1, data1) in existing_edges:
for isite1, ineighb1, data1 in existing_edges:
if isite1 == ineighb1:
if np.allclose(data1["delta"], nb_image_cell) or np.allclose(
data1["delta"], -nb_image_cell
Expand Down Expand Up @@ -316,7 +316,7 @@ def print_links(self):
print("Links in graph :")
for node in nodes:
print(node.isite, " is connected with : ")
for (n1, n2, data) in self.environment_subgraph().edges(node, data=True):
for n1, n2, data in self.environment_subgraph().edges(node, data=True):
if n1.isite == data["start"]:
print(
f" - {n2.isite} by {len(data['ligands'])} ligands ({data['delta'][0]} "
Expand Down
Expand Up @@ -1427,7 +1427,6 @@ def coordination_geometry_symmetry_measures_standard(
local2perfect_maps = []
perfect2local_maps = []
for iperm, perm in enumerate(algo.permutations):

local2perfect_map = {}
perfect2local_map = {}
permutations.append(perm)
Expand Down
Expand Up @@ -1266,7 +1266,6 @@ def differences_wrt(self, other):
return differences

def __eq__(self, other: object) -> bool:

if not isinstance(other, StructureEnvironments):
return NotImplemented

Expand Down
Expand Up @@ -545,7 +545,6 @@ def test_delta_csms_weight(self):
assert abs(delta_w - 1.0) < 1e-8

def test_dist_angle_area_weight(self):

surface_definition = {
"type": "standard_elliptic",
"distance_bounds": {"lower": 1.2, "upper": 1.8},
Expand Down Expand Up @@ -589,7 +588,6 @@ def test_dist_angle_area_weight(self):
assert da_area_weight.rectangle_crosses_area(d1=d1, d2=d2, a1=a1, a2=a2)

def test_dist_nb_set_weight(self):

dnbset_weight = DistanceNbSetWeight()
dnbset_weight2 = DistanceNbSetWeight(
weight_function={
Expand Down
Expand Up @@ -583,7 +583,7 @@ def maps_and_surfaces(
for cn, value in self._unique_coordinated_neighbors_parameters_indices[isite].items(): # pylint: disable=E1101
for imap, list_parameters_indices in enumerate(value):
thissurf = 0.0
for (idp, iap, iacb) in list_parameters_indices:
for idp, iap, iacb in list_parameters_indices:
if iacb in additional_conditions:
thissurf += surfaces[idp, iap]
maps_and_surfaces.append(
Expand Down Expand Up @@ -617,7 +617,7 @@ def maps_and_surfaces_bounded(self, isite, surface_calculation_options=None, add
for cn, value in self._unique_coordinated_neighbors_parameters_indices[isite].items(): # pylint: disable=E1101
for imap, list_parameters_indices in enumerate(value):
thissurf = 0.0
for (idp, iap, iacb) in list_parameters_indices:
for idp, iap, iacb in list_parameters_indices:
if iacb in additional_conditions:
thissurf += surfaces[idp, iap]
maps_and_surfaces.append(
Expand Down
2 changes: 1 addition & 1 deletion pymatgen/analysis/chemenv/utils/graph_utils.py
Expand Up @@ -56,7 +56,7 @@ def get_all_simple_paths_edges(graph, source, target, cutoff=None, data=True):
continue
node_paths.append(path)
current_edge_paths = [[]]
for (node1, node2) in [(node1, path[inode1 + 1]) for inode1, node1 in enumerate(path[:-1])]:
for node1, node2 in [(node1, path[inode1 + 1]) for inode1, node1 in enumerate(path[:-1])]:
new_edge_paths = []
for key, edge_data in graph[node1][node2].items():
for tmp_edge_path in current_edge_paths:
Expand Down
1 change: 1 addition & 0 deletions pymatgen/analysis/diffraction/core.py
Expand Up @@ -224,6 +224,7 @@ def get_unique_families(hkls):
Returns:
{hkl: multiplicity}: A dict with unique hkl and multiplicity.
"""

# TODO: Definitely can be sped up.
def is_perm(hkl1, hkl2) -> bool:
h1 = np.abs(hkl1)
Expand Down
1 change: 0 additions & 1 deletion pymatgen/analysis/diffraction/neutron.py
Expand Up @@ -140,7 +140,6 @@ def get_pattern(self, structure: Structure, scaled=True, two_theta_range=(0, 90)
# Force miller indices to be integers.
hkl = [int(round(i)) for i in hkl]
if g_hkl != 0:

d_hkl = 1 / g_hkl

# Bragg condition
Expand Down
1 change: 0 additions & 1 deletion pymatgen/analysis/diffraction/xrd.py
Expand Up @@ -214,7 +214,6 @@ def get_pattern(self, structure: Structure, scaled=True, two_theta_range=(0, 90)
# Force miller indices to be integers.
hkl = [int(round(i)) for i in hkl]
if g_hkl != 0:

# Bragg condition
theta = asin(wavelength * g_hkl / 2)

Expand Down
2 changes: 0 additions & 2 deletions pymatgen/analysis/dimensionality.py
Expand Up @@ -229,7 +229,6 @@ def rank_increase(seen, candidate):
seen_comp_vertices[comp_i].add(image_i)

for comp_j, image_j in connected_sites[comp_i]:

image_j = tuple(np.add(image_j, image_i))

if (comp_j, image_j) in seen_vertices:
Expand Down Expand Up @@ -280,7 +279,6 @@ def zero_d_graph_to_molecule_graph(bonded_structure, graph):
sites.append(site_i)

for site_j in bonded_structure.get_connected_sites(comp_i, jimage=image_i):

if (site_j.index, site_j.jimage) not in seen_indices and (
site_j.index,
site_j.jimage,
Expand Down

0 comments on commit 5fdebc9

Please sign in to comment.