Skip to content

Commit 0d708d6

Browse files
committed
Merge branch 'master' of github.com:materialsproject/pymatgen
2 parents 00bf636 + 34f7f6e commit 0d708d6

Some content is hidden

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

48 files changed

+285
-224
lines changed
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
#!/usr/bin/env bash
2+
set -euo pipefail
3+
set -x
4+
5+
# Use a custom bin directory for easier GitHub Actions caching
6+
BIN_DIR="${1:-$PWD/opt/bin}" && mkdir -p "$BIN_DIR"
7+
8+
# Install BoltzTraP
9+
wget --no-verbose -O BoltzTraP.tar.bz2 https://owncloud.tuwien.ac.at/index.php/s/s2d55LYlZnioa3s/download
10+
tar -jxf BoltzTraP.tar.bz2
11+
cp boltztrap-1.2.5/src/{BoltzTraP,x_trans} "$BIN_DIR"
12+
13+
# Install Vampire 5.0
14+
# TODO: Accepts self-signed cert (https://github.com/richard-evans/vampire/issues/122)
15+
wget --no-verbose --no-check-certificate https://vampire.york.ac.uk/resources/release-5/vampire-5.0-linux.tar.gz
16+
tar -zxf vampire-5.0-linux.tar.gz && mv linux vampire-5.0
17+
cp vampire-5.0/vampire-serial "$BIN_DIR"
18+
19+
# Install Voro++ and ZEO++
20+
wget --no-verbose http://www.zeoplusplus.org/zeo++-0.3.tar.gz
21+
tar -xzf zeo++-0.3.tar.gz
22+
make -C zeo++-0.3/voro++/src -s CFLAGS="-w"
23+
make -C zeo++-0.3 -s CFLAGS="-w"
24+
cp zeo++-0.3/voro++/src/voro++ "$BIN_DIR"
25+
cp zeo++-0.3/network "$BIN_DIR"
26+
27+
# Install mcsqs (from ATAT)
28+
# TODO: cannot build on MacOS
29+
if [[ "$OSTYPE" == "linux-gnu"* ]]; then
30+
wget --no-verbose https://axelvandewalle.github.io/www-avdw/atat/atat3_50.tar.gz
31+
tar -zxf atat3_50.tar.gz
32+
33+
# Replace `BINDIR` in makefile
34+
sed -i "s|^BINDIR=.*|BINDIR=$BIN_DIR|" atat/makefile
35+
36+
sudo apt install csh -y -q
37+
make -C atat && make -C atat install
38+
fi
39+
40+
# Add to path
41+
echo "$BIN_DIR" >> "$GITHUB_PATH"

.github/workflows/test.yml

Lines changed: 10 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ jobs:
5656
MPLBACKEND: Agg # non-interactive backend for matplotlib
5757
PMG_MAPI_KEY: ${{ secrets.PMG_MAPI_KEY }}
5858
PYTHONWARNDEFAULTENCODING: "true" # PEP 597: Enable optional EncodingWarning
59+
OPT_BIN_DIR: ${{ github.workspace }}/opt/bin # for optional Unix dependencies
5960
steps:
6061
- name: Check out repo
6162
uses: actions/checkout@v4
@@ -94,23 +95,17 @@ jobs:
9495
pip install --upgrade matgl>=1.2.6
9596
pip install torch==2.2.0 torchdata==0.7.1
9697
97-
- name: Install optional Ubuntu and macOS dependencies
98+
- name: Restore cache for optional Ubuntu/MacOS dependencies
9899
if: matrix.config.os == 'ubuntu-latest' || matrix.config.os == 'macos-latest'
99-
run: |
100-
# Install BoltzTraP
101-
wget -q -O BoltzTraP.tar.bz2 https://owncloud.tuwien.ac.at/index.php/s/s2d55LYlZnioa3s/download
102-
tar -jxf BoltzTraP.tar.bz2 && realpath boltztrap-1.2.5/src/ >> $GITHUB_PATH
103-
104-
# Install Vampire 5.0
105-
wget -q https://vampire.york.ac.uk/resources/release-5/vampire-5.0-linux.tar.gz
106-
tar -zxf vampire-5.0-linux.tar.gz && mv linux vampire-5.0
107-
realpath vampire-5.0/ >> $GITHUB_PATH
108-
109-
# Install Voro++ and ZEO++
110-
wget -q http://www.zeoplusplus.org/zeo++-0.3.tar.gz && tar -xzf zeo++-0.3.tar.gz
100+
id: optbin-cache
101+
uses: actions/cache@v4
102+
with:
103+
path: ${{ env.OPT_BIN_DIR }}
104+
key: opt-bin-${{ runner.os }}-${{ hashFiles('.github/workflows/_install_opt_unit_deps.sh') }}
111105

112-
cd zeo++-0.3/voro++/src && make -s CFLAGS="-w" && realpath . >> $GITHUB_PATH && cd ../..
113-
make -s CFLAGS="-w" && realpath . >> $GITHUB_PATH
106+
- name: Build optional Ubuntu/MacOS dependencies (when cache misses)
107+
if: (matrix.config.os == 'ubuntu-latest' || matrix.config.os == 'macos-latest') && steps.optbin-cache.outputs.cache-hit != 'true'
108+
run: bash .github/workflows/_install_opt_unit_deps.sh "$OPT_BIN_DIR"
114109

