Skip to content

Commit

Permalink
Merge branch 'master' into type-elec-struct
Browse files Browse the repository at this point in the history
  • Loading branch information
DanielYang59 committed Jul 1, 2024
2 parents 94ea368 + d77f776 commit cb427d7
Show file tree
Hide file tree
Showing 643 changed files with 802 additions and 1,312 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ jobs:
ruff format --check .
- name: mypy
run: mypy ${{ github.event.repository.name }}
run: mypy src

- name: pyright
run: pyright
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.4.8
rev: v0.5.0
hooks:
- id: ruff
args: [ --fix, --unsafe-fixes ]
Expand Down
1 change: 0 additions & 1 deletion dev_scripts/chemenv/explicit_permutations.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
import os

import numpy as np

from pymatgen.analysis.chemenv.coordination_environments.coordination_geometries import (
AllCoordinationGeometries,
ExplicitPermutationsAlgorithm,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
import json

import numpy as np

from pymatgen.analysis.chemenv.coordination_environments.coordination_geometries import AllCoordinationGeometries
from pymatgen.analysis.chemenv.coordination_environments.coordination_geometry_finder import (
AbstractGeometry,
Expand Down
1 change: 0 additions & 1 deletion dev_scripts/chemenv/get_plane_permutations_optimized.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@

import numpy as np
import tabulate

from pymatgen.analysis.chemenv.coordination_environments.coordination_geometries import AllCoordinationGeometries
from pymatgen.analysis.chemenv.coordination_environments.coordination_geometry_finder import (
AbstractGeometry,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@

import matplotlib.pyplot as plt
import numpy as np

from pymatgen.analysis.chemenv.coordination_environments.chemenv_strategies import (
AngleNbSetWeight,
CNBiasNbSetWeight,
Expand Down
1 change: 0 additions & 1 deletion dev_scripts/chemenv/test_algos.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
from random import shuffle

import numpy as np

from pymatgen.analysis.chemenv.coordination_environments.coordination_geometries import AllCoordinationGeometries
from pymatgen.analysis.chemenv.coordination_environments.coordination_geometry_finder import (
AbstractGeometry,
Expand Down
1 change: 0 additions & 1 deletion dev_scripts/chemenv/view_environment.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
from __future__ import annotations

import numpy as np

from pymatgen.analysis.chemenv.coordination_environments.coordination_geometries import (
SEPARATION_PLANE,
AllCoordinationGeometries,
Expand Down
1 change: 0 additions & 1 deletion dev_scripts/potcar_scrambler.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
import numpy as np
from monty.os.path import zpath
from monty.serialization import zopen

from pymatgen.core import SETTINGS
from pymatgen.io.vasp import Potcar, PotcarSingle
from pymatgen.io.vasp.sets import _load_yaml_config
Expand Down
3 changes: 1 addition & 2 deletions dev_scripts/update_pt_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,8 @@
import requests
from monty.dev import requires
from monty.serialization import dumpfn, loadfn
from ruamel import yaml

from pymatgen.core import Element, get_el_sp
from ruamel import yaml

try:
from bs4 import BeautifulSoup
Expand Down
9 changes: 4 additions & 5 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -132,8 +132,8 @@ feff_plot_dos = "pymatgen.cli.feff_plot_dos:main"
get_environment = "pymatgen.cli.get_environment:main"

[tool.setuptools.packages.find]
where = ["."]
include = ["pymatgen.*"]
where = ["src"]
include = ["pymatgen"]

[tool.setuptools.package-data]
"pymatgen.analysis" = ["*.yaml", "*.json", "*.csv"]
Expand Down Expand Up @@ -247,9 +247,8 @@ docstring-code-format = true
[tool.ruff.lint.per-file-ignores]
"__init__.py" = ["F401"]
"tests/**" = ["ANN201", "D", "PLR0124"]
"tasks.py" = ["D"]
"pymatgen/analysis/*" = ["D"]
"pymatgen/io/*" = ["D"]
"src/pymatgen/analysis/*" = ["D"]
"src/pymatgen/io/*" = ["D"]
"dev_scripts/*" = ["D"]

[tool.pytest.ini_options]
Expand Down
6 changes: 3 additions & 3 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,17 +15,17 @@
ext_modules=[
Extension(
"pymatgen.optimization.linear_assignment",
["pymatgen/optimization/linear_assignment.pyx"],
["src/pymatgen/optimization/linear_assignment.pyx"],
extra_link_args=extra_link_args,
),
Extension(
"pymatgen.util.coord_cython",
["pymatgen/util/coord_cython.pyx"],
["src/pymatgen/util/coord_cython.pyx"],
extra_link_args=extra_link_args,
),
Extension(
"pymatgen.optimization.neighbors",
["pymatgen/optimization/neighbors.pyx"],
["src/pymatgen/optimization/neighbors.pyx"],
extra_link_args=extra_link_args,
),
],
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,13 @@
from typing import TYPE_CHECKING

from monty.json import MSONable

from pymatgen.analysis.structure_matcher import ElementComparator, StructureMatcher
from pymatgen.core import get_el_sp
from pymatgen.symmetry.analyzer import SpacegroupAnalyzer

if TYPE_CHECKING:
from typing_extensions import Self

from pymatgen.core import Structure
from typing_extensions import Self


class AbstractStructureFilter(MSONable, abc.ABC):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
from warnings import warn

from monty.json import MSONable, jsanitize

from pymatgen.core.structure import Structure
from pymatgen.io.cif import CifParser
from pymatgen.io.vasp.inputs import Poscar
Expand All @@ -24,9 +23,8 @@
from collections.abc import Sequence
from typing import Any

from typing_extensions import Self

from pymatgen.alchemy.filters import AbstractStructureFilter
from typing_extensions import Self


class TransformedStructure(MSONable):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,8 @@
from collections.abc import Sequence
from typing import Callable

from typing_extensions import Self

from pymatgen.alchemy.filters import AbstractStructureFilter
from typing_extensions import Self

__author__ = "Shyue Ping Ong, Will Richards"
__copyright__ = "Copyright 2012, The Materials Project"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,6 @@
from matplotlib import patches
from matplotlib.path import Path
from monty.serialization import loadfn
from scipy.spatial import Delaunay

from pymatgen import vis
from pymatgen.analysis.local_env import VoronoiNN
from pymatgen.analysis.structure_matcher import StructureMatcher
Expand All @@ -22,13 +20,13 @@
from pymatgen.core.surface import generate_all_slabs
from pymatgen.symmetry.analyzer import SpacegroupAnalyzer
from pymatgen.util.coord import in_coord_list_pbc
from scipy.spatial import Delaunay

if TYPE_CHECKING:
import matplotlib.pyplot as plt
from numpy.typing import ArrayLike
from typing_extensions import Self

from pymatgen.core.surface import Slab
from typing_extensions import Self

__author__ = "Joseph Montoya"
__copyright__ = "Copyright 2016, The Materials Project"
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@

import networkx as nx
from monty.json import MSONable

from pymatgen.analysis.fragmenter import open_ring
from pymatgen.analysis.graphs import MoleculeGraph, MolGraphSplitError
from pymatgen.analysis.local_env import OpenBabelNN
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@

import numpy as np
from monty.serialization import loadfn

from pymatgen.core import Element, Species, get_el_sp
from pymatgen.symmetry.analyzer import SpacegroupAnalyzer

Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
from monty.json import MSONable, jsanitize
from networkx.algorithms.components import is_connected
from networkx.algorithms.traversal import bfs_tree

from pymatgen.analysis.chemenv.connectivity.environment_nodes import EnvironmentNode
from pymatgen.analysis.chemenv.utils.chemenv_errors import ChemenvError
from pymatgen.analysis.chemenv.utils.graph_utils import get_delta
Expand Down Expand Up @@ -532,7 +531,6 @@ def show_graph(
If not provided, the graph is not saved.
drawing_type (str): The type of drawing to use. Can be "internal" or "external".
"""

shown_graph = self._connected_subgraph if graph is None else graph

plt.figure()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
import logging

import numpy as np

from pymatgen.analysis.chemenv.connectivity.structure_connectivity import StructureConnectivity

__author__ = "David Waroquiers"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
import networkx as nx
import numpy as np
from monty.json import MSONable, jsanitize

from pymatgen.analysis.chemenv.connectivity.connected_components import ConnectedComponent
from pymatgen.analysis.chemenv.connectivity.environment_nodes import get_environment_node
from pymatgen.analysis.chemenv.coordination_environments.structure_environments import LightStructureEnvironments
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,6 @@

import numpy as np
from monty.json import MSONable
from scipy.stats import gmean

from pymatgen.analysis.chemenv.coordination_environments.coordination_geometries import AllCoordinationGeometries
from pymatgen.analysis.chemenv.coordination_environments.voronoi import DetailedVoronoiContainer
from pymatgen.analysis.chemenv.utils.chemenv_errors import EquivalentSiteSearchError
Expand All @@ -29,6 +27,7 @@
from pymatgen.core.operations import SymmOp
from pymatgen.core.sites import PeriodicSite
from pymatgen.symmetry.analyzer import SpacegroupAnalyzer
from scipy.stats import gmean

if TYPE_CHECKING:
from typing import ClassVar
Expand Down Expand Up @@ -403,7 +402,7 @@ def get_site_coordination_environments_fractions(
def get_site_ce_fractions_and_neighbors(self, site, full_ce_info=False, strategy_info=False):
"""
Applies the strategy to the structure_environments object in order to get coordination environments, their
fraction, csm, geometry_info, and neighbors
fraction, csm, geometry_info, and neighbors.
Args:
site: Site for which the above information is sought
Expand Down Expand Up @@ -458,7 +457,7 @@ def setup_options(self, all_options_dict):
@abc.abstractmethod
def __eq__(self, other: object) -> bool:
"""
Equality method that should be implemented for any strategy
Equality method that should be implemented for any strategy.
Args:
other: strategy to be compared with the current one
Expand Down Expand Up @@ -1122,7 +1121,6 @@ def __init__(
max_csm:
symmetry_measure_type:
"""

raise NotImplementedError("TargetedPenaltiedAbundanceChemenvStrategy not yet implemented")

super().__init__(
Expand Down Expand Up @@ -1587,6 +1585,7 @@ def get_effective_csm(
symmetry_measure_type: Type of symmetry measure to be used in the effective CSM.
max_effective_csm: Max CSM to use for the effective CSM calculation.
effective_csm_estimator_ratio_function: Ratio function to use to compute effective CSM.
Returns:
Effective CSM of a given Neighbors set.
"""
Expand Down Expand Up @@ -1951,9 +1950,7 @@ def delta_cn_specifics(
)

def as_dict(self):
"""
MSONable dict.
"""
"""MSONable dict."""
return {
"@module": type(self).__module__,
"@class": type(self).__name__,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -101,9 +101,7 @@ def as_dict(self):

@classmethod
def from_dict(cls, dct: dict) -> Self:
"""
Reconstruct ExplicitPermutationsAlgorithm from its JSON-serializable dict representation.
"""
"""Reconstruct ExplicitPermutationsAlgorithm from its JSON-serializable dict representation."""
return cls(dct["permutations"])


Expand Down
Loading

0 comments on commit cb427d7

Please sign in to comment.