Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

StructureGroupBuilder and StructureGroupDoc minor fixes #494

Merged
merged 3 commits into from
Aug 8, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
17 changes: 10 additions & 7 deletions emmet-builders/emmet/builders/materials/electrodes.py
Original file line number Diff line number Diff line change
Expand Up @@ -275,13 +275,16 @@ def update_targets(self, items: List):
def _entry_from_mat_doc(self, mdoc):
# Note since we are just structure grouping we don't need to be careful with energy or correction
# All of the energy analysis is left to other builders
d_ = {
"entry_id": mdoc["material_id"],
"structure": mdoc["structure"],
"energy": list(mdoc["entries"].values())[0]["energy"],
"correction": list(mdoc["entries"].values())[0]["correction"]
}
return ComputedStructureEntry.from_dict(d_)
entries = [ComputedStructureEntry.from_dict(v) for v in mdoc["entries"].values()]
if len(entries) == 1:
return entries[0]
else:
if "GGA+U" in mdoc["entries"].keys():
return ComputedStructureEntry.from_dict(mdoc["entries"]["GGA+U"])
elif "GGA" in mdoc["entries"].keys():
return ComputedStructureEntry.from_dict(mdoc["entries"]["GGA"])
else:
return None

def process_item(self, item: Any) -> Any:
if item is None:
Expand Down
7 changes: 3 additions & 4 deletions emmet-core/emmet/core/structure_group.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,11 +65,10 @@ class StructureGroupDoc(BaseModel):
description="A list of materials ids for all of the materials that were grouped together."
)

host_material_id: str = Field(
host_material_ids: list = Field(
None,
description="Material id that corresponds to the host structure, which is defined as the structure with the"
"lowest concentration of ignored specie and lowest energy if there are multiple structures with the"
"host concentration."
description="Material id(s) that correspond(s) to the host structure(s), which has/have the lowest"
"concentration of ignored specie."
)

insertion_material_ids: list = Field(
Expand Down