Skip to content

Commit

Permalink
add duplicate element checking in MPRester.get_entries_in_chemsys (#736)
Browse files Browse the repository at this point in the history
  • Loading branch information
mattmcdermott committed Jan 27, 2023
1 parent 0713f8c commit 9dc27dc
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions mp_api/client/mprester.py
Expand Up @@ -934,9 +934,11 @@ def get_entries_in_chemsys(
if isinstance(elements, str):
elements = elements.split("-")

elements_set = set(elements) # remove duplicate elements

all_chemsyses = []
for i in range(len(elements)):
for els in itertools.combinations(elements, i + 1):
for i in range(len(elements_set)):
for els in itertools.combinations(elements_set, i + 1):
all_chemsyses.append("-".join(sorted(els)))

entries = [] # type: List[ComputedEntry]
Expand Down

0 comments on commit 9dc27dc

Please sign in to comment.