From 9c755a3f8bc3c40b3a76eeece4d2bfb55ae544c8 Mon Sep 17 00:00:00 2001 From: Jason Munro Date: Tue, 31 Oct 2023 16:55:57 -0700 Subject: [PATCH] Nested elasticity summary fix (#878) * 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 --- .../emmet/builders/materials/summary.py | 2 +- emmet-core/emmet/core/summary.py | 38 ++++++++----------- 2 files changed, 17 insertions(+), 23 deletions(-) diff --git a/emmet-builders/emmet/builders/materials/summary.py b/emmet-builders/emmet/builders/materials/summary.py index 1b7d5550ef..a923539fbf 100644 --- a/emmet-builders/emmet/builders/materials/summary.py +++ b/emmet-builders/emmet/builders/materials/summary.py @@ -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): """ diff --git a/emmet-core/emmet/core/summary.py b/emmet-core/emmet/core/summary.py index 841d63bbad..0483db0328 100644 --- a/emmet-core/emmet/core/summary.py +++ b/emmet-core/emmet/core/summary.py @@ -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( @@ -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", ],