diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json deleted file mode 100644 index 58b5c7371ae..00000000000 --- a/.devcontainer/devcontainer.json +++ /dev/null @@ -1,21 +0,0 @@ -{ - "image": "mcr.microsoft.com/devcontainers/universal:2", - "hostRequirements": { - "cpus": 1 // configurable up to 16 cores - }, - "waitFor": "onCreateCommand", - "updateContentCommand": "pip install -r requirements.txt", - "postCreateCommand": "pip install pymatgen", - "customizations": { - "codespaces": { - "openFiles": [".devcontainer/repro_template.ipynb"] - }, - "vscode": { - "extensions": ["ms-toolsai.jupyter", "ms-python.python"], - "settings": { - "jupyter.notebookFileRoot": "${workspaceFolder}", - "jupyter.defaultKernel": "python3" - } - } - } -} diff --git a/.devcontainer/repro_template.ipynb b/.devcontainer/repro_template.ipynb deleted file mode 100644 index 7220451def5..00000000000 --- a/.devcontainer/repro_template.ipynb +++ /dev/null @@ -1,84 +0,0 @@ -{ - "cells": [ - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "# `pymatgen` issue repro template\n", - "\n", - "[Codespaces](https://docs.github.com/codespaces/overview) enable you to effortlessly reproduce and debug Pymatgen issues.\n", - "\n", - "- Skip the hassle of environment setup\n", - "- Streamline information collection for faster issue reports\n" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [ - "# Collect Python version, pymatgen version and current date\n", - "from __future__ import annotations\n", - "\n", - "import platform\n", - "import sys\n", - "from datetime import datetime\n", - "from importlib.metadata import version\n", - "\n", - "print(f\"date: {datetime.today():%Y-%m-%d}\")\n", - "print(f\"Python version: {sys.version.split()[0]}\")\n", - "print(f\"pymatgen version: {version('pymatgen')}\")\n", - "print(f\"OS: {platform.system()} {platform.release()}\")" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Code to reproduce issue goes below\n" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [ - "# Your code to reproduce issue goes here, for example:\n", - "from pymatgen.core.structure import Molecule\n", - "\n", - "c_monox = Molecule([\"C\", \"O\"], [[0.0, 0.0, 0.0], [0.0, 0.0, 1.2]])\n", - "print(c_monox)" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "### Now share the code and outputs in a [new GitHub issue](https://github.com/materialsproject/pymatgen/issues/new?&labels=bug&template=bug_report.yaml)\n" - ] - } - ], - "metadata": { - "kernelspec": { - "display_name": "Python 3", - "language": "python", - "name": "python3" - }, - "language_info": { - "codemirror_mode": { - "name": "ipython", - "version": 3 - }, - "file_extension": ".py", - "mimetype": "text/x-python", - "name": "python", - "nbconvert_exporter": "python", - "pygments_lexer": "ipython3", - "version": "3.11.6" - } - }, - "nbformat": 4, - "nbformat_minor": 2 -} diff --git a/.github/release.yml b/.github/release.yml index 22dba0444aa..0c1827511d8 100644 --- a/.github/release.yml +++ b/.github/release.yml @@ -22,6 +22,8 @@ changelog: labels: [refactor] - title: ๐งช Tests labels: [tests] + - title: ๐งน Linting + labels: [linting] - title: ๐ Security Fixes labels: [security] - title: ๐ฅ Package Health diff --git a/.github/workflows/issue-metrics.yml b/.github/workflows/issue-metrics.yml index 484dd0effcd..4fbcdc6b066 100644 --- a/.github/workflows/issue-metrics.yml +++ b/.github/workflows/issue-metrics.yml @@ -2,7 +2,7 @@ name: Monthly issue metrics on: workflow_dispatch: schedule: - - cron: '3 2 1 * *' + - cron: "3 2 1 * *" # Run at 2:03am on the first of every month permissions: contents: read @@ -17,28 +17,28 @@ jobs: issues: write pull-requests: read steps: - - name: Get dates for last month - shell: bash - run: | - # Calculate the first day of the previous month - first_day=$(date -d "last month" +%Y-%m-01) + - name: Get dates for last month + shell: bash + run: | + # Calculate the first day of the previous month + first_day=$(date -d "last month" +%Y-%m-01) - # Calculate the last day of the previous month - last_day=$(date -d "$first_day +1 month -1 day" +%Y-%m-%d) + # Calculate the last day of the previous month + last_day=$(date -d "$first_day +1 month -1 day" +%Y-%m-%d) - #Set an environment variable with the date range - echo "$first_day..$last_day" - echo "last_month=$first_day..$last_day" >> "$GITHUB_ENV" + #Set an environment variable with the date range + echo "$first_day..$last_day" + echo "last_month=$first_day..$last_day" >> "$GITHUB_ENV" - - name: Run issue-metrics tool - uses: github/issue-metrics@v3 - env: - GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} - SEARCH_QUERY: 'repo:materialsproject/pymatgen is:issue created:${{ env.last_month }} -reason:"not planned"' + - name: Run issue-metrics tool + uses: github/issue-metrics@v3 + env: + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + SEARCH_QUERY: 'repo:materialsproject/pymatgen is:issue created:${{ env.last_month }} -reason:"not planned"' - - name: Create issue - uses: peter-evans/create-issue-from-file@v5 - with: - title: Monthly issue metrics report - token: ${{ secrets.GITHUB_TOKEN }} - content-filepath: ./issue_metrics.md + - name: Create issue + uses: peter-evans/create-issue-from-file@v5 + with: + title: Monthly issue metrics report + token: ${{ secrets.GITHUB_TOKEN }} + content-filepath: ./issue_metrics.md diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 755437a1d72..271d06eff91 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -36,7 +36,7 @@ jobs: pip install build python -m build --sdist - - uses: actions/upload-artifact@v3 + - uses: actions/upload-artifact@v4 with: path: dist/*.tar.gz @@ -45,7 +45,7 @@ jobs: strategy: matrix: os: [ubuntu-latest, macos-14, windows-latest] - python-version: ["39", "310", "311", "312"] + python-version: ["310", "311", "312"] runs-on: ${{ matrix.os }} steps: - name: Check out repo @@ -57,8 +57,9 @@ jobs: CIBW_BUILD: cp${{ matrix.python-version }}-* - name: Save artifact - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 with: + name: dist-${{ matrix.os }}-${{ matrix.python-version }} path: ./wheelhouse/*.whl release: @@ -74,9 +75,10 @@ jobs: python-version: "3.12" - name: Get build artifacts - uses: actions/download-artifact@v3 + uses: actions/download-artifact@v4 with: - name: artifact + pattern: dist-* + merge-multiple: true path: dist - name: Publish to PyPi or TestPyPI diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index b6d5930dd17..28a19a3cca7 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -1,4 +1,4 @@ -# Runs the complete test suite incl. many external command line dependencies (like Openbabel) +# Run the complete test suite incl. many external command line dependencies (like Openbabel) # as well as the pymatgen.ext package. Coverage used to be computed based on this workflow. name: Tests @@ -17,29 +17,33 @@ permissions: jobs: test: - # prevent this action from running on forks + # Prevent this action from running on forks if: github.repository == 'materialsproject/pymatgen' defaults: run: - shell: bash -l {0} # enables conda/mamba env activation by reading bash profile + shell: bash -l {0} # Enable conda/mamba env activation by reading bash profile strategy: fail-fast: false matrix: - # maximize CI coverage of different platforms and python versions while minimizing the + # Maximize CI coverage of different platforms and python versions while minimizing the # total number of jobs. We run all pytest splits with the oldest supported python - # version (currently 3.9) on windows (seems most likely to surface errors) and with + # version (currently 3.10) on windows (seems most likely to surface errors) and with # newest version (currently 3.12) on ubuntu (to get complete coverage on unix). config: - os: windows-latest - python: "3.9" + python: "3.10" resolution: highest extras: ci,optional + - os: windows-latest + python: "3.10" + resolution: highest + extras: ci,optional,numpy-v1 # Test NP1 on Windows (quite buggy ATM) - os: ubuntu-latest - python: '>3.9' + python: ">3.10" resolution: lowest-direct extras: ci,optional - os: macos-latest - python: '3.10' + python: "3.11" resolution: lowest-direct extras: ci # test with only required dependencies installed @@ -64,24 +68,38 @@ jobs: run: | micromamba create -n pmg python=${{ matrix.config.python }} --yes - - name: Install uv - run: micromamba run -n pmg pip install uv - - name: Install ubuntu-only conda dependencies if: matrix.config.os == 'ubuntu-latest' run: | - micromamba install -n pmg -c conda-forge enumlib packmol bader openbabel openff-toolkit --yes + micromamba install -n pmg -c conda-forge bader enumlib openff-toolkit packmol pygraphviz tblite --yes - - name: Install pymatgen and dependencies + - name: Install pymatgen and dependencies via uv run: | micromamba activate pmg - # TODO remove temporary fix. added since uv install torch is flaky. - # track https://github.com/astral-sh/uv/issues/1921 for resolution - pip install torch --upgrade - uv pip install numpy cython + pip install uv + + # TODO1 (use uv over pip) uv install torch is flaky, track #3826 + # TODO2 (pin torch version): DGL library (matgl) doesn't support torch > 2.2.1, + # see: https://discuss.dgl.ai/t/filenotfounderror-cannot-find-dgl-c-graphbolt-library/4302 + pip install torch==2.2.1 + uv pip install --editable '.[${{ matrix.config.extras }}]' --resolution=${{ matrix.config.resolution }} + - name: Install optional Ubuntu dependencies + if: matrix.config.os == 'ubuntu-latest' + run: | + # Install BoltzTraP + wget -q -O BoltzTraP.tar.bz2 https://owncloud.tuwien.ac.at/index.php/s/s2d55LYlZnioa3s/download + tar -jxf BoltzTraP.tar.bz2 + echo "$(realpath boltztrap-1.2.5/src/)" >> $GITHUB_PATH + + # Install Vampire 5.0 + wget -q https://vampire.york.ac.uk/resources/release-5/vampire-5.0-linux.tar.gz + tar -zxf vampire-5.0-linux.tar.gz + mv linux vampire-5.0 + echo "$(realpath vampire-5.0/)" >> $GITHUB_PATH + - name: pytest split ${{ matrix.split }} run: | micromamba activate pmg @@ -90,7 +108,7 @@ jobs: trigger_atomate2_ci: needs: test runs-on: ubuntu-latest - # only run if changes were pushed to master + # Only run if changes are pushed to master if: github.ref == 'refs/heads/master' steps: - name: Trigger Atomate2 CI diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index a911872a807..2a8967994f5 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -8,7 +8,7 @@ ci: repos: - repo: https://github.com/astral-sh/ruff-pre-commit - rev: v0.5.6 + rev: v0.6.4 hooks: - id: ruff args: [--fix, --unsafe-fixes] @@ -22,7 +22,7 @@ repos: - id: trailing-whitespace - repo: https://github.com/pre-commit/mirrors-mypy - rev: v1.11.1 + rev: v1.11.2 hooks: - id: mypy @@ -65,6 +65,6 @@ repos: args: [--drop-empty-cells, --keep-output] - repo: https://github.com/RobertCraigie/pyright-python - rev: v1.1.374 + rev: v1.1.379 hooks: - id: pyright diff --git a/ADMIN.md b/ADMIN.md index eaba471f2bf..5eb7579e143 100644 --- a/ADMIN.md +++ b/ADMIN.md @@ -16,7 +16,7 @@ The general procedure for releasing `pymatgen` comprises the following steps: ## Initial setup -Pymatgen uses [invoke](http://pyinvoke.org) to automate releases. +Pymatgen uses [invoke](https://pyinvoke.org) to automate releases. You will also need `sphinx` and `doc2dash`. ```sh diff --git a/CITATION.cff b/CITATION.cff index 84c4be022d7..dabb359948b 100644 --- a/CITATION.cff +++ b/CITATION.cff @@ -5,7 +5,7 @@ message: | In addition, some of pymatgen's functionality is based on scientific advances / principles developed by the computational materials scientists in our team. - Please refer to pymatgen's docs at http://pymatgen.org on how to cite them. + Please refer to pymatgen's docs at https://pymatgen.org on how to cite them. authors: - family-names: Ong given-names: Shyue Ping diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index f8a93d55f18..56739959a79 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -78,7 +78,7 @@ Given that `pymatgen` is intended to be a long-term code base, we adopt very str pre-commit run --all-files # ensure your entire codebase passes linters ``` -1. **Python 3**. We only support Python 3.9+. +1. **Python 3**. We only support Python 3.10+. 1. **Documentation** is required for all modules, classes and methods. In particular, the method doc strings should make clear the arguments expected and the return values. For complex algorithms (e.g., an Ewald summation), a summary of the algorithm should be provided and preferably with a link to a publication outlining the method in detail. For the above, if in doubt, please refer to the core classes in `pymatgen` for examples of what is expected. diff --git a/README.md b/README.md index c0b81ab1be0..9b48fb2154a 100644 --- a/README.md +++ b/README.md @@ -12,7 +12,7 @@ height="70"> [![codecov](https://codecov.io/gh/materialsproject/pymatgen/branch/master/graph/badge.svg?token=XC47Un1LV2)](https://codecov.io/gh/materialsproject/pymatgen) [![PyPI Downloads](https://img.shields.io/pypi/dm/pymatgen?logo=pypi&logoColor=white&color=blue&label=PyPI)](https://pypi.org/project/pymatgen) [![Conda Downloads](https://img.shields.io/conda/dn/conda-forge/pymatgen?logo=condaforge&color=blue&label=Conda)](https://anaconda.org/conda-forge/pymatgen) -[![Requires Python 3.9+](https://img.shields.io/badge/Python-3.9+-blue.svg?logo=python&logoColor=white)](https://python.org/downloads) +[![Requires Python 3.10+](https://img.shields.io/badge/Python-3.10+-blue.svg?logo=python&logoColor=white)](https://python.org/downloads) [![Paper](https://img.shields.io/badge/J.ComMatSci-2012.10.028-blue?logo=elsevier&logoColor=white)](https://doi.org/10.1016/j.commatsci.2012.10.028) @@ -63,7 +63,7 @@ If you'd like to use the latest unreleased changes on the main branch, you can i pip install -U git+https://github.com/materialsproject/pymatgen ``` -The minimum Python version is 3.9. Some extra functionality (e.g., generation of POTCARs) does require additional setup (see the [`pymatgen` docs]). +The minimum Python version is 3.10. Some extra functionality (e.g., generation of POTCARs) does require additional setup (see the [`pymatgen` docs]). ## Change Log diff --git a/dev_scripts/chemenv/explicit_permutations_plane_algorithm.py b/dev_scripts/chemenv/explicit_permutations_plane_algorithm.py index bd71080c300..6f2ec7a5d89 100644 --- a/dev_scripts/chemenv/explicit_permutations_plane_algorithm.py +++ b/dev_scripts/chemenv/explicit_permutations_plane_algorithm.py @@ -44,16 +44,14 @@ raise ValueError("Should all be separation plane") perms_on_file = f"Permutations on file in this algorithm ({len(sep_plane_algo._permutations)}) " - print(perms_on_file) - print(sep_plane_algo._permutations) + print(f"{perms_on_file}\n{sep_plane_algo._permutations}") permutations = sep_plane_algo.safe_separation_permutations( ordered_plane=sep_plane_algo.ordered_plane, ordered_point_groups=sep_plane_algo.ordered_point_groups ) sep_plane_algo._permutations = permutations - print(f"Test permutations ({len(permutations)}) :") - print(permutations) + print(f"Test permutations ({len(permutations)}):\n{permutations}") lgf = LocalGeometryFinder() lgf.setup_parameters(structure_refinement=lgf.STRUCTURE_REFINEMENT_NONE) diff --git a/dev_scripts/chemenv/get_plane_permutations_optimized.py b/dev_scripts/chemenv/get_plane_permutations_optimized.py index 1244d13e487..6a6588fe414 100644 --- a/dev_scripts/chemenv/get_plane_permutations_optimized.py +++ b/dev_scripts/chemenv/get_plane_permutations_optimized.py @@ -398,9 +398,10 @@ def random_permutations_iterator(initial_permutation, n_permutations): perms_used[some_perm] += 1 else: perms_used[some_perm] = 1 - tcurrent = time.process_time() - assert n_permutations is not None - time_left = (n_permutations - idx_perm) * (tcurrent - t0) / idx_perm + t_now = time.process_time() + if n_permutations is None: + raise ValueError(f"{n_permutations=}") + time_left = (n_permutations - idx_perm) * (t_now - t0) / idx_perm time_left = f"{time_left:.1f}" idx_perm += 1 print( diff --git a/dev_scripts/chemenv/strategies/multi_weights_strategy_parameters.py b/dev_scripts/chemenv/strategies/multi_weights_strategy_parameters.py index 495a8bb668e..a72fd0427e5 100644 --- a/dev_scripts/chemenv/strategies/multi_weights_strategy_parameters.py +++ b/dev_scripts/chemenv/strategies/multi_weights_strategy_parameters.py @@ -51,7 +51,9 @@ def __init__(self, initial_environment_symbol, expected_final_environment_symbol self.abstract_geometry = AbstractGeometry.from_cg(self.coordination_geometry) @classmethod - def simple_expansion(cls, initial_environment_symbol, expected_final_environment_symbol, neighbors_indices): + def simple_expansion( + cls, initial_environment_symbol, expected_final_environment_symbol, neighbors_indices + ) -> CoordinationEnvironmentMorphing: """Simple expansion of a coordination environment. Args: @@ -63,8 +65,8 @@ def simple_expansion(cls, initial_environment_symbol, expected_final_environment CoordinationEnvironmentMorphing """ morphing_description = [ - {"ineighbor": i_nb, "site_type": "neighbor", "expansion_origin": "central_site"} - for i_nb in neighbors_indices + {"ineighbor": nbr_idx, "site_type": "neighbor", "expansion_origin": "central_site"} + for nbr_idx in neighbors_indices ] return cls( initial_environment_symbol=initial_environment_symbol, @@ -156,11 +158,11 @@ def get_structure(self, morphing_factor): if morphing["site_type"] != "neighbor": raise ValueError(f"Key \"site_type\" is {morphing['site_type']} while it can only be neighbor") - i_site = morphing["ineighbor"] + 1 + site_idx = morphing["ineighbor"] + 1 if morphing["expansion_origin"] == "central_site": origin = bare_points[0] - vector = bare_points[i_site] - origin - coords[i_site] += vector * (morphing_factor - 1.0) + vector = bare_points[site_idx] - origin + coords[site_idx] += vector * (morphing_factor - 1.0) return Structure(lattice=lattice, species=species, coords=coords, coords_are_cartesian=True) diff --git a/dev_scripts/nist_codata.txt b/dev_scripts/nist_codata.txt index 604cfe3021d..611eeed1ef4 100644 --- a/dev_scripts/nist_codata.txt +++ b/dev_scripts/nist_codata.txt @@ -2,7 +2,7 @@ Fundamental Physical Constants --- Complete Listing - From: http://physics.nist.gov/constants + From: https://physics.nist.gov/cuu/Constants/index.html diff --git a/dev_scripts/potcar_scrambler.py b/dev_scripts/potcar_scrambler.py index 0dd2b0190fa..0cf09dc5b77 100644 --- a/dev_scripts/potcar_scrambler.py +++ b/dev_scripts/potcar_scrambler.py @@ -48,20 +48,21 @@ def __init__(self, potcars: Potcar | PotcarSingle) -> None: def _rand_float_from_str_with_prec(self, input_str: str, bloat: float = 1.5) -> float: n_prec = len(input_str.split(".")[1]) bd = max(1, bloat * abs(float(input_str))) # ensure we don't get 0 - return round(bd * np.random.rand(1)[0], n_prec) + return round(bd * np.random.default_rng().random(), n_prec) def _read_fortran_str_and_scramble(self, input_str: str, bloat: float = 1.5): input_str = input_str.strip() + rng = np.random.default_rng() if input_str.lower() in {"t", "f", "true", "false"}: - return bool(np.random.randint(2)) + return rng.choice((True, False)) if input_str.upper() == input_str.lower() and input_str[0].isnumeric(): if "." in input_str: return self._rand_float_from_str_with_prec(input_str, bloat=bloat) integer = int(input_str) fac = int(np.sign(integer)) # return int of same sign - return fac * np.random.randint(abs(max(1, int(np.ceil(bloat * integer))))) + return fac * rng.integers(abs(max(1, int(np.ceil(bloat * integer))))) try: float(input_str) return self._rand_float_from_str_with_prec(input_str, bloat=bloat) diff --git a/dev_scripts/regen_libxcfunc.py b/dev_scripts/regen_libxcfunc.py index 98f9936a5c0..7524f460030 100755 --- a/dev_scripts/regen_libxcfunc.py +++ b/dev_scripts/regen_libxcfunc.py @@ -34,10 +34,12 @@ def parse_section(section): section += [line] else: num, entry = parse_section(section) - assert num not in dct + if num in dct: + raise RuntimeError(f"{num=} should not be present in {dct=}.") dct[num] = entry section = [] - assert section == [] + if section: + raise RuntimeError(f"Expected empty section, got {section=}") return dct diff --git a/dev_scripts/update_pt_data.py b/dev_scripts/update_pt_data.py index 88f321ed712..84e93ef243d 100644 --- a/dev_scripts/update_pt_data.py +++ b/dev_scripts/update_pt_data.py @@ -20,11 +20,11 @@ except ImportError: BeautifulSoup = None -ptable_yaml_path = "periodic_table.yaml" +PTABLE_YAML_PATH = "periodic_table.yaml" def parse_oxi_state(): - data = loadfn(ptable_yaml_path) + data = loadfn(PTABLE_YAML_PATH) with open("oxidation_states.txt") as file: oxi_data = file.read() oxi_data = re.sub("[\n\r]", "", oxi_data) @@ -62,7 +62,7 @@ def parse_oxi_state(): def parse_ionic_radii(): - data = loadfn(ptable_yaml_path) + data = loadfn(PTABLE_YAML_PATH) with open("ionic_radii.csv") as file: radii_data = file.read() radii_data = radii_data.split("\r") @@ -92,7 +92,7 @@ def parse_ionic_radii(): def parse_radii(): - data = loadfn(ptable_yaml_path) + data = loadfn(PTABLE_YAML_PATH) with open("radii.csv") as file: radii_data = file.read() radii_data = radii_data.split("\r") @@ -128,7 +128,7 @@ def parse_radii(): def update_ionic_radii(): - data = loadfn(ptable_yaml_path) + data = loadfn(PTABLE_YAML_PATH) for dct in data.values(): if "Ionic_radii" in dct: @@ -147,7 +147,7 @@ def update_ionic_radii(): def parse_shannon_radii(): - data = loadfn(ptable_yaml_path) + data = loadfn(PTABLE_YAML_PATH) from openpyxl import load_workbook @@ -179,13 +179,13 @@ def parse_shannon_radii(): if el in data: data[el]["Shannon radii"] = dict(radii[el]) - dumpfn(data, ptable_yaml_path) + dumpfn(data, PTABLE_YAML_PATH) with open("../pymatgen/core/periodic_table.json", mode="w") as file: json.dump(data, file) def gen_periodic_table(): - data = loadfn(ptable_yaml_path) + data = loadfn(PTABLE_YAML_PATH) with open("../pymatgen/core/periodic_table.json", mode="w") as file: json.dump(data, file) @@ -217,14 +217,16 @@ def gen_iupac_ordering(): ([17], range(6, 1, -1)), ] # At -> F - order = sum((list(product(x, y)) for x, y in order), []) # noqa: RUF017 - iupac_ordering_dict = dict(zip([Element.from_row_and_group(row, group) for group, row in order], range(len(order)))) + order = [item for sublist in (list(product(x, y)) for x, y in order) for item in sublist] + iupac_ordering_dict = dict( + zip([Element.from_row_and_group(row, group) for group, row in order], range(len(order)), strict=True) + ) # first clean periodic table of any IUPAC ordering for el in periodic_table: periodic_table[el].pop("IUPAC ordering", None) - # now add iupac ordering + # now add IUPAC ordering for el in periodic_table: if "IUPAC ordering" in periodic_table[el]: # sanity check that we don't cover the same element twice @@ -237,7 +239,7 @@ def gen_iupac_ordering(): def add_electron_affinities(): """Update the periodic table data file with electron affinities.""" - req = requests.get("https://wikipedia.org/wiki/Electron_affinity_(data_page)", timeout=600) + req = requests.get("https://wikipedia.org/wiki/Electron_affinity_(data_page)", timeout=60) soup = BeautifulSoup(req.text, "html.parser") table = None for table in soup.find_all("table"): @@ -251,23 +253,26 @@ def add_electron_affinities(): data += [row] data.pop(0) - ea = {} + element_electron_affinities = {} max_Z = max(Element(element).Z for element in Element.__members__) for r in data: # don't want superheavy elements or less common isotopes - if int(r[0]) > max_Z or r[2] in ea: + if int(r[0]) > max_Z or r[2] in element_electron_affinities: continue temp_str = re.sub(r"[\s\(\)]", "", r[3].strip("()[]")) # hyphen-like characters used that can't be parsed by .float bytes_rep = temp_str.encode("unicode_escape").replace(b"\\u2212", b"-") - ea[r[2]] = float(bytes_rep.decode("unicode_escape")) - - Z_set = {Element.from_name(element).Z for element in ea} - assert Z_set.issuperset(range(1, 93)) # Ensure that we have data for up to U. - print(ea) + element_electron_affinities[r[2]] = float(bytes_rep.decode("unicode_escape")) + + Z_set = {Element.from_name(element).Z for element in element_electron_affinities} + # Ensure that we have data for up to Uranium + if not Z_set.issuperset(range(1, 93)): + missing_electron_affinities = set(range(1, 93)) - Z_set + raise ValueError(f"{missing_electron_affinities=}") + print(element_electron_affinities) pt = loadfn("../pymatgen/core/periodic_table.json") for key, val in pt.items(): - val["Electron affinity"] = ea.get(Element(key).long_name) + val["Electron affinity"] = element_electron_affinities.get(Element(key).long_name) dumpfn(pt, "../pymatgen/core/periodic_table.json") @@ -282,15 +287,17 @@ def add_ionization_energies(): break data = defaultdict(list) for row in table.find_all("tr"): - row = [td.get_text().strip() for td in row.find_all("td")] - if row: + if row := [td.get_text().strip() for td in row.find_all("td")]: Z = int(row[0]) val = re.sub(r"\s", "", row[8].strip("()[]")) val = None if val == "" else float(val) data[Z] += [val] print(data) - print(data[51]) - assert set(data).issuperset(range(1, 93)) # Ensure that we have data for up to U. + + # Ensure that we have data for up to U. + if not set(data).issuperset(range(1, 93)): + raise RuntimeError("Failed to get data up to Uranium") + pt = loadfn("../pymatgen/core/periodic_table.json") for key, val in pt.items(): del val["Ionization energy"] diff --git a/dev_scripts/update_spacegroup_data.py b/dev_scripts/update_spacegroup_data.py index b0f1c348ab9..3cff776f9c7 100644 --- a/dev_scripts/update_spacegroup_data.py +++ b/dev_scripts/update_spacegroup_data.py @@ -30,7 +30,7 @@ def convert_symmops_to_sg_encoding(symbol: str) -> str: Args: symbol (str): "hermann_mauguin" or "universal_h_m" key of symmops.json Returns: - symbol in the format of SYMM_DATA["space_group_encoding"] keys + str: symbol in the format of SYMM_DATA["space_group_encoding"] keys """ symbol_representation = symbol.split(":") representation = ":" + "".join(symbol_representation[1].split(" ")) if len(symbol_representation) > 1 else "" @@ -51,7 +51,7 @@ def remove_identity_from_full_hermann_mauguin(symbol: str) -> str: Args: symbol (str): "hermann_mauguin" key of symmops.json Returns: - short "hermann_mauguin" key + str: short "hermann_mauguin" key """ if symbol in ("P 1", "C 1", "P 1 "): return symbol @@ -76,13 +76,13 @@ def remove_identity_from_full_hermann_mauguin(symbol: str) -> str: SYMM_DATA["space_group_encoding"] = new_symm_data -for spg_idx, spg in enumerate(SYMM_OPS): +for spg in SYMM_OPS: if "(" in spg["hermann_mauguin"]: - SYMM_OPS[spg_idx]["hermann_mauguin"] = spg["hermann_mauguin"].split("(")[0] + spg["hermann_mauguin"] = spg["hermann_mauguin"].split("(")[0] - short_h_m = remove_identity_from_full_hermann_mauguin(SYMM_OPS[spg_idx]["hermann_mauguin"]) - SYMM_OPS[spg_idx]["short_h_m"] = convert_symmops_to_sg_encoding(short_h_m) - SYMM_OPS[spg_idx]["hermann_mauguin_u"] = convert_symmops_to_sg_encoding(spg["hermann_mauguin"]) + short_h_m = remove_identity_from_full_hermann_mauguin(spg["hermann_mauguin"]) + spg["short_h_m"] = convert_symmops_to_sg_encoding(short_h_m) + spg["hermann_mauguin_u"] = convert_symmops_to_sg_encoding(spg["hermann_mauguin"]) for spg_idx, spg in enumerate(SYMM_OPS): try: diff --git a/docs/CHANGES.md b/docs/CHANGES.md index b080903b763..f5c9e2daef0 100644 --- a/docs/CHANGES.md +++ b/docs/CHANGES.md @@ -6,15 +6,259 @@ nav_order: 4 # Changelog +## v2024.10.3 +- Enable parsing of "SCF energy" and "Total energy" from QCOutput for Q-chem 6.1.1+. (@Jaebeom-P) +- Fix dict equality check with numpy array (@DanielYang59) +- Fix usage of strict=True for zip in cp2k.outputs (@DanielYang59) +- Fix bug with species defaults (@tpurcell90) +- SLME Bug Fixes (@kavanase) + + +## v2024.9.17.1 + +- Emergency release No. 2 to fix yet another regression in chempot diagram. (Thanks @yang-ruoxi for fixing.) + +## v2024.9.17 + +- Emergency release to fix broken phase diagram plotting due to completely unnecessary refactoring. (Thanks @yang-ruoxi for fixing.) + +## v2024.9.10 + +๐ฅ **Breaking**: NumPy/Cython integer type changed from `np.long`/`np.int_` to int64 on Windows to align with NumPy 2.x, [changing the default integer type to int64 on Windows 64-bit systems](https://numpy.org/doc/stable/release/2.0.0-notes.html) in favor of the platform-dependent `np.int_` type. +Recommendation: Please explicitly declare `dtype=np.int64` when initializing a NumPy array if it's passed to a Cythonized pymatgen function like `find_points_in_spheres`. You may also want to test downstream packages with [NumPy 1.x on Windows in CI pipelines](https://numpy.org/devdocs/dev/depending_on_numpy.html#build-time-dependency). + +### ๐ Enhancements + +* Formatting customization for `PWInput` by @jsukpark in https://github.com/materialsproject/pymatgen/pull/4001 +* DOS Fingerprints enhancements by @naik-aakash in https://github.com/materialsproject/pymatgen/pull/3946 +* Add HSE-specific vdW parameters for dftd3 and dftd3-bj to MPHSERelaxSet. by @hongyi-zhao in https://github.com/materialsproject/pymatgen/pull/3955 +* Add VASP setting for the dftd4 vdW functional and extend PBE_64 support. by @hongyi-zhao in https://github.com/materialsproject/pymatgen/pull/3967 +* Add SOC & multiple `PROCAR` parsing functionalities by @kavanase in https://github.com/materialsproject/pymatgen/pull/3890 +* Add modification to aims input to match atomate2 magnetic order script by @tpurcell90 in https://github.com/materialsproject/pymatgen/pull/3878 + +### ๐ Bug Fixes + +* Ion: fix CO2- and I3- parsing errors; enhance tests by @rkingsbury in https://github.com/materialsproject/pymatgen/pull/3991 +* Fix ruff PD901 and prefer `sum` over `len`+`if` by @janosh in https://github.com/materialsproject/pymatgen/pull/4012 +* Explicitly use `int64` in Numpy/cython code to avoid OS inconsistency by @DanielYang59 in https://github.com/materialsproject/pymatgen/pull/3992 +* Update `FermiDos.get_doping()` to be more robust by @kavanase in https://github.com/materialsproject/pymatgen/pull/3879 +* Fix missing `/src` in doc links to source code by @DanielYang59 in https://github.com/materialsproject/pymatgen/pull/4032 +* Fix `LNONCOLLINEAR` match in `Outcar` parser by @DanielYang59 in https://github.com/materialsproject/pymatgen/pull/4034 +* Fix in-place `VaspInput.incar` updates having no effect if `incar` is dict (not `Incar` instance) by @janosh in https://github.com/materialsproject/pymatgen/pull/4052 +* Fix typo in `Cp2kOutput.parse_hirshfeld` `add_site_property("hirshf[i->'']eld")` by @janosh in https://github.com/materialsproject/pymatgen/pull/4055 +* Fix `apply_operation(fractional=True)` by @kavanase in https://github.com/materialsproject/pymatgen/pull/4057 + +### ๐ฅ Breaking Changes + +* Pascal-case `PMG_VASP_PSP_DIR_Error` by @janosh in https://github.com/materialsproject/pymatgen/pull/4048 + +### ๐ Documentation + +* Docstring tweaks for `io.vasp.inputs` and format tweaks for some other parts by @DanielYang59 in https://github.com/materialsproject/pymatgen/pull/3996 +* Replace HTTP URLs with HTTPS, avoid `from pytest import raises/mark` by @DanielYang59 in https://github.com/materialsproject/pymatgen/pull/4021 +* Fix incorrect attribute name in `Lobster.outputs.Cohpcar` docstring by @DanielYang59 in https://github.com/materialsproject/pymatgen/pull/4039 + +### ๐งน House-Keeping + +* Use `strict=True` with `zip` to ensure length equality by @DanielYang59 in https://github.com/materialsproject/pymatgen/pull/4011 + +### ๐ Performance + +* add LRU cache to structure matcher by @kbuma in https://github.com/materialsproject/pymatgen/pull/4036 + +### ๐ง CI + +* Install optional boltztrap, vampire and openbabel in CI by @DanielYang59 in https://github.com/materialsproject/pymatgen/pull/3985 + +### ๐ก Refactoring + +* Make AimsSpeciesFile a dataclass by @tpurcell90 in https://github.com/materialsproject/pymatgen/pull/4054 + +### ๐งช Tests + +* Remove the `skip` mark for `test_delta_func` by @njzjz in https://github.com/materialsproject/pymatgen/pull/4014 +* Recover commented out code in tests and mark with `pytest.mark.skip` instead by @DanielYang59 in https://github.com/materialsproject/pymatgen/pull/4027 +* Add unit test for `io.vasp.help` by @DanielYang59 in https://github.com/materialsproject/pymatgen/pull/4020 + +### ๐งน Linting + +* Fix failing ruff `PT001` on master by @DanielYang59 in https://github.com/materialsproject/pymatgen/pull/4003 +* Fix fixable `ruff` rules by @DanielYang59 in https://github.com/materialsproject/pymatgen/pull/4015 +* Fix `S101`, replace all `assert` in code base (except for tests) by @DanielYang59 in https://github.com/materialsproject/pymatgen/pull/4017 +* Fix `ruff` PLC0206 and PLR6104 by @janosh in https://github.com/materialsproject/pymatgen/pull/4035 + +### ๐ฅ Package Health + +* Drop Python 3.9 support by @DanielYang59 in https://github.com/materialsproject/pymatgen/pull/4009 +* Avoid importing namespace package `pymatgen` directly by @DanielYang59 in https://github.com/materialsproject/pymatgen/pull/4053 + +### ๐ท๏ธ Type Hints + +* Set `kpoints` in `from_str` method as integer in auto Gamma and Monkhorst modes by @DanielYang59 in https://github.com/materialsproject/pymatgen/pull/3994 +* Improve type annotations for `io.lobster.{lobsterenv/outputs}` by @DanielYang59 in https://github.com/materialsproject/pymatgen/pull/3887 + +### ๐คทโโ๏ธ Other Changes + +* VaspInputSet.write_input: Improve error message by @yantar92 in https://github.com/materialsproject/pymatgen/pull/3999 + +## New Contributors + +* @yantar92 made their first contribution in https://github.com/materialsproject/pymatgen/pull/3999 +* @kbuma made their first contribution in https://github.com/materialsproject/pymatgen/pull/4036 + +**Full Changelog**: https://github.com/materialsproject/pymatgen/compare/v2024.8.9...v2024.9.10 + +## v2024.8.9 + +* Revert bad split of sets.py, which broke downstream code. + +### ๐ New Features + +* Add multiwfn QTAIM parsing capabilities by @espottesmith in https://github.com/materialsproject/pymatgen/pull/3926 + +### ๐ Bug Fixes + +* Fix chemical system method for different oxidation states by @danielzuegner in https://github.com/materialsproject/pymatgen/pull/3915 +* Fix coordination number bug by @jmmshn in https://github.com/materialsproject/pymatgen/pull/3954 +* Fix Ion formula parsing bug; add more special formulas by @rkingsbury in https://github.com/materialsproject/pymatgen/pull/3942 +* Dedup `numpy`dependency in `pyproject` by @janosh in https://github.com/materialsproject/pymatgen/pull/3970 +* test_graph: add filename only to pdf list by @drew-parsons in https://github.com/materialsproject/pymatgen/pull/3972 +* Bugfix: `io.pwscf.PWInput.from_str()` by @jsukpark in https://github.com/materialsproject/pymatgen/pull/3931 +* Fix d2k function by @tpurcell90 in https://github.com/materialsproject/pymatgen/pull/3932 +* Assign frame properties to molecule/structure when indexing trajectory by @CompRhys in https://github.com/materialsproject/pymatgen/pull/3979 + +### ๐ Enhancements + +* `Element`/`Species`: order `full_electron_structure` by energy by @rkingsbury in https://github.com/materialsproject/pymatgen/pull/3944 +* Extend `CubicSupercell` transformation to also be able to look for orthorhombic cells by @JaGeo in https://github.com/materialsproject/pymatgen/pull/3938 +* Allow custom `.pmgrc.yaml` location via new `PMG_CONFIG_FILE` env var by @janosh in https://github.com/materialsproject/pymatgen/pull/3949 +* Fix MPRester tests and access phonon properties from the new API without having `mp-api` installed. by @AntObi in https://github.com/materialsproject/pymatgen/pull/3950 +* Adding Abinit magmoms from netCDF files to Structure.site_properties by @gbrunin in https://github.com/materialsproject/pymatgen/pull/3936 +* Parallel Joblib Process Entries by @CompRhys in https://github.com/materialsproject/pymatgen/pull/3933 +* Add OPTIMADE adapter by @ml-evs in https://github.com/materialsproject/pymatgen/pull/3876 +* Check Inputs to Trajectory. by @CompRhys in https://github.com/materialsproject/pymatgen/pull/3978 + +### ๐ Documentation + +* Replace expired BoltzTraP link by @DanielYang59 in https://github.com/materialsproject/pymatgen/pull/3929 +* Correct method `get_projection_on_elements` docstring under `Procar` class by @DanielYang59 in https://github.com/materialsproject/pymatgen/pull/3945 + +### ๐งน House-Keeping + +* Split VASP input sets into submodules by @janosh in https://github.com/materialsproject/pymatgen/pull/3865 + +### ๐ง CI + +* Install some optional dependencies in CI by @DanielYang59 in https://github.com/materialsproject/pymatgen/pull/3786 + +### ๐ก Refactoring + +* Fix `Incar` `check_params` for `Union` type by @DanielYang59 in https://github.com/materialsproject/pymatgen/pull/3958 + +### ๐ฅ Package Health + +* build against NPY2 by @njzjz in https://github.com/materialsproject/pymatgen/pull/3894 + +### ๐ท๏ธ Type Hints + +* Improve types for `electronic_structure.{bandstructure/cohp}` by @DanielYang59 in https://github.com/materialsproject/pymatgen/pull/3873 +* Improve types for `electronic_structure.{core/dos}` by @DanielYang59 in https://github.com/materialsproject/pymatgen/pull/3880 + +### ๐คทโโ๏ธ Other Changes + +* switch to attr access interface for transformation matrix by @tsmathis in https://github.com/materialsproject/pymatgen/pull/3964 +* Fix import sorting by @janosh in https://github.com/materialsproject/pymatgen/pull/3968 +* Don't run `issue-metrics` on forks by @ab5424 in https://github.com/materialsproject/pymatgen/pull/3962 +* Enable Ruff rule family "N" and "S" by @DanielYang59 in https://github.com/materialsproject/pymatgen/pull/3892 + +## New Contributors + +* @danielzuegner made their first contribution in https://github.com/materialsproject/pymatgen/pull/3915 +* @tsmathis made their first contribution in https://github.com/materialsproject/pymatgen/pull/3964 +* @jsukpark made their first contribution in https://github.com/materialsproject/pymatgen/pull/3931 + +**Full Changelog**: https://github.com/materialsproject/pymatgen/compare/v2024.7.18...v2024.8.8 + +## v2024.8.8 + +### ๐ New Features + +* Add multiwfn QTAIM parsing capabilities by @espottesmith in https://github.com/materialsproject/pymatgen/pull/3926 + +### ๐ Bug Fixes + +* Fix chemical system method for different oxidation states by @danielzuegner in https://github.com/materialsproject/pymatgen/pull/3915 +* Fix coordination number bug by @jmmshn in https://github.com/materialsproject/pymatgen/pull/3954 +* Fix Ion formula parsing bug; add more special formulas by @rkingsbury in https://github.com/materialsproject/pymatgen/pull/3942 +* Dedup `numpy`dependency in `pyproject` by @janosh in https://github.com/materialsproject/pymatgen/pull/3970 +* test_graph: add filename only to pdf list by @drew-parsons in https://github.com/materialsproject/pymatgen/pull/3972 +* Bugfix: `io.pwscf.PWInput.from_str()` by @jsukpark in https://github.com/materialsproject/pymatgen/pull/3931 +* Fix d2k function by @tpurcell90 in https://github.com/materialsproject/pymatgen/pull/3932 +* Assign frame properties to molecule/structure when indexing trajectory by @CompRhys in https://github.com/materialsproject/pymatgen/pull/3979 + +### ๐ Enhancements + +* `Element`/`Species`: order `full_electron_structure` by energy by @rkingsbury in https://github.com/materialsproject/pymatgen/pull/3944 +* Extend `CubicSupercell` transformation to also be able to look for orthorhombic cells by @JaGeo in https://github.com/materialsproject/pymatgen/pull/3938 +* Allow custom `.pmgrc.yaml` location via new `PMG_CONFIG_FILE` env var by @janosh in https://github.com/materialsproject/pymatgen/pull/3949 +* Fix MPRester tests and access phonon properties from the new API without having `mp-api` installed. by @AntObi in https://github.com/materialsproject/pymatgen/pull/3950 +* Adding Abinit magmoms from netCDF files to Structure.site_properties by @gbrunin in https://github.com/materialsproject/pymatgen/pull/3936 +* Parallel Joblib Process Entries by @CompRhys in https://github.com/materialsproject/pymatgen/pull/3933 +* Add OPTIMADE adapter by @ml-evs in https://github.com/materialsproject/pymatgen/pull/3876 +* Check Inputs to Trajectory. by @CompRhys in https://github.com/materialsproject/pymatgen/pull/3978 + +### ๐ Documentation + +* Replace expired BoltzTraP link by @DanielYang59 in https://github.com/materialsproject/pymatgen/pull/3929 +* Correct method `get_projection_on_elements` docstring under `Procar` class by @DanielYang59 in https://github.com/materialsproject/pymatgen/pull/3945 + +### ๐งน House-Keeping + +* Split VASP input sets into submodules by @janosh in https://github.com/materialsproject/pymatgen/pull/3865 + +### ๐ง CI + +* Install some optional dependencies in CI by @DanielYang59 in https://github.com/materialsproject/pymatgen/pull/3786 + +### ๐ก Refactoring + +* Fix `Incar` `check_params` for `Union` type by @DanielYang59 in https://github.com/materialsproject/pymatgen/pull/3958 + +### ๐ฅ Package Health + +* build against NPY2 by @njzjz in https://github.com/materialsproject/pymatgen/pull/3894 + +### ๐ท๏ธ Type Hints + +* Improve types for `electronic_structure.{bandstructure/cohp}` by @DanielYang59 in https://github.com/materialsproject/pymatgen/pull/3873 +* Improve types for `electronic_structure.{core/dos}` by @DanielYang59 in https://github.com/materialsproject/pymatgen/pull/3880 + +### ๐คทโโ๏ธ Other Changes + +* switch to attr access interface for transformation matrix by @tsmathis in https://github.com/materialsproject/pymatgen/pull/3964 +* Fix import sorting by @janosh in https://github.com/materialsproject/pymatgen/pull/3968 +* Don't run `issue-metrics` on forks by @ab5424 in https://github.com/materialsproject/pymatgen/pull/3962 +* Enable Ruff rule family "N" and "S" by @DanielYang59 in https://github.com/materialsproject/pymatgen/pull/3892 + +## New Contributors + +* @danielzuegner made their first contribution in https://github.com/materialsproject/pymatgen/pull/3915 +* @tsmathis made their first contribution in https://github.com/materialsproject/pymatgen/pull/3964 +* @jsukpark made their first contribution in https://github.com/materialsproject/pymatgen/pull/3931 + +**Full Changelog**: https://github.com/materialsproject/pymatgen/compare/v2024.7.18...v2024.8.8 + ## v2024.7.18 -- Fix `setuptools` for packaging (#3934) -- Improve Keep Redundant Spaces algorithm for PatchedPhaseDiagram (#3900) -- Add electronic structure methods for Species (#3902) -- Migrate `spglib` to new `SpglibDataset` format with version 2.5.0 (#3923) -- SpaceGroup changes (#3859) -- Add MD input set to FHI-aims (#3896) + +* Fix `setuptools` for packaging (#3934) +* Improve Keep Redundant Spaces algorithm for PatchedPhaseDiagram (#3900) +* Add electronic structure methods for Species (#3902) +* Migrate `spglib` to new `SpglibDataset` format with version 2.5.0 (#3923) +* SpaceGroup changes (#3859) +* Add MD input set to FHI-aims (#3896) ## v2024.6.10 + * Fix bug in `update_charge_from_potcar` (#3866) * Fix bug in VASP parameter parsing (@mkhorton) * Add `strict_anions` option to `MaterialsProject2020Compatibility` (@mkhorton) diff --git a/docs/Gemfile.lock b/docs/Gemfile.lock index 28610a3e6f0..cb2f0c29a5b 100644 --- a/docs/Gemfile.lock +++ b/docs/Gemfile.lock @@ -224,8 +224,8 @@ GEM rb-fsevent (0.11.2) rb-inotify (0.10.1) ffi (~> 1.0) - rexml (3.2.8) - strscan (>= 3.0.9) + rexml (3.3.6) + strscan rouge (3.26.0) ruby2_keywords (0.0.5) rubyzip (2.3.2) diff --git a/docs/addons.md b/docs/addons.md index deb635d4019..caf64c1826a 100644 --- a/docs/addons.md +++ b/docs/addons.md @@ -43,3 +43,5 @@ look at [pymatgen dependents](https://github.com/materialsproject/pymatgen/netwo * [Matbench Discovery](https://github.com/janosh/matbench-discovery): Benchmark for machine learning crystal stability prediction. * [matgl](https://github.com/materialsvirtuallab/matgl): Graph deep learning library for materials. Implements M3GNet and MEGNet in DGL and Pytorch with more to come. * [chgnet](https://github.com/CederGroupHub/chgnet): Pretrained universal neural network potential for charge-informed atomistic modeling. +* [DebyeCalculator](https://github.com/FrederikLizakJohansen/DebyeCalculator): A vectorised implementation of the Debye Scattering Equation on CPU and GPU. +* [ramannoodle](https://github.com/wolearyc/ramannoodle): Efficiently compute off-resonance Raman spectra from first principles calculations (e.g. VASP) using polynomial and ML models. diff --git a/docs/apidoc/conf.py b/docs/apidoc/conf.py index fe33a4e80b8..997b86a1608 100644 --- a/docs/apidoc/conf.py +++ b/docs/apidoc/conf.py @@ -362,4 +362,4 @@ def find_source(): # no need to be relative to core here as module includes full path. filename = info["module"].replace(".", "/") + ".py" - return f"https://github.com/materialsproject/pymatgen/blob/v{__version__}/{filename}" + return f"https://github.com/materialsproject/pymatgen/blob/v{__version__}/src/{filename}" diff --git a/docs/apidoc/pymatgen.io.aims.sets.rst b/docs/apidoc/pymatgen.io.aims.sets.rst index 29a1aafbd4f..d1e3569155c 100644 --- a/docs/apidoc/pymatgen.io.aims.sets.rst +++ b/docs/apidoc/pymatgen.io.aims.sets.rst @@ -32,3 +32,11 @@ pymatgen.io.aims.sets.core module :members: :undoc-members: :show-inheritance: + +pymatgen.io.aims.sets.magnetism module +-------------------------------------- + +.. automodule:: pymatgen.io.aims.sets.magnetism + :members: + :undoc-members: + :show-inheritance: diff --git a/docs/apidoc/pymatgen.io.rst b/docs/apidoc/pymatgen.io.rst index 0be9f8909de..9831078dc88 100644 --- a/docs/apidoc/pymatgen.io.rst +++ b/docs/apidoc/pymatgen.io.rst @@ -128,6 +128,14 @@ pymatgen.io.lmto module :undoc-members: :show-inheritance: +pymatgen.io.multiwfn module +--------------------------- + +.. automodule:: pymatgen.io.multiwfn + :members: + :undoc-members: + :show-inheritance: + pymatgen.io.nwchem module ------------------------- @@ -144,6 +152,14 @@ pymatgen.io.openff module :undoc-members: :show-inheritance: +pymatgen.io.optimade module +--------------------------- + +.. automodule:: pymatgen.io.optimade + :members: + :undoc-members: + :show-inheritance: + pymatgen.io.packmol module -------------------------- diff --git a/docs/apidoc/pymatgen.util.rst b/docs/apidoc/pymatgen.util.rst index 8a645ccb065..289365ba6f8 100644 --- a/docs/apidoc/pymatgen.util.rst +++ b/docs/apidoc/pymatgen.util.rst @@ -57,6 +57,22 @@ pymatgen.util.io\_utils module :undoc-members: :show-inheritance: +pymatgen.util.joblib module +--------------------------- + +.. automodule:: pymatgen.util.joblib + :members: + :undoc-members: + :show-inheritance: + +pymatgen.util.misc module +------------------------- + +.. automodule:: pymatgen.util.misc + :members: + :undoc-members: + :show-inheritance: + pymatgen.util.num module ------------------------ diff --git a/docs/apidoc/pymatgen.util.testing.rst b/docs/apidoc/pymatgen.util.testing.rst index 0ee4fd38001..f2d5a33c5b0 100644 --- a/docs/apidoc/pymatgen.util.testing.rst +++ b/docs/apidoc/pymatgen.util.testing.rst @@ -5,14 +5,3 @@ pymatgen.util.testing package :members: :undoc-members: :show-inheritance: - -Submodules ----------- - -pymatgen.util.testing.aims module ---------------------------------- - -.. automodule:: pymatgen.util.testing.aims - :members: - :undoc-members: - :show-inheritance: diff --git a/docs/index.md b/docs/index.md index a1e71a8ac7a..adcb6cd125d 100644 --- a/docs/index.md +++ b/docs/index.md @@ -12,7 +12,7 @@ nav_order: 1 [![codecov](https://codecov.io/gh/materialsproject/pymatgen/branch/master/graph/badge.svg?token=XC47Un1LV2)](https://codecov.io/gh/materialsproject/pymatgen) [![PyPI Downloads](https://img.shields.io/pypi/dm/pymatgen?logo=pypi&logoColor=white&color=blue&label=PyPI)](https://pypi.org/project/pymatgen) [![Conda Downloads](https://img.shields.io/conda/dn/conda-forge/pymatgen?logo=condaforge&color=blue&label=Conda)](https://anaconda.org/conda-forge/pymatgen) -[![Requires Python 3.9+](https://img.shields.io/badge/Python-3.9+-blue.svg?logo=python&logoColor=white)](https://python.org/downloads) +[![Requires Python 3.10+](https://img.shields.io/badge/Python-3.10+-blue.svg?logo=python&logoColor=white)](https://python.org/downloads) [![Paper](https://img.shields.io/badge/J.ComMatSci-2012.10.028-blue?logo=elsevier&logoColor=white)](https://doi.org/10.1016/j.commatsci.2012.10.028) Pymatgen (Python Materials Genomics) is a robust, open-source Python library for materials analysis. These are some @@ -63,8 +63,8 @@ DiffusionAnalyzer.* *The code is mightier than the pen.* -As of 2022, pymatgen supports Python 3.9 and above. Our support schedule follows closely that of the Scientific -Python software stack, i.e., when packages such as numpy drops support for Python versions, we will drop support for +As of 2024, pymatgen supports Python 3.10 and above. Our support schedule follows closely that of the Scientific +Python software stack, i.e., when packages such as NumPy drops support for Python versions, we will drop support for newer versions. Similarly, support for new Python versions will be adopted only when most of the core dependencies support the new Python versions. @@ -178,31 +178,32 @@ perform further structure manipulation or analyses. Here are some quick examples of the core capabilities and objects: ```python -import pymatgen.core as pmg +from pymatgen.core import Element, Composition, Lattice, Structure, Molecule # Integrated symmetry analysis tools from spglib from pymatgen.symmetry.analyzer import SpacegroupAnalyzer -si = pmg.Element("Si") + +si = Element("Si") si.atomic_mass # 28.0855 print(si.melting_point) # 1687.0 K -comp = pmg.Composition("Fe2O3") +comp = Composition("Fe2O3") comp.weight # 159.6882 # Note that Composition conveniently allows strings to be treated just like an Element object. comp["Fe"] # 2.0 comp.get_atomic_fraction("Fe") # 0.4 -lattice = pmg.Lattice.cubic(4.2) -structure = pmg.Structure(lattice, ["Cs", "Cl"], ...[[0, 0, 0], [0.5, 0.5, 0.5]]) +lattice = Lattice.cubic(4.2) +structure = Structure(lattice, ["Cs", "Cl"], ...[[0, 0, 0], [0.5, 0.5, 0.5]]) # structure.volume # 74.088000000000008 # structure[0] # PeriodicSite: Cs (0.0000, 0.0000, 0.0000) [0.0000, 0.0000, 0.0000] # You can create a Structure using spacegroup symmetry as well. -li2o = pmg.Structure.from_spacegroup( - "Fm-3m", pmg.Lattice.cubic(3), ["Li", "O"], [[0.25, 0.25, 0.25], [0, 0, 0]] +li2o = Structure.from_spacegroup( + "Fm-3m", Lattice.cubic(3), ["Li", "O"], [[0.25, 0.25, 0.25], [0, 0, 0]] ) finder = SpacegroupAnalyzer(structure) @@ -218,13 +219,13 @@ structure.to(filename="POSCAR") structure.to(filename="CsCl.cif") # Reading a structure is similarly easy. -structure = pmg.Structure.from_str(open("CsCl.cif").read(), fmt="cif") -structure = pmg.Structure.from_file("CsCl.cif") +structure = Structure.from_str(open("CsCl.cif").read(), fmt="cif") +structure = Structure.from_file("CsCl.cif") # Reading and writing a molecule from a file. Supports XYZ and # Gaussian input and output by default. Support for many other # formats via the optional openbabel dependency (if installed). -methane = pmg.Molecule.from_file("methane.xyz") +methane = Molecule.from_file("methane.xyz") methane.to("methane.gjf") # Pythonic API for editing Structures and Molecules (v2.9.1 onwards) diff --git a/docs/modules.html b/docs/modules.html index 45c32066fbe..841d56798bf 100644 --- a/docs/modules.html +++ b/docs/modules.html @@ -1,13 +1,15 @@ - +
- + -