emmet-builders 0.78.3__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.
Files changed (44) hide show
  1. emmet/builders/abinit/phonon.py +47 -47
  2. emmet/builders/abinit/sound_velocity.py +15 -11
  3. emmet/builders/feff/xas.py +1 -2
  4. emmet/builders/materials/absorption_spectrum.py +25 -14
  5. emmet/builders/materials/alloys.py +10 -11
  6. emmet/builders/materials/chemenv.py +2 -3
  7. emmet/builders/materials/corrected_entries.py +21 -15
  8. emmet/builders/materials/dielectric.py +19 -11
  9. emmet/builders/materials/elasticity.py +44 -33
  10. emmet/builders/materials/electrodes.py +35 -28
  11. emmet/builders/materials/electronic_structure.py +17 -17
  12. emmet/builders/materials/magnetism.py +11 -4
  13. emmet/builders/materials/optimade.py +7 -3
  14. emmet/builders/materials/piezoelectric.py +24 -21
  15. emmet/builders/materials/provenance.py +16 -13
  16. emmet/builders/materials/robocrys.py +2 -3
  17. emmet/builders/materials/substrates.py +9 -8
  18. emmet/builders/materials/summary.py +3 -3
  19. emmet/builders/materials/thermo.py +17 -11
  20. emmet/builders/matscholar/missing_compositions.py +12 -8
  21. emmet/builders/mobility/migration_graph.py +5 -5
  22. emmet/builders/settings.py +21 -17
  23. emmet/builders/utils.py +101 -12
  24. emmet/builders/vasp/materials.py +40 -51
  25. emmet/builders/vasp/mp_potcar_stats.json.gz +0 -0
  26. emmet/builders/vasp/task_validator.py +25 -36
  27. emmet_builders-0.86.0.dist-info/METADATA +37 -0
  28. emmet_builders-0.86.0.dist-info/RECORD +41 -0
  29. {emmet_builders-0.78.3.dist-info → emmet_builders-0.86.0.dist-info}/WHEEL +1 -1
  30. emmet/builders/materials/ml.py +0 -87
  31. emmet/builders/molecules/atomic.py +0 -589
  32. emmet/builders/molecules/bonds.py +0 -324
  33. emmet/builders/molecules/metal_binding.py +0 -526
  34. emmet/builders/molecules/orbitals.py +0 -288
  35. emmet/builders/molecules/redox.py +0 -496
  36. emmet/builders/molecules/summary.py +0 -383
  37. emmet/builders/molecules/thermo.py +0 -500
  38. emmet/builders/molecules/vibration.py +0 -278
  39. emmet/builders/qchem/__init__.py +0 -0
  40. emmet/builders/qchem/molecules.py +0 -734
  41. emmet_builders-0.78.3.dist-info/METADATA +0 -47
  42. emmet_builders-0.78.3.dist-info/RECORD +0 -51
  43. /emmet/builders/{molecules/__init__.py → py.typed} +0 -0
  44. {emmet_builders-0.78.3.dist-info → emmet_builders-0.86.0.dist-info}/top_level.txt +0 -0
@@ -1,22 +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
- from pymatgen.analysis.elasticity.strain import Deformation
10
- from pymatgen.core.structure import Structure
11
- from pymatgen.transformations.standard_transformations import (
12
- DeformStructureTransformation,
13
- )
14
10
 
15
11
  from emmet.builders.settings import EmmetBuildSettings
16
- from emmet.core.utils import group_structures, jsanitize
12
+ from emmet.core.tasks import TaskDoc
13
+ from emmet.core.utils import group_structures, jsanitize, undeform_structure
17
14
  from emmet.core.vasp.calc_types import TaskType
18
15
  from emmet.core.vasp.material import MaterialsDoc
19
- from emmet.core.vasp.task_valid import TaskDocument
16
+
17
+ from typing import TYPE_CHECKING
18
+
19
+ if TYPE_CHECKING:
20
+ from collections.abc import Iterable, Iterator
20
21
 
21
22
  __author__ = "Shyam Dwaraknath <shyamd@lbl.gov>"
22
23
 
@@ -43,9 +44,9 @@ class MaterialsBuilder(Builder):
43
44
  self,
44
45
  tasks: Store,
45
46
  materials: Store,
46
- task_validation: Optional[Store] = None,
47
- query: Optional[Dict] = None,
48
- settings: Optional[EmmetBuildSettings] = None,
47
+ task_validation: Store | None = None,
48
+ query: dict | None = None,
49
+ settings: EmmetBuildSettings | None = None,
49
50
  **kwargs,