115110
- name: pytest split ${{ matrix.split }}
116111
env:

.pre-commit-config.yaml

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

99
repos:
1010
- repo: https://github.com/astral-sh/ruff-pre-commit
11-
rev: v0.11.12
11+
rev: v0.12.2
1212
hooks:
1313
- id: ruff
1414
args: [--fix, --unsafe-fixes]
@@ -22,7 +22,7 @@ repos:
2222
- id: trailing-whitespace
2323

2424
- repo: https://github.com/pre-commit/mirrors-mypy
25-
rev: v1.16.0
25+
rev: v1.16.1
2626
hooks:
2727
- id: mypy
2828
additional_dependencies: [numpy>=1.2.5]
@@ -37,7 +37,7 @@ repos:
3737
exclude: src/pymatgen/analysis/aflow_prototypes.json
3838

3939
- repo: https://github.com/MarcoGorelli/cython-lint
40-
rev: v0.16.6
40+
rev: v0.16.7
4141
hooks:
4242
- id: cython-lint
4343
args: [--no-pycodestyle]
@@ -66,6 +66,6 @@ repos:
6666
args: [--drop-empty-cells, --keep-output]
6767

6868
- repo: https://github.com/RobertCraigie/pyright-python
69-
rev: v1.1.401
69+
rev: v1.1.402
7070
hooks:
7171
- id: pyright

