Skip to content

Commit

Permalink
fix minor conversion bugs
Browse files Browse the repository at this point in the history
  • Loading branch information
shyamd committed May 28, 2021
1 parent 8bc1999 commit 03d3512
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions emmet-builders/emmet/builders/vasp/thermo.py
Expand Up @@ -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},
)
}
Expand Down Expand Up @@ -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")
Expand All @@ -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))
Expand Down

0 comments on commit 03d3512

Please sign in to comment.