emmet-builders 0.84.2__py3-none-any.whl → 0.86.0__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.
- emmet/builders/abinit/phonon.py +27 -25
- emmet/builders/abinit/sound_velocity.py +15 -11
- emmet/builders/feff/xas.py +1 -2
- emmet/builders/materials/absorption_spectrum.py +25 -14
- emmet/builders/materials/alloys.py +3 -4
- emmet/builders/materials/chemenv.py +2 -3
- emmet/builders/materials/corrected_entries.py +15 -9
- emmet/builders/materials/dielectric.py +19 -11
- emmet/builders/materials/elasticity.py +44 -33
- emmet/builders/materials/electrodes.py +24 -19
- emmet/builders/materials/electronic_structure.py +17 -17
- emmet/builders/materials/magnetism.py +11 -4
- emmet/builders/materials/optimade.py +7 -3
- emmet/builders/materials/piezoelectric.py +24 -21
- emmet/builders/materials/provenance.py +15 -12
- emmet/builders/materials/robocrys.py +2 -3
- emmet/builders/materials/substrates.py +9 -8
- emmet/builders/materials/summary.py +3 -3
- 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/settings.py +21 -17
- emmet/builders/utils.py +15 -10
- emmet/builders/vasp/materials.py +32 -16
- emmet/builders/vasp/task_validator.py +15 -11
- {emmet_builders-0.84.2.dist-info → emmet_builders-0.86.0.dist-info}/METADATA +21 -36
- emmet_builders-0.86.0.dist-info/RECORD +41 -0
- {emmet_builders-0.84.2.dist-info → emmet_builders-0.86.0.dist-info}/WHEEL +1 -1
- emmet/builders/materials/ml.py +0 -87
- emmet/builders/molecules/atomic.py +0 -589
- emmet/builders/molecules/bonds.py +0 -324
- emmet/builders/molecules/metal_binding.py +0 -526
- emmet/builders/molecules/orbitals.py +0 -288
- emmet/builders/molecules/redox.py +0 -496
- emmet/builders/molecules/summary.py +0 -383
- emmet/builders/molecules/thermo.py +0 -500
- emmet/builders/molecules/vibration.py +0 -278
- emmet/builders/qchem/__init__.py +0 -0
- emmet/builders/qchem/molecules.py +0 -734
- emmet_builders-0.84.2.dist-info/RECORD +0 -52
- /emmet/builders/{molecules/__init__.py → py.typed} +0 -0
- {emmet_builders-0.84.2.dist-info → emmet_builders-0.86.0.dist-info}/top_level.txt +0 -0
|
@@ -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 AlphaID
|
|
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 [
|
|
@@ -107,7 +108,7 @@ class SubstratesBuilder(Builder):
|
|
|
107
108
|
dict: a diffraction dict
|
|
108
109
|
"""
|
|
109
110
|
|
|
110
|
-
mpid =
|
|
111
|
+
mpid = AlphaID(item["material_id"])
|
|
111
112
|
elastic_tensor = item.get("elastic_tensor", None)
|
|
112
113
|
elastic_tensor = (
|
|
113
114
|
ElasticTensor.from_voigt(elastic_tensor) if elastic_tensor else None
|
|
@@ -3,10 +3,10 @@ from math import ceil
|
|
|
3
3
|
from maggma.builders import Builder
|
|
4
4
|
from maggma.utils import grouper
|
|
5
5
|
|
|
6
|
-
from emmet.core.mpid import
|
|
6
|
+
from emmet.core.mpid import AlphaID
|
|
7
7
|
from emmet.core.summary import SummaryDoc, HasProps
|
|
8
8
|
from emmet.core.utils import jsanitize
|
|
9
|
-
from emmet.core.
|
|
9
|
+
from emmet.core.types.enums import ThermoType
|
|
10
10
|
|
|
11
11
|
|
|
12
12
|
class SummaryBuilder(Builder):
|
|
@@ -214,7 +214,7 @@ class SummaryBuilder(Builder):
|
|
|
214
214
|
yield {"query": {self.materials.key: {"$in": list(split)}}}
|
|
215
215
|
|
|
216
216
|
def process_item(self, item):
|
|
217
|
-
material_id =
|
|
217
|
+
material_id = AlphaID(item[HasProps.materials.value]["material_id"])
|
|
218
218
|
doc = SummaryDoc.from_docs(material_id=material_id, **item)
|
|
219
219
|
return jsanitize(doc.model_dump(exclude_none=False), allow_bson=True)
|
|
220
220
|
|
|
@@ -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,
|
emmet/builders/settings.py
CHANGED
|
@@ -1,14 +1,13 @@
|
|
|
1
1
|
"""
|
|
2
2
|
Settings for defaults in the build pipelines for the Materials Project
|
|
3
3
|
"""
|
|
4
|
-
from typing import List
|
|
5
4
|
|
|
6
5
|
from pydantic.fields import Field
|
|
7
6
|
|
|
8
7
|
from emmet.core.provenance import Author, History
|
|
8
|
+
from emmet.core.qchem.calc_types import TaskType as QChemTaskType
|
|
9
9
|
from emmet.core.settings import EmmetSettings
|
|
10
10
|
from emmet.core.vasp.calc_types import TaskType as VaspTaskType
|
|
11
|
-
from emmet.core.qchem.calc_types import TaskType as QChemTaskType
|
|
12
11
|
|
|
13
12
|
|
|
14
13
|
class EmmetBuildSettings(EmmetSettings):
|
|
@@ -18,35 +17,40 @@ class EmmetBuildSettings(EmmetSettings):
|
|
|
18
17
|
EMMET_CONFIG_FILE to point to the json with emmet settings
|
|
19
18
|
"""
|
|
20
19
|
|
|
21
|
-
BUILD_TAGS:
|
|
20
|
+
BUILD_TAGS: list[str] = Field(
|
|
22
21
|
[], description="Tags for calculations to build materials"
|
|
23
22
|
)
|
|
24
|
-
EXCLUDED_TAGS:
|
|
23
|
+
EXCLUDED_TAGS: list[str] = Field(
|
|
25
24
|
[],
|
|
26
25
|
description="Tags to exclude from materials",
|
|
27
26
|
)
|
|
28
27
|
|
|
29
|
-
DEPRECATED_TAGS:
|
|
28
|
+
DEPRECATED_TAGS: list[str] = Field(
|
|
30
29
|
[], description="Tags for calculations to deprecate"
|
|
31
30
|
)
|
|
32
31
|
|
|
33
|
-
NON_COMMERCIAL_TAGS:
|
|
32
|
+
NON_COMMERCIAL_TAGS: list[str] = Field(
|
|
34
33
|
[], description="Tages for which to add BY-NC as license data in builder_meta"
|
|
35
34
|
)
|
|
36
35
|
|
|
37
|
-
VASP_ALLOWED_VASP_TYPES:
|
|
38
|
-
|
|
36
|
+
VASP_ALLOWED_VASP_TYPES: list[VaspTaskType] = Field(
|
|
37
|
+
list(VaspTaskType),
|
|
39
38
|
description="Allowed task_types to build materials from",
|
|
40
39
|
)
|
|
41
40
|
|
|
42
|
-
QCHEM_ALLOWED_TASK_TYPES:
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
41
|
+
QCHEM_ALLOWED_TASK_TYPES: list[QChemTaskType] = Field(
|
|
42
|
+
list(
|
|
43
|
+
map(
|
|
44
|
+
QChemTaskType,
|
|
45
|
+
[
|
|
46
|
+
"Single Point",
|
|
47
|
+
"Force",
|
|
48
|
+
"Geometry Optimization",
|
|
49
|
+
"Frequency Analysis",
|
|
50
|
+
"Frequency Flattening Geometry Optimization",
|
|
51
|
+
],
|
|
52
|
+
)
|
|
53
|
+
),
|
|
50
54
|
description="Allowed task_types to build molecules from",
|
|
51
55
|
)
|
|
52
56
|
|
|
@@ -71,7 +75,7 @@ class EmmetBuildSettings(EmmetSettings):
|
|
|
71
75
|
)
|
|
72
76
|
|
|
73
77
|
DEFAULT_HISTORY: History = Field(
|
|
74
|
-
History(
|
|
78
|
+
History( # type: ignore[call-arg]
|
|
75
79
|
name="Materials Project Optimized Structure",
|
|
76
80
|
url="http://www.materialsproject.org",
|
|
77
81
|
),
|
emmet/builders/utils.py
CHANGED
|
@@ -6,8 +6,6 @@ import sys
|
|
|
6
6
|
from gzip import GzipFile
|
|
7
7
|
from io import BytesIO
|
|
8
8
|
from itertools import chain, combinations
|
|
9
|
-
from pathlib import Path
|
|
10
|
-
from typing import Any, Literal, Optional, Set, Union
|
|
11
9
|
|
|
12
10
|
import orjson
|
|
13
11
|
from botocore.exceptions import ClientError
|
|
@@ -16,10 +14,17 @@ from pymatgen.analysis.diffusion.neb.full_path_mapper import MigrationGraph
|
|
|
16
14
|
from pymatgen.core import Structure
|
|
17
15
|
from pymatgen.io.vasp.inputs import PotcarSingle
|
|
18
16
|
|
|
17
|
+
from emmet.core.types.typing import FSPathType
|
|
18
|
+
|
|
19
19
|
from emmet.builders.settings import EmmetBuildSettings
|
|
20
20
|
|
|
21
|
+
from typing import TYPE_CHECKING
|
|
22
|
+
|
|
23
|
+
if TYPE_CHECKING:
|
|
24
|
+
from typing import Any, Literal
|
|
25
|
+
|
|
21
26
|
|
|
22
|
-
def maximal_spanning_non_intersecting_subsets(sets) ->
|
|
27
|
+
def maximal_spanning_non_intersecting_subsets(sets) -> set[set[Any]]:
|
|
23
28
|
"""
|
|
24
29
|
Finds the maximal spanning non intersecting subsets of a group of sets
|
|
25
30
|
This is usefull for parsing out the sandboxes and figuring out how to group
|
|
@@ -47,7 +52,7 @@ def maximal_spanning_non_intersecting_subsets(sets) -> Set[Set]:
|
|
|
47
52
|
return set(to_return_subsets)
|
|
48
53
|
|
|
49
54
|
|
|
50
|
-
def chemsys_permutations(chemsys) ->
|
|
55
|
+
def chemsys_permutations(chemsys) -> set[str]:
|
|
51
56
|
# Function to get all relevant chemical subsystems
|
|
52
57
|
# e.g. for Li-Mn-O returns Li, Li-Mn, Li-Mn-O, Li-O, Mn, Mn-O, O
|
|
53
58
|
elements = chemsys.split("-")
|
|
@@ -65,7 +70,7 @@ def get_hop_cutoff(
|
|
|
65
70
|
algorithm: str = "min_distance",
|
|
66
71
|
min_hop_distance: float = 1,
|
|
67
72
|
max_hop_distance: float = 7,
|
|
68
|
-
) ->
|
|
73
|
+
) -> float | None:
|
|
69
74
|
"""
|
|
70
75
|
A function to get an appropriate hop distance cutoff for a given migration
|
|
71
76
|
graph structure which can be used for MigrationGraph.with_distance()
|
|
@@ -165,7 +170,7 @@ def query_open_data(
|
|
|
165
170
|
key: str,
|
|
166
171
|
monty_decode: bool = True,
|
|
167
172
|
s3_resource: Any = None,
|
|
168
|
-
) ->
|
|
173
|
+
) -> dict | None:
|
|
169
174
|
"""Query a Materials Project AWS S3 Open Data bucket directly with boto3
|
|
170
175
|
|
|
171
176
|
Args:
|
|
@@ -173,7 +178,7 @@ def query_open_data(
|
|
|
173
178
|
prefix (str): Full set of file prefixes
|
|
174
179
|
key (str): Key for file
|
|
175
180
|
monty_decode (bool): Whether to monty decode or keep as dictionary. Defaults to True.
|
|
176
|
-
s3_resource (
|
|
181
|
+
s3_resource (Any | None): S3 resource. One will be instantiated if none are provided
|
|
177
182
|
|
|
178
183
|
Returns:
|
|
179
184
|
dict: MontyDecoded data or None
|
|
@@ -222,7 +227,7 @@ class HiddenPrints:
|
|
|
222
227
|
|
|
223
228
|
def get_potcar_stats(
|
|
224
229
|
method: Literal["potcar", "pymatgen", "stored"] = "potcar",
|
|
225
|
-
path_to_stored_stats:
|
|
230
|
+
path_to_stored_stats: FSPathType | None = None,
|
|
226
231
|
) -> dict[str, Any]:
|
|
227
232
|
"""
|
|
228
233
|
Get the POTCAR stats used in MP calculations to validate POTCARs.
|
|
@@ -237,8 +242,8 @@ def get_potcar_stats(
|
|
|
237
242
|
releases. As of 25 March, 2024, it does not appear that the
|
|
238
243
|
MP POTCARs have duplicates
|
|
239
244
|
- "stored": load a stored dict of POTCAR stats.
|
|
240
|
-
path_to_stored_stats :
|
|
241
|
-
If
|
|
245
|
+
path_to_stored_stats : FSPathType or None
|
|
246
|
+
If FSPathType, the path to the stored summary stats file.
|
|
242
247
|
If None, defaults to
|
|
243
248
|
`importlib.resources.file("emmet.builders.vasp") / "mp_potcar_stats.json.gz"`
|
|
244
249
|
Returns:
|
emmet/builders/vasp/materials.py
CHANGED
|
@@ -1,17 +1,23 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
1
3
|
from datetime import datetime
|
|
2
4
|
from itertools import chain
|
|
3
5
|
from math import ceil
|
|
4
|
-
from typing import Dict, Iterable, Iterator, List, Optional, Union
|
|
5
6
|
|
|
6
7
|
from maggma.builders import Builder
|
|
7
8
|
from maggma.stores import Store
|
|
8
9
|
from maggma.utils import grouper
|
|
9
10
|
|
|
10
11
|
from emmet.builders.settings import EmmetBuildSettings
|
|
12
|
+
from emmet.core.tasks import TaskDoc
|
|
11
13
|
from emmet.core.utils import group_structures, jsanitize, undeform_structure
|
|
12
14
|
from emmet.core.vasp.calc_types import TaskType
|
|
13
15
|
from emmet.core.vasp.material import MaterialsDoc
|
|
14
|
-
|
|
16
|
+
|
|
17
|
+
from typing import TYPE_CHECKING
|
|
18
|
+
|
|
19
|
+
if TYPE_CHECKING:
|
|
20
|
+
from collections.abc import Iterable, Iterator
|
|
15
21
|
|
|
16
22
|
__author__ = "Shyam Dwaraknath <shyamd@lbl.gov>"
|
|
17
23
|
|
|
@@ -38,9 +44,9 @@ class MaterialsBuilder(Builder):
|
|
|
38
44
|
self,
|
|
39
45
|
tasks: Store,
|
|
40
46
|
materials: Store,
|
|
41
|
-
task_validation:
|
|
42
|
-
query:
|
|
43
|
-
settings:
|
|
47
|
+
task_validation: Store | None = None,
|
|
48
|
+
query: dict | None = None,
|
|
49
|
+
settings: EmmetBuildSettings | None = None,
|
|
44
50
|
**kwargs,
|
|
45
51
|
):
|
|
46
52
|
"""
|
|
@@ -84,7 +90,7 @@ class MaterialsBuilder(Builder):
|
|
|
84
90
|
self.task_validation.ensure_index("task_id")
|
|
85
91
|
self.task_validation.ensure_index("valid")
|
|
86
92
|
|
|
87
|
-
def prechunk(self, number_splits: int) -> Iterable[
|
|
93
|
+
def prechunk(self, number_splits: int) -> Iterable[dict]: # pragma: no cover
|
|
88
94
|
"""Prechunk the materials builder for distributed computation"""
|
|
89
95
|
temp_query = dict(self.query)
|
|
90
96
|
temp_query["state"] = "successful"
|
|
@@ -114,7 +120,7 @@ class MaterialsBuilder(Builder):
|
|
|
114
120
|
for formula_chunk in grouper(to_process_forms, N):
|
|
115
121
|
yield {"query": {"formula_pretty": {"$in": list(formula_chunk)}}}
|
|
116
122
|
|
|
117
|
-
def get_items(self) -> Iterator[
|
|
123
|
+
def get_items(self) -> Iterator[list[dict]]:
|
|
118
124
|
"""
|
|
119
125
|
Gets all items to process into materials documents.
|
|
120
126
|
This does no datetime checking; relying on whether
|
|
@@ -186,6 +192,7 @@ class MaterialsBuilder(Builder):
|
|
|
186
192
|
# needed for run_type and task_type
|
|
187
193
|
"calcs_reversed.input.parameters",
|
|
188
194
|
"calcs_reversed.input.incar",
|
|
195
|
+
"calcs_reversed.run_type",
|
|
189
196
|
"orig_inputs",
|
|
190
197
|
"input.structure",
|
|
191
198
|
# needed for entry from task_doc
|
|
@@ -212,7 +219,7 @@ class MaterialsBuilder(Builder):
|
|
|
212
219
|
|
|
213
220
|
yield tasks
|
|
214
221
|
|
|
215
|
-
def process_item(self, items:
|
|
222
|
+
def process_item(self, items: list[dict]) -> list[dict]:
|
|
216
223
|
"""
|
|
217
224
|
Process the tasks into a list of materials
|
|
218
225
|
|
|
@@ -238,9 +245,11 @@ class MaterialsBuilder(Builder):
|
|
|
238
245
|
grouped_tasks = self.filter_and_group_tasks(tasks, task_transformations)
|
|
239
246
|
materials = []
|
|
240
247
|
for group in grouped_tasks:
|
|
248
|
+
# commercial_license == True means that the default CC-BY license is applied
|
|
249
|
+
# commercial_license == False means that a CC-BY-NC license is applied
|
|
241
250
|
commercial_license = True
|
|
242
251
|
for task_doc in group:
|
|
243
|
-
if set(task_doc.tags).intersection(
|
|
252
|
+
if task_doc.tags and set(task_doc.tags).intersection(
|
|
244
253
|
set(self.settings.NON_COMMERCIAL_TAGS)
|
|
245
254
|
):
|
|
246
255
|
commercial_license = False
|
|
@@ -270,7 +279,7 @@ class MaterialsBuilder(Builder):
|
|
|
270
279
|
|
|
271
280
|
return jsanitize([mat.model_dump() for mat in materials], allow_bson=True)
|
|
272
281
|
|
|
273
|
-
def update_targets(self, items:
|
|
282
|
+
def update_targets(self, items: list[list[dict]]):
|
|
274
283
|
"""
|
|
275
284
|
Inserts the new task_types into the task_types collection
|
|
276
285
|
|
|
@@ -294,8 +303,8 @@ class MaterialsBuilder(Builder):
|
|
|
294
303
|
self.logger.info("No items to update")
|
|
295
304
|
|
|
296
305
|
def filter_and_group_tasks(
|
|
297
|
-
self, tasks:
|
|
298
|
-
) -> Iterator[
|
|
306
|
+
self, tasks: list[TaskDoc], task_transformations: list[dict | None]
|
|
307
|
+
) -> Iterator[list[TaskDoc]]:
|
|
299
308
|
"""
|
|
300
309
|
Groups tasks by structure matching
|
|
301
310
|
"""
|
|
@@ -317,18 +326,25 @@ class MaterialsBuilder(Builder):
|
|
|
317
326
|
if task.task_type == TaskType.Deformation:
|
|
318
327
|
if (
|
|
319
328
|
transformations is None
|
|
329
|
+
or not task.input
|
|
330
|
+
or not task.input.structure
|
|
320
331
|
): # Do not include deformed tasks without transformation information
|
|
321
332
|
self.logger.debug(
|
|
322
|
-
"Cannot find transformation
|
|
323
|
-
|
|
324
|
-
)
|
|
333
|
+
"Cannot find transformation or original structure "
|
|
334
|
+
f"for deformation task {task.task_id}. Excluding task."
|
|
325
335
|
)
|
|
326
336
|
continue
|
|
327
337
|
else:
|
|
328
338
|
s = undeform_structure(task.input.structure, transformations)
|
|
329
339
|
|
|
340
|
+
elif task.output and task.output.structure:
|
|
341
|
+
s = task.output.structure # type: ignore[assignment]
|
|
330
342
|
else:
|
|
331
|
-
|
|
343
|
+
self.logger.debug(
|
|
344
|
+
f"Skipping task {task.task_id}, missing output structure."
|
|
345
|
+
)
|
|
346
|
+
continue
|
|
347
|
+
|
|
332
348
|
s.index: int = idx # type: ignore
|
|
333
349
|
structures.append(s)
|
|
334
350
|
|
|
@@ -1,13 +1,12 @@
|
|
|
1
|
-
from typing import Dict, Optional
|
|
2
|
-
|
|
3
1
|
from maggma.builders import MapBuilder
|
|
4
2
|
from maggma.core import Store
|
|
5
3
|
|
|
6
4
|
from emmet.builders.settings import EmmetBuildSettings
|
|
7
5
|
from emmet.builders.utils import get_potcar_stats
|
|
8
6
|
from emmet.core.tasks import TaskDoc
|
|
7
|
+
from emmet.core.types.enums import DeprecationMessage
|
|
9
8
|
from emmet.core.vasp.calc_types.enums import CalcType
|
|
10
|
-
from emmet.core.vasp.
|
|
9
|
+
from emmet.core.vasp.validation_legacy import ValidationDoc
|
|
11
10
|
|
|
12
11
|
|
|
13
12
|
class TaskValidator(MapBuilder):
|
|
@@ -15,9 +14,9 @@ class TaskValidator(MapBuilder):
|
|
|
15
14
|
self,
|
|
16
15
|
tasks: Store,
|
|
17
16
|
task_validation: Store,
|
|
18
|
-
potcar_stats:
|
|
19
|
-
settings:
|
|
20
|
-
query:
|
|
17
|
+
potcar_stats: dict[CalcType, dict[str, str]] | None = None,
|
|
18
|
+
settings: EmmetBuildSettings | None = None,
|
|
19
|
+
query: dict | None = None,
|
|
21
20
|
**kwargs,
|
|
22
21
|
):
|
|
23
22
|
"""
|
|
@@ -76,10 +75,15 @@ class TaskValidator(MapBuilder):
|
|
|
76
75
|
potcar_stats=self.potcar_stats,
|
|
77
76
|
)
|
|
78
77
|
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
78
|
+
if task_doc.tags:
|
|
79
|
+
bad_tags = list(
|
|
80
|
+
set(task_doc.tags).intersection(self.settings.DEPRECATED_TAGS)
|
|
81
|
+
)
|
|
82
|
+
if len(bad_tags) > 0:
|
|
83
|
+
validation_doc.warnings.append(
|
|
84
|
+
f"Manual Deprecation by tags: {bad_tags}"
|
|
85
|
+
)
|
|
86
|
+
validation_doc.valid = False
|
|
87
|
+
validation_doc.reasons.append(DeprecationMessage.MANUAL)
|
|
84
88
|
|
|
85
89
|
return validation_doc
|
|
@@ -1,38 +1,21 @@
|
|
|
1
|
-
Metadata-Version: 2.
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
2
|
Name: emmet-builders
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.86.0
|
|
4
4
|
Summary: Builders for the Emmet Library
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
Requires-
|
|
11
|
-
Description-Content-Type: text/markdown
|
|
12
|
-
Requires-Dist: emmet-core[all]
|
|
5
|
+
Author-email: The Materials Project <feedback@materialsproject.org>
|
|
6
|
+
License: Modified BSD
|
|
7
|
+
Project-URL: Homepage, https://github.com/materialsproject/emmet/tree/main/emmet-builders/
|
|
8
|
+
Project-URL: Documentation, https://materialsproject.github.io/emmet/
|
|
9
|
+
Requires-Python: >=3.11
|
|
10
|
+
Requires-Dist: emmet-core[all]>=0.85
|
|
13
11
|
Requires-Dist: maggma>=0.57.6
|
|
14
12
|
Requires-Dist: matminer>=0.9.1
|
|
15
|
-
Requires-Dist:
|
|
16
|
-
Requires-Dist: MDAnalysis>=2.7.0
|
|
17
|
-
Provides-Extra: docs
|
|
18
|
-
Requires-Dist: mkdocs; extra == "docs"
|
|
19
|
-
Requires-Dist: mkdocs-material<8.3; extra == "docs"
|
|
20
|
-
Requires-Dist: mkdocs-material-extensions; extra == "docs"
|
|
21
|
-
Requires-Dist: mkdocs-minify-plugin; extra == "docs"
|
|
22
|
-
Requires-Dist: mkdocstrings; extra == "docs"
|
|
23
|
-
Requires-Dist: mkdocs-awesome-pages-plugin; extra == "docs"
|
|
24
|
-
Requires-Dist: mkdocs-markdownextradata-plugin; extra == "docs"
|
|
25
|
-
Requires-Dist: mkdocstrings[python]; extra == "docs"
|
|
26
|
-
Requires-Dist: livereload; extra == "docs"
|
|
27
|
-
Requires-Dist: jinja2; extra == "docs"
|
|
28
|
-
Provides-Extra: ml
|
|
29
|
-
Requires-Dist: emmet-core[ml]; extra == "ml"
|
|
30
|
-
Provides-Extra: openmm
|
|
31
|
-
Requires-Dist: transport-analysis>=0.1.0; extra == "openmm"
|
|
13
|
+
Requires-Dist: pymatgen-io-validation>=0.1.1
|
|
32
14
|
Provides-Extra: test
|
|
33
15
|
Requires-Dist: pre-commit; extra == "test"
|
|
34
16
|
Requires-Dist: pytest; extra == "test"
|
|
35
17
|
Requires-Dist: pytest-cov; extra == "test"
|
|
18
|
+
Requires-Dist: pytest-xdist; extra == "test"
|
|
36
19
|
Requires-Dist: pycodestyle; extra == "test"
|
|
37
20
|
Requires-Dist: pydocstyle; extra == "test"
|
|
38
21
|
Requires-Dist: flake8; extra == "test"
|
|
@@ -41,12 +24,14 @@ Requires-Dist: mypy-extensions; extra == "test"
|
|
|
41
24
|
Requires-Dist: types-setuptools; extra == "test"
|
|
42
25
|
Requires-Dist: types-requests; extra == "test"
|
|
43
26
|
Requires-Dist: wincertstore; extra == "test"
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
27
|
+
Provides-Extra: docs
|
|
28
|
+
Requires-Dist: mkdocs; extra == "docs"
|
|
29
|
+
Requires-Dist: mkdocs-material<8.3; extra == "docs"
|
|
30
|
+
Requires-Dist: mkdocs-material-extensions; extra == "docs"
|
|
31
|
+
Requires-Dist: mkdocs-minify-plugin; extra == "docs"
|
|
32
|
+
Requires-Dist: mkdocstrings; extra == "docs"
|
|
33
|
+
Requires-Dist: mkdocs-awesome-pages-plugin; extra == "docs"
|
|
34
|
+
Requires-Dist: mkdocs-markdownextradata-plugin; extra == "docs"
|
|
35
|
+
Requires-Dist: mkdocstrings[python]; extra == "docs"
|
|
36
|
+
Requires-Dist: livereload; extra == "docs"
|
|
37
|
+
Requires-Dist: jinja2; extra == "docs"
|