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
|
@@ -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.
|
|
12
|
-
from emmet.core.qchem.molecule import MoleculeDoc, evaluate_lot
|
|
11
|
+
from emmet.builders.settings import EmmetBuildSettings
|
|
13
12
|
from emmet.core.molecules.electric import ElectricMultipoleDoc
|
|
13
|
+
from emmet.core.qchem.molecule import MoleculeDoc, evaluate_lot
|
|
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
|
|
|
@@ -41,8 +40,8 @@ class ElectricMultipoleBuilder(Builder):
|
|
|
41
40
|
tasks: Store,
|
|
42
41
|
molecules: Store,
|
|
43
42
|
multipoles: Store,
|
|
44
|
-
query:
|
|
45
|
-
settings:
|
|
43
|
+
query: dict | None = None,
|
|
44
|
+
settings: EmmetBuildSettings | None = None,
|
|
46
45
|
**kwargs,
|
|
47
46
|
):
|
|
48
47
|
self.tasks = tasks
|
|
@@ -89,7 +88,7 @@ class ElectricMultipoleBuilder(Builder):
|
|
|
89
88
|
self.multipoles.ensure_index("last_updated")
|
|
90
89
|
self.multipoles.ensure_index("formula_alphabetical")
|
|
91
90
|
|
|
92
|
-
def prechunk(self, number_splits: int) -> Iterable[
|
|
91
|
+
def prechunk(self, number_splits: int) -> Iterable[dict]: # pragma: no cover
|
|
93
92
|
"""Prechunk the builder for distributed computation"""
|
|
94
93
|
|
|
95
94
|
temp_query = dict(self.query)
|
|
@@ -115,7 +114,7 @@ class ElectricMultipoleBuilder(Builder):
|
|
|
115
114
|
query["species_hash"] = {"$in": list(hash_chunk)}
|
|
116
115
|
yield {"query": query}
|
|
117
116
|
|
|
118
|
-
def get_items(self) -> Iterator[
|
|
117
|
+
def get_items(self) -> Iterator[list[dict]]:
|
|
119
118
|
"""
|
|
120
119
|
Gets all items to process into multipole documents.
|
|
121
120
|
This does no datetime checking; relying on on whether
|
|
@@ -162,12 +161,12 @@ class ElectricMultipoleBuilder(Builder):
|
|
|
162
161
|
|
|
163
162
|
yield molecules
|
|
164
163
|
|
|
165
|
-
def process_item(self, items:
|
|
164
|
+
def process_item(self, items: list[dict]) -> list[dict]:
|
|
166
165
|
"""
|
|
167
166
|
Process the tasks into ElectricMultipoleDocs
|
|
168
167
|
|
|
169
168
|
Args:
|
|
170
|
-
tasks
|
|
169
|
+
tasks list[dict] : a list of MoleculeDocs in dict form
|
|
171
170
|
|
|
172
171
|
Returns:
|
|
173
172
|
[dict] : a list of new electric multipole docs
|
|
@@ -250,7 +249,7 @@ class ElectricMultipoleBuilder(Builder):
|
|
|
250
249
|
|
|
251
250
|
return jsanitize([doc.model_dump() for doc in multipole_docs], allow_bson=True)
|
|
252
251
|
|
|
253
|
-
def update_targets(self, items:
|
|
252
|
+
def update_targets(self, items: list[list[dict]]):
|
|
254
253
|
"""
|
|
255
254
|
Inserts the new documents into the multipoles collection
|
|
256
255
|
|
|
@@ -1,24 +1,22 @@
|
|
|
1
|
+
import copy
|
|
1
2
|
from datetime import datetime
|
|
2
3
|
from itertools import chain
|
|
3
4
|
from math import ceil
|
|
4
|
-
from typing import
|
|
5
|
-
import copy
|
|
6
|
-
|
|
7
|
-
from pymatgen.core.structure import Molecule
|
|
8
|
-
from pymatgen.util.graph_hashing import weisfeiler_lehman_graph_hash
|
|
5
|
+
from typing import Iterable, Iterator
|
|
9
6
|
|
|
10
7
|
from maggma.builders import Builder
|
|
11
8
|
from maggma.core import Store
|
|
12
9
|
from maggma.utils import grouper
|
|
10
|
+
from pymatgen.core.structure import Molecule
|
|
11
|
+
from pymatgen.util.graph_hashing import weisfeiler_lehman_graph_hash
|
|
13
12
|
|
|
14
|
-
from emmet.
|
|
13
|
+
from emmet.builders.settings import EmmetBuildSettings
|
|
15
14
|
from emmet.core.molecules.atomic import PartialChargesDoc, PartialSpinsDoc
|
|
16
15
|
from emmet.core.molecules.bonds import MoleculeBondingDoc, metals
|
|
16
|
+
from emmet.core.molecules.metal_binding import METAL_BINDING_METHODS, MetalBindingDoc
|
|
17
17
|
from emmet.core.molecules.thermo import MoleculeThermoDoc
|
|
18
|
-
from emmet.core.
|
|
18
|
+
from emmet.core.qchem.molecule import MoleculeDoc
|
|
19
19
|
from emmet.core.utils import jsanitize
|
|
20
|
-
from emmet.builders.settings import EmmetBuildSettings
|
|
21
|
-
|
|
22
20
|
|
|
23
21
|
__author__ = "Evan Spotte-Smith"
|
|
24
22
|
|
|
@@ -73,9 +71,9 @@ class MetalBindingBuilder(Builder):
|
|
|
73
71
|
bonds: Store,
|
|
74
72
|
thermo: Store,
|
|
75
73
|
metal_binding: Store,
|
|
76
|
-
query:
|
|
77
|
-
methods:
|
|
78
|
-
settings:
|
|
74
|
+
query: dict | None = None,
|
|
75
|
+
methods: list | None = None,
|
|
76
|
+
settings: EmmetBuildSettings | None = None,
|
|
79
77
|
**kwargs,
|
|
80
78
|
):
|
|
81
79
|
self.molecules = molecules
|
|
@@ -161,7 +159,7 @@ class MetalBindingBuilder(Builder):
|
|
|
161
159
|
self.metal_binding.ensure_index("formula_alphabetical")
|
|
162
160
|
self.metal_binding.ensure_index("method")
|
|
163
161
|
|
|
164
|
-
def prechunk(self, number_splits: int) -> Iterable[
|
|
162
|
+
def prechunk(self, number_splits: int) -> Iterable[dict]: # pragma: no cover
|
|
165
163
|
"""Prechunk the builder for distributed computation"""
|
|
166
164
|
|
|
167
165
|
temp_query = dict(self.query)
|
|
@@ -187,7 +185,7 @@ class MetalBindingBuilder(Builder):
|
|
|
187
185
|
query["species_hash"] = {"$in": list(hash_chunk)}
|
|
188
186
|
yield {"query": query}
|
|
189
187
|
|
|
190
|
-
def get_items(self) -> Iterator[
|
|
188
|
+
def get_items(self) -> Iterator[list[dict]]:
|
|
191
189
|
"""
|
|
192
190
|
Gets all items to process into metal_binding documents.
|
|
193
191
|
|
|
@@ -232,12 +230,12 @@ class MetalBindingBuilder(Builder):
|
|
|
232
230
|
|
|
233
231
|
yield molecules
|
|
234
232
|
|
|
235
|
-
def process_item(self, items:
|
|
233
|
+
def process_item(self, items: list[dict]) -> list[dict]:
|
|
236
234
|
"""
|
|
237
235
|
Process molecule, bonding, partial charges, partial spins, and thermo documents into MetalBindingDocs
|
|
238
236
|
|
|
239
237
|
Args:
|
|
240
|
-
tasks
|
|
238
|
+
tasks list[dict] : a list of MoleculeDocs in dict form
|
|
241
239
|
|
|
242
240
|
Returns:
|
|
243
241
|
[dict] : a list of new metal binding docs
|
|
@@ -491,7 +489,7 @@ class MetalBindingBuilder(Builder):
|
|
|
491
489
|
|
|
492
490
|
return jsanitize([doc.model_dump() for doc in binding_docs], allow_bson=True)
|
|
493
491
|
|
|
494
|
-
def update_targets(self, items:
|
|
492
|
+
def update_targets(self, items: list[list[dict]]):
|
|
495
493
|
"""
|
|
496
494
|
Inserts the new documents into the metal_binding collection
|
|
497
495
|
|
|
@@ -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.
|
|
12
|
-
from emmet.core.qchem.molecule import MoleculeDoc, evaluate_lot
|
|
11
|
+
from emmet.builders.settings import EmmetBuildSettings
|
|
13
12
|
from emmet.core.molecules.orbitals import OrbitalDoc
|
|
13
|
+
from emmet.core.qchem.molecule import MoleculeDoc, evaluate_lot
|
|
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
|
|
|
@@ -40,8 +39,8 @@ class OrbitalBuilder(Builder):
|
|
|
40
39
|
tasks: Store,
|
|
41
40
|
molecules: Store,
|
|
42
41
|
orbitals: Store,
|
|
43
|
-
query:
|
|
44
|
-
settings:
|
|
42
|
+
query: dict | None = None,
|
|
43
|
+
settings: EmmetBuildSettings | None = None,
|
|
45
44
|
**kwargs,
|
|
46
45
|
):
|
|
47
46
|
self.tasks = tasks
|
|
@@ -87,7 +86,7 @@ class OrbitalBuilder(Builder):
|
|
|
87
86
|
self.orbitals.ensure_index("last_updated")
|
|
88
87
|
self.orbitals.ensure_index("formula_alphabetical")
|
|
89
88
|
|
|
90
|
-
def prechunk(self, number_splits: int) -> Iterable[
|
|
89
|
+
def prechunk(self, number_splits: int) -> Iterable[dict]: # pragma: no cover
|
|
91
90
|
"""Prechunk the builder for distributed computation"""
|
|
92
91
|
|
|
93
92
|
temp_query = dict(self.query)
|
|
@@ -113,7 +112,7 @@ class OrbitalBuilder(Builder):
|
|
|
113
112
|
query["species_hash"] = {"$in": list(hash_chunk)}
|
|
114
113
|
yield {"query": query}
|
|
115
114
|
|
|
116
|
-
def get_items(self) -> Iterator[
|
|
115
|
+
def get_items(self) -> Iterator[list[dict]]:
|
|
117
116
|
"""
|
|
118
117
|
Gets all items to process into orbital documents.
|
|
119
118
|
This does no datetime checking; relying on on whether
|
|
@@ -160,12 +159,12 @@ class OrbitalBuilder(Builder):
|
|
|
160
159
|
|
|
161
160
|
yield molecules
|
|
162
161
|
|
|
163
|
-
def process_item(self, items:
|
|
162
|
+
def process_item(self, items: list[dict]) -> list[dict]:
|
|
164
163
|
"""
|
|
165
164
|
Process the tasks into a OrbitalDocs
|
|
166
165
|
|
|
167
166
|
Args:
|
|
168
|
-
tasks
|
|
167
|
+
tasks list[dict] : a list of MoleculeDocs in dict form
|
|
169
168
|
|
|
170
169
|
Returns:
|
|
171
170
|
[dict] : a list of new orbital docs
|
|
@@ -257,7 +256,7 @@ class OrbitalBuilder(Builder):
|
|
|
257
256
|
|
|
258
257
|
return jsanitize([doc.model_dump() for doc in orbital_docs], allow_bson=True)
|
|
259
258
|
|
|
260
|
-
def update_targets(self, items:
|
|
259
|
+
def update_targets(self, items: list[list[dict]]):
|
|
261
260
|
"""
|
|
262
261
|
Inserts the new documents into the orbitals collection
|
|
263
262
|
|
|
@@ -1,22 +1,21 @@
|
|
|
1
|
-
from collections import defaultdict
|
|
2
1
|
import copy
|
|
2
|
+
from collections import defaultdict
|
|
3
3
|
from datetime import datetime
|
|
4
4
|
from itertools import chain, groupby
|
|
5
5
|
from math import ceil
|
|
6
|
-
from typing import Any,
|
|
6
|
+
from typing import Any, Iterable, Iterator
|
|
7
7
|
|
|
8
8
|
from maggma.builders import Builder
|
|
9
9
|
from maggma.core import Store
|
|
10
10
|
from maggma.utils import grouper
|
|
11
11
|
|
|
12
|
-
from emmet.
|
|
13
|
-
from emmet.core.qchem.molecule import MoleculeDoc
|
|
12
|
+
from emmet.builders.settings import EmmetBuildSettings
|
|
14
13
|
from emmet.core.molecules.bonds import metals
|
|
15
|
-
from emmet.core.molecules.thermo import MoleculeThermoDoc
|
|
16
14
|
from emmet.core.molecules.redox import RedoxDoc
|
|
15
|
+
from emmet.core.molecules.thermo import MoleculeThermoDoc
|
|
16
|
+
from emmet.core.qchem.molecule import MoleculeDoc
|
|
17
|
+
from emmet.core.qchem.task import TaskDocument
|
|
17
18
|
from emmet.core.utils import confirm_molecule, get_graph_hash, jsanitize
|
|
18
|
-
from emmet.builders.settings import EmmetBuildSettings
|
|
19
|
-
|
|
20
19
|
|
|
21
20
|
__author__ = "Evan Spotte-Smith"
|
|
22
21
|
|
|
@@ -51,8 +50,8 @@ class RedoxBuilder(Builder):
|
|
|
51
50
|
molecules: Store,
|
|
52
51
|
thermo: Store,
|
|
53
52
|
redox: Store,
|
|
54
|
-
query:
|
|
55
|
-
settings:
|
|
53
|
+
query: dict | None = None,
|
|
54
|
+
settings: EmmetBuildSettings | None = None,
|
|
56
55
|
**kwargs,
|
|
57
56
|
):
|
|
58
57
|
self.tasks = tasks
|
|
@@ -107,7 +106,7 @@ class RedoxBuilder(Builder):
|
|
|
107
106
|
self.redox.ensure_index("last_updated")
|
|
108
107
|
self.redox.ensure_index("formula_alphabetical")
|
|
109
108
|
|
|
110
|
-
def prechunk(self, number_splits: int) -> Iterable[
|
|
109
|
+
def prechunk(self, number_splits: int) -> Iterable[dict]: # pragma: no cover
|
|
111
110
|
"""Prechunk the builder for distributed computation"""
|
|
112
111
|
|
|
113
112
|
temp_query = dict(self.query)
|
|
@@ -133,7 +132,7 @@ class RedoxBuilder(Builder):
|
|
|
133
132
|
query["species_hash"] = {"$in": list(hash_chunk)}
|
|
134
133
|
yield {"query": query}
|
|
135
134
|
|
|
136
|
-
def get_items(self) -> Iterator[
|
|
135
|
+
def get_items(self) -> Iterator[list[dict]]:
|
|
137
136
|
"""
|
|
138
137
|
Gets all items to process into redox documents.
|
|
139
138
|
This does no datetime checking; relying on on whether
|
|
@@ -180,12 +179,12 @@ class RedoxBuilder(Builder):
|
|
|
180
179
|
|
|
181
180
|
yield molecules
|
|
182
181
|
|
|
183
|
-
def process_item(self, items:
|
|
182
|
+
def process_item(self, items: list[dict]) -> list[dict]:
|
|
184
183
|
"""
|
|
185
184
|
Process the tasks into a RedoxDoc
|
|
186
185
|
|
|
187
186
|
Args:
|
|
188
|
-
tasks
|
|
187
|
+
tasks list[dict] : a list of MoleculeDocs in dict form
|
|
189
188
|
|
|
190
189
|
Returns:
|
|
191
190
|
[dict] : a list of new redox docs
|
|
@@ -203,7 +202,7 @@ class RedoxBuilder(Builder):
|
|
|
203
202
|
|
|
204
203
|
for graph_group in group_by_graph.values():
|
|
205
204
|
# Molecule docs will be grouped by charge
|
|
206
|
-
charges:
|
|
205
|
+
charges: dict[int, Any] = dict()
|
|
207
206
|
|
|
208
207
|
for gg in graph_group:
|
|
209
208
|
# First, grab relevant MoleculeThermoDocs and identify possible IE/EA single-points
|
|
@@ -360,7 +359,7 @@ class RedoxBuilder(Builder):
|
|
|
360
359
|
[doc.model_dump() for doc in redox_docs if doc is not None], allow_bson=True
|
|
361
360
|
)
|
|
362
361
|
|
|
363
|
-
def update_targets(self, items:
|
|
362
|
+
def update_targets(self, items: list[list[dict]]):
|
|
364
363
|
"""
|
|
365
364
|
Inserts the new documents into the orbitals collection
|
|
366
365
|
|
|
@@ -391,7 +390,7 @@ class RedoxBuilder(Builder):
|
|
|
391
390
|
self.logger.info("No items to update")
|
|
392
391
|
|
|
393
392
|
@staticmethod
|
|
394
|
-
def _group_by_graph(mol_docs:
|
|
393
|
+
def _group_by_graph(mol_docs: list[MoleculeDoc]) -> dict[int, list[MoleculeDoc]]:
|
|
395
394
|
"""
|
|
396
395
|
Group molecule docs by molecular graph connectivity
|
|
397
396
|
|
|
@@ -399,7 +398,7 @@ class RedoxBuilder(Builder):
|
|
|
399
398
|
:return: Grouped molecule entries
|
|
400
399
|
"""
|
|
401
400
|
|
|
402
|
-
graph_hashes_nometal:
|
|
401
|
+
graph_hashes_nometal: list[str] = list()
|
|
403
402
|
results = defaultdict(list)
|
|
404
403
|
|
|
405
404
|
# Within each group, group by the covalent molecular graph
|
|
@@ -430,10 +429,10 @@ class RedoxBuilder(Builder):
|
|
|
430
429
|
|
|
431
430
|
@staticmethod
|
|
432
431
|
def _collect_by_lot_solvent(
|
|
433
|
-
thermo_docs:
|
|
434
|
-
ie_docs:
|
|
435
|
-
ea_docs:
|
|
436
|
-
) ->
|
|
432
|
+
thermo_docs: list[MoleculeThermoDoc],
|
|
433
|
+
ie_docs: list[TaskDocument],
|
|
434
|
+
ea_docs: list[TaskDocument],
|
|
435
|
+
) -> dict[str, Any]:
|
|
437
436
|
"""
|
|
438
437
|
For a given MoleculeDoc, group potential MoleculeThermoDocs and TaskDocs for
|
|
439
438
|
IE/EA calculations based on level of theory and solvent.
|
|
@@ -452,7 +451,7 @@ class RedoxBuilder(Builder):
|
|
|
452
451
|
}
|
|
453
452
|
"""
|
|
454
453
|
|
|
455
|
-
def _lot_solv(doc:
|
|
454
|
+
def _lot_solv(doc: MoleculeThermoDoc | TaskDocument):
|
|
456
455
|
if isinstance(doc, MoleculeThermoDoc):
|
|
457
456
|
if doc.correction:
|
|
458
457
|
return doc.correction_lot_solvent
|
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
from datetime import datetime
|
|
2
2
|
from itertools import chain
|
|
3
3
|
from math import ceil
|
|
4
|
-
from typing import Any,
|
|
5
|
-
|
|
6
|
-
# from monty.serialization import loadfn, dumpfn
|
|
4
|
+
from typing import Any, Iterable, Iterator
|
|
7
5
|
|
|
8
6
|
from maggma.builders import Builder
|
|
9
7
|
from maggma.core import Store
|
|
10
8
|
from maggma.utils import grouper
|
|
11
9
|
|
|
10
|
+
from emmet.builders.settings import EmmetBuildSettings
|
|
12
11
|
from emmet.core.molecules.summary import MoleculeSummaryDoc
|
|
13
12
|
from emmet.core.utils import jsanitize
|
|
14
|
-
|
|
13
|
+
|
|
14
|
+
# from monty.serialization import loadfn, dumpfn
|
|
15
15
|
|
|
16
16
|
|
|
17
17
|
__author__ = "Evan Spotte-Smith"
|
|
@@ -43,8 +43,8 @@ class SummaryBuilder(Builder):
|
|
|
43
43
|
thermo: Store,
|
|
44
44
|
vibes: Store,
|
|
45
45
|
summary: Store,
|
|
46
|
-
query:
|
|
47
|
-
settings:
|
|
46
|
+
query: dict | None = None,
|
|
47
|
+
settings: EmmetBuildSettings | None = None,
|
|
48
48
|
**kwargs,
|
|
49
49
|
):
|
|
50
50
|
self.molecules = molecules
|
|
@@ -198,7 +198,7 @@ class SummaryBuilder(Builder):
|
|
|
198
198
|
self.summary.ensure_index("last_updated")
|
|
199
199
|
self.summary.ensure_index("formula_alphabetical")
|
|
200
200
|
|
|
201
|
-
def prechunk(self, number_splits: int) -> Iterable[
|
|
201
|
+
def prechunk(self, number_splits: int) -> Iterable[dict]: # pragma: no cover
|
|
202
202
|
"""Prechunk the builder for distributed computation"""
|
|
203
203
|
|
|
204
204
|
temp_query = dict(self.query)
|
|
@@ -224,7 +224,7 @@ class SummaryBuilder(Builder):
|
|
|
224
224
|
query["species_hash"] = {"$in": list(hash_chunk)}
|
|
225
225
|
yield {"query": query}
|
|
226
226
|
|
|
227
|
-
def get_items(self) -> Iterator[
|
|
227
|
+
def get_items(self) -> Iterator[list[dict]]:
|
|
228
228
|
"""
|
|
229
229
|
Gets all items to process into summary documents.
|
|
230
230
|
This does no datetime checking; relying on on whether
|
|
@@ -271,20 +271,20 @@ class SummaryBuilder(Builder):
|
|
|
271
271
|
|
|
272
272
|
yield molecules
|
|
273
273
|
|
|
274
|
-
def process_item(self, items:
|
|
274
|
+
def process_item(self, items: list[dict]) -> list[dict]:
|
|
275
275
|
"""
|
|
276
276
|
Process the tasks into a MoleculeSummaryDoc
|
|
277
277
|
|
|
278
278
|
Args:
|
|
279
|
-
tasks
|
|
279
|
+
tasks list[dict] : a list of MoleculeDocs in dict form
|
|
280
280
|
|
|
281
281
|
Returns:
|
|
282
282
|
[dict] : a list of new orbital docs
|
|
283
283
|
"""
|
|
284
284
|
|
|
285
|
-
def _group_docs(docs:
|
|
285
|
+
def _group_docs(docs: list[dict[str, Any]], by_method: bool = False):
|
|
286
286
|
"""Helper function to group docs by solvent"""
|
|
287
|
-
grouped:
|
|
287
|
+
grouped: dict[str, Any] = dict()
|
|
288
288
|
|
|
289
289
|
for doc in docs:
|
|
290
290
|
solvent = doc.get("solvent")
|
|
@@ -367,7 +367,7 @@ class SummaryBuilder(Builder):
|
|
|
367
367
|
|
|
368
368
|
return jsanitize([doc.model_dump() for doc in summary_docs], allow_bson=True)
|
|
369
369
|
|
|
370
|
-
def update_targets(self, items:
|
|
370
|
+
def update_targets(self, items: list[list[dict]]):
|
|
371
371
|
"""
|
|
372
372
|
Inserts the new documents into the summary collection
|
|
373
373
|
|
|
@@ -2,22 +2,20 @@ 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
|
|
6
|
-
|
|
7
|
-
from pymatgen.core.structure import Molecule
|
|
8
|
-
from pymatgen.analysis.molecule_matcher import MoleculeMatcher
|
|
5
|
+
from typing import Iterable, Iterator
|
|
9
6
|
|
|
10
7
|
from maggma.builders import Builder
|
|
11
8
|
from maggma.core import Store
|
|
12
9
|
from maggma.utils import grouper
|
|
10
|
+
from pymatgen.analysis.molecule_matcher import MoleculeMatcher
|
|
11
|
+
from pymatgen.core.structure import Molecule
|
|
13
12
|
|
|
14
|
-
from emmet.
|
|
15
|
-
from emmet.core.
|
|
16
|
-
from emmet.core.molecules.thermo import get_free_energy, MoleculeThermoDoc
|
|
13
|
+
from emmet.builders.settings import EmmetBuildSettings
|
|
14
|
+
from emmet.core.molecules.thermo import MoleculeThermoDoc, get_free_energy
|
|
17
15
|
from emmet.core.qchem.calc_types import TaskType
|
|
16
|
+
from emmet.core.qchem.molecule import MoleculeDoc, evaluate_lot
|
|
17
|
+
from emmet.core.qchem.task import TaskDocument
|
|
18
18
|
from emmet.core.utils import jsanitize
|
|
19
|
-
from emmet.builders.settings import EmmetBuildSettings
|
|
20
|
-
|
|
21
19
|
|
|
22
20
|
__author__ = "Evan Spotte-Smith"
|
|
23
21
|
|
|
@@ -119,8 +117,8 @@ class ThermoBuilder(Builder):
|
|
|
119
117
|
tasks: Store,
|
|
120
118
|
molecules: Store,
|
|
121
119
|
thermo: Store,
|
|
122
|
-
query:
|
|
123
|
-
settings:
|
|
120
|
+
query: dict | None = None,
|
|
121
|
+
settings: EmmetBuildSettings | None = None,
|
|
124
122
|
**kwargs,
|
|
125
123
|
):
|
|
126
124
|
self.tasks = tasks
|
|
@@ -166,7 +164,7 @@ class ThermoBuilder(Builder):
|
|
|
166
164
|
self.thermo.ensure_index("last_updated")
|
|
167
165
|
self.thermo.ensure_index("formula_alphabetical")
|
|
168
166
|
|
|
169
|
-
def prechunk(self, number_splits: int) -> Iterable[
|
|
167
|
+
def prechunk(self, number_splits: int) -> Iterable[dict]: # pragma: no cover
|
|
170
168
|
"""Prechunk the builder for distributed computation"""
|
|
171
169
|
|
|
172
170
|
temp_query = dict(self.query)
|
|
@@ -192,7 +190,7 @@ class ThermoBuilder(Builder):
|
|
|
192
190
|
query["species_hash"] = {"$in": list(hash_chunk)}
|
|
193
191
|
yield {"query": query}
|
|
194
192
|
|
|
195
|
-
def get_items(self) -> Iterator[
|
|
193
|
+
def get_items(self) -> Iterator[list[dict]]:
|
|
196
194
|
"""
|
|
197
195
|
Gets all items to process into thermo documents.
|
|
198
196
|
This does no datetime checking; relying on on whether
|
|
@@ -239,12 +237,12 @@ class ThermoBuilder(Builder):
|
|
|
239
237
|
|
|
240
238
|
yield molecules
|
|
241
239
|
|
|
242
|
-
def process_item(self, items:
|
|
240
|
+
def process_item(self, items: list[dict]) -> list[dict]:
|
|
243
241
|
"""
|
|
244
242
|
Process the tasks into a MoleculeThermoDoc
|
|
245
243
|
|
|
246
244
|
Args:
|
|
247
|
-
items
|
|
245
|
+
items list[dict] : a list of MoleculeDocs in dict form
|
|
248
246
|
|
|
249
247
|
Returns:
|
|
250
248
|
[dict] : a list of new thermo docs
|
|
@@ -469,7 +467,7 @@ class ThermoBuilder(Builder):
|
|
|
469
467
|
|
|
470
468
|
return jsanitize([doc.model_dump() for doc in thermo_docs], allow_bson=True)
|
|
471
469
|
|
|
472
|
-
def update_targets(self, items:
|
|
470
|
+
def update_targets(self, items: list[list[dict]]):
|
|
473
471
|
"""
|
|
474
472
|
Inserts the new thermo docs into the thermo collection
|
|
475
473
|
|
|
@@ -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.
|
|
12
|
-
from emmet.core.qchem.molecule import MoleculeDoc, evaluate_lot
|
|
11
|
+
from emmet.builders.settings import EmmetBuildSettings
|
|
13
12
|
from emmet.core.molecules.trajectory import ForcesDoc, TrajectoryDoc
|
|
13
|
+
from emmet.core.qchem.molecule import MoleculeDoc, evaluate_lot
|
|
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
|
|
|
@@ -41,8 +40,8 @@ class ForcesBuilder(Builder):
|
|
|
41
40
|
tasks: Store,
|
|
42
41
|
molecules: Store,
|
|
43
42
|
forces: Store,
|
|
44
|
-
query:
|
|
45
|
-
settings:
|
|
43
|
+
query: dict | None = None,
|
|
44
|
+
settings: EmmetBuildSettings | None = None,
|
|
46
45
|
**kwargs,
|
|
47
46
|
):
|
|
48
47
|
self.tasks = tasks
|
|
@@ -88,7 +87,7 @@ class ForcesBuilder(Builder):
|
|
|
88
87
|
self.forces.ensure_index("last_updated")
|
|
89
88
|
self.forces.ensure_index("formula_alphabetical")
|
|
90
89
|
|
|
91
|
-
def prechunk(self, number_splits: int) -> Iterable[
|
|
90
|
+
def prechunk(self, number_splits: int) -> Iterable[dict]: # pragma: no cover
|
|
92
91
|
"""Prechunk the builder for distributed computation"""
|
|
93
92
|
|
|
94
93
|
temp_query = dict(self.query)
|
|
@@ -114,7 +113,7 @@ class ForcesBuilder(Builder):
|
|
|
114
113
|
query["species_hash"] = {"$in": list(hash_chunk)}
|
|
115
114
|
yield {"query": query}
|
|
116
115
|
|
|
117
|
-
def get_items(self) -> Iterator[
|
|
116
|
+
def get_items(self) -> Iterator[list[dict]]:
|
|
118
117
|
"""
|
|
119
118
|
Gets all items to process into force documents.
|
|
120
119
|
This does no datetime checking; relying on on whether
|
|
@@ -161,12 +160,12 @@ class ForcesBuilder(Builder):
|
|
|
161
160
|
|
|
162
161
|
yield molecules
|
|
163
162
|
|
|
164
|
-
def process_item(self, items:
|
|
163
|
+
def process_item(self, items: list[dict]) -> list[dict]:
|
|
165
164
|
"""
|
|
166
165
|
Process the tasks into ForcesDoc
|
|
167
166
|
|
|
168
167
|
Args:
|
|
169
|
-
items
|
|
168
|
+
items list[dict] : a list of MoleculeDocs in dict form
|
|
170
169
|
|
|
171
170
|
Returns:
|
|
172
171
|
[dict] : a list of new forces docs
|
|
@@ -242,7 +241,7 @@ class ForcesBuilder(Builder):
|
|
|
242
241
|
|
|
243
242
|
return jsanitize([doc.model_dump() for doc in force_docs], allow_bson=True)
|
|
244
243
|
|
|
245
|
-
def update_targets(self, items:
|
|
244
|
+
def update_targets(self, items: list[list[dict]]):
|
|
246
245
|
"""
|
|
247
246
|
Inserts the new force docs into the forces collection
|
|
248
247
|
|
|
@@ -294,8 +293,8 @@ class TrajectoryBuilder(Builder):
|
|
|
294
293
|
tasks: Store,
|
|
295
294
|
molecules: Store,
|
|
296
295
|
trajectories: Store,
|
|
297
|
-
query:
|
|
298
|
-
settings:
|
|
296
|
+
query: dict | None = None,
|
|
297
|
+
settings: EmmetBuildSettings | None = None,
|
|
299
298
|
**kwargs,
|
|
300
299
|
):
|
|
301
300
|
self.tasks = tasks
|
|
@@ -341,7 +340,7 @@ class TrajectoryBuilder(Builder):
|
|
|
341
340
|
self.trajectories.ensure_index("last_updated")
|
|
342
341
|
self.trajectories.ensure_index("formula_alphabetical")
|
|
343
342
|
|
|
344
|
-
def prechunk(self, number_splits: int) -> Iterable[
|
|
343
|
+
def prechunk(self, number_splits: int) -> Iterable[dict]: # pragma: no cover
|
|
345
344
|
"""Prechunk the builder for distributed computation"""
|
|
346
345
|
|
|
347
346
|
temp_query = dict(self.query)
|
|
@@ -365,7 +364,7 @@ class TrajectoryBuilder(Builder):
|
|
|
365
364
|
for hash_chunk in grouper(to_process_hashes, N):
|
|
366
365
|
yield {"query": {"species_hash": {"$in": list(hash_chunk)}}}
|
|
367
366
|
|
|
368
|
-
def get_items(self) -> Iterator[
|
|
367
|
+
def get_items(self) -> Iterator[list[dict]]:
|
|
369
368
|
"""
|
|
370
369
|
Gets all items to process into trajectory documents.
|
|
371
370
|
This does no datetime checking; relying on on whether
|
|
@@ -412,12 +411,12 @@ class TrajectoryBuilder(Builder):
|
|
|
412
411
|
|
|
413
412
|
yield molecules
|
|
414
413
|
|
|
415
|
-
def process_item(self, items:
|
|
414
|
+
def process_item(self, items: list[dict]) -> list[dict]:
|
|
416
415
|
"""
|
|
417
416
|
Process the tasks into TrajectoryDocs
|
|
418
417
|
|
|
419
418
|
Args:
|
|
420
|
-
items
|
|
419
|
+
items list[dict] : a list of MoleculeDocs in dict form
|
|
421
420
|
|
|
422
421
|
Returns:
|
|
423
422
|
[dict] : a list of new trajectory docs
|
|
@@ -492,7 +491,7 @@ class TrajectoryBuilder(Builder):
|
|
|
492
491
|
|
|
493
492
|
return jsanitize([doc.model_dump() for doc in trajectory_docs], allow_bson=True)
|
|
494
493
|
|
|
495
|
-
def update_targets(self, items:
|
|
494
|
+
def update_targets(self, items: list[list[dict]]):
|
|
496
495
|
"""
|
|
497
496
|
Inserts the new force docs into the trajectories collection
|
|
498
497
|
|