Skip to content

Commit

Permalink
Nested elasticity summary fix (#878)
Browse files Browse the repository at this point in the history
* Fix elasticity query_ops

* Remove elasticity sub key in summary

* Fix elasticity tests

* Linting

* Fix elasticity import

* Fix nested elasticity data in summary

* More nested summary fixes

* Linting
  • Loading branch information
munrojm committed Oct 31, 2023
1 parent fc7b5a8 commit 9c755a3
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 23 deletions.
2 changes: 1 addition & 1 deletion emmet-builders/emmet/builders/materials/summary.py
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,7 @@ def prechunk(self, number_splits: int): # pragma: no cover
def process_item(self, item):
material_id = MPID(item[HasProps.materials.value]["material_id"])
doc = SummaryDoc.from_docs(material_id=material_id, **item)
return jsanitize(doc.dict(exclude_none=False), allow_bson=True)
return jsanitize(doc.model_dump(exclude_none=False), allow_bson=True)

def update_targets(self, items):
"""
Expand Down
38 changes: 16 additions & 22 deletions emmet-core/emmet/core/summary.py
Original file line number Diff line number Diff line change
Expand Up @@ -309,28 +309,26 @@ class SummaryDoc(PropertyDoc):

# Elasticity

k_voigt: Optional[float] = Field(
None, description="Voigt average of the bulk modulus."
)
# k_voigt: Optional[float] = Field(None, description="Voigt average of the bulk modulus.")

k_reuss: Optional[float] = Field(
None, description="Reuss average of the bulk modulus in GPa."
)
# k_reuss: Optional[float] = Field(None, description="Reuss average of the bulk modulus in GPa.")

k_vrh: Optional[float] = Field(
None, description="Voigt-Reuss-Hill average of the bulk modulus in GPa."
)
# k_vrh: Optional[float] = Field(None, description="Voigt-Reuss-Hill average of the bulk modulus in GPa.")

g_voigt: Optional[float] = Field(
None, description="Voigt average of the shear modulus in GPa."
)
# g_voigt: Optional[float] = Field(None, description="Voigt average of the shear modulus in GPa.")

g_reuss: Optional[float] = Field(
None, description="Reuss average of the shear modulus in GPa."
# g_reuss: Optional[float] = Field(None, description="Reuss average of the shear modulus in GPa.")

# g_vrh: Optional[float] = Field(None, description="Voigt-Reuss-Hill average of the shear modulus in GPa.")

bulk_modulus: Optional[dict] = Field(
None,
description="Voigt, Reuss, and Voigt-Reuss-Hill averages of the bulk modulus in GPa.",
)

g_vrh: Optional[float] = Field(
None, description="Voigt-Reuss-Hill average of the shear modulus in GPa."
shear_modulus: Optional[dict] = Field(
None,
description="Voigt, Reuss, and Voigt-Reuss-Hill averages of the shear modulus in GPa.",
)

universal_anisotropy: Optional[float] = Field(
Expand Down Expand Up @@ -513,12 +511,8 @@ def from_docs(cls, material_id: MPID, **docs: Dict[str, Dict]):
"is_magnetic",
],
HasProps.elasticity.value: [
"k_voigt",
"k_reuss",
"k_vrh",
"g_voigt",
"g_reuss",
"g_vrh",
"bulk_modulus",
"shear_modulus",
"universal_anisotropy",
"homogeneous_poisson",
],
Expand Down

0 comments on commit 9c755a3

Please sign in to comment.