dev_scripts/periodic_table_resources/_periodic_table.yaml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ Atomic no:
3535
No: 102, Lr: 103, Rf: 104, Db: 105, Sg: 106, Bh: 107, Hs: 108, Mt: 109, Ds: 110,
3636
Rg: 111, Cn: 112, Nh: 113, Fl: 114, Mc: 115, Lv: 116, Ts: 117, Og: 118}
3737
Atomic orbitals:
38+
unit: hartree
3839
data:
3940
H:
4041
1s: -0.233471
@@ -1086,7 +1087,7 @@ Boiling point:
10861087
Pb: 2022, Bi: 1837, Po: 1235, Rn: 211.3, Ra: 2010, Ac: 3573, Th: 5093, U: 4200,
10871088
Np: 4273, Pu: 3503, Am: 2880, Cm: 3383}
10881089
Brinell hardness:
1089-
unit: MN m^-2
1090+
unit: MPa
10901091
data: {Be: 600, Na: 0.69, Mg: 260, Al: 245, K: 0.363, Ca: 167, Sc: 750, Ti: 716,
10911092
V: 628, Cr: 1120, Mn: 196, Fe: 490, Co: 700, Ni: 700, Cu: 874, Zn: 412, Ga: 60,
10921093
As: 1440, Se: 736, Rb: 0.216, Y: 589, Zr: 650, Nb: 736, Mo: 1500, Ru: 2160, Rh: 1100,
@@ -2579,7 +2580,7 @@ Mineral hardness:
25792580
Re: 7.0, Os: 7.0, Ir: 6.5, Pt: 3.5, Au: 2.5, Hg: 1.5, Tl: 1.2, Pb: 1.5, Bi: 2.25,
25802581
Th: 3.0, U: 6.0}
25812582
Molar volume:
2582-
unit: cm^3
2583+
unit: cm^3 mol^-1
25832584
data: {H: 11.42, He: 21.0, Li: 13.02, Be: 4.85, B: 4.39, C: 5.29, N: 13.54, O: 17.36,
25842585
F: 11.20, Ne: 13.23, Na: 23.78, Mg: 14.00, Al: 10.00, Si: 12.06, P: 17.02, S: 15.53,
25852586
Cl: 17.39, Ar: 22.56, K: 45.94, Ca: 26.20, Sc: 15.00, Ti: 10.64, V: 8.32, Cr: 7.23,
@@ -4156,7 +4157,7 @@ Velocity of sound:
41564157
Hf: 3010, Ta: 3400, W: 5174, Re: 4700, Os: 4940, Ir: 4825, Pt: 2680, Au: 1740,
41574158
Hg: 1407, Tl: 818, Pb: 1260, Bi: 1790, Th: 2490, U: 3155, Pu: 2260}
41584159
Vickers hardness:
4159-
unit: MN m^-2
4160+
unit: MPa
41604161
data: {Be: 1670, B: 49000, Al: 167, Ti: 970, V: 628, Cr: 1060, Fe: 608, Co: 1043,
41614162
Ni: 638, Cu: 369, Zr: 903, Nb: 1320, Mo: 1530, Rh: 1246, Pd: 461, Ag: 251, La: 491,
41624163
Ce: 270, Pr: 400, Nd: 343, Sm: 412, Eu: 167, Gd: 570, Tb: 863, Dy: 540, Ho: 481,

dev_scripts/periodic_table_resources/elemental_properties.yaml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -244,6 +244,7 @@ Atomic no:
244244
D: 1
245245
T: 1
246246
Atomic orbitals:
247+
unit: hartree
247248
data:
248249
Ac:
249250
1s: -3443.110367
@@ -1349,7 +1350,7 @@ Boiling point:
13491350
Zn: 1180
13501351
Zr: 4682
13511352
Brinell hardness:
1352-
unit: MN m^-2
1353+
unit: MPa
13531354
data:
13541355
Ag: 24.5
13551356
Al: 245
@@ -2584,7 +2585,7 @@ Mineral hardness:
25842585
Zn: 2.5
25852586
Zr: 5.0
25862587
Molar volume:
2587-
unit: cm^3
2588+
unit: cm^3 mol^-1
25882589
data:
25892590
Ac: 22.55
25902591
Ag: 10.27
@@ -3183,7 +3184,7 @@ Velocity of sound:
31833184
Zn: 3700
31843185
Zr: 3800
31853186
Vickers hardness:
3186-
unit: MN m^-2
3187+
unit: MPa
31873188
data:
31883189
Ag: 251
31893190
Al: 167

docs/Gemfile.lock

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pyproject.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ mlp = ["matgl>=1.2.7 ; python_version<'3.13'"]
105105
numba = ["numba>=0.55"]
106106
numpy-v1 = ["numpy>=1.25.0,<2"] # Test NP1 on Windows (quite buggy ATM)
107107
optional = [
108-
"pymatgen[abinit,ase,mlp,tblite,matcalc]",
108+
"pymatgen[abinit,ase,matcalc,mlp,tblite,zeopp]",
109109
"beautifulsoup4",
110110
# PR4347: BoltzTraP2 needs to bump cmake version for spglib build
111111
# "BoltzTraP2>=24.9.4",
@@ -125,7 +125,7 @@ symmetry = ["moyopy[interface]>=0.3", "spglib>=2.5"]
125125
# https://github.com/tblite/tblite/issues/175
126126
tblite = ["tblite[ase]>=0.3.0; platform_system=='Linux' and python_version<'3.12'"]
127127
vis = ["vtk>=6.0.0"]
128-
zeopp = ["pyzeo"] # Note: requires Voro++ and Zeo++ to be installed
128+
zeopp = ["pyzeo; platform_system != 'Windows'"] # Note: requires Voro++ and Zeo++ to be installed
129129

130130
[project.scripts]
131131
pmg = "pymatgen.cli.pmg:main"

src/pymatgen/analysis/transition_state.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -347,11 +347,11 @@ def combine_neb_plots(neb_analyses, arranged_neb_analyses=False, reverse_plot=Fa
347347
)
348348

349349
if arranged_neb_analyses:
350-
neb1_energies = (
351-
neb1_energies[0 : len(neb1_energies) - 1]
352-
+ [(neb1_energies[-1] + neb2_energies[0]) / 2]
353-
+ neb2_energies[1:]
354-
)
350+
neb1_energies = [
351+
*neb1_energies[0 : len(neb1_energies) - 1],
352+
(neb1_energies[-1] + neb2_energies[0]) / 2,
353+
*neb2_energies[1:],
354+
]
355355
neb1_structures += neb2.structures[1:]
356356
neb1_forces = list(neb1_forces) + list(neb2.forces)[1:]
357357
neb1_r = list(neb1_r) + [i + neb1_r[-1] for i in list(neb2.r)[1:]]

src/pymatgen/command_line/mcsqs_caller.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@ def run_mcsqs(
146146

147147
raise RuntimeError("mcsqs exited before timeout reached")
148148

149-
except TimeoutExpired:
149+
except TimeoutExpired as exc:
150150
for process in mcsqs_find_sqs_processes:
151151
process.kill()
152152
process.communicate()
@@ -157,7 +157,7 @@ def run_mcsqs(
157157
raise RuntimeError(
158158
"mcsqs did not generate output files, "
159159
"is search_time sufficient or are number of instances too high?"
160-
)
160+
) from exc
161161

162162
process = Popen(["mcsqs", "-best"])
163163
process.communicate()
@@ -166,7 +166,7 @@ def run_mcsqs(
166166
return _parse_sqs_path(".")
167167

168168
os.chdir(original_directory)
169-
raise TimeoutError("Cluster expansion took too long.")
169+
raise TimeoutError("Cluster expansion took too long.") from exc
170170

171171

172172
def _parse_sqs_path(path) -> Sqs:

src/pymatgen/core/interface.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2816,7 +2816,7 @@ def from_slabs(
28162816
min_height = np.abs(film_max_c - film_min_c) + np.abs(sub_max_c - sub_min_c)
28172817

28182818
# Construct new lattice
2819-
abc = substrate_slab.lattice.abc[:2] + (min_height + gap + vacuum_over_film,)
2819+
abc = (*substrate_slab.lattice.abc[:2], min_height + gap + vacuum_over_film)
28202820
angles = substrate_slab.lattice.angles
28212821
lattice = Lattice.from_parameters(*abc, *angles)
28222822

0 commit comments

Comments
 (0)