Skip to content

Commit 3085b27

Browse files
author
Shyue Ping Ong
committed
Merge branch 'master' of github.com:materialsproject/pymatgen
2 parents efccd79 + 4c7e997 commit 3085b27

File tree

186 files changed

+2336
-2530
lines changed

Some content is hidden

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

186 files changed

+2336
-2530
lines changed

.pre-commit-config.yaml

Lines changed: 1 addition & 1 deletion
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.0.278
11+
rev: v0.0.279
1212
hooks:
1313
- id: ruff
1414
args: [--fix]

ADMIN.md

Lines changed: 10 additions & 65 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,11 @@ The general procedure for releasing `pymatgen` comprises the following
99
steps:
1010

1111
1. Make sure all CI checks are green. We don't want to release known bugs.
12-
2. Update and edit changelog.
13-
3. Release PyPI versions + doc.
14-
4. Release `conda` versions.
15-
5. Release Dash documentation.
12+
1. Update changelog.
13+
1. Run `invoke make-doc` to update the HTML docs.
14+
1. Tag the latest commit with `git tag v<yyyy.mm.dd>`.
15+
1. Make a GitHub release with auto-generated release notes.
16+
1. Make sure the release action runs that publishes the new version to PyPI and conda-forge runs to completion.
1617

1718
## Initial setup
1819

