Skip to content

Commit 39f15d5

Browse files
author
Shyue Ping Ong
committed
Merge branch 'master' of github.com:materialsproject/pymatgen
2 parents dd94223 + 8990032 commit 39f15d5

29 files changed

+862
-846
lines changed

.github/workflows/test.yml

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,13 @@ jobs:
7878
for pkg in cmd_line/*;
7979
do echo "$(pwd)/cmd_line/$pkg/Linux_64bit" >> "$GITHUB_PATH";
8080
done
81+
- name: Install Bader
82+
if: runner.os == 'Linux'
83+
run: |
84+
wget http://theory.cm.utexas.edu/henkelman/code/bader/download/bader_lnx_64.tar.gz
85+
tar xvzf bader_lnx_64.tar.gz
86+
sudo mv bader /usr/local/bin/
87+
continue-on-error: true
8188
- name: Install dependencies
8289
run: |
8390
python -m pip install --upgrade pip wheel
@@ -130,7 +137,9 @@ jobs:
130137
name: Install Python
131138
with:
132139
python-version: "3.10"
133-
- run: python -m pip install build
140+
- run: |
141+
python -m pip install build
142+
pip install -e .
134143
- name: Build sdist
135144
run: python -m build --sdist
136145
- uses: actions/upload-artifact@v3

.pre-commit-config.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ ci:
88

99
repos:
1010
- repo: https://github.com/astral-sh/ruff-pre-commit
11-
rev: v0.0.279
11+
rev: v0.0.281
1212
hooks:
1313
- id: ruff
1414
args: [--fix]

pymatgen/analysis/chemenv/coordination_environments/chemenv_strategies.py

Lines changed: 0 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -2024,7 +2024,6 @@ def __init__(
20242024
self.area_weight = self.w_area_has_intersection
20252025
elif weight_type == "has_intersection_smoothstep":
20262026
raise NotImplementedError
2027-
# self.area_weight = self.w_area_has_intersection_smoothstep
20282027
else:
20292028
raise ValueError(f'Weight type is {weight_type!r} while it should be "has_intersection"')
20302029
self.surface_definition = surface_definition
@@ -2064,28 +2063,6 @@ def weight(self, nb_set, structure_environments, cn_map=None, additional_info=No
20642063
additional_info=additional_info,
20652064
)
20662065

2067-
def w_area_has_intersection_smoothstep(self, nb_set, structure_environments, cn_map, additional_info):
2068-
"""Get intersection of the neighbors set area with the surface.
2069-
2070-
:param nb_set: Neighbors set.
2071-
:param structure_environments: Structure environments.
2072-
:param cn_map: Mapping index of the neighbors set.
2073-
:param additional_info: Additional information.
2074-
:return: Area intersection between neighbors set and surface.
2075-
"""
2076-
w_area = self.w_area_intersection_specific(
2077-
nb_set=nb_set,
2078-
structure_environments=structure_environments,
2079-
cn_map=cn_map,
2080-
additional_info=additional_info,
2081-
)
2082-
if w_area > 0:
2083-
if self.smoothstep_distance is not None:
2084-
w_area = w_area
2085-
if self.smoothstep_angle is not None:
2086-
w_area = w_area
2087-
return w_area
2088-
20892066
def w_area_has_intersection(self, nb_set, structure_environments, cn_map, additional_info):
20902067
"""Get intersection of the neighbors set area with the surface.
20912068

pymatgen/analysis/gb/grain.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
if TYPE_CHECKING:
2222
from numpy.typing import ArrayLike
2323

24+
from pymatgen.core.trajectory import Vector3D
2425
from pymatgen.util.typing import CompositionLike
2526

2627
# This module implements representations of grain boundaries, as well as
@@ -55,10 +56,10 @@ def __init__(
5556
lattice: np.ndarray | Lattice,
5657
species: Sequence[CompositionLike],
5758
coords: Sequence[ArrayLike],
58-
rotation_axis: tuple[float, float, float],
59+
rotation_axis: Vector3D,
5960
rotation_angle: float,
60-
gb_plane: tuple[float, float, float],
61-
join_plane: tuple[float, float, float],
61+
gb_plane: Vector3D,
62+
join_plane: Vector3D,
6263
init_cell: Structure,
6364
vacuum_thickness: float,
6465
ab_shift: tuple[float, float],

pymatgen/analysis/local_env.py

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3649,12 +3649,13 @@ def get_nn_info(self, structure: Structure, n: int):
36493649
site = structure[n]
36503650
neighbors = structure.get_neighbors(site, self.cutoff)
36513651

3652-
if self.cation_anion and hasattr(site.specie, "oxi_state"):
3652+
oxi_state = getattr(site.specie, "oxi_state", None)
3653+
if self.cation_anion and oxi_state is not None:
36533654
# filter out neighbor of like charge (except for neutral sites)
3654-
if site.specie.oxi_state >= 0:
3655+
if oxi_state >= 0:
36553656
neighbors = [n for n in neighbors if n.oxi_state <= 0]
3656-
elif site.specie.oxi_state <= 0:
3657-
neighbors = [n for n in neighbors if n.oxi_state >= 0]
3657+
elif oxi_state < 0:
3658+
neighbors = [nghbr for nghbr in neighbors if nghbr.oxi_state >= 0]
36583659

36593660
if self.use_fictive_radius:
36603661
# calculate fictive ionic radii
@@ -3882,7 +3883,8 @@ def get_nn_data(self, structure: Structure, n: int, length=None):
38823883
target = []
38833884
m_oxi = structure[n].specie.oxi_state
38843885
for site in structure:
3885-
if site.specie.oxi_state * m_oxi <= 0: # opposite charge
3886+
oxi_state = getattr(site.specie, "oxi_state", None)
3887+
if oxi_state is not None and oxi_state * m_oxi <= 0: # opposite charge
38863888
target.append(site.specie)
38873889
if not target:
38883890
raise ValueError("No valid targets for site within cation_anion constraint!")

pymatgen/analysis/wulff.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -462,7 +462,6 @@ def get_plot(
462462
ax.set_zlim([-r_range * 1.1, r_range * 1.1]) # pylint: disable=E1101
463463
# add legend
464464
if legend_on:
465-
color_proxy = color_proxy
466465
if show_area:
467466
ax.legend(
468467
color_proxy,

pymatgen/apps/battery/conversion_battery.py

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,6 @@ def from_composition_and_pd(cls, comp, pd, working_ion_symbol="Li", allow_unstab
7272
profile.reverse()
7373
if len(profile) < 2:
7474
return None
75-
working_ion_entry = working_ion_entry
7675
working_ion = working_ion_entry.composition.elements[0].symbol
7776
normalization_els = {}
7877
for el, amt in comp.items():
@@ -83,7 +82,7 @@ def from_composition_and_pd(cls, comp, pd, working_ion_symbol="Li", allow_unstab
8382
framework.pop(working_ion)
8483
framework = Composition(framework)
8584

86-
vpairs = [
85+
v_pairs = [
8786
ConversionVoltagePair.from_steps(
8887
profile[i],
8988
profile[i + 1],
@@ -94,7 +93,7 @@ def from_composition_and_pd(cls, comp, pd, working_ion_symbol="Li", allow_unstab
9493
]
9594

9695
return ConversionElectrode( # pylint: disable=E1123
97-
voltage_pairs=vpairs,
96+
voltage_pairs=v_pairs,
9897
working_ion_entry=working_ion_entry,
9998
initial_comp_formula=comp.reduced_formula,
10099
framework_formula=framework.reduced_formula,
@@ -338,26 +337,24 @@ def from_steps(cls, step1, step2, normalization_els, framework_formula):
338337
sum(curr_rxn.all_comp[i].weight * abs(curr_rxn.coeffs[i]) for i in range(len(curr_rxn.all_comp))) / 2
339338
)
340339
mass_charge = prev_mass_dischg
341-
mass_discharge = mass_discharge
342340
vol_discharge = sum(
343341
abs(curr_rxn.get_coeff(e.composition)) * e.structure.volume
344342
for e in step2["entries"]
345343
if e.composition.reduced_formula != working_ion
346344
)
347345

348-
totalcomp = Composition({})
346+
total_comp = Composition({})
349347
for comp in prev_rxn.products:
350348
if comp.reduced_formula != working_ion:
351-
totalcomp += comp * abs(prev_rxn.get_coeff(comp))
352-
frac_charge = totalcomp.get_atomic_fraction(Element(working_ion))
349+
total_comp += comp * abs(prev_rxn.get_coeff(comp))
350+
frac_charge = total_comp.get_atomic_fraction(Element(working_ion))
353351

354-
totalcomp = Composition({})
352+
total_comp = Composition({})
355353
for comp in curr_rxn.products:
356354
if comp.reduced_formula != working_ion:
357-
totalcomp += comp * abs(curr_rxn.get_coeff(comp))
358-
frac_discharge = totalcomp.get_atomic_fraction(Element(working_ion))
355+
total_comp += comp * abs(curr_rxn.get_coeff(comp))
356+
frac_discharge = total_comp.get_atomic_fraction(Element(working_ion))
359357

360-
rxn = rxn
361358
entries_charge = step1["entries"]
362359
entries_discharge = step2["entries"]
363360

0 commit comments

Comments
 (0)