Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
rkingsbury committed Jul 18, 2024
2 parents 519c17e + d77f776 commit 191de0d
Show file tree
Hide file tree
Showing 702 changed files with 10,699 additions and 9,326 deletions.
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
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 .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ 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 '.[${{ matrix.config.extras }}]' --resolution=${{ matrix.config.resolution }}
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -40,3 +40,4 @@ venv/
ENV/
env.bak/
venv.bak/
.pdm-python
18 changes: 9 additions & 9 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,16 @@ exclude: ^(docs|tests/files|tasks.py)

ci:
autoupdate_schedule: monthly
skip: [mypy, pyright]
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.4.8
rev: v0.5.0
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 @@ -30,15 +30,15 @@ repos:
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

- repo: https://github.com/MarcoGorelli/cython-lint
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
Expand All @@ -55,13 +55,13 @@ repos:
# 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.366
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
7 changes: 3 additions & 4 deletions 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 Expand Up @@ -236,7 +235,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 @@ -308,7 +307,6 @@ def random_permutations_iterator(initial_permutation, n_permutations):
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 @@ -400,7 +398,8 @@ def random_permutations_iterator(initial_permutation, n_permutations):
else:
perms_used[some_perm] = 1
tcurrent = time.process_time()
time_left = (n_permutations - idx_perm) * (tcurrent - t0) / idx_perm # type: ignore
assert n_permutations is not None
time_left = (n_permutations - idx_perm) * (tcurrent - t0) / idx_perm
time_left = f"{time_left:.1f}"
idx_perm += 1
print(
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
25 changes: 12 additions & 13 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 All @@ -30,24 +29,24 @@ def parse_oxi_state():
oxi_data = re.sub("[\n\r]", "", oxi_data)
patt = re.compile("<tr>(.*?)</tr>", re.MULTILINE)

for m in patt.finditer(oxi_data):
line = m.group(1)
for match in patt.finditer(oxi_data):
line = match[1]
line = re.sub("</td>", "", line)
line = re.sub("(<td>)+", "<td>", line)
line = re.sub("</*a[^>]*>", "", line)
el = None
oxi_states = []
common_oxi = []
for tok in re.split("<td>", line.strip()):
m2 = re.match(r"<b>([A-Z][a-z]*)</b>", tok)
if m2:
el = m2.group(1)
match2 = re.match(r"<b>([A-Z][a-z]*)</b>", tok)
if match2:
el = match2[1]
else:
m3 = re.match(r"(<b>)*([\+\-]\d)(</b>)*", tok)
if m3:
oxi_states += [int(m3.group(2))]
if m3.group(1):
common_oxi += [int(m3.group(2))]
match3 = re.match(r"(<b>)*([\+\-]\d)(</b>)*", tok)
if match3:
oxi_states += [int(match3[2])]
if match3[1]:
common_oxi += [int(match3[2])]
if el in data:
del data[el]["Max oxidation state"]
del data[el]["Min oxidation state"]
Expand Down Expand Up @@ -79,7 +78,7 @@ def parse_ionic_radii():
ionic_radii = {}
for tok_idx in range(3, len(tokens)):
if match := re.match(r"^\s*([0-9\.]+)", tokens[tok_idx]):
ionic_radii[int(header[tok_idx])] = float(match.group(1))
ionic_radii[int(header[tok_idx])] = float(match[1])

if el in data:
data[el][f"Ionic_radii{suffix}"] = ionic_radii
Expand Down
4 changes: 2 additions & 2 deletions docs/apidoc/conf.py

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 191de0d

Please sign in to comment.