Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

For MPcules: Molecule Trajectory and graph hashes #2945

Merged
merged 36 commits into from
Apr 25, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
3190126
Merge branch 'mpmaster'
espottesmith Mar 25, 2021
bfaa9ba
Merge branch 'mpmaster'
espottesmith May 28, 2021
b352b27
Merge remote-tracking branch 'origin/master'
espottesmith Feb 1, 2022
150e1bd
Merge remote-tracking branch 'materialsproject/master'
espottesmith Jun 11, 2022
a9fa576
Merge remote-tracking branch 'materialsproject/master'
espottesmith Sep 29, 2022
975e4e9
Merge remote-tracking branch 'materialsproject/master'
espottesmith Feb 3, 2023
85d88d8
Initial commit; adding graph hashing from emmet, beginning work on mo…
espottesmith Feb 3, 2023
af08f37
Continued
espottesmith Feb 3, 2023
8ce8446
Trajectory first draft done
espottesmith Feb 3, 2023
3787c7b
Tests
espottesmith Feb 3, 2023
d0c1ad9
Merge remote-tracking branch 'materialsproject/master' into for_mpcules
espottesmith Feb 3, 2023
df29aa6
Beginning to add entry classes to incorporate into Emmet
espottesmith Feb 3, 2023
9baa12e
More test fixes for molecule trajectory
espottesmith Feb 3, 2023
f603a20
molecule trajectory works
espottesmith Feb 3, 2023
3ef2f85
Small addition
espottesmith Mar 18, 2023
2ffb209
Merge remote-tracking branch 'materialsproject/master' into for_mpcules
espottesmith Apr 19, 2023
e2bc08b
Add tests for graph hashing
espottesmith Apr 19, 2023
e4f2e57
Small tweaks to trajectory tests
espottesmith Apr 19, 2023
ef6874e
pre-commit auto-fixes
pre-commit-ci[bot] Apr 19, 2023
cac6a25
mypy is a cruelty to both programmers and programming languages
espottesmith Apr 19, 2023
d25d41f
Merge remote-tracking branch 'origin/for_mpcules' into for_mpcules
espottesmith Apr 19, 2023
1dc02f4
Ah, yes. Let's just staple type-checking to a language built around d…
espottesmith Apr 19, 2023
a8ca931
fix common typo MSONAble->MSONable
janosh Apr 19, 2023
625fa12
tweak PR template
janosh Apr 19, 2023
ff39467
fix supported types list
janosh Apr 19, 2023
652fe45
fix from_molecules() return type
janosh Apr 19, 2023
4994b45
Requested change
espottesmith Apr 20, 2023
3fe06cf
Merge remote-tracking branch 'origin/for_mpcules' into for_mpcules
espottesmith Apr 20, 2023
74862f4
pre-commit auto-fixes
pre-commit-ci[bot] Apr 20, 2023
f73693b
Trying to make mypy happy, like a crying child
espottesmith Apr 20, 2023
9e6a69e
And now ruff
espottesmith Apr 20, 2023
9af72c2
pre-commit auto-fixes
pre-commit-ci[bot] Apr 20, 2023
73bbeac
Please let it end
espottesmith Apr 20, 2023
2ca75b8
faff
janosh Apr 22, 2023
4c9e24c
remove use_molecule kwarg
janosh Apr 22, 2023
176eb47
fix mypy, refactor to_positions() and to_displacements()
janosh Apr 22, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,11 @@ Before a pull request can be merged, the following items must be checked:
- [ ] Tests have been added for any new functionality or bug fixes.
- [ ] All linting and tests pass.

Note that the CI system will run all the above checks. But it will be much more efficient if you already fix most errors prior to submitting the PR. We highly recommended installing `pre-commit` hooks. Simply Run
Our CI will run all the above checks but it might be more efficient if you already fix most errors before submitting the PR. We highly recommended installing `pre-commit` hooks. Simply Run

```sh
pip install -U pre-commit
pre-commit install
```

in the repo's root directory. Afterwards linters will run before every commit and abort if any issues pop up.
in the repo's root directory. Once `pre-commit` has installed `git` hooks, our linters will run before every commit and abort if issues pop up.
2 changes: 1 addition & 1 deletion CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -686,7 +686,7 @@ v2020.7.16

v2020.7.14
----------
* EwaldSummation is now MSONAble (@lbluque).
* EwaldSummation is now MSONable (@lbluque).
* Fix for QChem freq parsing (@samblau)
* Much improved linting and workflows.

Expand Down
2 changes: 1 addition & 1 deletion docs_rst/change_log.rst
Original file line number Diff line number Diff line change
Expand Up @@ -686,7 +686,7 @@ v2020.7.16

v2020.7.14
----------
* EwaldSummation is now MSONAble (@lbluque).
* EwaldSummation is now MSONable (@lbluque).
* Fix for QChem freq parsing (@samblau)
* Much improved linting and workflows.

Expand Down
2 changes: 1 addition & 1 deletion pymatgen/alchemy/filters.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ def __repr__(self):

