Skip to content

Commit 4e8fea7

Browse files
author
Jingyang Wang
committed
Merge remote-tracking branch 'upstream/master' into dev
2 parents 47869a7 + 6ac0cca commit 4e8fea7

File tree

218 files changed

+3637
-5041
lines changed

Some content is hidden

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

218 files changed

+3637
-5041
lines changed

.pre-commit-config.yaml

Lines changed: 2 additions & 2 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.0.284
11+
rev: v0.0.285
1212
hooks:
1313
- id: ruff
1414
args: [--fix]
@@ -26,7 +26,7 @@ repos:
2626
- id: black
2727

2828
- repo: https://github.com/pre-commit/mirrors-mypy
29-
rev: v1.4.1
29+
rev: v1.5.1
3030
hooks:
3131
- id: mypy
3232

CONTRIBUTING.md

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,22 +12,26 @@ For developers interested in expanding `pymatgen` for their own purposes, we rec
1212

1313
1. Fork the `pymatgen` GitHub repo, i.e., go to the main [`pymatgen` GitHub repo](https://github.com/materialsproject/pymatgen) and click fork to create a copy of the `pymatgen` code base on your own GitHub account.
1414

15-
1. Install git on your local machine (if you don't already have it).
15+
1. Install `git` on your local machine (if you don't already have it).
1616

1717
1. Clone *your forked repo* to your local machine. You will work mostly with your local repo and only publish changes when they are ready to be merged:
1818

1919
```sh
20-
git clone git@github.com:YOURNAME/pymatgen
20+
git clone https://github.com/<username>/pymatgen
2121
```
2222

23-
Note that the entire Github repo is fairly large because of the presence of test files, but these are absolutely necessary for rigorous testing of the code.
23+
Note that the entire Github repo is fairly large because of the presence of test files, but these are necessary for rigorous testing.
2424

25-
1. It is highly recommended you install all the optional dependencies as well.
25+
1. Make a new branch for your contributions
26+
27+
```sh
28+
git checkout -b my-new-fix-or-feature # should be run from up-to-date master
29+
```
2630

2731
1. Code (see [Coding Guidelines](#coding-guidelines)). Commit early and commit often. Keep your code up to date. You need to add the main repository to the list of your remotes.
2832

2933
```sh
30-
git remote add upstream git://github.com/materialsproject/`pymatgen`
34+
git remote add upstream https://github.com/materialsproject/pymatgen
3135
```
3236

3337
Make sure your repository is clean (no uncommitted changes) and is currently on the master branch. If not, commit or stash any changes and switch to the master.
@@ -75,6 +79,6 @@ Given that `pymatgen` is intended to be a long-term code base, we adopt very str
7579
```
7680
7781
1. **Python 3**. We only support Python 3.8+.
78-
1. **Documentation** is required for all modules, classes and methods. In particular, the method doc strings should make clear the arguments expected and the return values. For complex algorithms (e.g., an Ewald summation), a summary of the algorithm should be provided, and preferably with a link to a publication outlining the method in detail.
82+
1. **Documentation** is required for all modules, classes and methods. In particular, the method doc strings should make clear the arguments expected and the return values. For complex algorithms (e.g., an Ewald summation), a summary of the algorithm should be provided and preferably with a link to a publication outlining the method in detail.
7983
8084
For the above, if in doubt, please refer to the core classes in `pymatgen` for examples of what is expected.

README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,17 @@ height="70">
66
</picture>
77
</h1>
88

9+
<h4 align="center">
10+
911
[![CI Status](https://github.com/materialsproject/pymatgen/actions/workflows/test.yml/badge.svg)](https://github.com/materialsproject/pymatgen/actions/workflows/test.yml)
1012
[![codecov](https://codecov.io/gh/materialsproject/pymatgen/branch/master/graph/badge.svg?token=XC47Un1LV2)](https://codecov.io/gh/materialsproject/pymatgen)
1113
[![PyPI Downloads](https://img.shields.io/pypi/dm/pymatgen?logo=pypi&logoColor=white&color=blue&label=PyPI)](https://pypi.org/project/pymatgen)
1214
[![Conda Downloads](https://img.shields.io/conda/dn/conda-forge/pymatgen?logo=condaforge&color=blue&label=Conda)](https://anaconda.org/conda-forge/pymatgen)
1315
[![Requires Python 3.8+](https://img.shields.io/badge/Python-3.8+-blue.svg?logo=python&logoColor=white)](https://python.org/downloads)
1416
[![arXiv](https://img.shields.io/badge/J.ComMatSci-2012.10.028-blue)](https://doi.org/10.1016/j.commatsci.2012.10.028)
1517

18+
</h4>
19+
1620
Pymatgen (Python Materials Genomics) is a robust, open-source Python
1721
library for materials analysis. These are some of the main features:
1822

dev_scripts/chemenv/strategies/multi_weights_strategy_parameters.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -121,16 +121,16 @@ def figure_fractions(self, weights_options: dict, morphing_factors: Sequence[flo
121121
fig_height = fig_height_cm / 2.54
122122

123123
fig = plt.figure(num=1, figsize=(fig_width, fig_height))
124-
subplot = fig.add_subplot(111)
124+
ax = fig.add_subplot(111)
125125

126-
subplot.plot(
126+
ax.plot(
127127
morphing_factors,
128128
fractions_initial_environment,
129129
"b-",
130130
label=self.initial_environment_symbol,
131131
linewidth=1.5,
132132
)
133-
subplot.plot(
133+
ax.plot(
134134
morphing_factors,
135135
fractions_final_environment,
136136
"g--",
@@ -301,16 +301,16 @@ def get_weights(self, weights_options):
301301
self_weight_max_csms_per_cn[ce1.split(":")[1]].append(params["self_weight_max_csm"])
302302

303303
fig = plt.figure(1)
304-
subplot = fig.add_subplot(111)
304+
ax = fig.add_subplot(111)
305305

306306
for idx, cn_pair in enumerate(all_cn_pairs):
307307
if len(self_weight_max_csms[cn_pair]) == 0:
308308
continue
309-
subplot.plot(idx * np.ones_like(self_weight_max_csms[cn_pair]), self_weight_max_csms[cn_pair], "rx")
310-
subplot.plot(idx * np.ones_like(delta_csm_mins[cn_pair]), delta_csm_mins[cn_pair], "b+")
309+
ax.plot(idx * np.ones_like(self_weight_max_csms[cn_pair]), self_weight_max_csms[cn_pair], "rx")
310+
ax.plot(idx * np.ones_like(delta_csm_mins[cn_pair]), delta_csm_mins[cn_pair], "b+")
311311

312-
subplot.set_xticks(range(len(all_cn_pairs)))
313-
subplot.set_xticklabels(all_cn_pairs, rotation="vertical")
312+
ax.set_xticks(range(len(all_cn_pairs)))
313+
ax.set_xticklabels(all_cn_pairs, rotation="vertical")
314314
fig.savefig("self_delta_params.pdf")
315315

316316
fig2 = plt.figure(2)

docs/conf.py

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

docs/contributing.md

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

pymatgen/alchemy/__init__.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
"""
2-
This package provides the modules for performing large scale transformations on
1+
"""This package provides the modules for performing large scale transformations on
32
a large number of structures.
43
"""

pymatgen/alchemy/filters.py

Lines changed: 13 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -17,16 +17,14 @@
1717

1818

1919
class AbstractStructureFilter(MSONable, metaclass=abc.ABCMeta):
20-
"""
21-
AbstractStructureFilter that defines an API to perform testing of
20+
"""AbstractStructureFilter that defines an API to perform testing of
2221
Structures. Structures that return True to a test are retained during
2322
transmutation while those that return False are removed.
2423
"""
2524

2625
@abc.abstractmethod
2726
def test(self, structure: Structure):
28-
"""
29-
Method to execute the test.
27+
"""Method to execute the test.
3028
3129
Args:
3230
structure (Structure): Input structure to test
@@ -39,8 +37,7 @@ def test(self, structure: Structure):
3937

4038

4139
class ContainsSpecieFilter(AbstractStructureFilter):
42-
"""
43-
Filter for structures containing certain elements or species.
40+
"""Filter for structures containing certain elements or species.
4441
By default compares by atomic number.
4542
"""
4643

@@ -60,8 +57,7 @@ def __init__(self, species, strict_compare=False, AND=True, exclude=False):
6057
self._exclude = exclude
6158

6259
def test(self, structure: Structure):
63-
"""
64-
Method to execute the test.
60+
"""Method to execute the test.
6561
6662
Returns: True if structure do not contain specified species.
6763
"""
@@ -121,8 +117,7 @@ def from_dict(cls, dct):
121117

122118

123119
class SpecieProximityFilter(AbstractStructureFilter):
124-
"""
125-
This filter removes structures that have certain species that are too close
120+
"""This filter removes structures that have certain species that are too close
126121
together.
127122
"""
128123

@@ -139,8 +134,7 @@ def __init__(self, specie_and_min_dist_dict):
139134
self.specie_and_min_dist = {get_el_sp(k): v for k, v in specie_and_min_dist_dict.items()}
140135

141136
def test(self, structure: Structure):
142-
"""
143-
Method to execute the test.
137+
"""Method to execute the test.
144138
145139
Args:
146140
structure (Structure): Input structure to test
@@ -185,8 +179,7 @@ class RemoveDuplicatesFilter(AbstractStructureFilter):
185179
"""This filter removes exact duplicate structures from the transmuter."""
186180

187181
def __init__(self, structure_matcher: dict | StructureMatcher | None = None, symprec: float | None = None) -> None:
188-
"""
189-
Remove duplicate structures based on the structure matcher
182+
"""Remove duplicate structures based on the structure matcher
190183
and symmetry (if symprec is given).
191184
192185
Args:
@@ -235,8 +228,7 @@ class RemoveExistingFilter(AbstractStructureFilter):
235228
"""This filter removes structures existing in a given list from the transmuter."""
236229

237230
def __init__(self, existing_structures, structure_matcher=None, symprec=None):
238-
"""
239-
Remove existing structures based on the structure matcher
231+
"""Remove existing structures based on the structure matcher
240232
and symmetry (if symprec is given).
241233
242234
Args:
@@ -256,8 +248,7 @@ def __init__(self, existing_structures, structure_matcher=None, symprec=None):
256248
self.structure_matcher = structure_matcher or StructureMatcher(comparator=ElementComparator())
257249

258250
def test(self, structure: Structure):
259-
"""
260-
Method to execute the test.
251+
"""Method to execute the test.
261252
262253
Args:
263254
structure (Structure): Input structure to test
@@ -291,8 +282,7 @@ def as_dict(self):
291282

292283

293284
class ChargeBalanceFilter(AbstractStructureFilter):
294-
"""
295-
This filter removes structures that are not charge balanced from the
285+
"""This filter removes structures that are not charge balanced from the
296286
transmuter. This only works if the structure is oxidation state
297287
decorated, as structures with only elemental sites are automatically
298288
assumed to have net charge of 0.
@@ -302,8 +292,7 @@ def __init__(self):
302292
"""No args required."""
303293

304294
def test(self, structure: Structure):
305-
"""
306-
Method to execute the test.
295+
"""Method to execute the test.
307296
308297
Args:
309298
structure (Structure): Input structure to test
@@ -314,8 +303,7 @@ def test(self, structure: Structure):
314303

315304

316305
class SpeciesMaxDistFilter(AbstractStructureFilter):
317-
"""
318-
This filter removes structures that do have two particular species that are
306+
"""This filter removes structures that do have two particular species that are
319307
not nearest neighbors by a predefined max_dist. For instance, if you are
320308
analyzing Li battery materials, you would expect that each Li+ would be
321309
nearest neighbor to lower oxidation state transition metal for
@@ -336,8 +324,7 @@ def __init__(self, sp1, sp2, max_dist):
336324
self.max_dist = max_dist
337325

338326
def test(self, structure: Structure):
339-
"""
340-
Method to execute the test.
327+
"""Method to execute the test.
341328
342329
Args:
343330
structure (Structure): Input structure to test

0 commit comments

Comments
 (0)