Skip to content

Commit

Permalink
Merge branch 'master' of github.com:materialsproject/pymatgen
Browse files Browse the repository at this point in the history
  • Loading branch information
shyuep committed Jul 31, 2023
2 parents 9d71b3e + d35e1ec commit 71b7aec
Show file tree
Hide file tree
Showing 27 changed files with 587 additions and 599 deletions.
7 changes: 7 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,13 @@ jobs:
for pkg in cmd_line/*;
do echo "$(pwd)/cmd_line/$pkg/Linux_64bit" >> "$GITHUB_PATH";
done
- name: Install Bader
if: runner.os == 'Linux'
run: |
wget http://theory.cm.utexas.edu/henkelman/code/bader/download/bader_lnx_64.tar.gz
tar xvzf bader_lnx_64.tar.gz
sudo mv bader /usr/local/bin/
continue-on-error: true
- name: Install dependencies
run: |
python -m pip install --upgrade pip wheel
Expand Down
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ ci:

repos:
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.0.279
rev: v0.0.281
hooks:
- id: ruff
args: [--fix]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2024,7 +2024,6 @@ def __init__(
self.area_weight = self.w_area_has_intersection
elif weight_type == "has_intersection_smoothstep":
raise NotImplementedError
# self.area_weight = self.w_area_has_intersection_smoothstep
else:
raise ValueError(f'Weight type is {weight_type!r} while it should be "has_intersection"')
self.surface_definition = surface_definition
Expand Down Expand Up @@ -2064,28 +2063,6 @@ def weight(self, nb_set, structure_environments, cn_map=None, additional_info=No
additional_info=additional_info,
)

def w_area_has_intersection_smoothstep(self, nb_set, structure_environments, cn_map, additional_info):
"""Get intersection of the neighbors set area with the surface.
:param nb_set: Neighbors set.
:param structure_environments: Structure environments.
:param cn_map: Mapping index of the neighbors set.
:param additional_info: Additional information.
:return: Area intersection between neighbors set and surface.
"""
w_area = self.w_area_intersection_specific(
nb_set=nb_set,
structure_environments=structure_environments,
cn_map=cn_map,
additional_info=additional_info,
)
if w_area > 0:
if self.smoothstep_distance is not None:
w_area = w_area
if self.smoothstep_angle is not None:
w_area = w_area
return w_area

def w_area_has_intersection(self, nb_set, structure_environments, cn_map, additional_info):
"""Get intersection of the neighbors set area with the surface.
Expand Down
7 changes: 4 additions & 3 deletions pymatgen/analysis/gb/grain.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
if TYPE_CHECKING:
from numpy.typing import ArrayLike

from pymatgen.core.trajectory import Vector3D
from pymatgen.util.typing import CompositionLike

# This module implements representations of grain boundaries, as well as
Expand Down Expand Up @@ -55,10 +56,10 @@ def __init__(
lattice: np.ndarray | Lattice,
species: Sequence[CompositionLike],
coords: Sequence[ArrayLike],
rotation_axis: tuple[float, float, float],
rotation_axis: Vector3D,
rotation_angle: float,
gb_plane: tuple[float, float, float],
join_plane: tuple[float, float, float],
gb_plane: Vector3D,
join_plane: Vector3D,
init_cell: Structure,
vacuum_thickness: float,
ab_shift: tuple[float, float],
Expand Down
1 change: 0 additions & 1 deletion pymatgen/analysis/wulff.py
Original file line number Diff line number Diff line change
Expand Up @@ -462,7 +462,6 @@ def get_plot(
ax.set_zlim([-r_range * 1.1, r_range * 1.1]) # pylint: disable=E1101
# add legend
if legend_on:
color_proxy = color_proxy
if show_area:
ax.legend(
color_proxy,
Expand Down
19 changes: 8 additions & 11 deletions pymatgen/apps/battery/conversion_battery.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,6 @@ def from_composition_and_pd(cls, comp, pd, working_ion_symbol="Li", allow_unstab
profile.reverse()
if len(profile) < 2:
return None
working_ion_entry = working_ion_entry
working_ion = working_ion_entry.composition.elements[0].symbol
normalization_els = {}
for el, amt in comp.items():
Expand All @@ -83,7 +82,7 @@ def from_composition_and_pd(cls, comp, pd, working_ion_symbol="Li", allow_unstab
framework.pop(working_ion)
framework = Composition(framework)

vpairs = [
v_pairs = [
ConversionVoltagePair.from_steps(
profile[i],
profile[i + 1],
Expand All @@ -94,7 +93,7 @@ def from_composition_and_pd(cls, comp, pd, working_ion_symbol="Li", allow_unstab
]

return ConversionElectrode( # pylint: disable=E1123
voltage_pairs=vpairs,
voltage_pairs=v_pairs,
working_ion_entry=working_ion_entry,
initial_comp_formula=comp.reduced_formula,
framework_formula=framework.reduced_formula,
Expand Down Expand Up @@ -338,26 +337,24 @@ def from_steps(cls, step1, step2, normalization_els, framework_formula):
sum(curr_rxn.all_comp[i].weight * abs(curr_rxn.coeffs[i]) for i in range(len(curr_rxn.all_comp))) / 2
)
mass_charge = prev_mass_dischg
mass_discharge = mass_discharge
vol_discharge = sum(
abs(curr_rxn.get_coeff(e.composition)) * e.structure.volume
for e in step2["entries"]
if e.composition.reduced_formula != working_ion
)

totalcomp = Composition({})
total_comp = Composition({})
for comp in prev_rxn.products:
if comp.reduced_formula != working_ion:
totalcomp += comp * abs(prev_rxn.get_coeff(comp))
frac_charge = totalcomp.get_atomic_fraction(Element(working_ion))
total_comp += comp * abs(prev_rxn.get_coeff(comp))
frac_charge = total_comp.get_atomic_fraction(Element(working_ion))

totalcomp = Composition({})
total_comp = Composition({})
for comp in curr_rxn.products:
if comp.reduced_formula != working_ion:
totalcomp += comp * abs(curr_rxn.get_coeff(comp))
frac_discharge = totalcomp.get_atomic_fraction(Element(working_ion))
total_comp += comp * abs(curr_rxn.get_coeff(comp))
frac_discharge = total_comp.get_atomic_fraction(Element(working_ion))

rxn = rxn
entries_charge = step1["entries"]
entries_discharge = step2["entries"]

Expand Down
Loading

0 comments on commit 71b7aec

Please sign in to comment.