Skip to content

Commit

Permalink
intermediate model to store the result of structure matching
Browse files Browse the repository at this point in the history
  • Loading branch information
jmmshn committed Dec 19, 2020
1 parent 9857615 commit d174c3c
Showing 1 changed file with 52 additions and 0 deletions.
52 changes: 52 additions & 0 deletions emmet-core/emmet/core/electrode.py
Expand Up @@ -203,3 +203,55 @@ def from_composition_and_entries(
d["num_steps"] = d.pop("nsteps", None)
d["last_updated"] = datetime.utcnow()
return cls(task_id=task_id, framework=Composition(d["framework_formula"]), **d)


class StructureGroupDoc(BaseModel):
"""
Document model for the intermediate structure matching database used to build the insertion electrode documents.
"""

task_id: str = Field(
None,
"The combined task_id of the grouped document is given by the numerically smallest task id followed by '_Li' or whichever working atom is considered the working ion during grouping.",
)

structure_matched: bool = Field(
None,
description="True if the structures in this group has been matched to each other. This is False for groups that contain all the left over structures with the same framework.",
)

has_distinct_compositions: bool = Field(
None,
description="True if multiple working ion fractions are available in the group, which means a voltage step exits.",
)

grouped_task_ids: List[str] = Field(
None,
description="The ids of the materials that have been grouped by the structure matcher.",
)

entry_data: Dict = Field(
None,
description="Dictionary keyed by the task_id, contains the 'composition' and 'volume' of each material.",
)

framework_formula: str = Field(
None, description="The formula of the host framework."
)

working_ion: WorkingIon = Field(None, description="The working ion")

chemsys: str = Field(
None,
description="The chemsys this group belongs to. Always includes the working ion",
)

last_updated: datetime = Field(
None,
description="Timestamp for the most recent calculation for this Material document",
)

# Make sure that the datetime field is properly formatted
@validator("last_updated", pre=True)
def last_updated_dict_ok(cls, v):
return MontyDecoder().process_decoded(v)

0 comments on commit d174c3c

Please sign in to comment.