Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WIP: Adding support for reading vaspwave.h5 in Wavecar and Chgcar class #3768

Open
wants to merge 8 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
16 changes: 16 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# https://editorconfig.org/
root = true

# Default settings for all files.
[*]
end_of_line = lf
insert_final_newline = true
charset = utf-8
indent_style = space
indent_size = 4
trim_trailing_whitespace = true
max_line_length = 120

# Set indent size for json and YAML files.
[*.{json,yml,yaml}]
indent_size = 2
1 change: 0 additions & 1 deletion .gitattributes
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
# declare HTML, rST and test files as vendored/docs to exclude them when calculating repo languages on GitHub
tests/files/**/* linguist-vendored
cmd_line/* linguist-vendored
docs/**/* linguist-generated
dev_scripts/**/* linguist-vendored
2 changes: 1 addition & 1 deletion .github/code_of_conduct.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ In the interest of fostering an open and welcoming environment, we as
contributors and maintainers pledge to make participation in our project and
our community a harassment-free experience for everyone, regardless of age, body
size, disability, ethnicity, sex characteristics, gender identity and expression,
level of experience, education, socio-economic status, nationality, personal
level of experience, education, socioeconomic status, nationality, personal
appearance, race, religion, or sexual identity and orientation.

## Our Standards
Expand Down
4 changes: 2 additions & 2 deletions .github/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ changelog:
exclude:
authors: [dependabot, github-actions, pre-commit-ci]
categories:
- title: 💥 Breaking Changes
labels: [breaking]
- title: 🎉 New Features
labels: [feature]
- title: 🐛 Bug Fixes
Expand All @@ -20,8 +22,6 @@ changelog:
labels: [refactor]
- title: 🧪 Tests
labels: [tests]
- title: 💥 Breaking Changes
labels: [breaking]
- title: 🔒 Security Fixes
labels: [security]
- title: 🏥 Package Health
Expand Down
12 changes: 6 additions & 6 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,11 @@ jobs:
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.9"
python-version: '3.x'

- name: Install dependencies
run: |
pip install --upgrade ruff mypy
pip install --upgrade ruff mypy pyright
- name: ruff
run: |
Expand All @@ -31,7 +31,7 @@ jobs:
ruff format --check .
- name: mypy
run: |
mypy --version
rm -rf .mypy_cache
mypy ${{ github.event.repository.name }}
run: mypy src

- name: pyright
run: pyright
8 changes: 4 additions & 4 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ jobs:
- uses: actions/setup-python@v5
name: Install Python
with:
python-version: "3.11"
python-version: "3.12"

- name: Build sdist
run: |
Expand All @@ -45,7 +45,7 @@ jobs:
strategy:
matrix:
os: [ubuntu-latest, macos-14, windows-latest]
python-version: ["39", "310", "311"]
python-version: ["39", "310", "311", "312"]
runs-on: ${{ matrix.os }}
steps:
- name: Check out repo
Expand All @@ -68,10 +68,10 @@ jobs:
# For pypi trusted publishing
id-token: write
steps:
- name: Set up Python 3.11
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: 3.11
python-version: "3.12"

- name: Get build artifacts
uses: actions/download-artifact@v3
Expand Down
69 changes: 42 additions & 27 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,26 +25,32 @@ jobs:
strategy:
fail-fast: false
matrix:
# pytest-split automatically distributes work load so parallel jobs finish in similar time
os: [ubuntu-latest, windows-latest]
python-version: ["3.9", "3.11"]
split: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
# include/exclude is meant to 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 newest version (currently 3.11) on ubuntu (to get complete and speedy
# coverage on unix). We ignore mac-os, which is assumed to be similar to ubuntu.
exclude:
# 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
# newest version (currently 3.12) on ubuntu (to get complete coverage on unix).
config:
- os: windows-latest
python-version: "3.11"
python: "3.9"
resolution: highest
extras: ci,optional
- os: ubuntu-latest
python-version: "3.9"
python: '>3.9'
resolution: lowest-direct
extras: ci,optional
- os: macos-latest
python: '3.10'
resolution: lowest-direct
extras: ci # test with only required dependencies installed

# pytest-split automatically distributes work load so parallel jobs finish in similar time
# update durations file with `pytest --store-durations --durations-path tests/files/.pytest-split-durations`
split: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]

runs-on: ${{ matrix.os }}
runs-on: ${{ matrix.config.os }}

env:
PMG_MAPI_KEY: ${{ secrets.PMG_MAPI_KEY }}
GULP_LIB: ${{ github.workspace }}/cmd_line/gulp/Libraries
PMG_VASP_PSP_DIR: ${{ github.workspace }}/tests/files

steps:
Expand All @@ -56,18 +62,13 @@ jobs:

- name: Create mamba environment
run: |
micromamba create -n pmg python=${{ matrix.python-version }} --yes
micromamba create -n pmg python=${{ matrix.config.python }} --yes
- name: Install uv
run: micromamba run -n pmg pip install uv

