Skip to content

Commit

Permalink
fixed query for chemsys
Browse files Browse the repository at this point in the history
  • Loading branch information
jmmshn committed Mar 23, 2021
1 parent 1747828 commit f2c8a87
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions emmet-builders/emmet/builders/materials/electrodes.py
Expand Up @@ -142,7 +142,8 @@ def get_items(self):
base_query = {
"$and": [
self.query.copy(),
{"elements": {"$in": REDOX_ELEMENTS + [self.working_ion]}},
{"elements": {"$in": REDOX_ELEMENTS}},
{"elements": {"$in": [self.working_ion]}},
{"elements": {"$nin": other_wions}},
]
}
Expand Down Expand Up @@ -230,13 +231,17 @@ def get_items(self):
)
if mat_ids == target_mat_ids and max_mat_time < min_target_time:
yield None
elif len(target_mat_ids) == 0:
self.logger.info(
f"No documents in chemsys {chemsys} in the target database."
)
else:
self.logger.info(
f"Nuking all {len(target_mat_ids)} documents in chemsys {chemsys} in the target database."
)
self._remove_targets(list(target_mat_ids))

yield {"chemsys": chemsys, "materials": all_mats_in_chemsys}
else:
yield {"chemsys": chemsys, "materials": all_mats_in_chemsys}

def update_targets(self, items: List):
items = list(filter(None, chain.from_iterable(items)))
Expand Down

0 comments on commit f2c8a87

Please sign in to comment.