Skip to content

Commit b5c7d06

Browse files
author
Shyue Ping Ong
committed
Merge branch 'master' of github.com:materialsproject/pymatgen
2 parents 259b4d3 + fa6309c commit b5c7d06

File tree

367 files changed

+9029
-14133
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

367 files changed

+9029
-14133
lines changed

.devcontainer/devcontainer.json

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
{
2+
"image": "mcr.microsoft.com/devcontainers/universal:2",
3+
"hostRequirements": {
4+
"cpus": 1 // configurable up to 16 cores
5+
},
6+
"waitFor": "onCreateCommand",
7+
"updateContentCommand": "pip install -r requirements.txt",
8+
"postCreateCommand": "pip install pymatgen",
9+
"customizations": {
10+
"codespaces": {
11+
"openFiles": [".devcontainer/repro_template.ipynb"]
12+
},
13+
"vscode": {
14+
"extensions": ["ms-toolsai.jupyter", "ms-python.python"],
15+
"settings": {
16+
"jupyter.notebookFileRoot": "${workspaceFolder}",
17+
"jupyter.defaultKernel": "python3"
18+
}
19+
}
20+
}
21+
}

.devcontainer/repro_template.ipynb

Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
{
2+
"cells": [
3+
{
4+
"cell_type": "markdown",
5+
"metadata": {},
6+
"source": [
7+
"# `pymatgen` issue repro template\n",
8+
"\n",
9+
"[Codespaces](https://docs.github.com/codespaces/overview) enable you to effortlessly reproduce and debug Pymatgen issues.\n",
10+
"\n",
11+
"- Skip the hassle of environment setup\n",
12+
"- Streamline information collection for faster issue reports\n"
13+
]
14+
},
15+
{
16+
"cell_type": "code",
17+
"execution_count": null,
18+
"metadata": {},
19+
"outputs": [],
20+
"source": [
21+
"# Collect Python version, pymatgen version and current date\n",
22+
"from __future__ import annotations\n",
23+
"\n",
24+
"import platform\n",
25+
"import sys\n",
26+
"from datetime import datetime\n",
27+
"from importlib.metadata import version\n",
28+
"\n",
29+
"print(f\"date: {datetime.today():%Y-%m-%d}\")\n",
30+
"print(f\"Python version: {sys.version.split()[0]}\")\n",
31+
"print(f\"pymatgen version: {version('pymatgen')}\")\n",
32+
"print(f\"OS: {platform.system()} {platform.release()}\")"
33+
]
34+
},
35+
{
36+
"cell_type": "markdown",
37+
"metadata": {},
38+
"source": [
39+
"## Code to reproduce issue goes below\n"
40+
]
41+
},
42+
{
43+
"cell_type": "code",
44+
"execution_count": null,
45+
"metadata": {},
46+
"outputs": [],
47+
"source": [
48+
"# Your code to reproduce issue goes here, for example:\n",
49+
"from pymatgen.core.structure import Molecule\n",
50+
"\n",
51+
"c_monox = Molecule([\"C\", \"O\"], [[0.0, 0.0, 0.0], [0.0, 0.0, 1.2]])\n",
52+
"print(c_monox)"
53+
]
54+
},
55+
{
56+
"cell_type": "markdown",
57+
"metadata": {},
58+
"source": [
59+
"### 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"
60+
]
61+
}
62+
],
63+
"metadata": {
64+
"kernelspec": {
65+
"display_name": "Python 3",
66+
"language": "python",
67+
"name": "python3"
68+
},
69+
"language_info": {
70+
"codemirror_mode": {
71+
"name": "ipython",
72+
"version": 3
73+
},
74+
"file_extension": ".py",
75+
"mimetype": "text/x-python",
76+
"name": "python",
77+
"nbconvert_exporter": "python",
78+
"pygments_lexer": "ipython3",
79+
"version": "3.11.6"
80+
}
81+
},
82+
"nbformat": 4,
83+
"nbformat_minor": 2
84+
}
Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
name: Report a Bug
2+
description: Use this template to report a Pymatgen-related bug
3+
labels: bug
4+
body:
5+
- type: markdown
6+
attributes:
7+
value: |
8+
Try GitHub Codespaces for auto environment setup and streamlined info collection:
9+
10+
[![Open in Codespaces](https://github.com/codespaces/badge.svg)](https://codespaces.new/materialsproject/pymatgen?quickstart=1)
11+
12+
- type: input
13+
id: python-version
14+
attributes:
15+
label: Python version
16+
description: Use `python --version` to get Python version
17+
placeholder: ex. Python 3.11.5
18+
validations:
19+
required: true
20+
21+
- type: input
22+
id: pmg-version
23+
attributes:
24+
label: Pymatgen version
25+
description: Use `pip show pymatgen | grep Version` to get Pymatgen version
26+
placeholder: ex. 2023.12.18
27+
validations:
28+
required: true
29+
30+
- type: input
31+
id: os
32+
attributes:
33+
label: Operating system version
34+
placeholder: ex. Ubuntu 22.04 LTS
35+
validations:
36+
required: false
37+
38+
- type: textarea
39+
id: current-behavior
40+
attributes:
41+
label: Current behavior
42+
description: What bad behavior do you see?
43+
render: Python
44+
validations:
45+
required: true
46+
47+
- type: textarea
48+
id: expected-behavior
49+
attributes:
50+
label: Expected Behavior
51+
description: What did you expect to see?
52+
validations:
53+
required: true
54+
55+
- type: textarea
56+
id: code-snippet
57+
attributes:
58+
label: Minimal example
59+
description: Please provide a minimal code snippet to reproduce this bug.
60+
render: Python
61+
validations:
62+
required: false
63+
64+
- type: textarea
65+
id: files
66+
attributes:
67+
label: Relevant files to reproduce this bug
68+
description: Please upload relevant files to help reproduce this bug, or logs if helpful.
69+
validations:
70+
required: false
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
name: Feature Request
2+
description: Use this template to request a new feature
3+
labels: enhancement
4+
body:
5+
- type: textarea
6+
id: feature
7+
attributes:
8+
label: Feature Requested
9+
description: Specify the feature and provide examples or use cases.
10+
validations:
11+
required: true
12+
13+
- type: textarea
14+
id: solution
15+
attributes:
16+
label: Proposed Solution
17+
description: Share your thoughts on how the feature could be implemented.
18+
placeholder: Implement a new method that ...
19+
validations:
20+
required: true
21+
22+
- type: textarea
23+
id: relevant
24+
attributes:
25+
label: Relevant Information
26+
description: Additional context or links for understanding or implementing the feature.
27+
placeholder: Use cases, related discussions, relevant literature, ...
28+
validations:
29+
required: false

.github/workflows/lint.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ jobs:
1616
- uses: actions/checkout@v4
1717

1818
- name: Set up Python
19-
uses: actions/setup-python@v4
19+
uses: actions/setup-python@v5
2020
with:
2121
python-version: "3.9"
2222

.github/workflows/release.yml

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ jobs:
3636
steps:
3737
- uses: actions/checkout@v4
3838
- name: Set up Python ${{ matrix.python-version }}
39-
uses: actions/setup-python@v4
39+
uses: actions/setup-python@v5
4040
with:
4141
python-version: ${{ matrix.python-version }}
4242
cache: pip
@@ -68,7 +68,11 @@ jobs:
6868
- name: Install dependencies
6969
run: |
7070
python -m pip install --upgrade pip wheel
71-
python -m pip install numpy cython packaging
71+
72+
# TODO remove next line installing ase from main branch until FrechetCellFilter is released
73+
pip install git+https://gitlab.com/ase/ase
74+
75+
python -m pip install numpy cython
7276
python -m pip install -e '.[dev,optional]'
7377
- name: pytest
7478
if: github.event_name == 'release' || (github.event_name == 'workflow_dispatch' && inputs.task == 'release')
@@ -89,7 +93,7 @@ jobs:
8993
- name: Check out repo
9094
uses: actions/checkout@v4
9195

92-
- uses: actions/setup-python@v4
96+
- uses: actions/setup-python@v5
9397
name: Install Python
9498
with:
9599
python-version: "3.11"
@@ -134,7 +138,7 @@ jobs:
134138
id-token: write
135139
steps:
136140
- name: Set up Python 3.11
137-
uses: actions/setup-python@v4
141+
uses: actions/setup-python@v5
138142
with:
139143
python-version: 3.11
140144

.github/workflows/test.yml

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ jobs:
5454
steps:
5555
- uses: actions/checkout@v4
5656
- name: Set up Python ${{ matrix.python-version }}
57-
uses: actions/setup-python@v4
57+
uses: actions/setup-python@v5
5858
with:
5959
python-version: ${{ matrix.python-version }}
6060
cache: pip
@@ -97,8 +97,11 @@ jobs:
9797
continue-on-error: true # This is not critical to succeed.
9898
- name: Install dependencies
9999
run: |
100-
python -m pip install --upgrade pip wheel
101-
python -m pip install numpy cython packaging
100+
python -m pip install numpy cython
101+
102+
# TODO remove next line installing ase from main branch until FrechetCellFilter is released
103+
pip install git+https://gitlab.com/ase/ase
104+
102105
python -m pip install -e '.[dev,optional]'
103106
104107
- name: pytest split ${{ matrix.split }}

.pre-commit-config.yaml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,10 @@ ci:
88

99
repos:
1010
- repo: https://github.com/astral-sh/ruff-pre-commit
11-
rev: v0.1.7
11+
rev: v0.1.14
1212
hooks:
1313
- id: ruff
14-
args: [--fix]
14+
args: [--fix, --unsafe-fixes]
1515
- id: ruff-format
1616

1717
- repo: https://github.com/pre-commit/pre-commit-hooks
@@ -22,7 +22,7 @@ repos:
2222
- id: trailing-whitespace
2323

2424
- repo: https://github.com/pre-commit/mirrors-mypy
25-
rev: v1.7.1
25+
rev: v1.8.0
2626
hooks:
2727
- id: mypy
2828

@@ -47,7 +47,7 @@ repos:
4747
- id: blacken-docs
4848

4949
- repo: https://github.com/igorshubovych/markdownlint-cli
50-
rev: v0.37.0
50+
rev: v0.38.0
5151
hooks:
5252
- id: markdownlint
5353
# MD013: line too long

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ height="70">
1313
[![PyPI Downloads](https://img.shields.io/pypi/dm/pymatgen?logo=pypi&logoColor=white&color=blue&label=PyPI)](https://pypi.org/project/pymatgen)
1414
[![Conda Downloads](https://img.shields.io/conda/dn/conda-forge/pymatgen?logo=condaforge&color=blue&label=Conda)](https://anaconda.org/conda-forge/pymatgen)
1515
[![Requires Python 3.9+](https://img.shields.io/badge/Python-3.9+-blue.svg?logo=python&logoColor=white)](https://python.org/downloads)
16-
[![arXiv](https://img.shields.io/badge/J.ComMatSci-2012.10.028-blue)](https://doi.org/10.1016/j.commatsci.2012.10.028)
16+
[![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)
1717

1818
</h4>
1919

@@ -67,7 +67,7 @@ The minimum Python version is 3.9. Some extra functionality (e.g., generation of
6767

6868
## Change Log
6969

70-
Please check [GitHub releases](https://github.com/materialsproject/pymatgen/releases) and [commit history](https://github.com/materialsproject/pymatgen/commits/master) for the latest changes. A legacy changelog is still up at <https://pymatgen.org/change_log>.
70+
See [GitHub releases](https://github.com/materialsproject/pymatgen/releases), [`docs/CHANGES.md`](docs/CHANGES.md) or [commit history](https://github.com/materialsproject/pymatgen/commits/master) in increasing order of details.
7171

7272
## Using pymatgen
7373

dev_scripts/chemenv/explicit_permutations.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,11 +34,11 @@ class Algo:
3434

3535
if __name__ == "__main__":
3636
# Choose the geometry
37-
allcg = AllCoordinationGeometries()
37+
all_cg = AllCoordinationGeometries()
3838
while True:
3939
cg_symbol = input("Enter symbol of the geometry for which you want to get the explicit permutations : ")
4040
try:
41-
cg = allcg[cg_symbol]
41+
cg = all_cg[cg_symbol]
4242
break
4343
except LookupError:
4444
print("Wrong geometry, try again ...")
@@ -93,5 +93,5 @@ class Algo:
9393
cg._algorithms = [ExplicitPermutationsAlgorithm(permutations=explicit_permutations)]
9494
new_geom_dir = "new_geometry_files"
9595
os.makedirs(new_geom_dir, exist_ok=True)
96-
with open(f"{new_geom_dir}/{cg_symbol}.json", "w") as f:
97-
json.dump(cg.as_dict(), f)
96+
with open(f"{new_geom_dir}/{cg_symbol}.json", mode="w") as file:
97+
json.dump(cg.as_dict(), file)

0 commit comments

Comments
 (0)