- name: Copy GULP to bin
if: matrix.os == 'ubuntu-latest'
run: |
sudo cp cmd_line/gulp/Linux_64bit/* /usr/local/bin/
- name: Install ubuntu-only conda dependencies
if: matrix.os == 'ubuntu-latest'
if: matrix.config.os == 'ubuntu-latest'
run: |
micromamba install -n pmg -c conda-forge enumlib packmol bader openbabel openff-toolkit --yes
Expand All @@ -76,16 +77,30 @@ jobs:
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
pip install torch --upgrade
uv pip install numpy cython
uv pip install --editable '.[dev,optional]'
# TODO remove next line installing ase from main branch when FrechetCellFilter is released
uv pip install --upgrade 'git+https://gitlab.com/ase/ase'
uv pip install --editable '.[${{ matrix.config.extras }}]' --resolution=${{ matrix.config.resolution }}
- name: pytest split ${{ matrix.split }}
run: |
micromamba activate pmg
pytest --splits 10 --group ${{ matrix.split }} --durations-path tests/files/.pytest-split-durations tests
trigger_atomate2_ci:
needs: test
runs-on: ubuntu-latest
# only run if changes were pushed to master
if: github.ref == 'refs/heads/master'
steps:
- name: Trigger Atomate2 CI
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
curl -L \
-X POST \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" \
-H "X-GitHub-Api-Version: 2022-11-28" \
https://api.github.com/repos/materialsproject/atomate2/dispatches \
-d '{"event_type": "pymatgen-ci-trigger", "client_payload": {"pymatgen_ref": "${{ github.sha }}"}}'
5 changes: 1 addition & 4 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
__pycache__/
.DS_Store
pymatgen.egg-info
dependencies/PyCifRW-3.3/PyCifRW.egg-info
dependencies/spglib*/pyspglib.egg-info
dependencies/spglib*/build
*.o
*.so
*.pyc
Expand All @@ -26,7 +23,6 @@ setuptools*
.cache
.tox
.eggs/
gulptmp_4_1
.coverage
.*_cache
# VS Code
Expand All @@ -40,3 +36,4 @@ venv/
ENV/
env.bak/
venv.bak/
.pdm-python
36 changes: 21 additions & 15 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
exclude: ^(docs|tests/files|cmd_line|tasks.py)
exclude: ^(docs|tests/files|tasks.py)

ci:
autoupdate_schedule: monthly
skip: [mypy]
skip: [ mypy, pyright ]
autofix_commit_msg: pre-commit auto-fixes
autoupdate_commit_msg: pre-commit autoupdate

repos:
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.3.7
rev: v0.5.4
hooks:
- id: ruff
args: [--fix, --unsafe-fixes]
args: [ --fix, --unsafe-fixes ]
- id: ruff-format

- repo: https://github.com/pre-commit/pre-commit-hooks
Expand All @@ -22,43 +22,49 @@ repos:
- id: trailing-whitespace

- repo: https://github.com/pre-commit/mirrors-mypy
rev: v1.9.0
rev: v1.11.0
hooks:
- id: mypy

- repo: https://github.com/codespell-project/codespell
rev: v2.2.6
rev: v2.3.0
hooks:
- id: codespell
stages: [commit, commit-msg]
exclude_types: [html]
additional_dependencies: [tomli] # needed to read pyproject.toml below py3.11
stages: [ commit, commit-msg ]
exclude_types: [ html ]
additional_dependencies: [ tomli ] # needed to read pyproject.toml below py3.11
exclude: src/pymatgen/analysis/aflow_prototypes.json

- repo: https://github.com/MarcoGorelli/cython-lint
rev: v0.16.0
rev: v0.16.2
hooks:
- id: cython-lint
args: [--no-pycodestyle]
args: [ --no-pycodestyle ]
- id: double-quote-cython-strings

- repo: https://github.com/adamchainz/blacken-docs
rev: 1.16.0
rev: 1.18.0
hooks:
- id: blacken-docs

- repo: https://github.com/igorshubovych/markdownlint-cli
rev: v0.39.0
rev: v0.41.0
hooks:
- id: markdownlint
# MD013: line too long
# MD024: Multiple headings with the same content
# MD033: no inline HTML
# MD041: first line in a file should be a top-level heading
# MD025: single title
args: [--disable, MD013, MD024, MD025, MD033, MD041, "--"]
args: [ --disable, MD013, MD024, MD025, MD033, MD041, "--" ]

- repo: https://github.com/kynan/nbstripout
rev: 0.7.1
hooks:
- id: nbstripout
args: [--drop-empty-cells, --keep-output]
args: [ --drop-empty-cells, --keep-output ]

- repo: https://github.com/RobertCraigie/pyright-python
rev: v1.1.373
hooks:
- id: pyright
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
13 changes: 7 additions & 6 deletions dev_scripts/chemenv/get_plane_permutations_optimized.py
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@ def random_permutations_iterator(initial_permutation, n_permutations):
# Definition of the facets
all_planes_point_indices = [algo.plane_points]
if algo.other_plane_points is not None:
all_planes_point_indices.extend(algo.other_plane_points)
all_planes_point_indices += algo.other_plane_points

# Loop on the facets
explicit_permutations_per_plane = []
Expand All @@ -236,7 +236,7 @@ def random_permutations_iterator(initial_permutation, n_permutations):
sym_measures = [c["symmetry_measure"] for c in csms]
prt1(string="Continuous symmetry measures", printing_volume=printing_volume)
prt1(string=sym_measures, printing_volume=printing_volume)
csms_with_recorded_permutation = [] # type: ignore
csms_with_recorded_permutation: list = []
explicit_permutations = []
for icsm, csm in enumerate(csms):
found = False
Expand Down Expand Up @@ -305,10 +305,9 @@ def random_permutations_iterator(initial_permutation, n_permutations):
# Definition of the facets
all_planes_point_indices = [algo.plane_points]
if algo.other_plane_points is not None:
all_planes_point_indices.extend(algo.other_plane_points)
all_planes_point_indices += algo.other_plane_points

# Setup of the permutations to be used for this algorithm

indices = list(range(cg.coordination_number))
if permutations_setup_type == "all":
perms_iterator = itertools.permutations(indices)
Expand Down Expand Up @@ -399,8 +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()
time_left = (n_permutations - idx_perm) * (tcurrent - t0) / idx_perm # type: ignore
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(
Expand Down
Loading