-
Notifications
You must be signed in to change notification settings - Fork 102
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add class BaseMaker(Maker, ABC) in new atomate2/common/jobs/base.py
- Loading branch information
Showing
3 changed files
with
57 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
"""BaseMaker enforces a specific 'make' method signature for all atomate2 makers.""" | ||
|
||
from __future__ import annotations | ||
|
||
from abc import ABC, abstractmethod | ||
from typing import TYPE_CHECKING, Any | ||
|
||
from jobflow import Flow, Maker, Response | ||
|
||
if TYPE_CHECKING: | ||
from pymatgen.core import Structure | ||
|
||
|
||
class BaseMaker(Maker, ABC): | ||
""" | ||
Abstract base class for atomate2 Makers. | ||
This class is designed to enforce a consistent signature for the 'make' method. | ||
All subclasses must implement this method with identical signature so they are | ||
easily exchangeable in Flows. | ||
""" | ||
|
||
@abstractmethod | ||
def make( | ||
self, | ||
structure: Structure, | ||
*args: Any, | ||
**kwargs: Any, | ||
) -> Response | Flow: | ||
""" | ||
Abstract method for making a job or task. Must be implemented by subclasses. | ||
Parameters | ||
---------- | ||
structure : Structure | ||
The structure for the task or job. | ||
prev_dir : str | Path | None, optional | ||
The previous directory path, if applicable. | ||
Returns | ||
------- | ||
Response | ||
A jobflow.Response object containing the outcome of the task or job. | ||
""" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters