From 03d3512cc6b2f512faa25a1a1a245ef87eee7bf9 Mon Sep 17 00:00:00 2001 From: Shyam D Date: Fri, 28 May 2021 14:01:43 -0700 Subject: [PATCH] fix minor conversion bugs --- emmet-builders/emmet/builders/vasp/thermo.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/emmet-builders/emmet/builders/vasp/thermo.py b/emmet-builders/emmet/builders/vasp/thermo.py index c237ff2b2f..a64616a934 100644 --- a/emmet-builders/emmet/builders/vasp/thermo.py +++ b/emmet-builders/emmet/builders/vasp/thermo.py @@ -224,9 +224,9 @@ def get_entries(self, chemsys: str) -> List[Dict]: if self.oxidation_states: material_ids = [t["material_id"] for t in materials_docs] oxi_states_data = { - d["material_id"]: d["bond_valence"]["average_oxidation_states"] + d["material_id"]: d.get("average_oxidation_states", {}) for d in self.oxidation_states.query( - properties=["material_id", "bond_valence.average_oxidation_states"], + properties=["material_id", "average_oxidation_states"], criteria={"material_id": {"$in": material_ids}, "successful": True}, ) } @@ -258,7 +258,7 @@ def get_updated_chemsys( updated_mats = self.thermo.newer_in(self.materials, criteria=self.query) updated_chemsys = set( self.materials.distinct( - "chemsys", {self.materials.key: {"$in": list(updated_mats)}} + "chemsys", {"material_id": {"$in": list(updated_mats)}} ) ) self.logger.debug(f"Found {len(updated_chemsys)} updated chemical systems") @@ -269,8 +269,8 @@ def get_new_chemsys(self) -> Set: """Gets newer chemical system as defined by introduction of a new material""" # All materials that are not present in the thermo collection - thermo_mat_ids = self.thermo.distinct(self.thermo.key) - mat_ids = self.materials.distinct(self.materials.key, self.query) + thermo_mat_ids = self.thermo.distinct("material_id") + mat_ids = self.materials.distinct("material_id", self.query) dif_task_ids = list(set(mat_ids) - set(thermo_mat_ids)) q = {"material_id": {"$in": dif_task_ids}} new_mat_chemsys = set(self.materials.distinct("chemsys", q))