Skip to content

Commit

Permalink
fix: remove duplicated outputs from get_aflow_strs_from_iso_and_compo…
Browse files Browse the repository at this point in the history
…sition
  • Loading branch information
CompRhys committed Jul 18, 2024
1 parent 3e06cd8 commit ebc1f6e
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 3 additions & 3 deletions aviary/wren/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -643,7 +643,7 @@ def get_aflow_strs_from_iso_and_composition(
anom_ele_to_wyk = dict(zip(anom_amt_dict.keys(), wyckoffs))
anonymous_formula = RE_ANONYMOUS.sub(RE_SUBST_ONE_PREFIX, anonymous_formula)

result = []
result = set()
for t in translations:
wyckoff_part = "_".join(
RE_WYCKOFF.sub(RE_SUBST_ONE_PREFIX, anom_ele_to_wyk[t[elem]])
Expand All @@ -655,9 +655,9 @@ def get_aflow_strs_from_iso_and_composition(
aflow_str = (
f"{proto_formula}_{pearson}_{spg}_{canonicalized_wyckoff}:{chemical_system}"
)
result.append(aflow_str)
result.add(aflow_str)

return result
return list(result)


def count_distinct_wyckoff_letters(aflow_str: str) -> int:
Expand Down
2 changes: 1 addition & 1 deletion tests/test_wyckoff_ops.py
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ def test_get_aflow_strs_from_iso_and_composition(
aflows = get_aflow_strs_from_iso_and_composition(
isopointal_proto, Composition(composition)
)
assert aflows == expected.split(" ")
assert set(aflows) == set(expected.split(" "))

# check the round trip
assert all(
Expand Down

0 comments on commit ebc1f6e

Please sign in to comment.