emmet-builders 0.51.6__py3-none-any.whl → 0.51.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.

@@ -1,5 +1,7 @@
1
1
  import tempfile
2
2
  import traceback
3
+ from math import ceil
4
+ from maggma.utils import grouper
3
5
  from typing import Optional, Dict, List, Iterator
4
6
 
5
7
  from abipy.dfpt.vsound import SoundVelocity as AbiSoundVelocity
@@ -48,6 +50,25 @@ class SoundVelocityBuilder(Builder):
48
50
 
49
51
  super().__init__(sources=[phonon_materials], targets=[sound_vel], **kwargs)
50
52
 
53
+ def prechunk(self, number_splits: int): # pragma: no cover
54
+ """
55
+ Gets all materials that need sound velocity
56
+
57
+ Returns:
58
+ generator of materials to extract phonon sound velocity
59
+ """
60
+
61
+ # All relevant materials that have been updated since phonon props were last calculated
62
+ q = dict(self.query)
63
+
64
+ mats = self.phonon.newer_in(self.phonon_materials, exhaustive=True, criteria=q)
65
+
66
+ N = ceil(len(mats) / number_splits)
67
+
68
+ for mpid_chunk in grouper(mats, N):
69
+
70
+ yield {"query": {self.phonon_materials.key: {"$in": list(mpid_chunk)}}}
71
+
51
72
  def get_items(self) -> Iterator[Dict]:
52
73
  """
53
74
  Gets all materials that need sound velocity.
@@ -63,7 +84,7 @@ class SoundVelocityBuilder(Builder):
63
84
 
64
85
  # All relevant materials that have been updated since sound velocities were last calculated
65
86
  q = dict(self.query)
66
- mats = self.sound_vel.newer_in(self.materials, exhaustive=True, criteria=q)
87
+ mats = self.sound_vel.newer_in(self.phonon_materials, exhaustive=True, criteria=q)
67
88
  self.logger.info("Found {} new materials for sound velocity data".format(len(mats)))
68
89
 
69
90
  # list of properties queried from the results DB
@@ -79,7 +100,9 @@ class SoundVelocityBuilder(Builder):
79
100
 
80
101
  # Read the DDB file and pass as an object. Do not write here since in case of parallel
81
102
  # execution each worker will write its own file.
82
- item["ddb_str"] = self.ddb_source.get(item["abinit_output"]["ddb_id"]).read().decode("utf-8")
103
+ ddb_data = self.ddb_source.query_one(criteria={"_id": item["abinit_output"]["ddb_id"]})
104
+
105
+ item["ddb_str"] = ddb_data["data"].decode("utf-8")
83
106
 
84
107
  yield item
85
108
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: emmet-builders
3
- Version: 0.51.6
3
+ Version: 0.51.8
4
4
  Summary: Builders for the Emmet Library
5
5
  Home-page: https://github.com/materialsproject/emmet
6
6
  Author: The Materials Project
@@ -3,7 +3,7 @@ emmet/builders/settings.py,sha256=xVIqpQjSxn--m6mbKJIr7g-nqoqZr1Vcxi3YNa3etOg,27
3
3
  emmet/builders/utils.py,sha256=VtA_77cBqzKBaA747FBbcPX3M0QmQE-l2nMLzlQwijw,5775
4
4
  emmet/builders/abinit/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
5
5
  emmet/builders/abinit/phonon.py,sha256=0rzi_CuJrO5iGUFr24iSLAj438aUSNHcn9gWNTVLoc4,32029
6
- emmet/builders/abinit/sound_velocity.py,sha256=mqUVrHmmK2B7pLPhNcPlQIOAOM6IUdCgGTzUu5AD77A,5984
6
+ emmet/builders/abinit/sound_velocity.py,sha256=H5j2oXce8DRAt_jcOaTrQnOMi9cgVBlTdyGAD96Z9o4,6721
7
7
  emmet/builders/feff/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
8
8
  emmet/builders/feff/xas.py,sha256=JZAU69tZXI_JEkzNxwVruebcRVcTZJnQON3H0cbrnvg,2093
9
9
  emmet/builders/materials/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
@@ -42,7 +42,7 @@ emmet/builders/qchem/molecules.py,sha256=myR8zaZg2GDFb6TFoHDUtvtbvBp4K55bkTC-mJw
42
42
  emmet/builders/vasp/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
43
43
  emmet/builders/vasp/materials.py,sha256=JnV_5Kd0qCU0hsqAcyhZwgMTYVcs54NmYKS9kNS9bhI,13334
44
44
  emmet/builders/vasp/task_validator.py,sha256=9hiYdnG_Wz4zxzG6mrxjPIJbZTm_N-22UwpYPT5zXFE,3601
45
- emmet_builders-0.51.6.dist-info/METADATA,sha256=91tjT7rpwymbp4CARp7S6wvr6dEJNrjC2KRrKJc9x-4,1449
46
- emmet_builders-0.51.6.dist-info/WHEEL,sha256=pkctZYzUS4AYVn6dJ-7367OJZivF2e8RA9b_ZBjif18,92
47
- emmet_builders-0.51.6.dist-info/top_level.txt,sha256=6GcpbmWPeFhNCTfDFilb8GQ4T1UQu4z9c5jpobjwE-Q,6
48
- emmet_builders-0.51.6.dist-info/RECORD,,
45
+ emmet_builders-0.51.8.dist-info/METADATA,sha256=6bed7_x6-_bJtsfnWWsSEhVg-Im3bw95ij_yr0W41lU,1449
46
+ emmet_builders-0.51.8.dist-info/WHEEL,sha256=pkctZYzUS4AYVn6dJ-7367OJZivF2e8RA9b_ZBjif18,92
47
+ emmet_builders-0.51.8.dist-info/top_level.txt,sha256=6GcpbmWPeFhNCTfDFilb8GQ4T1UQu4z9c5jpobjwE-Q,6
48
+ emmet_builders-0.51.8.dist-info/RECORD,,