def as_dict(self):
"""
Returns: MSONAble dict
Returns: MSONable dict
"""
return {
"@module": type(self).__module__,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ def __new__(cls, myfloat):
return flt

def as_dict(self):
"""MSONAble dict"""
"""MSONable dict"""
return {
"@module": type(self).__module__,
"@class": type(self).__name__,
Expand Down Expand Up @@ -109,7 +109,7 @@ def __new__(cls, myfloat):
return flt

def as_dict(self):
"""MSONAble dict"""
"""MSONable dict"""
return {
"@module": type(self).__module__,
"@class": type(self).__name__,
Expand Down Expand Up @@ -1300,7 +1300,7 @@ def __eq__(self, other: object) -> bool:
return self.aa == other.aa # type: ignore

def as_dict(self):
"""MSONAble dict"""
"""MSONable dict"""
return {
"@module": type(self).__module__,
"@class": type(self).__name__,
Expand Down
2 changes: 1 addition & 1 deletion pymatgen/analysis/chemenv/utils/graph_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -296,7 +296,7 @@ def from_edges(cls, edges, edges_are_ordered=True):

def as_dict(self):
"""
:return: MSONAble dict
:return: MSONable dict
"""
d = MSONable.as_dict(self)
# Transforming tuple object to a list to allow BSON and MongoDB
Expand Down
2 changes: 1 addition & 1 deletion pymatgen/analysis/diffraction/tests/test_xrd.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ def test_get_pattern(self):
struct = self.get_structure("CsCl")
c = XRDCalculator()
xrd = c.get_pattern(struct, two_theta_range=(0, 90))
assert xrd.to_json() # Test MSONAble property
assert xrd.to_json() # Test MSONable property
# Check the first two peaks
assert xrd.x[0] == pytest.approx(21.107738329639844)
assert xrd.y[0] == pytest.approx(36.483184003748946)
Expand Down
4 changes: 2 additions & 2 deletions pymatgen/analysis/molecule_matcher.py
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,7 @@ def __init__(self, angle_tolerance=10.0):
def as_dict(self):
"""
Returns:
MSONAble dict.
MSONable dict.
"""
return {
"version": __version__,
Expand Down Expand Up @@ -710,7 +710,7 @@ def group_molecules(self, mol_list):
def as_dict(self):
"""
Returns:
MSONAble dict.
MSONable dict.
"""
return {
"version": __version__,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ def cond_prob_list(self, l1, l2):

def as_dict(self):
"""
Returns: MSONAble dict
Returns: MSONable dict
"""
return {
"name": type(self).__name__,
Expand Down
2 changes: 1 addition & 1 deletion pymatgen/apps/battery/insertion_battery.py
Original file line number Diff line number Diff line change
Expand Up @@ -389,7 +389,7 @@ def from_dict_legacy(cls, d):

def as_dict_legacy(self):
"""
Returns: MSONAble dict
Returns: MSONable dict
"""
return {
"@module": type(self).__module__,
Expand Down
2 changes: 1 addition & 1 deletion pymatgen/apps/borg/hive.py
Original file line number Diff line number Diff line change
Expand Up @@ -291,7 +291,7 @@ def __str__(self):

def as_dict(self):
"""
Returns: MSONAble dict
Returns: MSONable dict
"""
return {
"init_args": {"inc_structure": self._inc_structure},
Expand Down
2 changes: 1 addition & 1 deletion pymatgen/core/interface.py
Original file line number Diff line number Diff line change
Expand Up @@ -300,7 +300,7 @@ def __update_c(self, new_c: float) -> None:

def as_dict(self):
"""
:return: MSONAble dict
:return: MSONable dict
"""
d = super().as_dict()
d["in_plane_offset"] = self.in_plane_offset.tolist()
Expand Down
2 changes: 1 addition & 1 deletion pymatgen/core/operations.py
Original file line number Diff line number Diff line change
Expand Up @@ -427,7 +427,7 @@ def rotoreflection(axis: ArrayLike, angle: float, origin: ArrayLike = (0, 0, 0))

def as_dict(self) -> dict[str, Any]:
"""
:return: MSONAble dict.
:return: MSONable dict.
"""
return {
"@module": type(self).__module__,
Expand Down
2 changes: 1 addition & 1 deletion pymatgen/core/periodic_table.py
Original file line number Diff line number Diff line change
Expand Up @@ -1510,7 +1510,7 @@ def from_string(species_string: str) -> DummySpecies:

def as_dict(self) -> dict:
"""
:return: MSONAble dict representation.
:return: MSONable dict representation.
"""
d = {
"@module": type(self).__module__,
Expand Down
2 changes: 1 addition & 1 deletion pymatgen/core/structure.py
Original file line number Diff line number Diff line change
Expand Up @@ -1034,7 +1034,7 @@ def lattice(self) -> Lattice:
@property
def density(self) -> float:
"""
Returns the density in units of g/cc
Returns the density in units of g/cm^3.
"""
m = Mass(self.composition.weight, "amu")
return m.to("g") / (self.volume * Length(1, "ang").to("cm") ** 3)
Expand Down
2 changes: 1 addition & 1 deletion pymatgen/core/surface.py
Original file line number Diff line number Diff line change
Expand Up @@ -495,7 +495,7 @@ def to_s(x):

def as_dict(self):
"""
:return: MSONAble dict
:return: MSONable dict
"""
d = super().as_dict()
d["@module"] = type(self).__module__
Expand Down
2 changes: 1 addition & 1 deletion pymatgen/core/tensors.py
Original file line number Diff line number Diff line change
Expand Up @@ -686,7 +686,7 @@ def as_dict(self, voigt: bool = False) -> dict:

@classmethod
def from_dict(cls, d) -> Tensor:
"""Instantiate Tensors from dicts (using MSONAble API).
"""Instantiate Tensors from dicts (using MSONable API).

Returns:
Tensor: hydrated tensor object
Expand Down
Loading