-
Notifications
You must be signed in to change notification settings - Fork 105
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
Molecule for forcefield #1127
base: main
Are you sure you want to change the base?
Molecule for forcefield #1127
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -15,14 +15,18 @@ | |
_DEFAULT_CALCULATOR_KWARGS, | ||
_FORCEFIELD_DATA_OBJECTS, | ||
) | ||
from atomate2.forcefields.schemas import ForceFieldTaskDocument | ||
from atomate2.forcefields.schemas import ( | ||
ForceFieldMoleculeTaskDocument, | ||
ForceFieldStructureTaskDocument, | ||
ForceFieldTaskDocument, | ||
) | ||
from atomate2.forcefields.utils import ase_calculator, revert_default_dtype | ||
|
||
if TYPE_CHECKING: | ||
from pathlib import Path | ||
|
||
from ase.calculators.calculator import Calculator | ||
from pymatgen.core.structure import Structure | ||
from pymatgen.core.structure import Molecule, Structure | ||
|
||
|
||
@dataclass | ||
|
@@ -126,19 +130,18 @@ def __post_init__(self) -> None: | |
|
||
@job( | ||
data=[*_FORCEFIELD_DATA_OBJECTS, "ionic_steps"], | ||
output_schema=ForceFieldTaskDocument, | ||
) | ||
def make( | ||
self, | ||
structure: Structure, | ||
structure: Molecule | Structure, | ||
prev_dir: str | Path | None = None, | ||
) -> ForceFieldTaskDocument: | ||
) -> ForceFieldStructureTaskDocument | ForceFieldMoleculeTaskDocument: | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I am not sure why this isn't done for all other ForceFieldMakers? There, I only see a replacement with There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Which makers are you referring to? I only found two makers that have an explicit make function, ForceFieldRelaxMaker and ForceFieldMDMaker. It seems, the other makers inherent from these two. |
||
""" | ||
Perform MD on a structure using forcefields and jobflow. | ||
|
||
Parameters | ||
---------- | ||
structure: .Structure | ||
structure: .Structure or Molecule | ||
pymatgen structure. | ||
prev_dir : str or Path or None | ||
A previous calculation directory to copy output files from. Unused, just | ||
|
@@ -156,7 +159,7 @@ def make( | |
stacklevel=1, | ||
) | ||
|
||
return ForceFieldTaskDocument.from_ase_compatible_result( | ||
return ForceFieldTaskDocument.from_ase_compatible_result_forcefield( | ||
str(self.force_field_name), # make mypy happy | ||
md_result, | ||
relax_cell=(self.ensemble == MDEnsemble.npt), | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is not needed anymore?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This function is only called from the forcefields schemas.
I moved this function to src/atomate2/forcefields/schemas.py.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see. However, it is a general static method. Why not keeping it here?