50
51
  ):
51
52
  """
@@ -89,7 +90,7 @@ class MaterialsBuilder(Builder):
89
90
  self.task_validation.ensure_index("task_id")
90
91
  self.task_validation.ensure_index("valid")
91
92
 
92
- def prechunk(self, number_splits: int) -> Iterable[Dict]: # pragma: no cover
93
+ def prechunk(self, number_splits: int) -> Iterable[dict]: # pragma: no cover
93
94
  """Prechunk the materials builder for distributed computation"""
94
95
  temp_query = dict(self.query)
95
96
  temp_query["state"] = "successful"
@@ -119,7 +120,7 @@ class MaterialsBuilder(Builder):
119
120
  for formula_chunk in grouper(to_process_forms, N):
120
121
  yield {"query": {"formula_pretty": {"$in": list(formula_chunk)}}}
121
122
 
122
- def get_items(self) -> Iterator[List[Dict]]:
123
+ def get_items(self) -> Iterator[list[dict]]:
123
124
  """
124
125
  Gets all items to process into materials documents.
125
126
  This does no datetime checking; relying on whether
@@ -181,7 +182,7 @@ class MaterialsBuilder(Builder):
181
182
  invalid_ids = set()
182
183
 
183
184
  projected_fields = [
184
- "last_updated",
185
+ # "last_updated",
185
186
  "completed_at",
186
187
  "task_id",
187
188
  "formula_pretty",
@@ -191,13 +192,16 @@ class MaterialsBuilder(Builder):
191
192
  # needed for run_type and task_type
192
193
  "calcs_reversed.input.parameters",
193
194
  "calcs_reversed.input.incar",
195
+ "calcs_reversed.run_type",
194
196
  "orig_inputs",
195
197
  "input.structure",
196
198
  # needed for entry from task_doc
197
199
  "output.energy",
200
+ "calcs_reversed.output.energy",
198
201
  "input.is_hubbard",
199
202
  "input.hubbards",
200
- "input.potcar_spec",
203
+ "calcs_reversed.input.potcar_spec",
204
+ "calcs_reversed.output.structure",
201
205
  # needed for transform deformation structure back for grouping
202
206
  "transformations",
203
207
  # misc info for materials doc
@@ -215,7 +219,7 @@ class MaterialsBuilder(Builder):
215
219
 
216
220
  yield tasks
217
221
 
218
- def process_item(self, items: List[Dict]) -> List[Dict]:
222
+ def process_item(self, items: list[dict]) -> list[dict]:
219
223
  """
220
224
  Process the tasks into a list of materials
221
225
 
@@ -227,7 +231,9 @@ class MaterialsBuilder(Builder):
227
231
  were processed
228
232
  """
229
233
 
230
- tasks = [TaskDocument(**task) for task in items]
234
+ tasks = [
235
+ TaskDoc(**task) for task in items
236
+ ] # [TaskDoc(**task) for task in items]
231
237
  formula = tasks[0].formula_pretty
232
238
  task_ids = [task.task_id for task in tasks]
233
239
 
@@ -239,9 +245,11 @@ class MaterialsBuilder(Builder):
239
245
  grouped_tasks = self.filter_and_group_tasks(tasks, task_transformations)
240
246
  materials = []
241
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
242
250
  commercial_license = True
243
251
  for task_doc in group:
244
- if set(task_doc.tags).intersection(
252
+ if task_doc.tags and set(task_doc.tags).intersection(
245
253
  set(self.settings.NON_COMMERCIAL_TAGS)
246
254
  ):
247
255
  commercial_license = False
@@ -271,7 +279,7 @@ class MaterialsBuilder(Builder):
271
279
 
272
280
  return jsanitize([mat.model_dump() for mat in materials], allow_bson=True)
273
281
 
274
- def update_targets(self, items: List[List[Dict]]):
282
+ def update_targets(self, items: list[list[dict]]):
275
283
  """
276
284
  Inserts the new task_types into the task_types collection
277
285
 
@@ -295,8 +303,8 @@ class MaterialsBuilder(Builder):
295
303
  self.logger.info("No items to update")
296
304
 
297
305
  def filter_and_group_tasks(
298
- self, tasks: List[TaskDocument], task_transformations: List[Union[Dict, None]]
299
- ) -> Iterator[List[TaskDocument]]:
306
+ self, tasks: list[TaskDoc], task_transformations: list[dict | None]
307
+ ) -> Iterator[list[TaskDoc]]:
300
308
  """
301
309
  Groups tasks by structure matching
302
310
  """
@@ -318,18 +326,25 @@ class MaterialsBuilder(Builder):
318
326
  if task.task_type == TaskType.Deformation:
319
327
  if (
320
328
  transformations is None
329
+ or not task.input
330
+ or not task.input.structure
321
331
  ): # Do not include deformed tasks without transformation information
322
332
  self.logger.debug(
323
- "Cannot find transformation for deformation task {}. Excluding task.".format(
324
- task.task_id
325
- )
333
+ "Cannot find transformation or original structure "
334
+ f"for deformation task {task.task_id}. Excluding task."
326
335
  )
327
336
  continue
328
337
  else:
329
338
  s = undeform_structure(task.input.structure, transformations)
330
339
 
340
+ elif task.output and task.output.structure:
341
+ s = task.output.structure # type: ignore[assignment]
331
342
  else:
332
- s = task.output.structure
343
+ self.logger.debug(
344
+ f"Skipping task {task.task_id}, missing output structure."
345
+ )
346
+ continue
347
+
333
348
  s.index: int = idx # type: ignore
334
349
  structures.append(s)
335
350
 
@@ -343,29 +358,3 @@ class MaterialsBuilder(Builder):
343
358
  for group in grouped_structures:
344
359
  grouped_tasks = [filtered_tasks[struct.index] for struct in group] # type: ignore
345
360
  yield grouped_tasks
346
-
347
-
348
- def undeform_structure(structure: Structure, transformations: Dict) -> Structure:
349
- """
350
- Get the undeformed structure by applying the transformations in a reverse order.
351
-
352
- Args:
353
- structure: deformed structure
354
- transformation: transformation that deforms the structure
355
-
356
- Returns:
357
- undeformed structure
358
- """
359
-
360
- for transformation in reversed(transformations.get("history", [])):
361
- if transformation["@class"] == "DeformStructureTransformation":
362
- deform = Deformation(transformation["deformation"])
363
- dst = DeformStructureTransformation(deform.inv)
364
- structure = dst.apply_transformation(structure)
365
- else:
366
- raise RuntimeError(
367
- "Expect transformation to be `DeformStructureTransformation`; "
368
- f"got {transformation['@class']}"
369
- )
370
-
371
- return structure
@@ -1,13 +1,12 @@
1
- from typing import Dict, Optional
2
- from collections import defaultdict
3
-
4
1
  from maggma.builders import MapBuilder
5
2
  from maggma.core import Store
6
3
 
7
4
  from emmet.builders.settings import EmmetBuildSettings
8
- from emmet.core.vasp.task_valid import TaskDocument
5
+ from emmet.builders.utils import get_potcar_stats
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.validation import DeprecationMessage, ValidationDoc
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_hashes: Optional[Dict[CalcType, Dict[str, str]]] = None,
19
- settings: Optional[EmmetBuildSettings] = None,
20
- query: Optional[Dict] = None,
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
  """
@@ -26,7 +25,7 @@ class TaskValidator(MapBuilder):
26
25
  Args:
27
26
  tasks: Store of task documents
28
27
  task_validation: Store of task_types for tasks
29
- potcar_hashes: Optional dictionary of potcar hash data.
28
+ potcar_stats: Optional dictionary of potcar hash data.
30
29
  Mapping is calculation type -> potcar symbol -> hash value.
31
30
  """
32
31
  self.tasks = tasks
@@ -34,29 +33,14 @@ class TaskValidator(MapBuilder):
34
33
  self.settings = EmmetBuildSettings.autoload(settings)
35
34
  self.query = query
36
35
  self.kwargs = kwargs
37
- self.potcar_hashes = potcar_hashes
36
+ self.potcar_stats = potcar_stats
38
37
 
39
38
  # Set up potcar cache if appropriate
40
- if self.settings.VASP_VALIDATE_POTCAR_HASHES:
41
- if not self.potcar_hashes:
42
- from pymatgen.io.vasp.inputs import PotcarSingle
43
-
44
- hashes = defaultdict(dict) # type: dict
45
-
46
- for (
47
- calc_type,
48
- input_set,
49
- ) in self.settings.VASP_DEFAULT_INPUT_SETS.items():
50
- functional = input_set.CONFIG["POTCAR_FUNCTIONAL"]
51
- for potcar_symbol in input_set.CONFIG["POTCAR"].values():
52
- potcar = PotcarSingle.from_symbol_and_functional(
53
- symbol=potcar_symbol, functional=functional
54
- )
55
- hashes[calc_type][potcar_symbol] = potcar._summary_stats
56
-
57
- self.potcar_hashes = potcar_hashes
39
+ if self.settings.VASP_VALIDATE_POTCAR_STATS:
40
+ if not self.potcar_stats:
41
+ self.potcar_stats = get_potcar_stats(method="stored")
58
42
  else:
59
- self.potcar_hashes = None
43
+ self.potcar_stats = None
60
44
 
61
45
  super().__init__(
62
46
  source=tasks,
@@ -80,7 +64,7 @@ class TaskValidator(MapBuilder):
80
64
  Args:
81
65
  item (dict): a (projection of a) task doc
82
66
  """
83
- task_doc = TaskDocument(**item)
67
+ task_doc = TaskDoc(**item)
84
68
  validation_doc = ValidationDoc.from_task_doc(
85
69
  task_doc=task_doc,
86
70
  kpts_tolerance=self.settings.VASP_KPTS_TOLERANCE,
@@ -88,13 +72,18 @@ class TaskValidator(MapBuilder):
88
72
  input_sets=self.settings.VASP_DEFAULT_INPUT_SETS,
89
73
  LDAU_fields=self.settings.VASP_CHECKED_LDAU_FIELDS,
90
74
  max_allowed_scf_gradient=self.settings.VASP_MAX_SCF_GRADIENT,
91
- potcar_hashes=self.potcar_hashes,
75
+ potcar_stats=self.potcar_stats,
92
76
  )
93
77
 
94
- bad_tags = list(set(task_doc.tags).intersection(self.settings.DEPRECATED_TAGS))
95
- if len(bad_tags) > 0:
96
- validation_doc.warnings.append(f"Manual Deprecation by tags: {bad_tags}")
97
- validation_doc.valid = False
98
- validation_doc.reasons.append(DeprecationMessage.MANUAL)
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)
99
88
 
100
89
  return validation_doc
@@ -0,0 +1,37 @@
1
+ Metadata-Version: 2.4
2
+ Name: emmet-builders
3
+ Version: 0.86.0
4
+ Summary: Builders for the Emmet Library
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
11
+ Requires-Dist: maggma>=0.57.6
12
+ Requires-Dist: matminer>=0.9.1
13
+ Requires-Dist: pymatgen-io-validation>=0.1.1
14
+ Provides-Extra: test
15
+ Requires-Dist: pre-commit; extra == "test"
16
+ Requires-Dist: pytest; extra == "test"
17
+ Requires-Dist: pytest-cov; extra == "test"
18
+ Requires-Dist: pytest-xdist; extra == "test"
19
+ Requires-Dist: pycodestyle; extra == "test"
20
+ Requires-Dist: pydocstyle; extra == "test"
21
+ Requires-Dist: flake8; extra == "test"
22
+ Requires-Dist: mypy; extra == "test"
23
+ Requires-Dist: mypy-extensions; extra == "test"
24
+ Requires-Dist: types-setuptools; extra == "test"
25
+ Requires-Dist: types-requests; extra == "test"
26
+ Requires-Dist: wincertstore; extra == "test"
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"
@@ -0,0 +1,41 @@
1
+ emmet/builders/__init__.py,sha256=y-ZREtieuFK3MaYvCBDMPf3YLxnsZG1VNho9lMjnRDU,221
2
+ emmet/builders/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
3
+ emmet/builders/settings.py,sha256=ZNIUKYdwT9Am5Gb-r5tkCTr-R2nysKh4Q_6-PChKZo4,3036
4
+ emmet/builders/utils.py,sha256=8x6wJgcV-DFGhDZzeYwpRXgz8PeZLLr_Q2wnIvBqlvA,10946
5
+ emmet/builders/abinit/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
6
+ emmet/builders/abinit/phonon.py,sha256=A8-bxMq3sTEiZ0dH4P9Gjb5pvOx040pSfhW4pGyTO1U,32034
7
+ emmet/builders/abinit/sound_velocity.py,sha256=D-GFiFtm0DUwvsl31W4GHNFHeZYM4ditZY8hOwcnj9A,7091
8
+ emmet/builders/feff/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
9
+ emmet/builders/feff/xas.py,sha256=wQnO0IcxAclYY4fVoyc4sDqs1Cx7vFzMq-_oIHnk3EU,2068
10
+ emmet/builders/materials/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
11
+ emmet/builders/materials/absorption_spectrum.py,sha256=_uQSF8KX8BIHqiW_7oOMtur7uKkzf704H88bXHxJSCs,6892
12
+ emmet/builders/materials/alloys.py,sha256=oAlS4TRt181Z_Cc3jfyrFXwqqRbEfthuv2GxcvKUzzI,14199
13
+ emmet/builders/materials/basic_descriptors.py,sha256=IVCkN0vjkoNis2d_OUezVhPzGpaVcP6IkX123UwB6oQ,5845
14
+ emmet/builders/materials/bonds.py,sha256=TFfkfKG1-7zcim9gPJqRz1UcyVN_px0889VWhSICc5g,1847
15
+ emmet/builders/materials/chemenv.py,sha256=ZTR6_VyAif3yvcSy8xagBkmKczZsDD3LC77RMKi4E0U,1191
16
+ emmet/builders/materials/corrected_entries.py,sha256=nlA7qSXdQM7_fe8WiPJ_dN971OFeMonkZqc7rlL6jIE,12480
17
+ emmet/builders/materials/dielectric.py,sha256=-KVqY6l4qBcj_BaQf6hd9VsGlbC_Y9wEH_z2VfUNz2s,6692
18
+ emmet/builders/materials/elasticity.py,sha256=2sNJAOTFEkIsyReQPGdzbIXt23PSsq_5dCv9RBeWpI4,16571
19
+ emmet/builders/materials/electrodes.py,sha256=VESA_xY8BJiocPanRfta0hUyi0SBAOIlsZ0dEKty5tE,23855
20
+ emmet/builders/materials/electronic_structure.py,sha256=YJiayaEUd5Hnfj4tKJpw1HpjAwCckf7S3O1et25Fbvs,29457
21
+ emmet/builders/materials/magnetism.py,sha256=JxEWUzgrpI3fXoR9dIhT_iU8iW5O3bGIquDevlAvnjw,4738
22
+ emmet/builders/materials/optimade.py,sha256=TYzw-xLaNeNa2h0Fa5Ft3Iqg0LMEHj1_-MbfMmfDdpk,5211
23
+ emmet/builders/materials/oxidation_states.py,sha256=ptTfakXk1bjexniBzx87XCutiuRiolFpnMZETsJlj6I,1670
24
+ emmet/builders/materials/piezoelectric.py,sha256=XPjl3iPwS9VFqmxu3mT34S1CHUEli3Samu4B2vH7Baw,7857
25
+ emmet/builders/materials/provenance.py,sha256=HbjP7TW6GVIp86vylu4PiInem0oE9hWFKh0DRx_eIzs,9116
26
+ emmet/builders/materials/robocrys.py,sha256=6nVAgqsk2T9VdibCR2eZeVosqwJ2lEt_Yr_4hzotEIA,1257
27
+ emmet/builders/materials/similarity.py,sha256=SIqdmPgs3f7oUQCeu0IBh26y_evYWc0EOEvbIALl-0s,5414
28
+ emmet/builders/materials/substrates.py,sha256=cdHNYabSvsdONWUP4alU73PpMzHc4DYLuEdUpIZETds,6132
29
+ emmet/builders/materials/summary.py,sha256=ZIR2rV1WeGvU0B_wz9W_VX1KXhs104fDwSxsVMstlQk,8030
30
+ emmet/builders/materials/thermo.py,sha256=oOH-8IEyUxNckXniFCe_-En2rTG2bNybudqdrf9ztL4,10988
31
+ emmet/builders/matscholar/missing_compositions.py,sha256=6prFb3mmvr_y12XIzZ8w8SiHLEone1B6Hxyq6cTusSE,8704
32
+ emmet/builders/mobility/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
33
+ emmet/builders/mobility/migration_graph.py,sha256=BxVh3homd9GEniB33_dJ1e2wmRvMnievHHPRs6fnbBw,3899
34
+ emmet/builders/vasp/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
35
+ emmet/builders/vasp/materials.py,sha256=pcSUF78RBaKL3FdyDB6QSjrL0apUi3PT0A8Sj6Bc5Ks,13302
36
+ emmet/builders/vasp/mp_potcar_stats.json.gz,sha256=x3bn4gSMj1U_3bR2qKIaBtbJlYT-EJgoUIMFTA9bvaU,338957
37
+ emmet/builders/vasp/task_validator.py,sha256=LCj-LBuNzt2vJQ8G6WJvBtiM7_Kxrh3Uhvq97viVoIA,3033
38
+ emmet_builders-0.86.0.dist-info/METADATA,sha256=IANQcvHHJADuzqjBesW9So2XWUIQNQZE0FuaDPui554,1588
39
+ emmet_builders-0.86.0.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
40
+ emmet_builders-0.86.0.dist-info/top_level.txt,sha256=6GcpbmWPeFhNCTfDFilb8GQ4T1UQu4z9c5jpobjwE-Q,6
41
+ emmet_builders-0.86.0.dist-info/RECORD,,
@@ -1,5 +1,5 @@
1
1
  Wheel-Version: 1.0
2
- Generator: bdist_wheel (0.42.0)
2
+ Generator: setuptools (80.9.0)
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any
5
5
 
@@ -1,87 +0,0 @@
1
- from importlib.metadata import version
2
- from typing import TYPE_CHECKING, Optional, Union
3
-
4
- from maggma.builders.map_builder import MapBuilder
5
- from maggma.core import Store
6
- from matcalc.utils import get_universal_calculator
7
- from pymatgen.core import Structure
8
-
9
- from emmet.core.ml import MLDoc
10
- from emmet.core.utils import jsanitize
11
-
12
- if TYPE_CHECKING:
13
- from ase.calculators.calculator import Calculator
14
-
15
-
16
- class MLBuilder(MapBuilder):
17
- def __init__(
18
- self,
19
- materials: Store,
20
- ml_potential: Store,
21
- model: Union[str, "Calculator"],
22
- model_kwargs: Optional[dict] = None,
23
- prop_kwargs: Optional[dict] = None,
24
- provenance: Optional[dict] = None,
25
- **kwargs,
26
- ):
27
- """Machine learning interatomic potential builder.
28
-
29
- Args:
30
- materials (Store): Materials to use as input structures.
31
- ml_potential (Store): Where to save MLDoc documents to.
32
- model (str | Calculator): ASE calculator or name of model to use as ML
33
- potential. See matcalc.utils.UNIVERSAL_CALCULATORS for recognized names.
34
- model_kwargs (dict, optional): Additional kwargs to pass to the calculator.
35
- Defaults to None.
36
- prop_kwargs (dict[str, dict], optional): Separate kwargs passed to each matcalc
37
- PropCalc class. Recognized keys are RelaxCalc, ElasticityCalc, PhononCalc, EOSCalc.
38
- Defaults to None.
39
- provenance (dict, optional): Additional provenance information to include in
40
- MLDocs. Will be saved in each document so use sparingly. Defaults to None.
41
- Set to {} to disable default provenance model, version, matcalc_version.
42
- """
43
- self.materials = materials
44
- self.ml_potential = ml_potential
45
- self.kwargs = kwargs
46
- self.model = get_universal_calculator(model, **(model_kwargs or {}))
47
- self.prop_kwargs = prop_kwargs or {}
48
-
49
- if provenance == {}:
50
- self.provenance = {}
51
- else:
52
- model_name = (
53
- model if isinstance(model, str) else type(model).__name__
54
- ).lower()
55
- model_name = {"chgnetcalculator": "chgnet"}.get(model_name, model_name)
56
- pkg_name = {"m3gnet": "matgl"}.get(model_name, model_name)
57
- self.provenance = dict(
58
- model=model_name,
59
- version=version(pkg_name),
60
- matcalc_version=version("matcalc"),
61
- **(provenance or {}),
62
- )
63
-
64
- # Enforce that we key on material_id
65
- self.materials.key = "material_id"
66
- self.ml_potential.key = "material_id"
67
- super().__init__(
68
- source=materials,
69
- target=ml_potential,
70
- projection=["structure", "deprecated"],
71
- **kwargs,
72
- )
73
-
74
- def unary_function(self, item):
75
- struct = Structure.from_dict(item["structure"])
76
- mp_id, deprecated = item["material_id"], item["deprecated"]
77
-
78
- doc = MLDoc(
79
- structure=struct,
80
- material_id=mp_id,
81
- calculator=self.model,
82
- prop_kwargs=self.prop_kwargs,
83
- deprecated=deprecated,
84
- **self.provenance,
85
- )
86
-
87
- return jsanitize(doc, allow_bson=True)