emmet-builders 0.84.7rc4__py3-none-any.whl → 0.84.9__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 +15 -11
- emmet/builders/abinit/sound_velocity.py +14 -10
- emmet/builders/feff/xas.py +1 -2
- emmet/builders/materials/absorption_spectrum.py +9 -4
- emmet/builders/materials/alloys.py +2 -3
- emmet/builders/materials/chemenv.py +2 -3
- emmet/builders/materials/corrected_entries.py +14 -8
- emmet/builders/materials/dielectric.py +9 -4
- emmet/builders/materials/elasticity.py +32 -25
- emmet/builders/materials/electrodes.py +23 -18
- emmet/builders/materials/electronic_structure.py +16 -16
- emmet/builders/materials/magnetism.py +9 -3
- emmet/builders/materials/ml.py +9 -11
- emmet/builders/materials/optimade.py +7 -3
- emmet/builders/materials/piezoelectric.py +1 -2
- emmet/builders/materials/provenance.py +11 -7
- emmet/builders/materials/robocrys.py +2 -3
- emmet/builders/materials/substrates.py +8 -7
- emmet/builders/materials/thermo.py +17 -11
- emmet/builders/matscholar/missing_compositions.py +12 -8
- emmet/builders/mobility/migration_graph.py +5 -5
- emmet/builders/molecules/atomic.py +27 -22
- emmet/builders/molecules/bonds.py +17 -12
- emmet/builders/molecules/electric.py +16 -11
- emmet/builders/molecules/metal_binding.py +19 -16
- emmet/builders/molecules/orbitals.py +15 -11
- emmet/builders/molecules/redox.py +27 -21
- emmet/builders/molecules/summary.py +21 -13
- emmet/builders/molecules/thermo.py +20 -15
- emmet/builders/molecules/trajectory.py +23 -18
- emmet/builders/molecules/vibration.py +15 -11
- emmet/builders/qchem/molecules.py +37 -32
- emmet/builders/settings.py +7 -8
- emmet/builders/utils.py +11 -7
- emmet/builders/vasp/materials.py +17 -11
- emmet/builders/vasp/task_validator.py +3 -5
- {emmet_builders-0.84.7rc4.dist-info → emmet_builders-0.84.9.dist-info}/METADATA +1 -1
- emmet_builders-0.84.9.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.9.dist-info}/WHEEL +0 -0
- {emmet_builders-0.84.7rc4.dist-info → emmet_builders-0.84.9.dist-info}/top_level.txt +0 -0
|
@@ -4,7 +4,6 @@ from datetime import datetime
|
|
|
4
4
|
from functools import lru_cache
|
|
5
5
|
from itertools import chain
|
|
6
6
|
from math import ceil
|
|
7
|
-
from typing import Any, Dict, Iterator, List, Optional
|
|
8
7
|
|
|
9
8
|
from maggma.builders import Builder
|
|
10
9
|
from maggma.stores import MongoStore
|
|
@@ -18,6 +17,12 @@ from emmet.core.electrode import ConversionElectrodeDoc, InsertionElectrodeDoc
|
|
|
18
17
|
from emmet.core.structure_group import StructureGroupDoc, _get_id_lexi
|
|
19
18
|
from emmet.core.utils import jsanitize
|
|
20
19
|
|
|
20
|
+
from typing import TYPE_CHECKING
|
|
21
|
+
|
|
22
|
+
if TYPE_CHECKING:
|
|
23
|
+
from typing import Any
|
|
24
|
+
from collections.abc import Iterator
|
|
25
|
+
|
|
21
26
|
|
|
22
27
|
def s_hash(el):
|
|
23
28
|
return el.data["comp_delith"]
|
|
@@ -85,7 +90,7 @@ class StructureGroupBuilder(Builder):
|
|
|
85
90
|
materials: MongoStore,
|
|
86
91
|
sgroups: MongoStore,
|
|
87
92
|
working_ion: str,
|
|
88
|
-
query:
|
|
93
|
+
query: dict | None = None,
|
|
89
94
|
ltol: float = default_build_settings.LTOL,
|
|
90
95
|
stol: float = default_build_settings.STOL,
|
|
91
96
|
angle_tol: float = default_build_settings.ANGLE_TOL,
|
|
@@ -115,15 +120,15 @@ class StructureGroupBuilder(Builder):
|
|
|
115
120
|
self.check_newer = check_newer
|
|
116
121
|
self.chunk_size = chunk_size
|
|
117
122
|
|
|
118
|
-
self.query[
|
|
119
|
-
|
|
120
|
-
|
|
123
|
+
self.query["deprecated"] = (
|
|
124
|
+
False # Ensure only non-deprecated materials are chosen
|
|
125
|
+
)
|
|
121
126
|
|
|
122
127
|
super().__init__(
|
|
123
128
|
sources=[materials], targets=[sgroups], chunk_size=chunk_size, **kwargs
|
|
124
129
|
)
|
|
125
130
|
|
|
126
|
-
def prechunk(self, number_splits: int) -> Iterator[
|
|
131
|
+
def prechunk(self, number_splits: int) -> Iterator[dict]: # pragma: no cover
|
|
127
132
|
"""
|
|
128
133
|
Prechunk method to perform chunking by the key field
|
|
129
134
|
"""
|
|
@@ -268,7 +273,7 @@ class StructureGroupBuilder(Builder):
|
|
|
268
273
|
else:
|
|
269
274
|
yield {"chemsys": chemsys, "materials": all_mats_in_chemsys}
|
|
270
275
|
|
|
271
|
-
def update_targets(self, items:
|
|
276
|
+
def update_targets(self, items: list):
|
|
272
277
|
items = list(filter(None, chain.from_iterable(items)))
|
|
273
278
|
if len(items) > 0:
|
|
274
279
|
self.logger.info("Updating {} sgroups documents".format(len(items)))
|
|
@@ -319,7 +324,7 @@ class InsertionElectrodeBuilder(Builder):
|
|
|
319
324
|
grouped_materials: MongoStore,
|
|
320
325
|
thermo: MongoStore,
|
|
321
326
|
insertion_electrode: MongoStore,
|
|
322
|
-
query:
|
|
327
|
+
query: dict | None = None,
|
|
323
328
|
strip_structures: bool = False,
|
|
324
329
|
**kwargs,
|
|
325
330
|
):
|
|
@@ -335,7 +340,7 @@ class InsertionElectrodeBuilder(Builder):
|
|
|
335
340
|
**kwargs,
|
|
336
341
|
)
|
|
337
342
|
|
|
338
|
-
def prechunk(self, number_splits: int) -> Iterator[
|
|
343
|
+
def prechunk(self, number_splits: int) -> Iterator[dict]:
|
|
339
344
|
"""
|
|
340
345
|
Prechunk method to perform chunking by the key field
|
|
341
346
|
"""
|
|
@@ -418,7 +423,7 @@ class InsertionElectrodeBuilder(Builder):
|
|
|
418
423
|
else:
|
|
419
424
|
yield None
|
|
420
425
|
|
|
421
|
-
def process_item(self, item) ->
|
|
426
|
+
def process_item(self, item) -> dict:
|
|
422
427
|
"""
|
|
423
428
|
- Add volume information to each entry to create the insertion electrode document
|
|
424
429
|
- Add the host structure
|
|
@@ -460,14 +465,14 @@ class InsertionElectrodeBuilder(Builder):
|
|
|
460
465
|
# {"failed_reason": "unable to create InsertionElectrode document"}
|
|
461
466
|
return jsanitize(ie.model_dump())
|
|
462
467
|
|
|
463
|
-
def update_targets(self, items:
|
|
468
|
+
def update_targets(self, items: list):
|
|
464
469
|
items = list(filter(None, items))
|
|
465
470
|
if len(items) > 0:
|
|
466
471
|
self.logger.info("Updating {} battery documents".format(len(items)))
|
|
467
472
|
for struct_group_dict in items:
|
|
468
|
-
struct_group_dict[
|
|
469
|
-
|
|
470
|
-
|
|
473
|
+
struct_group_dict[self.grouped_materials.last_updated_field] = (
|
|
474
|
+
datetime.utcnow()
|
|
475
|
+
)
|
|
471
476
|
self.insertion_electrode.update(docs=items, key=["battery_id"])
|
|
472
477
|
else:
|
|
473
478
|
self.logger.info("No items to update")
|
|
@@ -480,7 +485,7 @@ class ConversionElectrodeBuilder(Builder):
|
|
|
480
485
|
conversion_electrode_store: MongoStore,
|
|
481
486
|
working_ion: str,
|
|
482
487
|
thermo_type: str,
|
|
483
|
-
query:
|
|
488
|
+
query: dict | None = None,
|
|
484
489
|
**kwargs,
|
|
485
490
|
):
|
|
486
491
|
self.phase_diagram_store = phase_diagram_store
|
|
@@ -499,7 +504,7 @@ class ConversionElectrodeBuilder(Builder):
|
|
|
499
504
|
**kwargs,
|
|
500
505
|
)
|
|
501
506
|
|
|
502
|
-
def prechunk(self, number_splits: int) -> Iterator[
|
|
507
|
+
def prechunk(self, number_splits: int) -> Iterator[dict]:
|
|
503
508
|
"""
|
|
504
509
|
Prechunk method to perform chunking by the key field
|
|
505
510
|
"""
|
|
@@ -532,7 +537,7 @@ class ConversionElectrodeBuilder(Builder):
|
|
|
532
537
|
for phase_diagram_doc in self.phase_diagram_store.query(criteria=q):
|
|
533
538
|
yield phase_diagram_doc
|
|
534
539
|
|
|
535
|
-
def process_item(self, item) ->
|
|
540
|
+
def process_item(self, item) -> dict:
|
|
536
541
|
"""
|
|
537
542
|
- For each phase diagram doc, find all possible conversion electrodes and create conversion electrode docs
|
|
538
543
|
"""
|
|
@@ -611,7 +616,7 @@ class ConversionElectrodeBuilder(Builder):
|
|
|
611
616
|
|
|
612
617
|
return new_docs # type: ignore
|
|
613
618
|
|
|
614
|
-
def update_targets(self, items:
|
|
619
|
+
def update_targets(self, items: list):
|
|
615
620
|
combined_items = []
|
|
616
621
|
for _items in items:
|
|
617
622
|
_items = list(filter(None, _items))
|
|
@@ -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,6 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
1
3
|
from math import ceil
|
|
2
|
-
from typing import Dict, Iterator, Optional
|
|
3
4
|
|
|
4
5
|
from maggma.builders import Builder
|
|
5
6
|
from maggma.stores import Store
|
|
@@ -9,6 +10,11 @@ from pymatgen.core.structure import Structure
|
|
|
9
10
|
from emmet.core.magnetism import MagnetismDoc
|
|
10
11
|
from emmet.core.utils import jsanitize
|
|
11
12
|
|
|
13
|
+
from typing import TYPE_CHECKING
|
|
14
|
+
|
|
15
|
+
if TYPE_CHECKING:
|
|
16
|
+
from collections.abc import Iterator
|
|
17
|
+
|
|
12
18
|
__author__ = "Shyam Dwaraknath <shyamd@lbl.gov>, Matthew Horton <mkhorton@lbl.gov>"
|
|
13
19
|
|
|
14
20
|
|
|
@@ -18,7 +24,7 @@ class MagneticBuilder(Builder):
|
|
|
18
24
|
materials: Store,
|
|
19
25
|
magnetism: Store,
|
|
20
26
|
tasks: Store,
|
|
21
|
-
query:
|
|
27
|
+
query: dict | None = None,
|
|
22
28
|
**kwargs,
|
|
23
29
|
):
|
|
24
30
|
"""
|
|
@@ -42,7 +48,7 @@ class MagneticBuilder(Builder):
|
|
|
42
48
|
|
|
43
49
|
super().__init__(sources=[materials, tasks], targets=[magnetism], **kwargs)
|
|
44
50
|
|
|
45
|
-
def prechunk(self, number_splits: int) -> Iterator[
|
|
51
|
+
def prechunk(self, number_splits: int) -> Iterator[dict]: # pragma: no cover
|
|
46
52
|
"""
|
|
47
53
|
Prechunk method to perform chunking by the key field
|
|
48
54
|
"""
|
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,4 @@
|
|
|
1
1
|
from math import ceil
|
|
2
|
-
from typing import Dict, Iterator, Optional
|
|
3
2
|
|
|
4
3
|
from maggma.builders import Builder
|
|
5
4
|
from maggma.core import Store
|
|
@@ -9,6 +8,11 @@ from pymatgen.core.structure import Structure
|
|
|
9
8
|
from emmet.core.optimade import OptimadeMaterialsDoc
|
|
10
9
|
from emmet.core.utils import jsanitize
|
|
11
10
|
|
|
11
|
+
from typing import TYPE_CHECKING
|
|
12
|
+
|
|
13
|
+
if TYPE_CHECKING:
|
|
14
|
+
from collections.abc import Iterator
|
|
15
|
+
|
|
12
16
|
|
|
13
17
|
class OptimadeMaterialsBuilder(Builder):
|
|
14
18
|
def __init__(
|
|
@@ -16,7 +20,7 @@ class OptimadeMaterialsBuilder(Builder):
|
|
|
16
20
|
materials: Store,
|
|
17
21
|
thermo: Store,
|
|
18
22
|
optimade: Store,
|
|
19
|
-
query:
|
|
23
|
+
query: dict | None = None,
|
|
20
24
|
**kwargs,
|
|
21
25
|
):
|
|
22
26
|
"""
|
|
@@ -42,7 +46,7 @@ class OptimadeMaterialsBuilder(Builder):
|
|
|
42
46
|
|
|
43
47
|
super().__init__(sources=[materials, thermo], targets=optimade, **kwargs)
|
|
44
48
|
|
|
45
|
-
def prechunk(self, number_splits: int) -> Iterator[
|
|
49
|
+
def prechunk(self, number_splits: int) -> Iterator[dict]: # pragma: no cover
|
|
46
50
|
"""
|
|
47
51
|
Prechunk method to perform chunking by the key field
|
|
48
52
|
"""
|
|
@@ -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,6 @@
|
|
|
1
1
|
from collections import defaultdict
|
|
2
2
|
from datetime import datetime
|
|
3
3
|
from math import ceil
|
|
4
|
-
from typing import Dict, Iterable, List, Optional, Tuple
|
|
5
4
|
|
|
6
5
|
from maggma.core import Builder, Store
|
|
7
6
|
from maggma.utils import grouper
|
|
@@ -12,15 +11,20 @@ from emmet.builders.settings import EmmetBuildSettings
|
|
|
12
11
|
from emmet.core.provenance import ProvenanceDoc, SNLDict
|
|
13
12
|
from emmet.core.utils import get_sg, jsanitize
|
|
14
13
|
|
|
14
|
+
from typing import TYPE_CHECKING
|
|
15
|
+
|
|
16
|
+
if TYPE_CHECKING:
|
|
17
|
+
from collections.abc import Iterable
|
|
18
|
+
|
|
15
19
|
|
|
16
20
|
class ProvenanceBuilder(Builder):
|
|
17
21
|
def __init__(
|
|
18
22
|
self,
|
|
19
23
|
materials: Store,
|
|
20
24
|
provenance: Store,
|
|
21
|
-
source_snls:
|
|
22
|
-
settings:
|
|
23
|
-
query:
|
|
25
|
+
source_snls: list[Store],
|
|
26
|
+
settings: EmmetBuildSettings | None = None,
|
|
27
|
+
query: dict | None = None,
|
|
24
28
|
**kwargs,
|
|
25
29
|
):
|
|
26
30
|
"""
|
|
@@ -59,7 +63,7 @@ class ProvenanceBuilder(Builder):
|
|
|
59
63
|
s.ensure_index("snl_id")
|
|
60
64
|
s.ensure_index("formula_pretty")
|
|
61
65
|
|
|
62
|
-
def prechunk(self, number_splits: int) -> Iterable[
|
|
66
|
+
def prechunk(self, number_splits: int) -> Iterable[dict]: # pragma: no cover
|
|
63
67
|
self.ensure_indicies()
|
|
64
68
|
|
|
65
69
|
# Find all formulas for materials that have been updated since this
|
|
@@ -101,7 +105,7 @@ class ProvenanceBuilder(Builder):
|
|
|
101
105
|
for chunk in grouper(mat_ids, N):
|
|
102
106
|
yield {"query": {"material_id": {"$in": chunk}}}
|
|
103
107
|
|
|
104
|
-
def get_items(self) ->
|
|
108
|
+
def get_items(self) -> tuple[list[dict], list[dict]]: # type: ignore
|
|
105
109
|
"""
|
|
106
110
|
Gets all materials to assocaite with SNLs
|
|
107
111
|
Returns:
|
|
@@ -178,7 +182,7 @@ class ProvenanceBuilder(Builder):
|
|
|
178
182
|
self.logger.debug(f"Found {len(snl_structs)} potential snls for {mat_id}")
|
|
179
183
|
yield mat, snl_structs
|
|
180
184
|
|
|
181
|
-
def process_item(self, item) ->
|
|
185
|
+
def process_item(self, item) -> dict:
|
|
182
186
|
"""
|
|
183
187
|
Matches SNLS and Materials
|
|
184
188
|
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,9 @@
|
|
|
1
|
-
from
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
2
3
|
import warnings
|
|
3
|
-
from itertools import chain
|
|
4
|
-
from typing import Dict, Iterator, List, Optional, Set
|
|
5
4
|
from datetime import datetime
|
|
5
|
+
from itertools import chain
|
|
6
|
+
from math import ceil
|
|
6
7
|
|
|
7
8
|
from maggma.core import Builder, Store
|
|
8
9
|
from maggma.stores import S3Store
|
|
@@ -12,18 +13,23 @@ from pymatgen.analysis.phase_diagram import PhaseDiagramError
|
|
|
12
13
|
from pymatgen.entries.computed_entries import ComputedStructureEntry
|
|
13
14
|
|
|
14
15
|
from emmet.builders.utils import HiddenPrints
|
|
15
|
-
from emmet.core.thermo import
|
|
16
|
+
from emmet.core.thermo import PhaseDiagramDoc, ThermoDoc
|
|
16
17
|
from emmet.core.utils import jsanitize
|
|
17
18
|
|
|
19
|
+
from typing import TYPE_CHECKING
|
|
20
|
+
|
|
21
|
+
if TYPE_CHECKING:
|
|
22
|
+
from collections.abc import Iterator
|
|
23
|
+
|
|
18
24
|
|
|
19
25
|
class ThermoBuilder(Builder):
|
|
20
26
|
def __init__(
|
|
21
27
|
self,
|
|
22
28
|
thermo: Store,
|
|
23
29
|
corrected_entries: Store,
|
|
24
|
-
phase_diagram:
|
|
25
|
-
query:
|
|
26
|
-
num_phase_diagram_eles:
|
|
30
|
+
phase_diagram: Store | None = None,
|
|
31
|
+
query: dict | None = None,
|
|
32
|
+
num_phase_diagram_eles: int | None = None,
|
|
27
33
|
chunk_size: int = 1000,
|
|
28
34
|
**kwargs,
|
|
29
35
|
):
|
|
@@ -49,7 +55,7 @@ class ThermoBuilder(Builder):
|
|
|
49
55
|
self.phase_diagram = phase_diagram
|
|
50
56
|
self.num_phase_diagram_eles = num_phase_diagram_eles
|
|
51
57
|
self.chunk_size = chunk_size
|
|
52
|
-
self._completed_tasks:
|
|
58
|
+
self._completed_tasks: set[str] = set()
|
|
53
59
|
|
|
54
60
|
if self.thermo.key != "thermo_id":
|
|
55
61
|
warnings.warn(
|
|
@@ -111,7 +117,7 @@ class ThermoBuilder(Builder):
|
|
|
111
117
|
coll.ensure_index("chemsys")
|
|
112
118
|
coll.ensure_index("phase_diagram_id")
|
|
113
119
|
|
|
114
|
-
def prechunk(self, number_splits: int) -> Iterator[
|
|
120
|
+
def prechunk(self, number_splits: int) -> Iterator[dict]: # pragma: no cover
|
|
115
121
|
to_process_chemsys = self._get_chemsys_to_process()
|
|
116
122
|
|
|
117
123
|
N = ceil(len(to_process_chemsys) / number_splits)
|
|
@@ -119,7 +125,7 @@ class ThermoBuilder(Builder):
|
|
|
119
125
|
for chemsys_chunk in grouper(to_process_chemsys, N):
|
|
120
126
|
yield {"query": {"chemsys": {"$in": list(chemsys_chunk)}}}
|
|
121
127
|
|
|
122
|
-
def get_items(self) -> Iterator[
|
|
128
|
+
def get_items(self) -> Iterator[list[dict]]:
|
|
123
129
|
"""
|
|
124
130
|
Gets whole chemical systems of entries to process
|
|
125
131
|
"""
|
|
@@ -224,7 +230,7 @@ class ThermoBuilder(Builder):
|
|
|
224
230
|
"""
|
|
225
231
|
Inserts the thermo and phase diagram docs into the thermo collection
|
|
226
232
|
Args:
|
|
227
|
-
items ([[tuple(
|
|
233
|
+
items ([[tuple(list[dict],list[dict])]]): a list of a list of thermo and phase diagram dict pairs to update
|
|
228
234
|
"""
|
|
229
235
|
|
|
230
236
|
thermo_docs = [pair[0] for pair_list in items for pair in pair_list]
|
|
@@ -1,13 +1,17 @@
|
|
|
1
|
-
from itertools import combinations
|
|
2
1
|
import itertools
|
|
2
|
+
from itertools import combinations
|
|
3
3
|
from math import ceil
|
|
4
|
-
from typing import Dict, List, Iterator, Optional
|
|
5
4
|
|
|
6
5
|
from maggma.core import Builder
|
|
7
|
-
from maggma.stores import
|
|
6
|
+
from maggma.stores import MongoStore, MongoURIStore, S3Store
|
|
8
7
|
from maggma.utils import grouper
|
|
9
8
|
from pymatgen.core import Composition, Element
|
|
10
9
|
|
|
10
|
+
from typing import TYPE_CHECKING
|
|
11
|
+
|
|
12
|
+
if TYPE_CHECKING:
|
|
13
|
+
from collections.abc import Iterator
|
|
14
|
+
|
|
11
15
|
|
|
12
16
|
class MissingCompositionsBuilder(Builder):
|
|
13
17
|
"""
|
|
@@ -21,7 +25,7 @@ class MissingCompositionsBuilder(Builder):
|
|
|
21
25
|
phase_diagram: S3Store,
|
|
22
26
|
mpcontribs: MongoURIStore,
|
|
23
27
|
missing_compositions: MongoStore,
|
|
24
|
-
query:
|
|
28
|
+
query: dict | None = None,
|
|
25
29
|
**kwargs,
|
|
26
30
|
):
|
|
27
31
|
"""
|
|
@@ -47,7 +51,7 @@ class MissingCompositionsBuilder(Builder):
|
|
|
47
51
|
**kwargs,
|
|
48
52
|
)
|
|
49
53
|
|
|
50
|
-
def prechunk(self, number_splits: int) -> Iterator[
|
|
54
|
+
def prechunk(self, number_splits: int) -> Iterator[dict]: # pragma: no cover
|
|
51
55
|
"""
|
|
52
56
|
Prechunk method to perform chunking by the key field
|
|
53
57
|
"""
|
|
@@ -61,7 +65,7 @@ class MissingCompositionsBuilder(Builder):
|
|
|
61
65
|
for split in grouper(keys, N):
|
|
62
66
|
yield {"query": {self.phase_diagram.key: {"$in": list(split)}}}
|
|
63
67
|
|
|
64
|
-
def get_items(self) -> Iterator[
|
|
68
|
+
def get_items(self) -> Iterator[dict]:
|
|
65
69
|
"""
|
|
66
70
|
Returns all chemical systems (combinations of elements)
|
|
67
71
|
to process.
|
|
@@ -112,7 +116,7 @@ class MissingCompositionsBuilder(Builder):
|
|
|
112
116
|
self.logger.error(f"Erro looking for phase diagram for {sys}: {ex}")
|
|
113
117
|
continue
|
|
114
118
|
|
|
115
|
-
def process_item(self, item:
|
|
119
|
+
def process_item(self, item: dict) -> dict:
|
|
116
120
|
"""
|
|
117
121
|
Processes a chemical system and finds missing c
|
|
118
122
|
ompositions for that system.
|
|
@@ -195,7 +199,7 @@ class MissingCompositionsBuilder(Builder):
|
|
|
195
199
|
else:
|
|
196
200
|
self.logger.info("No items to update")
|
|
197
201
|
|
|
198
|
-
def _get_entries_in_chemsys(self, chemsys) ->
|
|
202
|
+
def _get_entries_in_chemsys(self, chemsys) -> list:
|
|
199
203
|
"""Queries the MPContribs Store for entries in a chemical system."""
|
|
200
204
|
# get sub-systems
|
|
201
205
|
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,
|