Skip to content

Commit

Permalink
add from_ase_task_doc func back in ase/schemas.py
Browse files Browse the repository at this point in the history
  • Loading branch information
yaoyi92 committed Feb 26, 2025
1 parent 5897cfe commit 7b32166
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions src/atomate2/ase/schemas.py
Original file line number Diff line number Diff line change
Expand Up @@ -233,6 +233,27 @@ class AseStructureTaskDoc(StructureMetadata):

tags: Optional[list[str]] = Field(None, description="List of tags for the task.")

@classmethod
def from_ase_task_doc(
cls, ase_task_doc: AseTaskDoc, **task_document_kwargs
) -> AseStructureTaskDoc:
"""Create an AseStructureTaskDoc for a task that has ASE-compatible outputs.
Parameters
----------
ase_task_doc : AseTaskDoc
Task doc for the calculation
task_document_kwargs : dict
Additional keyword args passed to :obj:`.AseStructureTaskDoc()`.
"""
task_document_kwargs.update(
{k: getattr(ase_task_doc, k) for k in _task_doc_translation_keys},
structure=ase_task_doc.mol_or_struct,
)
return cls.from_structure(
meta_structure=ase_task_doc.mol_or_struct, **task_document_kwargs
)


class AseMoleculeTaskDoc(MoleculeMetadata):
"""Document containing information on molecule manipulation using ASE."""
Expand Down

0 comments on commit 7b32166

Please sign in to comment.