@@ -23,72 +24,29 @@ You will also need `sphinx` and `doc2dash`.
2324
pip install --upgrade invoke sphinx doc2dash
2425
```
2526

26-
Add your PyPI username and password and GITHUB_RELEASE_TOKEN into your
27-
environment:
28-
29-
```sh
30-
export TWINE_USERNAME=PYPIUSERNAME
31-
export TWINE_PASSWORD=PYPIPASSWORD
32-
export GITHUB_RELEASES_TOKEN=TOKEN_YOU_GET_FROM_GITHUB
33-
```
34-
35-
You may want to add these to your .bash_profile to avoid having to type
36-
these each time.
37-
38-
### Machine-specific issues
39-
40-
The above instructions are general, but some known issues are machine-specific:
41-
42-
- Installing lxml via pip required <span
43-
class="title-ref">STATIC_DEPS=true pip install lxml</span> on macOS
44-
10.13.
45-
- It can be useful to <span class="title-ref">pip install --upgrade pip
46-
twine setuptools</span> (this may be necessary if there are
47-
authentication errors when connecting to PyPI).
48-
- You may have to <span class="title-ref">brew install hdf5
49-
netcdf</span> or similar to be able to pip install the optional
50-
requirement <span class="title-ref">netCDF4</span>.
51-
5227
## Doing the release
5328

54-
Ensure appropriate environment variables are set including <span
55-
class="title-ref">DISCOURSE_API_USERNAME</span>, <span
56-
class="title-ref">DISCOURSE_API_KEY</span> and <span
57-
class="title-ref">GITHUB_RELEASES_TOKEN</span>.
58-
59-
First update the change log. The autogenerated change log is simply a
60-
list of commit messages since the last version. Make sure to edit the
61-
log for brevity and to attribute significant features to appropriate
62-
developers:
29+
First update the change log. The autogenerated change log is simply a list of commit messages since the last version. Make sure to edit the log for brevity and to attribute significant features to appropriate developers:
6330

6431
```sh
6532
invoke update-changelog
6633
```
6734

68-
Then, do the release with the following sequence of commands (you can
69-
put them in a bash script in your PATH somewhere):
35+
Then, do the release with the following sequence of commands (you can put them in a bash script in your PATH somewhere):
7036

7137
```sh
7238
invoke release --notest --nodoc
7339
invoke update-doc
7440
python setup.py develop
7541
```
7642

77-
Double check that the releases are properly done on Pypi. If you are
78-
releasing on a Mac, you should see a pymatgen.version.tar.gz and two
79-
wheels (Py37 and P). There will be a py37 wheel for Windows that is
80-
generated by Appveyor.
43+
Double check that the releases are properly done on Pypi. If you are releasing on a Mac, you should see a pymatgen.version.tar.gz and two wheels (Py37 and P). There will be a py37 wheel for Windows that is generated by Appveyor.
8144

8245
## Materials.sh
8346

84-
Fork and clone the
85-
[materials.sh](https://github.com/materialsvirtuallab/materials.sh).
86-
This repo contains the `conda` skeletons to build the `conda` versions for
87-
various matsci codes on the Anaconda [matsci
88-
channel](https://anaconda.org/matsci).
47+
Fork and clone the [materials.sh](https://github.com/materialsvirtuallab/materials.sh). This repo contains the `conda` skeletons to build the `conda` versions for various matsci codes on the Anaconda [matsci channel](https://anaconda.org/matsci).
8948

90-
The first time this is run, you may need to <span class="title-ref">pip
91-
install beautifulsoup4</span>.
49+
The first time this is run, you may need to `pip install beautifulsoup4`.
9250

9351
If you doing this for the first time, make sure conda-build and
9452
anaconda-client are installed:
@@ -114,16 +72,3 @@ versions.
11472

11573
Check that the [matsci channel](https://anaconda.org/matsci) versions
11674
are properly updated.
117-
118-
## Dash docs
119-
120-
Fork and clone the [Dash User Contributions
121-
repo](https://github.com/Kapeli/Dash-User-Contributions).
122-
123-
Generate the offline Dash doc using:
124-
125-
```sh
126-
invoke contribute-dash
127-
```
128-
129-
Create a pull request and submit.

CHANGES.rst

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,13 @@
11
Change log
22
==========
33

4+
- Unreadable string concat ops to f-string by @janosh in https://github.com/materialsproject/pymatgen/pull/3162
5+
- Revert `mp-api<0.34.0` pin by @janosh in https://github.com/materialsproject/pymatgen/pull/3165
6+
- Fix CI error `"pdentries_test.csv"` not found by @janosh in https://github.com/materialsproject/pymatgen/pull/3168
7+
- Fix issues with labels by @stefsmeets in https://github.com/materialsproject/pymatgen/pull/3169
8+
9+
**Full Changelog**: https://github.com/materialsproject/pymatgen/compare/v2023.7.17...v2023.7.20
10+
411
v2023.7.17
512
----------
613
- Cython 3.0 support.

dev_scripts/chemenv/equivalent_indices.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,5 +133,5 @@
133133
i7 = 6 if i0 in [1, 4] else 7
134134
equiv_list.append([i0, i1, i2, i3, i4, i5, i6, i7])
135135

136-
print(f"Equivalent indices ({len(equiv_list):d}) for {cg_symbol} : ")
136+
print(f"Equivalent indices ({len(equiv_list)}) for {cg_symbol} : ")
137137
print(equiv_list)

dev_scripts/chemenv/explicit_permutations_plane_algorithm.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -36,14 +36,14 @@
3636

3737
new_algos = []
3838

39-
ialgo = 1
39+
idx = 1
4040
for sep_plane_algo in cg._algorithms:
41-
print(f"In {ialgo = :d}/{len(cg._algorithms):d}")
42-
ialgo += 1
41+
print(f"In {idx = }/{len(cg._algorithms)}")
42+
idx += 1
4343
if sep_plane_algo.algorithm_type != "SEPARATION_PLANE":
4444
raise ValueError("Should all be separation plane")
4545

46-
perms_on_file = f"Permutations on file in this algorithm ({len(sep_plane_algo._permutations):d}) "
46+
perms_on_file = f"Permutations on file in this algorithm ({len(sep_plane_algo._permutations)}) "
4747
print(perms_on_file)
4848
print(sep_plane_algo._permutations)
4949
permutations = sep_plane_algo.safe_separation_permutations(
@@ -52,7 +52,7 @@
5252

5353
sep_plane_algo._permutations = permutations
5454

55-
print(f"Test permutations ({len(permutations):d}) :")
55+
print(f"Test permutations ({len(permutations)}) :")
5656
print(permutations)
5757

5858
lgf = LocalGeometryFinder()
@@ -134,7 +134,7 @@
134134
explicit_permutations.append(sep_perms[icsm])
135135

136136
print(perms_on_file)
137-
print(f"Permutations found ({len(explicit_permutations):d}) : ")
137+
print(f"Permutations found ({len(explicit_permutations)}) : ")
138138
print(explicit_permutations)
139139
sep_plane_algo.explicit_permutations = explicit_permutations
140140
new_algos.append(sep_plane_algo)

dev_scripts/chemenv/get_plane_permutations_optimized.py

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,7 @@ def random_permutations_iterator(initial_permutation, n_permutations):
175175
# 1. Check the algorithms defined for this coordination geometry and get the explicit permutations
176176
original_n_explicit_perms = []
177177
original_n_explicit_optimized_perms = []
178-
for ialgo, algo in enumerate(cg.algorithms):
178+
for idx, algo in enumerate(cg.algorithms):
179179
algo._permutations = algo.explicit_permutations
180180
algo.minimum_number_of_points = 4
181181
if algo.algorithm_type == "EXPLICIT_PERMUTATIONS":
@@ -185,7 +185,7 @@ def random_permutations_iterator(initial_permutation, n_permutations):
185185
else:
186186
eop = str(len(algo.explicit_optimized_permutations))
187187
print(
188-
f"For ialgo {ialgo,:d}, plane_points are "
188+
f"For {idx=}, plane_points are "
189189
f"[{', '.join(map(str, algo.plane_points))}], "
190190
f"side_0 is [{', '.join(map(str, algo.point_groups[0]))}] and "
191191
f"side_1 is [{', '.join(map(str, algo.point_groups[1]))}]."
@@ -194,7 +194,7 @@ def random_permutations_iterator(initial_permutation, n_permutations):
194194
original_n_explicit_optimized_perms.append(eop)
195195
print(
196196
f" For this algorithm, there are {eop} optimized permutations and "
197-
f"{len(algo.explicit_permutations):d} explicit permutations"
197+
f"{len(algo.explicit_permutations)} explicit permutations"
198198
)
199199
if algo.other_plane_points is None:
200200
input("Multiplicity and other plane points is not defined for this algorithm !")
@@ -204,7 +204,7 @@ def random_permutations_iterator(initial_permutation, n_permutations):
204204
ordered_plane=algo.ordered_plane, ordered_point_groups=algo.ordered_point_groups
205205
)
206206
algo._permutations = permutations
207-
print(f"Safe permutations found ({len(permutations):d})")
207+
print(f"Safe permutations found ({len(permutations)})")
208208

209209
# Definition of the facets
210210
all_planes_point_indices = [algo.plane_points]
@@ -213,9 +213,9 @@ def random_permutations_iterator(initial_permutation, n_permutations):
213213

214214
# Loop on the facets
215215
explicit_permutations_per_plane = []
216-
for iplane, plane_point_indices in enumerate(all_planes_point_indices):
216+
for idx_plane, plane_point_indices in enumerate(all_planes_point_indices):
217217
prt1(
218-
string=f"In plane {iplane:d} ({'-'.join(str(pp) for pp in plane_point_indices)})",
218+
string=f"In plane {idx_plane} ({'-'.join(str(pp) for pp in plane_point_indices)})",
219219
printing_volume=printing_volume,
220220
)
221221

@@ -268,7 +268,7 @@ def random_permutations_iterator(initial_permutation, n_permutations):
268268
algo.explicit_permutations = [list(perm) for perm in list(explicit_permutations_per_plane[0])]
269269
algo.explicit_permutations.sort()
270270
algo.explicit_permutations = np.array(algo.explicit_permutations)
271-
print(f"Explicit permutations found ({len(algo.explicit_permutations):d})")
271+
print(f"Explicit permutations found ({len(algo.explicit_permutations)})")
272272
print(algo.explicit_permutations)
273273
print()
274274
# Setup the permutations for the next optimization
@@ -291,10 +291,10 @@ def random_permutations_iterator(initial_permutation, n_permutations):
291291
perms_used_algos: list[dict] = [{} for _ in cg.algorithms]
292292

293293
# Loop on algorithms
294-
for ialgo, algo in enumerate(cg.algorithms):
294+
for idx, algo in enumerate(cg.algorithms):
295295
perms_used: dict[tuple, int] = {}
296296
print(
297-
f"In ialgo {ialgo:d} (plane_points : "
297+
f"In {idx=} (plane_points : "
298298
f"[{', '.join(map(str, algo.plane_points))}], "
299299
f"side_0 : [{', '.join(map(str, algo.point_groups[0]))}] and "
300300
f"side_1 : [{', '.join(map(str, algo.point_groups[1]))}])"
@@ -334,12 +334,12 @@ def random_permutations_iterator(initial_permutation, n_permutations):
334334
raise ValueError("Permutation setup not allowed ...")
335335

336336
# Loop on permutations
337-
iperm = 1
337+
idx_perm = 1
338338
t0 = time.process_time()
339339
time_left: float | str = "Unknown"
340340
for indices_perm in perms_iterator:
341341
prt1(
342-
string=f"Perm # {iperm:d}/{n_permutations:d} : "
342+
string=f"Perm # {idx_perm}/{n_permutations} : "
343343
f"{'-'.join(map(str, indices_perm))} "
344344
f"(est. rem. time : {time_left} sec)",
345345
printing_volume=printing_volume,
@@ -353,9 +353,9 @@ def random_permutations_iterator(initial_permutation, n_permutations):
353353

354354
# Loop on the facets
355355
separation_permutations = []
356-
for iplane, plane_point_indices in enumerate(all_planes_point_indices):
356+
for idx_plane, plane_point_indices in enumerate(all_planes_point_indices):
357357
prt2(
358-
string=f"In plane {iplane:d} ({'-'.join(str(pp) for pp in plane_point_indices)})",
358+
string=f"In plane {idx_plane} ({'-'.join(str(pp) for pp in plane_point_indices)})",
359359
printing_volume=printing_volume,
360360
)
361361

@@ -399,28 +399,28 @@ def random_permutations_iterator(initial_permutation, n_permutations):
399399
else:
400400
perms_used[some_perm] = 1
401401
tcurrent = time.process_time()
402-
time_left = (n_permutations - iperm) * (tcurrent - t0) / iperm # type: ignore
402+
time_left = (n_permutations - idx_perm) * (tcurrent - t0) / idx_perm # type: ignore
403403
time_left = f"{time_left:.1f}"
404-
iperm += 1
404+
idx_perm += 1
405405
print(
406-
f"Optimized permutations {len(perms_used):d}/{len(algo.permutations):d}"
407-
f"(old : {original_n_explicit_optimized_perms[ialgo]}/{original_n_explicit_perms[ialgo]}) : "
406+
f"Optimized permutations {len(perms_used)}/{len(algo.permutations)}"
407+
f"(old : {original_n_explicit_optimized_perms[idx]}/{original_n_explicit_perms[idx]}) : "
408408
)
409409
for perm, number in perms_used.items():
410-
print(f" - permutation {'-'.join(map(str, perm))} : {number:d}")
410+
print(f" - permutation {'-'.join(map(str, perm))} : {number}")
411411
print(
412-
f"For {ialgo=} (plane_points : [{', '.join(map(str, algo.plane_points))}], "
412+
f"For {idx=} (plane_points : [{', '.join(map(str, algo.plane_points))}], "
413413
f"side_0 : [{', '.join(map(str, algo.point_groups[0]))}] and "
414414
f"side_1 : [{', '.join(map(str, algo.point_groups[1]))}]),\n"
415415
f"Optimized perturbations {len(perms_used)}/{len(algo.permutations)} (old : "
416-
f"{original_n_explicit_optimized_perms[ialgo]}/{original_n_explicit_perms[ialgo]}) are :"
416+
f"{original_n_explicit_optimized_perms[idx]}/{original_n_explicit_perms[idx]}) are :"
417417
)
418-
# print(f"Optimized permutations ({len(perms_used):d}/{len(algo.permutations):d}) : ")
418+
# print(f"Optimized permutations ({len(perms_used)}/{len(algo.permutations)}) : ")
419419
explicit_optimized_permutations = [list(perm) for perm in perms_used]
420420
explicit_optimized_permutations.sort()
421421
print(explicit_optimized_permutations)
422422
print()
423-
test = input(f'Set optimized permutations for algorithm {ialgo:d} ? ("y" to confirm)')
423+
test = input(f'Set optimized permutations for algorithm {idx} ? ("y" to confirm)')
424424
if test == "y":
425425
algo.explicit_optimized_permutations = np.array(explicit_optimized_permutations)
426426

dev_scripts/chemenv/plane_multiplicity.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,5 +30,5 @@
3030
all_plane_points.append(tuple(equiv_plane))
3131
all_plane_points = [tuple(equiv_plane) for equiv_plane in set(all_plane_points)]
3232

33-
print(f"All plane points ({len(all_plane_points):d}) for {cg_symbol} : ")
33+
print(f"All plane points ({len(all_plane_points)}) for {cg_symbol} : ")
3434
print(all_plane_points)

dev_scripts/chemenv/strategies/multi_weights_strategy_parameters.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -277,7 +277,7 @@ def get_weights(self, weights_options):
277277
for ii in range(1, 14):
278278
self_weight_max_csms_per_cn[str(ii)] = []
279279
for jj in range(ii + 1, 14):
280-
cn_pair = f"{ii:d}_{jj:d}"
280+
cn_pair = f"{ii}_{jj}"
281281
self_weight_max_csms[cn_pair] = []
282282
delta_csm_mins[cn_pair] = []
283283
all_cn_pairs.append(cn_pair)

dev_scripts/chemenv/test_algos.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@
6565
lgf.perfect_geometry = AbstractGeometry.from_cg(cg=cg)
6666
points_perfect = lgf.perfect_geometry.points_wocs_ctwocc()
6767

68-
print(f"Perm # {idx_perm:d}/{n_perms:d} : ", indices_perm)
68+
print(f"Perm # {idx_perm}/{n_perms} : ", indices_perm)
6969

7070
algos_results = []
7171
for algo in cg.algorithms:

dev_scripts/chemenv/test_algos_all_geoms.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@
9898
lgf.perfect_geometry = AbstractGeometry.from_cg(cg=cg)
9999
points_perfect = lgf.perfect_geometry.points_wocs_ctwocc()
100100

101-
print(f"Perm # {i_perm:d}/{n_perms:d} : ", indices_perm)
101+
print(f"Perm # {i_perm}/{n_perms} : ", indices_perm)
102102

103103
algos_results = []
104104
for algo in cg.algorithms:

0 commit comments

Comments
 (0)