Skip to content

Commit ebc1f6e

Browse files
committed
fix: remove duplicated outputs from get_aflow_strs_from_iso_and_composition
1 parent 3e06cd8 commit ebc1f6e

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

aviary/wren/utils.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -643,7 +643,7 @@ def get_aflow_strs_from_iso_and_composition(
643643
anom_ele_to_wyk = dict(zip(anom_amt_dict.keys(), wyckoffs))
644644
anonymous_formula = RE_ANONYMOUS.sub(RE_SUBST_ONE_PREFIX, anonymous_formula)
645645

646-
result = []
646+
result = set()
647647
for t in translations:
648648
wyckoff_part = "_".join(
649649
RE_WYCKOFF.sub(RE_SUBST_ONE_PREFIX, anom_ele_to_wyk[t[elem]])
@@ -655,9 +655,9 @@ def get_aflow_strs_from_iso_and_composition(
655655
aflow_str = (
656656
f"{proto_formula}_{pearson}_{spg}_{canonicalized_wyckoff}:{chemical_system}"
657657
)
658-
result.append(aflow_str)
658+
result.add(aflow_str)
659659

660-
return result
660+
return list(result)
661661

662662

663663
def count_distinct_wyckoff_letters(aflow_str: str) -> int:

tests/test_wyckoff_ops.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ def test_get_aflow_strs_from_iso_and_composition(
112112
aflows = get_aflow_strs_from_iso_and_composition(
113113
isopointal_proto, Composition(composition)
114114
)
115-
assert aflows == expected.split(" ")
115+
assert set(aflows) == set(expected.split(" "))
116116

117117
# check the round trip
118118
assert all(

0 commit comments

Comments
 (0)