Skip to content

Commit

Permalink
relocate dunder methods to top for core.trajectory
Browse files Browse the repository at this point in the history
fix `core.operations`

add types for site, mypy errors to fix

remove no_type_check decorator

move dunder methods to the top

fix mypy errors

remove debug tag

improve `spectrum`

finish `core.tensors`

finish `xcfunc`

fix hash of `SymmOp`

finish `core.trajectory`

Add types for `core.molecular_orbitals/operations/sites/spectrum/tensor/xcfunc`  (materialsproject#3829)

* fix `core.molecular_orbitals`

* fix `core.operations`

* add types for site, mypy errors to fix

* remove no_type_check decorator

* move dunder methods to the top

* fix mypy errors

* remove debug tag

* improve `spectrum`

* finish `core.tensors`

* finish `xcfunc`

* fix hash of `SymmOp`

* add a missing type

* Revert "fix hash of `SymmOp`"

This reverts commit bf2a953.

* fix some types in operations

* "TEST": remove one unused var, relocate another

* final tweak types

* avoid hard-code class name

* format tweaks

* type tweak

* fix unit test

* replace all `[0:x]` with `[:x]`

Guard `TYPE_CHECKING` only imports (materialsproject#3827)

* flake8 --select=TYP001

* fix type import

* format docstring to google style

* fix more unguarded typecheck imports

* format more docs to Google format

* trigger CI (better var names)

---------

Co-authored-by: Janosh Riebesell <janosh.riebesell@gmail.com>

move structures out of util dir (materialsproject#3831)

Add matgenb in the aux link section. Because apparently it is not
"discoverable". Fixes materialsproject#3811.

More updates.

Move AIMS notebooks to matgenb.

Add README in examples folder that point to proper resources.

Improve type annotations and comments for `io.cif` (materialsproject#3820)

* remove duplicate warning

* type and docstring tweaks

* add some types for io.cif

* add comments and types

* temp save of some formatting

* revert functional change

* revert unrelated changes

* fix unit test

* remove update that does nothing

* relocate `sub_space_group` and `space_groups` to their usage

* add more types

* pre-commit auto-fixes

* breaking: make parse_magmom/oxi_stats private

* remove merge header

* fix unit test

* add more types

* fix mypy errors

* add a few spaces

* remove if name ==main

* simplify "check to see if" in comments

* final tweaks

* revise docstring

* replace deprecated abc.abstractproperty

* add missing doc strings and standardize existing

* breaking: fix typo in method name orthongonalize_structure

* revert accidental change in test_composition.py

---------

Co-authored-by: Janosh Riebesell <janosh.riebesell@gmail.com>
  • Loading branch information
DanielYang59 and janosh committed May 16, 2024
1 parent 51180fc commit 1683c18
Show file tree
Hide file tree
Showing 121 changed files with 1,839 additions and 1,697 deletions.
2 changes: 1 addition & 1 deletion docs/_config.yml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

37 changes: 14 additions & 23 deletions docs/index.md

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion docs/pymatgen.md

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 7 additions & 0 deletions examples/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
All examples are housed at [matgenb]. Please consult this resource first.

If there are questions that cannot be found in the examples, you may use the [pymatgen MatSci forum] or [GitHub discussion].

[matgenb]: https://matgenb.materialsvirtuallab.org/
[pymatgen MatSci forum]: https://matsci.org/pymatgen
[github discussion]: https://github.com/materialsproject/pymatgen/discussions
151 changes: 0 additions & 151 deletions examples/aims_io/FHI-aims-example.ipynb

This file was deleted.

6 changes: 3 additions & 3 deletions pymatgen/alchemy/materials.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import datetime
import json
import re
from typing import TYPE_CHECKING, Any
from typing import TYPE_CHECKING
from warnings import warn

from monty.json import MSONable, jsanitize
Expand All @@ -22,15 +22,15 @@

if TYPE_CHECKING:
from collections.abc import Sequence
from typing import Any

from typing_extensions import Self

from pymatgen.alchemy.filters import AbstractStructureFilter


class TransformedStructure(MSONable):
"""Container object for new structures that include history of
transformations.
"""Container for new structures that include history of transformations.
Each transformed structure is made up of a sequence of structures with
associated transformation history.
Expand Down
3 changes: 2 additions & 1 deletion pymatgen/alchemy/transmuters.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,14 @@
import os
import re
from multiprocessing import Pool
from typing import TYPE_CHECKING, Callable
from typing import TYPE_CHECKING

from pymatgen.alchemy.materials import TransformedStructure
from pymatgen.io.vasp.sets import MPRelaxSet, VaspInputSet

if TYPE_CHECKING:
from collections.abc import Sequence
from typing import Callable

from typing_extensions import Self

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1265,7 +1265,7 @@ def from_dict(cls, dct: dict) -> Self:


class NbSetWeight(MSONable, abc.ABC):
"""Abstract object for neighbors sets weights estimations."""
"""Abstract base class for neighbor set weight estimations."""

@abc.abstractmethod
def as_dict(self):
Expand All @@ -1282,7 +1282,7 @@ def weight(self, nb_set, structure_environments, cn_map=None, additional_info=No
additional_info: Additional information.
Returns:
Weight of the neighbors set.
float: Weight of the neighbors set.
"""


Expand Down Expand Up @@ -1313,7 +1313,7 @@ def weight(self, nb_set, structure_environments, cn_map=None, additional_info=No
additional_info: Additional information.
Returns:
Weight of the neighbors set.
float: Weight of the neighbors set.
"""
return self.aw(nb_set=nb_set)

Expand Down Expand Up @@ -1534,7 +1534,7 @@ def weight(self, nb_set, structure_environments, cn_map=None, additional_info=No
additional_info: Additional information.
Returns:
Weight of the neighbors set.
float: Weight of the neighbors set.
"""
fda_list = self.fda(nb_set=nb_set)
return self.eval(fda_list=fda_list)
Expand Down Expand Up @@ -1680,7 +1680,7 @@ def weight(self, nb_set, structure_environments, cn_map=None, additional_info=No
additional_info: Additional information.
Returns:
Weight of the neighbors set.
float: Weight of the neighbors set.
"""
effective_csm = get_effective_csm(
nb_set=nb_set,
Expand Down Expand Up @@ -1791,7 +1791,7 @@ def weight(self, nb_set, structure_environments, cn_map=None, additional_info=No
additional_info: Additional information.
Returns:
Weight of the neighbors set.
float: Weight of the neighbors set.
"""
effcsm = get_effective_csm(
nb_set=nb_set,
Expand Down Expand Up @@ -2006,7 +2006,7 @@ def weight(self, nb_set, structure_environments, cn_map=None, additional_info=No
additional_info: Additional information.
Returns:
Weight of the neighbors set.
float: Weight of the neighbors set.
"""
return self.cn_weights[len(nb_set)]

Expand Down Expand Up @@ -2186,7 +2186,7 @@ def weight(self, nb_set, structure_environments, cn_map=None, additional_info=No
additional_info: Additional information.
Returns:
Weight of the neighbors set.
float: Weight of the neighbors set.
"""
return self.area_weight(
nb_set=nb_set,
Expand Down Expand Up @@ -2379,7 +2379,7 @@ def weight(self, nb_set, structure_environments, cn_map=None, additional_info=No
additional_info: Additional information.
Returns:
Weight of the neighbors set.
float: Weight of the neighbors set.
"""
return self.weight_rf.eval(nb_set.distance_plateau())

Expand Down Expand Up @@ -2446,7 +2446,7 @@ def weight(self, nb_set, structure_environments, cn_map=None, additional_info=No
additional_info: Additional information.
Returns:
Weight of the neighbors set.
float: Weight of the neighbors set.
"""
return self.weight_rf.eval(nb_set.angle_plateau())

Expand Down Expand Up @@ -2509,7 +2509,7 @@ def weight(self, nb_set, structure_environments, cn_map=None, additional_info=No
additional_info: Additional information.
Returns:
Weight of the neighbors set.
float: Weight of the neighbors set.
"""
cn = cn_map[0]
isite = nb_set.isite
Expand Down Expand Up @@ -2590,7 +2590,7 @@ def weight(self, nb_set, structure_environments, cn_map=None, additional_info=No
additional_info: Additional information.
Returns:
Weight of the neighbors set.
float: Weight of the neighbors set.
"""
cn = cn_map[0]
isite = nb_set.isite
Expand Down

0 comments on commit 1683c18

Please sign in to comment.