emmet-builders 0.84.7rc4__py3-none-any.whl → 0.84.8__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of emmet-builders might be problematic. Click here for more details.
- emmet/builders/abinit/phonon.py +11 -11
- emmet/builders/abinit/sound_velocity.py +10 -10
- emmet/builders/feff/xas.py +1 -2
- emmet/builders/materials/absorption_spectrum.py +4 -4
- emmet/builders/materials/alloys.py +2 -3
- emmet/builders/materials/chemenv.py +2 -3
- emmet/builders/materials/corrected_entries.py +8 -8
- emmet/builders/materials/dielectric.py +3 -4
- emmet/builders/materials/elasticity.py +25 -25
- emmet/builders/materials/electrodes.py +18 -18
- emmet/builders/materials/electronic_structure.py +16 -16
- emmet/builders/materials/magnetism.py +3 -3
- emmet/builders/materials/ml.py +9 -11
- emmet/builders/materials/optimade.py +3 -3
- emmet/builders/materials/piezoelectric.py +1 -2
- emmet/builders/materials/provenance.py +7 -7
- emmet/builders/materials/robocrys.py +2 -3
- emmet/builders/materials/substrates.py +8 -7
- emmet/builders/materials/thermo.py +10 -10
- emmet/builders/matscholar/missing_compositions.py +8 -8
- emmet/builders/mobility/migration_graph.py +5 -5
- emmet/builders/molecules/atomic.py +22 -23
- emmet/builders/molecules/bonds.py +12 -13
- emmet/builders/molecules/electric.py +11 -12
- emmet/builders/molecules/metal_binding.py +15 -17
- emmet/builders/molecules/orbitals.py +11 -12
- emmet/builders/molecules/redox.py +21 -22
- emmet/builders/molecules/summary.py +13 -13
- emmet/builders/molecules/thermo.py +14 -16
- emmet/builders/molecules/trajectory.py +18 -19
- emmet/builders/molecules/vibration.py +11 -12
- emmet/builders/qchem/molecules.py +29 -31
- emmet/builders/settings.py +7 -8
- emmet/builders/utils.py +5 -5
- emmet/builders/vasp/materials.py +11 -11
- emmet/builders/vasp/task_validator.py +3 -5
- {emmet_builders-0.84.7rc4.dist-info → emmet_builders-0.84.8.dist-info}/METADATA +1 -1
- emmet_builders-0.84.8.dist-info/RECORD +54 -0
- emmet_builders-0.84.7rc4.dist-info/RECORD +0 -54
- {emmet_builders-0.84.7rc4.dist-info → emmet_builders-0.84.8.dist-info}/WHEEL +0 -0
- {emmet_builders-0.84.7rc4.dist-info → emmet_builders-0.84.8.dist-info}/top_level.txt +0 -0
|
@@ -1,28 +1,28 @@
|
|
|
1
|
-
from collections import defaultdict
|
|
2
|
-
from math import ceil
|
|
3
1
|
import itertools
|
|
4
2
|
import re
|
|
3
|
+
from collections import defaultdict
|
|
4
|
+
from math import ceil
|
|
5
|
+
|
|
5
6
|
import boto3
|
|
6
7
|
import numpy as np
|
|
7
8
|
from botocore.handlers import disable_signing
|
|
8
9
|
from maggma.builders import Builder
|
|
9
10
|
from maggma.utils import grouper
|
|
10
11
|
from pymatgen.analysis.magnetism.analyzer import CollinearMagneticStructureAnalyzer
|
|
12
|
+
from pymatgen.analysis.structure_matcher import StructureMatcher
|
|
11
13
|
from pymatgen.core import Structure
|
|
12
|
-
from pymatgen.electronic_structure.core import Spin
|
|
13
14
|
from pymatgen.electronic_structure.bandstructure import BandStructureSymmLine
|
|
15
|
+
from pymatgen.electronic_structure.core import Spin
|
|
14
16
|
from pymatgen.electronic_structure.dos import CompleteDos
|
|
15
|
-
from pymatgen.symmetry.bandstructure import HighSymmKpath
|
|
16
|
-
from pymatgen.analysis.structure_matcher import StructureMatcher
|
|
17
|
-
from pymatgen.symmetry.analyzer import SpacegroupAnalyzer
|
|
18
17
|
from pymatgen.io.vasp.sets import MPStaticSet
|
|
18
|
+
from pymatgen.symmetry.analyzer import SpacegroupAnalyzer
|
|
19
|
+
from pymatgen.symmetry.bandstructure import HighSymmKpath
|
|
19
20
|
|
|
20
|
-
from emmet.
|
|
21
|
+
from emmet.builders.utils import query_open_data
|
|
21
22
|
from emmet.core.electronic_structure import ElectronicStructureDoc
|
|
23
|
+
from emmet.core.settings import EmmetSettings
|
|
22
24
|
from emmet.core.utils import jsanitize
|
|
23
25
|
|
|
24
|
-
from emmet.builders.utils import query_open_data
|
|
25
|
-
|
|
26
26
|
SETTINGS = EmmetSettings()
|
|
27
27
|
|
|
28
28
|
|
|
@@ -297,7 +297,7 @@ class ElectronicStructureBuilder(Builder):
|
|
|
297
297
|
Inserts electronic structure documents into the electronic_structure collection
|
|
298
298
|
|
|
299
299
|
Args:
|
|
300
|
-
items ([
|
|
300
|
+
items ([dict]): A list of ElectronicStructureDoc dictionaries to update
|
|
301
301
|
"""
|
|
302
302
|
|
|
303
303
|
items = list(filter(None, items))
|
|
@@ -577,9 +577,9 @@ class ElectronicStructureBuilder(Builder):
|
|
|
577
577
|
|
|
578
578
|
other_calcs.append(
|
|
579
579
|
{
|
|
580
|
-
"is_static":
|
|
581
|
-
|
|
582
|
-
|
|
580
|
+
"is_static": (
|
|
581
|
+
True if "Static" in mat["task_types"][task_id] else False
|
|
582
|
+
),
|
|
583
583
|
"task_id": task_id,
|
|
584
584
|
"is_hubbard": int(is_hubbard),
|
|
585
585
|
"nkpoints": int(nkpoints),
|
|
@@ -640,9 +640,9 @@ class ElectronicStructureBuilder(Builder):
|
|
|
640
640
|
bs_obj["data"] if bs_obj is not None else None
|
|
641
641
|
)
|
|
642
642
|
|
|
643
|
-
materials_doc["bandstructure"][bs_type][
|
|
644
|
-
"output_structure"
|
|
645
|
-
|
|
643
|
+
materials_doc["bandstructure"][bs_type]["output_structure"] = (
|
|
644
|
+
sorted_bs_data[0]["output_structure"]
|
|
645
|
+
)
|
|
646
646
|
|
|
647
647
|
materials_doc["origins"].append(
|
|
648
648
|
{
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
from math import ceil
|
|
2
|
-
from typing import
|
|
2
|
+
from typing import Iterator
|
|
3
3
|
|
|
4
4
|
from maggma.builders import Builder
|
|
5
5
|
from maggma.stores import Store
|
|
@@ -18,7 +18,7 @@ class MagneticBuilder(Builder):
|
|
|
18
18
|
materials: Store,
|
|
19
19
|
magnetism: Store,
|
|
20
20
|
tasks: Store,
|
|
21
|
-
query:
|
|
21
|
+
query: dict | None = None,
|
|
22
22
|
**kwargs,
|
|
23
23
|
):
|
|
24
24
|
"""
|
|
@@ -42,7 +42,7 @@ class MagneticBuilder(Builder):
|
|
|
42
42
|
|
|
43
43
|
super().__init__(sources=[materials, tasks], targets=[magnetism], **kwargs)
|
|
44
44
|
|
|
45
|
-
def prechunk(self, number_splits: int) -> Iterator[
|
|
45
|
+
def prechunk(self, number_splits: int) -> Iterator[dict]: # pragma: no cover
|
|
46
46
|
"""
|
|
47
47
|
Prechunk method to perform chunking by the key field
|
|
48
48
|
"""
|
emmet/builders/materials/ml.py
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
from importlib.metadata import version
|
|
2
|
-
from typing import TYPE_CHECKING, Optional, Union
|
|
3
2
|
|
|
4
3
|
from maggma.builders.map_builder import MapBuilder
|
|
5
4
|
from maggma.core import Store
|
|
@@ -16,13 +15,12 @@ from pymatgen.core import Structure
|
|
|
16
15
|
from emmet.core.ml import MLDoc
|
|
17
16
|
from emmet.core.utils import jsanitize
|
|
18
17
|
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
from ase.calculators.calculator import Calculator
|
|
18
|
+
try:
|
|
19
|
+
from ase.calculators.calculator import Calculator
|
|
22
20
|
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
21
|
+
ase_installed = True
|
|
22
|
+
except ImportError:
|
|
23
|
+
ase_installed = False
|
|
26
24
|
|
|
27
25
|
|
|
28
26
|
class MLBuilder(MapBuilder):
|
|
@@ -30,10 +28,10 @@ class MLBuilder(MapBuilder):
|
|
|
30
28
|
self,
|
|
31
29
|
materials: Store,
|
|
32
30
|
ml_potential: Store,
|
|
33
|
-
model:
|
|
34
|
-
model_kwargs:
|
|
35
|
-
prop_kwargs:
|
|
36
|
-
provenance:
|
|
31
|
+
model: str | Calculator,
|
|
32
|
+
model_kwargs: dict | None = None,
|
|
33
|
+
prop_kwargs: dict | None = None,
|
|
34
|
+
provenance: dict | None = None,
|
|
37
35
|
**kwargs,
|
|
38
36
|
):
|
|
39
37
|
"""Machine learning interatomic potential builder.
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
from math import ceil
|
|
2
|
-
from typing import
|
|
2
|
+
from typing import Iterator
|
|
3
3
|
|
|
4
4
|
from maggma.builders import Builder
|
|
5
5
|
from maggma.core import Store
|
|
@@ -16,7 +16,7 @@ class OptimadeMaterialsBuilder(Builder):
|
|
|
16
16
|
materials: Store,
|
|
17
17
|
thermo: Store,
|
|
18
18
|
optimade: Store,
|
|
19
|
-
query:
|
|
19
|
+
query: dict | None = None,
|
|
20
20
|
**kwargs,
|
|
21
21
|
):
|
|
22
22
|
"""
|
|
@@ -42,7 +42,7 @@ class OptimadeMaterialsBuilder(Builder):
|
|
|
42
42
|
|
|
43
43
|
super().__init__(sources=[materials, thermo], targets=optimade, **kwargs)
|
|
44
44
|
|
|
45
|
-
def prechunk(self, number_splits: int) -> Iterator[
|
|
45
|
+
def prechunk(self, number_splits: int) -> Iterator[dict]: # pragma: no cover
|
|
46
46
|
"""
|
|
47
47
|
Prechunk method to perform chunking by the key field
|
|
48
48
|
"""
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
from math import ceil
|
|
2
|
-
from typing import Dict, Optional
|
|
3
2
|
|
|
4
3
|
import numpy as np
|
|
5
4
|
from maggma.builders import Builder
|
|
@@ -17,7 +16,7 @@ class PiezoelectricBuilder(Builder):
|
|
|
17
16
|
materials: Store,
|
|
18
17
|
tasks: Store,
|
|
19
18
|
piezoelectric: Store,
|
|
20
|
-
query:
|
|
19
|
+
query: dict | None = None,
|
|
21
20
|
**kwargs,
|
|
22
21
|
):
|
|
23
22
|
self.materials = materials
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
from collections import defaultdict
|
|
2
2
|
from datetime import datetime
|
|
3
3
|
from math import ceil
|
|
4
|
-
from typing import
|
|
4
|
+
from typing import Iterable
|
|
5
5
|
|
|
6
6
|
from maggma.core import Builder, Store
|
|
7
7
|
from maggma.utils import grouper
|
|
@@ -18,9 +18,9 @@ class ProvenanceBuilder(Builder):
|
|
|
18
18
|
self,
|
|
19
19
|
materials: Store,
|
|
20
20
|
provenance: Store,
|
|
21
|
-
source_snls:
|
|
22
|
-
settings:
|
|
23
|
-
query:
|
|
21
|
+
source_snls: list[Store],
|
|
22
|
+
settings: EmmetBuildSettings | None = None,
|
|
23
|
+
query: dict | None = None,
|
|
24
24
|
**kwargs,
|
|
25
25
|
):
|
|
26
26
|
"""
|
|
@@ -59,7 +59,7 @@ class ProvenanceBuilder(Builder):
|
|
|
59
59
|
s.ensure_index("snl_id")
|
|
60
60
|
s.ensure_index("formula_pretty")
|
|
61
61
|
|
|
62
|
-
def prechunk(self, number_splits: int) -> Iterable[
|
|
62
|
+
def prechunk(self, number_splits: int) -> Iterable[dict]: # pragma: no cover
|
|
63
63
|
self.ensure_indicies()
|
|
64
64
|
|
|
65
65
|
# Find all formulas for materials that have been updated since this
|
|
@@ -101,7 +101,7 @@ class ProvenanceBuilder(Builder):
|
|
|
101
101
|
for chunk in grouper(mat_ids, N):
|
|
102
102
|
yield {"query": {"material_id": {"$in": chunk}}}
|
|
103
103
|
|
|
104
|
-
def get_items(self) ->
|
|
104
|
+
def get_items(self) -> tuple[list[dict], list[dict]]: # type: ignore
|
|
105
105
|
"""
|
|
106
106
|
Gets all materials to assocaite with SNLs
|
|
107
107
|
Returns:
|
|
@@ -178,7 +178,7 @@ class ProvenanceBuilder(Builder):
|
|
|
178
178
|
self.logger.debug(f"Found {len(snl_structs)} potential snls for {mat_id}")
|
|
179
179
|
yield mat, snl_structs
|
|
180
180
|
|
|
181
|
-
def process_item(self, item) ->
|
|
181
|
+
def process_item(self, item) -> dict:
|
|
182
182
|
"""
|
|
183
183
|
Matches SNLS and Materials
|
|
184
184
|
Args:
|
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
from typing import Dict, Optional
|
|
2
1
|
from maggma.builders.map_builder import MapBuilder
|
|
3
2
|
from maggma.core import Store
|
|
4
|
-
|
|
5
3
|
from pymatgen.core.structure import Structure
|
|
4
|
+
|
|
6
5
|
from emmet.core.robocrys import RobocrystallogapherDoc
|
|
7
6
|
from emmet.core.utils import jsanitize
|
|
8
7
|
|
|
@@ -12,7 +11,7 @@ class RobocrystallographerBuilder(MapBuilder):
|
|
|
12
11
|
self,
|
|
13
12
|
oxidation_states: Store,
|
|
14
13
|
robocrys: Store,
|
|
15
|
-
query:
|
|
14
|
+
query: dict | None = None,
|
|
16
15
|
**kwargs
|
|
17
16
|
):
|
|
18
17
|
self.oxidation_states = oxidation_states
|
|
@@ -1,14 +1,15 @@
|
|
|
1
|
-
from typing import
|
|
2
|
-
|
|
3
|
-
from maggma.core.store import Store
|
|
1
|
+
from typing import Iterable
|
|
2
|
+
|
|
4
3
|
from maggma.core.builder import Builder
|
|
5
|
-
from
|
|
4
|
+
from maggma.core.store import Store
|
|
5
|
+
from maggma.utils import grouper
|
|
6
6
|
from pymatgen.analysis.elasticity.elastic import ElasticTensor
|
|
7
|
+
from pymatgen.core.structure import Structure
|
|
7
8
|
from pymatgen.symmetry.analyzer import SpacegroupAnalyzer
|
|
8
9
|
|
|
10
|
+
from emmet.core.mpid import MPID
|
|
9
11
|
from emmet.core.substrates import SubstratesDoc
|
|
10
12
|
from emmet.core.utils import jsanitize
|
|
11
|
-
from maggma.utils import grouper
|
|
12
13
|
|
|
13
14
|
|
|
14
15
|
class SubstratesBuilder(Builder):
|
|
@@ -17,7 +18,7 @@ class SubstratesBuilder(Builder):
|
|
|
17
18
|
materials: Store,
|
|
18
19
|
substrates: Store,
|
|
19
20
|
elasticity: Store,
|
|
20
|
-
query:
|
|
21
|
+
query: dict | None = None,
|
|
21
22
|
**kwargs,
|
|
22
23
|
):
|
|
23
24
|
"""
|
|
@@ -47,7 +48,7 @@ class SubstratesBuilder(Builder):
|
|
|
47
48
|
**kwargs,
|
|
48
49
|
)
|
|
49
50
|
|
|
50
|
-
def prechunk(self, number_splits: int) -> Iterable[
|
|
51
|
+
def prechunk(self, number_splits: int) -> Iterable[dict]: # pragma: no cover
|
|
51
52
|
to_process_mat_ids = self._find_to_process()
|
|
52
53
|
|
|
53
54
|
return [
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
from math import ceil
|
|
2
1
|
import warnings
|
|
3
|
-
from itertools import chain
|
|
4
|
-
from typing import Dict, Iterator, List, Optional, Set
|
|
5
2
|
from datetime import datetime
|
|
3
|
+
from itertools import chain
|
|
4
|
+
from math import ceil
|
|
5
|
+
from typing import Iterator, Set
|
|
6
6
|
|
|
7
7
|
from maggma.core import Builder, Store
|
|
8
8
|
from maggma.stores import S3Store
|
|
@@ -12,7 +12,7 @@ from pymatgen.analysis.phase_diagram import PhaseDiagramError
|
|
|
12
12
|
from pymatgen.entries.computed_entries import ComputedStructureEntry
|
|
13
13
|
|
|
14
14
|
from emmet.builders.utils import HiddenPrints
|
|
15
|
-
from emmet.core.thermo import
|
|
15
|
+
from emmet.core.thermo import PhaseDiagramDoc, ThermoDoc
|
|
16
16
|
from emmet.core.utils import jsanitize
|
|
17
17
|
|
|
18
18
|
|
|
@@ -21,9 +21,9 @@ class ThermoBuilder(Builder):
|
|
|
21
21
|
self,
|
|
22
22
|
thermo: Store,
|
|
23
23
|
corrected_entries: Store,
|
|
24
|
-
phase_diagram:
|
|
25
|
-
query:
|
|
26
|
-
num_phase_diagram_eles:
|
|
24
|
+
phase_diagram: Store | None = None,
|
|
25
|
+
query: dict | None = None,
|
|
26
|
+
num_phase_diagram_eles: int | None = None,
|
|
27
27
|
chunk_size: int = 1000,
|
|
28
28
|
**kwargs,
|
|
29
29
|
):
|
|
@@ -111,7 +111,7 @@ class ThermoBuilder(Builder):
|
|
|
111
111
|
coll.ensure_index("chemsys")
|
|
112
112
|
coll.ensure_index("phase_diagram_id")
|
|
113
113
|
|
|
114
|
-
def prechunk(self, number_splits: int) -> Iterator[
|
|
114
|
+
def prechunk(self, number_splits: int) -> Iterator[dict]: # pragma: no cover
|
|
115
115
|
to_process_chemsys = self._get_chemsys_to_process()
|
|
116
116
|
|
|
117
117
|
N = ceil(len(to_process_chemsys) / number_splits)
|
|
@@ -119,7 +119,7 @@ class ThermoBuilder(Builder):
|
|
|
119
119
|
for chemsys_chunk in grouper(to_process_chemsys, N):
|
|
120
120
|
yield {"query": {"chemsys": {"$in": list(chemsys_chunk)}}}
|
|
121
121
|
|
|
122
|
-
def get_items(self) -> Iterator[
|
|
122
|
+
def get_items(self) -> Iterator[list[dict]]:
|
|
123
123
|
"""
|
|
124
124
|
Gets whole chemical systems of entries to process
|
|
125
125
|
"""
|
|
@@ -224,7 +224,7 @@ class ThermoBuilder(Builder):
|
|
|
224
224
|
"""
|
|
225
225
|
Inserts the thermo and phase diagram docs into the thermo collection
|
|
226
226
|
Args:
|
|
227
|
-
items ([[tuple(
|
|
227
|
+
items ([[tuple(list[dict],list[dict])]]): a list of a list of thermo and phase diagram dict pairs to update
|
|
228
228
|
"""
|
|
229
229
|
|
|
230
230
|
thermo_docs = [pair[0] for pair_list in items for pair in pair_list]
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
from itertools import combinations
|
|
2
1
|
import itertools
|
|
2
|
+
from itertools import combinations
|
|
3
3
|
from math import ceil
|
|
4
|
-
from typing import
|
|
4
|
+
from typing import Iterator
|
|
5
5
|
|
|
6
6
|
from maggma.core import Builder
|
|
7
|
-
from maggma.stores import
|
|
7
|
+
from maggma.stores import MongoStore, MongoURIStore, S3Store
|
|
8
8
|
from maggma.utils import grouper
|
|
9
9
|
from pymatgen.core import Composition, Element
|
|
10
10
|
|
|
@@ -21,7 +21,7 @@ class MissingCompositionsBuilder(Builder):
|
|
|
21
21
|
phase_diagram: S3Store,
|
|
22
22
|
mpcontribs: MongoURIStore,
|
|
23
23
|
missing_compositions: MongoStore,
|
|
24
|
-
query:
|
|
24
|
+
query: dict | None = None,
|
|
25
25
|
**kwargs,
|
|
26
26
|
):
|
|
27
27
|
"""
|
|
@@ -47,7 +47,7 @@ class MissingCompositionsBuilder(Builder):
|
|
|
47
47
|
**kwargs,
|
|
48
48
|
)
|
|
49
49
|
|
|
50
|
-
def prechunk(self, number_splits: int) -> Iterator[
|
|
50
|
+
def prechunk(self, number_splits: int) -> Iterator[dict]: # pragma: no cover
|
|
51
51
|
"""
|
|
52
52
|
Prechunk method to perform chunking by the key field
|
|
53
53
|
"""
|
|
@@ -61,7 +61,7 @@ class MissingCompositionsBuilder(Builder):
|
|
|
61
61
|
for split in grouper(keys, N):
|
|
62
62
|
yield {"query": {self.phase_diagram.key: {"$in": list(split)}}}
|
|
63
63
|
|
|
64
|
-
def get_items(self) -> Iterator[
|
|
64
|
+
def get_items(self) -> Iterator[dict]:
|
|
65
65
|
"""
|
|
66
66
|
Returns all chemical systems (combinations of elements)
|
|
67
67
|
to process.
|
|
@@ -112,7 +112,7 @@ class MissingCompositionsBuilder(Builder):
|
|
|
112
112
|
self.logger.error(f"Erro looking for phase diagram for {sys}: {ex}")
|
|
113
113
|
continue
|
|
114
114
|
|
|
115
|
-
def process_item(self, item:
|
|
115
|
+
def process_item(self, item: dict) -> dict:
|
|
116
116
|
"""
|
|
117
117
|
Processes a chemical system and finds missing c
|
|
118
118
|
ompositions for that system.
|
|
@@ -195,7 +195,7 @@ class MissingCompositionsBuilder(Builder):
|
|
|
195
195
|
else:
|
|
196
196
|
self.logger.info("No items to update")
|
|
197
197
|
|
|
198
|
-
def _get_entries_in_chemsys(self, chemsys) ->
|
|
198
|
+
def _get_entries_in_chemsys(self, chemsys) -> list:
|
|
199
199
|
"""Queries the MPContribs Store for entries in a chemical system."""
|
|
200
200
|
# get sub-systems
|
|
201
201
|
chemsys_subsystems = []
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
from maggma.builders.map_builder import MapBuilder
|
|
2
2
|
from maggma.stores import MongoStore
|
|
3
|
-
from typing import Tuple
|
|
4
|
-
from emmet.core.mobility.migrationgraph import MigrationGraphDoc
|
|
5
|
-
from emmet.builders.utils import get_hop_cutoff
|
|
6
|
-
from pymatgen.apps.battery.insertion_battery import InsertionElectrode
|
|
7
3
|
from pymatgen.analysis.diffusion.neb.full_path_mapper import MigrationGraph
|
|
4
|
+
from pymatgen.apps.battery.insertion_battery import InsertionElectrode
|
|
5
|
+
|
|
6
|
+
from emmet.builders.utils import get_hop_cutoff
|
|
7
|
+
from emmet.core.mobility.migrationgraph import MigrationGraphDoc
|
|
8
8
|
from emmet.core.utils import jsanitize
|
|
9
9
|
|
|
10
10
|
|
|
@@ -18,7 +18,7 @@ class MigrationGraphBuilder(MapBuilder):
|
|
|
18
18
|
max_hop_distance: float = 7,
|
|
19
19
|
populate_sc_fields: bool = True,
|
|
20
20
|
min_length_sc: float = 8,
|
|
21
|
-
minmax_num_atoms:
|
|
21
|
+
minmax_num_atoms: tuple[int, int] = (80, 120),
|
|
22
22
|
ltol: float = 0.2,
|
|
23
23
|
stol: float = 0.3,
|
|
24
24
|
angle_tol: float = 5,
|
|
@@ -2,23 +2,22 @@ from collections import defaultdict
|
|
|
2
2
|
from datetime import datetime
|
|
3
3
|
from itertools import chain
|
|
4
4
|
from math import ceil
|
|
5
|
-
from typing import
|
|
5
|
+
from typing import Iterable, Iterator
|
|
6
6
|
|
|
7
7
|
from maggma.builders import Builder
|
|
8
8
|
from maggma.core import Store
|
|
9
9
|
from maggma.utils import grouper
|
|
10
10
|
|
|
11
|
-
from emmet.
|
|
12
|
-
from emmet.core.qchem.molecule import MoleculeDoc, evaluate_lot
|
|
11
|
+
from emmet.builders.settings import EmmetBuildSettings
|
|
13
12
|
from emmet.core.molecules.atomic import (
|
|
14
|
-
PartialChargesDoc,
|
|
15
|
-
PartialSpinsDoc,
|
|
16
13
|
CHARGES_METHODS,
|
|
17
14
|
SPINS_METHODS,
|
|
15
|
+
PartialChargesDoc,
|
|
16
|
+
PartialSpinsDoc,
|
|
18
17
|
)
|
|
18
|
+
from emmet.core.qchem.molecule import MoleculeDoc, evaluate_lot
|
|
19
|
+
from emmet.core.qchem.task import TaskDocument
|
|
19
20
|
from emmet.core.utils import jsanitize
|
|
20
|
-
from emmet.builders.settings import EmmetBuildSettings
|
|
21
|
-
|
|
22
21
|
|
|
23
22
|
__author__ = "Evan Spotte-Smith"
|
|
24
23
|
|
|
@@ -55,9 +54,9 @@ class PartialChargesBuilder(Builder):
|
|
|
55
54
|
tasks: Store,
|
|
56
55
|
molecules: Store,
|
|
57
56
|
charges: Store,
|
|
58
|
-
query:
|
|
59
|
-
methods:
|
|
60
|
-
settings:
|
|
57
|
+
query: dict | None = None,
|
|
58
|
+
methods: list | None = None,
|
|
59
|
+
settings: EmmetBuildSettings | None = None,
|
|
61
60
|
**kwargs,
|
|
62
61
|
):
|
|
63
62
|
self.tasks = tasks
|
|
@@ -105,7 +104,7 @@ class PartialChargesBuilder(Builder):
|
|
|
105
104
|
self.charges.ensure_index("last_updated")
|
|
106
105
|
self.charges.ensure_index("formula_alphabetical")
|
|
107
106
|
|
|
108
|
-
def prechunk(self, number_splits: int) -> Iterable[
|
|
107
|
+
def prechunk(self, number_splits: int) -> Iterable[dict]: # pragma: no cover
|
|
109
108
|
"""Prechunk the builder for distributed computation"""
|
|
110
109
|
|
|
111
110
|
temp_query = dict(self.query)
|
|
@@ -131,7 +130,7 @@ class PartialChargesBuilder(Builder):
|
|
|
131
130
|
query["species_hash"] = {"$in": list(hash_chunk)}
|
|
132
131
|
yield {"query": query}
|
|
133
132
|
|
|
134
|
-
def get_items(self) -> Iterator[
|
|
133
|
+
def get_items(self) -> Iterator[list[dict]]:
|
|
135
134
|
"""
|
|
136
135
|
Gets all items to process into partial charges documents.
|
|
137
136
|
This does no datetime checking; relying on on whether
|
|
@@ -178,12 +177,12 @@ class PartialChargesBuilder(Builder):
|
|
|
178
177
|
|
|
179
178
|
yield molecules
|
|
180
179
|
|
|
181
|
-
def process_item(self, items:
|
|
180
|
+
def process_item(self, items: list[dict]) -> list[dict]:
|
|
182
181
|
"""
|
|
183
182
|
Process the tasks into PartialChargesDocs
|
|
184
183
|
|
|
185
184
|
Args:
|
|
186
|
-
tasks
|
|
185
|
+
tasks list[dict] : a list of MoleculeDocs in dict form
|
|
187
186
|
|
|
188
187
|
Returns:
|
|
189
188
|
[dict] : a list of new partial charges docs
|
|
@@ -275,7 +274,7 @@ class PartialChargesBuilder(Builder):
|
|
|
275
274
|
|
|
276
275
|
return jsanitize([doc.model_dump() for doc in charges_docs], allow_bson=True)
|
|
277
276
|
|
|
278
|
-
def update_targets(self, items:
|
|
277
|
+
def update_targets(self, items: list[list[dict]]):
|
|
279
278
|
"""
|
|
280
279
|
Inserts the new documents into the charges collection
|
|
281
280
|
|
|
@@ -334,9 +333,9 @@ class PartialSpinsBuilder(Builder):
|
|
|
334
333
|
tasks: Store,
|
|
335
334
|
molecules: Store,
|
|
336
335
|
spins: Store,
|
|
337
|
-
query:
|
|
338
|
-
methods:
|
|
339
|
-
settings:
|
|
336
|
+
query: dict | None = None,
|
|
337
|
+
methods: list | None = None,
|
|
338
|
+
settings: EmmetBuildSettings | None = None,
|
|
340
339
|
**kwargs,
|
|
341
340
|
):
|
|
342
341
|
self.tasks = tasks
|
|
@@ -384,7 +383,7 @@ class PartialSpinsBuilder(Builder):
|
|
|
384
383
|
self.spins.ensure_index("last_updated")
|
|
385
384
|
self.spins.ensure_index("formula_alphabetical")
|
|
386
385
|
|
|
387
|
-
def prechunk(self, number_splits: int) -> Iterable[
|
|
386
|
+
def prechunk(self, number_splits: int) -> Iterable[dict]: # pragma: no cover
|
|
388
387
|
"""Prechunk the builder for distributed computation"""
|
|
389
388
|
|
|
390
389
|
temp_query = dict(self.query)
|
|
@@ -410,7 +409,7 @@ class PartialSpinsBuilder(Builder):
|
|
|
410
409
|
query["species_hash"] = {"$in": list(hash_chunk)}
|
|
411
410
|
yield {"query": query}
|
|
412
411
|
|
|
413
|
-
def get_items(self) -> Iterator[
|
|
412
|
+
def get_items(self) -> Iterator[list[dict]]:
|
|
414
413
|
"""
|
|
415
414
|
Gets all items to process into partial spins documents.
|
|
416
415
|
This does no datetime checking; relying on on whether
|
|
@@ -457,12 +456,12 @@ class PartialSpinsBuilder(Builder):
|
|
|
457
456
|
|
|
458
457
|
yield molecules
|
|
459
458
|
|
|
460
|
-
def process_item(self, items:
|
|
459
|
+
def process_item(self, items: list[dict]) -> list[dict]:
|
|
461
460
|
"""
|
|
462
461
|
Process the tasks into PartialSpinsDocs
|
|
463
462
|
|
|
464
463
|
Args:
|
|
465
|
-
tasks
|
|
464
|
+
tasks list[dict] : a list of MoleculeDocs in dict form
|
|
466
465
|
|
|
467
466
|
Returns:
|
|
468
467
|
[dict] : a list of new partial spins docs
|
|
@@ -555,7 +554,7 @@ class PartialSpinsBuilder(Builder):
|
|
|
555
554
|
|
|
556
555
|
return jsanitize([doc.model_dump() for doc in spins_docs], allow_bson=True)
|
|
557
556
|
|
|
558
|
-
def update_targets(self, items:
|
|
557
|
+
def update_targets(self, items: list[list[dict]]):
|
|
559
558
|
"""
|
|
560
559
|
Inserts the new documents into the spins collection
|
|
561
560
|
|
|
@@ -2,18 +2,17 @@ from collections import defaultdict
|
|
|
2
2
|
from datetime import datetime
|
|
3
3
|
from itertools import chain
|
|
4
4
|
from math import ceil
|
|
5
|
-
from typing import
|
|
5
|
+
from typing import Iterable, Iterator
|
|
6
6
|
|
|
7
7
|
from maggma.builders import Builder
|
|
8
8
|
from maggma.core import Store
|
|
9
9
|
from maggma.utils import grouper
|
|
10
10
|
|
|
11
|
-
from emmet.
|
|
11
|
+
from emmet.builders.settings import EmmetBuildSettings
|
|
12
|
+
from emmet.core.molecules.bonds import BOND_METHODS, MoleculeBondingDoc
|
|
12
13
|
from emmet.core.qchem.molecule import MoleculeDoc, evaluate_lot
|
|
13
|
-
from emmet.core.
|
|
14
|
+
from emmet.core.qchem.task import TaskDocument
|
|
14
15
|
from emmet.core.utils import jsanitize
|
|
15
|
-
from emmet.builders.settings import EmmetBuildSettings
|
|
16
|
-
|
|
17
16
|
|
|
18
17
|
__author__ = "Evan Spotte-Smith"
|
|
19
18
|
|
|
@@ -54,9 +53,9 @@ class BondingBuilder(Builder):
|
|
|
54
53
|
tasks: Store,
|
|
55
54
|
molecules: Store,
|
|
56
55
|
bonds: Store,
|
|
57
|
-
query:
|
|
58
|
-
methods:
|
|
59
|
-
settings:
|
|
56
|
+
query: dict | None = None,
|
|
57
|
+
methods: list | None = None,
|
|
58
|
+
settings: EmmetBuildSettings | None = None,
|
|
60
59
|
**kwargs,
|
|
61
60
|
):
|
|
62
61
|
self.tasks = tasks
|
|
@@ -104,7 +103,7 @@ class BondingBuilder(Builder):
|
|
|
104
103
|
self.bonds.ensure_index("last_updated")
|
|
105
104
|
self.bonds.ensure_index("formula_alphabetical")
|
|
106
105
|
|
|
107
|
-
def prechunk(self, number_splits: int) -> Iterable[
|
|
106
|
+
def prechunk(self, number_splits: int) -> Iterable[dict]: # pragma: no cover
|
|
108
107
|
"""Prechunk the builder for distributed computation"""
|
|
109
108
|
|
|
110
109
|
temp_query = dict(self.query)
|
|
@@ -130,7 +129,7 @@ class BondingBuilder(Builder):
|
|
|
130
129
|
query["species_hash"] = {"$in": list(hash_chunk)}
|
|
131
130
|
yield {"query": query}
|
|
132
131
|
|
|
133
|
-
def get_items(self) -> Iterator[
|
|
132
|
+
def get_items(self) -> Iterator[list[dict]]:
|
|
134
133
|
"""
|
|
135
134
|
Gets all items to process into bonding documents.
|
|
136
135
|
This does no datetime checking; relying on on whether
|
|
@@ -177,12 +176,12 @@ class BondingBuilder(Builder):
|
|
|
177
176
|
|
|
178
177
|
yield molecules
|
|
179
178
|
|
|
180
|
-
def process_item(self, items:
|
|
179
|
+
def process_item(self, items: list[dict]) -> list[dict]:
|
|
181
180
|
"""
|
|
182
181
|
Process the tasks into MoleculeBondingDocs
|
|
183
182
|
|
|
184
183
|
Args:
|
|
185
|
-
tasks
|
|
184
|
+
tasks list[dict] : a list of MoleculeDocs in dict form
|
|
186
185
|
|
|
187
186
|
Returns:
|
|
188
187
|
[dict] : a list of new bonding docs
|
|
@@ -292,7 +291,7 @@ class BondingBuilder(Builder):
|
|
|
292
291
|
|
|
293
292
|
return jsanitize([doc.model_dump() for doc in bonding_docs], allow_bson=True)
|
|
294
293
|
|
|
295
|
-
def update_targets(self, items:
|
|
294
|
+
def update_targets(self, items: list[list[dict]]):
|
|
296
295
|
"""
|
|
297
296
|
Inserts the new documents into the bonds collection
|
|
298
297
|
|