Skip to content

Commit

Permalink
changed default in grouper from -1 back to None
Browse files Browse the repository at this point in the history
  • Loading branch information
jmmshn committed Mar 24, 2021
1 parent 76ae6a9 commit 2e40a59
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
8 changes: 2 additions & 6 deletions emmet-builders/emmet/builders/materials/electrodes.py
Expand Up @@ -52,11 +52,7 @@ def s_hash(el):

WORKING_IONS = ["Li", "Be", "Na", "Mg", "K", "Ca", "Rb", "Sr", "Cs", "Ba"]

MAT_PROPS = [
"structure",
"material_id",
"formula_pretty",
]
MAT_PROPS = ["structure", "material_id", "formula_pretty", "entries"]

sg_fields = ["number", "hall_number", "international", "hall", "choice"]

Expand Down Expand Up @@ -398,7 +394,7 @@ def process_item(self, item) -> Dict:
host_structure=host_structure,
)
if ie is None:
return None # {"failed_reason": "unable to create InsertionElectrode document"}
return None # {"failed_reason": "unable to create InsertionElectrode document"}
return jsanitize(ie.dict())

def update_targets(self, items: List):
Expand Down
8 changes: 6 additions & 2 deletions emmet-core/emmet/core/structure_group.py
Expand Up @@ -24,10 +24,10 @@ def generic_groupby(list_in, comp=operator.eq) -> List[int]:
Returns:
[int] list of labels for the input list
"""
list_out = [-1] * len(list_in)
list_out = [None] * len(list_in)
label_num = 0
for i1, ls1 in enumerate(list_out):
if ls1 != -1:
if ls1 is not None:
continue
list_out[i1] = label_num
for i2, ls2 in list(enumerate(list_out))[i1 + 1 :]:
Expand Down Expand Up @@ -181,6 +181,9 @@ def from_ungrouped_structure_entries(
logger.debug(
f"Performing structure matching for {framework} with {len(f_group_l)} documents."
)
print(
f"Performing structure matching for {framework} with {len(f_group_l)} documents."
)
for g in group_entries_with_structure_matcher(f_group_l, sm):
struct_group = cls.from_grouped_entries(
g, ignored_species=ignored_species
Expand Down Expand Up @@ -210,6 +213,7 @@ def group_entries_with_structure_matcher(
g,
comp=lambda x, y: struct_matcher.fit(x.structure, y.structure, symmetric=True),
)
print(labs)
for ilab in set(labs):
sub_g = [g[itr] for itr, jlab in enumerate(labs) if jlab == ilab]
yield [el for el in sub_g]
Expand Down

0 comments on commit 2e40a59

Please sign in to comment.