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

Implement MD workflows #1672

Open
wants to merge 126 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 87 commits
Commits
Show all changes
126 commits
Select commit Hold shift + click to select a range
b23a93f
initial
tomdemeyere Feb 7, 2024
3e332dc
fix
tomdemeyere Feb 11, 2024
5cbeaea
Merge remote-tracking branch 'upstream/main' into md_workflow
tomdemeyere Feb 13, 2024
c736ac3
working
tomdemeyere Feb 13, 2024
6c36678
working
tomdemeyere Feb 13, 2024
42dcb82
working
tomdemeyere Feb 14, 2024
f806b57
better tests
tomdemeyere Feb 14, 2024
97d1511
Merge branch 'main' into md_workflow
Andrew-S-Rosen Feb 14, 2024
1fc6914
suggestions
tomdemeyere Feb 15, 2024
6a2f634
Merge remote-tracking branch 'origin/md_workflow' into md_workflow
tomdemeyere Feb 15, 2024
cfd1de7
remove comment
tomdemeyere Feb 15, 2024
07f6943
oops
tomdemeyere Feb 15, 2024
c744af9
Merge branch 'main' into md_workflow
Andrew-S-Rosen Feb 15, 2024
dcace7e
Fix inconsistent `fix_com` and `fix_rot` naming
Andrew-S-Rosen Feb 16, 2024
8a2c030
Fix hyperlink to docs
Andrew-S-Rosen Feb 16, 2024
f6f8b5b
Merge branch 'main' into md_workflow
Andrew-S-Rosen Feb 16, 2024
e12eb07
Mention temperature units in docstring
Andrew-S-Rosen Feb 16, 2024
5dfb65e
Clean up docstring
Andrew-S-Rosen Feb 16, 2024
3169347
Fix docs
Andrew-S-Rosen Feb 16, 2024
ed098c0
md_job
tomdemeyere Feb 16, 2024
174d855
merge
tomdemeyere Feb 16, 2024
825297a
units mess, not sure how to deal with that
tomdemeyere Feb 17, 2024
a13538a
fix
tomdemeyere Feb 18, 2024
a2325f7
Merge branch 'main' into md_workflow
Andrew-S-Rosen Feb 29, 2024
bb21109
suggestions
tomdemeyere Mar 17, 2024
e74aa9a
Merge branch 'main' into md_workflow
Andrew-S-Rosen Mar 17, 2024
f0d0e70
pre-commit auto-fixes
pre-commit-ci[bot] Mar 17, 2024
778e5ee
oops
tomdemeyere Mar 18, 2024
5c9a433
Merge remote-tracking branch 'origin/md_workflow' into md_workflow
tomdemeyere Mar 18, 2024
b873c02
oops
tomdemeyere Mar 18, 2024
3a4bb9e
oops bis
tomdemeyere Mar 18, 2024
863a017
restarting...
tomdemeyere Mar 18, 2024
c259a8d
Merge branch 'main' into md_workflow
Andrew-S-Rosen Mar 19, 2024
97f1d1f
pre-commit auto-fixes
pre-commit-ci[bot] Mar 19, 2024
0166e78
Merge branch 'main' into md_workflow
Andrew-S-Rosen Mar 20, 2024
a5a1684
pre-commit auto-fixes
pre-commit-ci[bot] Mar 20, 2024
9816644
timestep is fs
tomdemeyere Apr 8, 2024
191de6c
pre-commit auto-fixes
pre-commit-ci[bot] Apr 8, 2024
f9de29e
no restart for now
tomdemeyere Apr 8, 2024
46b9c00
Merge remote-tracking branch 'origin/md_workflow' into md_workflow
tomdemeyere Apr 8, 2024
e12e731
intuitive default + units conversion
tomdemeyere Apr 9, 2024
5d58766
pre-commit auto-fixes
pre-commit-ci[bot] Apr 9, 2024
31ae63f
Merge remote-tracking branch 'upstream/main' into md_workflow
tomdemeyere Apr 9, 2024
a075555
schema
tomdemeyere Apr 9, 2024
2af9820
Merge remote-tracking branch 'origin/md_workflow' into md_workflow
tomdemeyere Apr 9, 2024
8673e4c
unit fix
tomdemeyere Apr 10, 2024
6c2cf83
Merge branch 'main' into md_workflow
Andrew-S-Rosen Apr 10, 2024
5fb9bf5
Merge branch 'main' into md_workflow
Andrew-S-Rosen Apr 10, 2024
260cf78
Some minor docstring cleanup
Andrew-S-Rosen Apr 11, 2024
a5bc2a8
Merge branch 'main' into md_workflow
Andrew-S-Rosen Apr 11, 2024
d11806d
pre-commit auto-fixes
pre-commit-ci[bot] Apr 11, 2024
dcd3b37
Fix type hint
Andrew-S-Rosen Apr 11, 2024
de9ec00
Fix type hints
Andrew-S-Rosen Apr 11, 2024
18561f7
Fix type hint
Andrew-S-Rosen Apr 11, 2024
b797acb
pre-commit auto-fixes
pre-commit-ci[bot] Apr 11, 2024
99e91da
Minor test cleanup
Andrew-S-Rosen Apr 11, 2024
eda62a2
Refactor
Andrew-S-Rosen Apr 11, 2024
9ecd8ce
Merge branch 'main' into md_workflow
Andrew-S-Rosen Apr 11, 2024
58f2ff8
Fix import
Andrew-S-Rosen Apr 11, 2024
57a589b
Merge branch 'main' into md_workflow
Andrew-S-Rosen Apr 13, 2024
d29bdee
Merge branch 'main' into md_workflow
Andrew-S-Rosen Apr 15, 2024
c5cdc2e
Merge branch 'main' into md_workflow
Andrew-S-Rosen Apr 22, 2024
636f012
pre-commit auto-fixes
pre-commit-ci[bot] Apr 22, 2024
2469065
fix
Andrew-S-Rosen Apr 22, 2024
f946399
Merge branch 'md_workflow' of github.com:tomdemeyere/quacc into md_wo…
Andrew-S-Rosen Apr 22, 2024
5367a45
update docstring
Andrew-S-Rosen Apr 22, 2024
ca2b1e5
pre-commit auto-fixes
pre-commit-ci[bot] Apr 22, 2024
e1c4e48
Rename `md_units` --> `convert_md_units`
Andrew-S-Rosen Apr 22, 2024
475ccef
Merge branch 'md_workflow' of github.com:tomdemeyere/quacc into md_wo…
Andrew-S-Rosen Apr 22, 2024
d5d9f15
pre-commit auto-fixes
pre-commit-ci[bot] Apr 22, 2024
5dbdfa9
Merge branch 'main' into md_workflow
Andrew-S-Rosen May 12, 2024
25cb740
Merge branch 'main' into md_workflow
Andrew-S-Rosen Jun 5, 2024
d9a67d2
Merge branch 'main' into md_workflow
Andrew-S-Rosen Jun 12, 2024
548df48
pre-commit auto-fixes
pre-commit-ci[bot] Jun 12, 2024
1f9c741
Merge branch 'main' into md_workflow
Andrew-S-Rosen Jun 12, 2024
6d4af21
fix
Andrew-S-Rosen Jun 12, 2024
af3f25d
fix
Andrew-S-Rosen Jun 12, 2024
e999e60
fix docs
Andrew-S-Rosen Jun 12, 2024
d1e7b3d
fix
Andrew-S-Rosen Jun 12, 2024
31ae752
Slight refactor
Andrew-S-Rosen Jun 15, 2024
775c051
Merge branch 'main' into md_workflow
Andrew-S-Rosen Jun 15, 2024
be90963
Add code comments
Andrew-S-Rosen Jun 15, 2024
843cdc4
Merge branch 'main' into md_workflow
Andrew-S-Rosen Jun 15, 2024
9fdb592
Remove unused logger
Andrew-S-Rosen Jun 15, 2024
164adb5
Refactor
Andrew-S-Rosen Jun 15, 2024
522b0ca
pre-commit auto-fixes
pre-commit-ci[bot] Jun 15, 2024
039f20f
Fix
Andrew-S-Rosen Jun 15, 2024
1539581
Fix type hint/schema
Andrew-S-Rosen Jun 15, 2024
2df4564
Add new job to docs
Andrew-S-Rosen Jun 15, 2024
b9d63ae
Merge branch 'main' into md_workflow
Andrew-S-Rosen Jun 15, 2024
5975892
Add code comment
Andrew-S-Rosen Jun 15, 2024
2770a7a
Merge branch 'md_workflow' of github.com:tomdemeyere/quacc into md_wo…
Andrew-S-Rosen Jun 15, 2024
4681d26
Clarify type hints
Andrew-S-Rosen Jun 15, 2024
074f58c
Fix stray `del`
Andrew-S-Rosen Jun 15, 2024
65bc767
Fix
Andrew-S-Rosen Jun 15, 2024
efe0b99
Merge branch 'main' into md_workflow
Andrew-S-Rosen Jun 20, 2024
70ef89b
Fix
Andrew-S-Rosen Jun 20, 2024
1fdaf59
fix
Andrew-S-Rosen Jun 20, 2024
57e0d6f
Merge branch 'main' into md_workflow
Andrew-S-Rosen Jun 20, 2024
332cedd
Update md.py
Andrew-S-Rosen Jun 20, 2024
e4892f3
Fix type hint
Andrew-S-Rosen Jun 20, 2024
ee442c7
Merge branch 'main' into md_workflow
Andrew-S-Rosen Jun 20, 2024
975801b
Merge branch 'main' into md_workflow
Andrew-S-Rosen Jun 20, 2024
e0cd615
Merge branch 'main' into md_workflow
Andrew-S-Rosen Jun 20, 2024
243bf2f
Clean up docstring
Andrew-S-Rosen Jun 22, 2024
544f707
Refactor
Andrew-S-Rosen Jun 22, 2024
ca5c2ee
Merge branch 'md_workflow' of github.com:tomdemeyere/quacc into md_wo…
Andrew-S-Rosen Jun 22, 2024
5e45d44
Catch a potential user error
Andrew-S-Rosen Jun 22, 2024
8855e26
pre-commit auto-fixes
pre-commit-ci[bot] Jun 22, 2024
aa74c1c
Fix docstring
Andrew-S-Rosen Jun 22, 2024
9daa4dc
Merge branch 'md_workflow' of github.com:tomdemeyere/quacc into md_wo…
Andrew-S-Rosen Jun 22, 2024
c71d57d
type hint cleanup
Andrew-S-Rosen Jun 22, 2024
d0fc4ec
pre-commit auto-fixes
pre-commit-ci[bot] Jun 22, 2024
ec4f7f3
Update type hint
Andrew-S-Rosen Jun 22, 2024
454ca20
Fix type hint
Andrew-S-Rosen Jun 22, 2024
ebe6d08
Fix tests
Andrew-S-Rosen Jun 22, 2024
723fb19
Merge branch 'md_workflow' of github.com:tomdemeyere/quacc into md_wo…
Andrew-S-Rosen Jun 22, 2024
0e84dfa
Fix behavior of com, rot
Andrew-S-Rosen Jun 22, 2024
1fd976d
pre-commit auto-fixes
pre-commit-ci[bot] Jun 22, 2024
389b8df
fix tests
Andrew-S-Rosen Jun 22, 2024
41af2b7
Merge branch 'md_workflow' of github.com:tomdemeyere/quacc into md_wo…
Andrew-S-Rosen Jun 22, 2024
6f5e485
pre-commit auto-fixes
pre-commit-ci[bot] Jun 22, 2024
44f87f0
fix
Andrew-S-Rosen Jun 22, 2024
27babd7
Merge branch 'md_workflow' of github.com:tomdemeyere/quacc into md_wo…
Andrew-S-Rosen Jun 22, 2024
f3fb1fc
Remove unused lines
Andrew-S-Rosen Jun 22, 2024
9470e0e
More cleanup of unused lines
Andrew-S-Rosen Jun 22, 2024
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
123 changes: 123 additions & 0 deletions src/quacc/recipes/emt/md.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,123 @@
"""
Molecular Dynamics recipes for EMT.
"""

from __future__ import annotations

from typing import TYPE_CHECKING

from ase.calculators.emt import EMT
from ase.md.velocitydistribution import (
MaxwellBoltzmannDistribution,
Stationary,
ZeroRotation,
)

from quacc import job
from quacc.runners.ase import Runner
from quacc.schemas.ase import summarize_md_run
from quacc.utils.dicts import recursive_dict_merge

if TYPE_CHECKING:
from typing import Any

from ase.atoms import Atoms

from quacc.schemas._aliases.ase import DynSchema


@job
def md_job(
atoms: Atoms,
maxwell_boltzmann_params: dict[str, Any] | None = None,
md_params: dict[str, Any] | None = None,
**calc_kwargs,
) -> DynSchema:
"""
Carry out a Molecular Dynamics calculation.

!!! Note "Units"

Quacc does not follow ASE standards for Molecular Dynamics units.

Quacc ALWAYS uses the following units:

- Time: femtoseconds (fs)
- Pressure: GPa
- Temperature: Kelvin (K)
- Compressibility: 1/GPa
Comment on lines +38 to +41
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is going to introduce additional confusion simply because if people don't read the docstring (common), it'll just lead to a mess. At the same time, I agree that the ASE units themselves are disgusting.

I'm somewhat inclined to require users to supply what ASE supports directly without all these swaps and logs --- if a keyword that is chosen is deprecated, then ASE will warn them. If the user picks non-ASE units, then that's ultimately on them. We could still keep convert_md_units around though (but now with inverse=True as default) so users can have a quick way and sensible way to make adjustments when launching their jobs? We could mention this utility function in the docstring as a guide.


!!! Note "Keywords"

Additionally, Quacc uses the keywords `fix_com` and `fix_rot` instead of
`fixcm` and `fixrot` to fix the center of mass and rotation, respectively.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If this is just a matter of renaming and nothing else, let's just stick with the ASE ones. If you approve, let me know and I can revert the change here.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes sure!


As of March 2024, ASE still accept deprecated keywords such as:

- temperature instead of temperature_K
- pressure instead of pressure_au
- compressibility instead of compressibility_au
- dt instead of timestep

All of these keywords will be accepted by Quacc, but it is recommended to use the
new keywords to avoid confusion. Everything will always be converted to the Quacc
units mentioned above.
Andrew-S-Rosen marked this conversation as resolved.
Show resolved Hide resolved

Shared keywords between various dynamics type such as `timestep` and `steps` should
be specified in the `md_params` dictionary. Keywords specific to the dynamics type
should be specified in a dictionary `dynamics_kwargs` inside `md_params`.

The dynamics type can be specified in `md_params` as `dynamics`.

Parameters
----------
atoms
Atoms object
maxwell_boltzmann_params
Dictionary of custom kwargs for the initial temperature distribution. Set a value
to `quacc.Remove` to remove a pre-existing key entirely. For a list of available
keys, refer to [ase.md.velocitydistribution.MaxwellBoltzmannDistribution][].
Quacc has two additional parameters `fix_com` and `fix_rot` to fix the center of mass
and rotation from the initial velocity distribution. Defaults are
`{"temperature": None, "fix_com": True, "fix_rot": True}`. If `temperature` is set to
`None`, the initial temperature will not be set.
md_params
Dictionary of custom kwargs for the optimization process. Set a value
to `quacc.Remove` to remove a pre-existing key entirely. For a list of available
keys, refer to [quacc.runners.ase.Runner.run_md][].
**calc_kwargs
Custom kwargs for the EMT calculator. Set a value to
`quacc.Remove` to remove a pre-existing key entirely. For a list of available
keys, refer to the `ase.calculators.emt.EMT` calculator.

Returns
-------
DynSchema
Dictionary of results, specified in [quacc.schemas.ase.summarize_md_run][].
See the type-hint for the data structure.
"""

maxwell_boltzmann_defaults = {"fix_com": True, "fix_rot": True, "temperature": None}
md_params = md_params or {}

maxwell_boltzmann_params = recursive_dict_merge(
maxwell_boltzmann_defaults, maxwell_boltzmann_params
)

initial_temperature = maxwell_boltzmann_params.pop("temperature", None)
fix_com = maxwell_boltzmann_params.pop("fix_com", False)
fix_rot = maxwell_boltzmann_params.pop("fix_rot", False)

if initial_temperature:
MaxwellBoltzmannDistribution(
atoms, temperature_K=initial_temperature, **maxwell_boltzmann_params
)
if fix_com:
Stationary(atoms)
if fix_rot:
ZeroRotation(atoms)

calc = EMT(**calc_kwargs)
dyn = Runner(atoms, calc).run_md(**md_params)

return summarize_md_run(dyn, additional_fields={"name": "EMT MD"})
153 changes: 143 additions & 10 deletions src/quacc/runners/ase.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

from __future__ import annotations

import logging
import sys
from importlib.util import find_spec
from shutil import copy, copytree
Expand All @@ -11,6 +12,8 @@
from ase.calculators import calculator
from ase.filters import FrechetCellFilter
from ase.io import Trajectory, read
from ase.md.md import MolecularDynamics
from ase.md.verlet import VelocityVerlet
from ase.optimize import BFGS
from ase.optimize.sciopt import SciPyOptimizer
from ase.vibrations import Vibrations
Expand All @@ -22,6 +25,9 @@
from quacc.runners._base import BaseRunner
from quacc.runners.prep import terminate
from quacc.utils.dicts import recursive_dict_merge
from quacc.utils.units import convert_md_units

LOGGER = logging.getLogger(__name__)

has_sella = bool(find_spec("sella"))

Expand All @@ -32,7 +38,7 @@

from ase.atoms import Atoms
from ase.calculators.calculator import Calculator
from ase.optimize.optimize import Optimizer
from ase.optimize.optimize import Dynamics

from quacc.utils.files import Filenames, SourceDirectory

Expand All @@ -43,7 +49,7 @@ class OptParams(TypedDict, total=False):

fmax: float
max_steps: int
optimizer: Optimizer # default = BFGS
optimizer: Dynamics = BFGS # default = BFGS
optimizer_kwargs: OptimizerKwargs | None
store_intermediate_results: bool
fn_hook: Callable | None
Expand Down Expand Up @@ -167,12 +173,12 @@ def run_opt(
relax_cell: bool = False,
fmax: float | None = 0.01,
max_steps: int = 1000,
optimizer: Optimizer = BFGS,
optimizer: Dynamics = BFGS,
optimizer_kwargs: OptimizerKwargs | None = None,
store_intermediate_results: bool = False,
fn_hook: Callable | None = None,
run_kwargs: dict[str, Any] | None = None,
) -> Optimizer:
) -> Dynamics:
"""
This is a wrapper around the optimizers in ASE.

Expand Down Expand Up @@ -223,8 +229,12 @@ def run_opt(
raise ValueError(msg)

# Handle optimizer kwargs
if issubclass(optimizer, SciPyOptimizer) or optimizer.__name__ == "IRC":
if (
issubclass(optimizer, (SciPyOptimizer, MolecularDynamics))
or optimizer.__name__ == "IRC"
):
# https://gitlab.com/ase/ase/-/issues/1476
# https://gitlab.com/ase/ase/-/merge_requests/3310
optimizer_kwargs.pop("restart", None)
if optimizer.__name__ == "Sella":
self._set_sella_kwargs(optimizer_kwargs)
Expand All @@ -239,15 +249,17 @@ def run_opt(
self.atoms = FrechetCellFilter(self.atoms)

# Run optimization
full_run_kwargs = {"fmax": fmax, "steps": max_steps, **run_kwargs}
if issubclass(optimizer, MolecularDynamics):
full_run_kwargs.pop("fmax")
try:
with traj, optimizer(self.atoms, **optimizer_kwargs) as dyn:
if issubclass(optimizer, SciPyOptimizer):
if issubclass(optimizer, (SciPyOptimizer, MolecularDynamics)):
# https://gitlab.coms/ase/ase/-/issues/1475
dyn.run(fmax=fmax, steps=max_steps, **run_kwargs)
# https://gitlab.com/ase/ase/-/issues/1497
dyn.run(**full_run_kwargs)
else:
for i, _ in enumerate(
dyn.irun(fmax=fmax, steps=max_steps, **run_kwargs)
):
for i, _ in enumerate(dyn.irun(**full_run_kwargs)):
if store_intermediate_results:
self._copy_intermediate_files(
i,
Expand Down Expand Up @@ -307,6 +319,50 @@ def run_vib(self, vib_kwargs: VibKwargs | None = None) -> Vibrations:

return vib

def run_md(
self,
timestep: float = 1.0,
steps: int = 500,
dynamics: MolecularDynamics = VelocityVerlet,
dynamics_kwargs: dict[str, Any] | None = None,
) -> MolecularDynamics:
"""
Run an ASE-based MD in a scratch directory and copy the results back to
the original directory. This can be useful if file I/O is slow in the working
directory, so long as file transfer speeds are reasonable.

Parameters
----------
timestep
The time step in femtoseconds.
steps
Maximum number of steps to run
dynamics
MolecularDynamics class to use, from `ase.md.md.MolecularDynamics`.
dynamics_kwargs
Dictionary of kwargs for the dynamics. Takes all valid kwargs for ASE
MolecularDynamics classes.

Returns
-------
Dymamics
The ASE MolecularDynamics object.
"""

# Set defaults
dynamics_kwargs = dynamics_kwargs or {}
dynamics_kwargs["timestep"] = timestep
dynamics_kwargs["logfile"] = "-" if SETTINGS.DEBUG else self.tmpdir / "md.log"
dynamics_kwargs = self._fix_deprecated_md_params(dynamics_kwargs)
dynamics_kwargs = convert_md_units(dynamics_kwargs)

return self.run_opt(
fmax=None,
max_steps=steps,
optimizer=dynamics,
optimizer_kwargs=dynamics_kwargs,
)

def _copy_intermediate_files(
self, step_number: int, files_to_ignore: list[Path] | None = None
) -> None:
Expand Down Expand Up @@ -362,3 +418,80 @@ def _set_sella_kwargs(self, optimizer_kwargs: dict[str, Any]) -> None:

if not self.atoms.pbc.any() and "internal" not in optimizer_kwargs:
optimizer_kwargs["internal"] = True

@staticmethod
def _fix_deprecated_md_params(dynamics_kwargs: dict[str, Any]) -> None:
"""
Helper function to handle deprecated MD parameters.

Parameters
----------
dynamics_kwargs
Dictionary of keyword arguments for the molecular dynamics calculation.

Returns
-------
None
"""

if "trajectory" in dynamics_kwargs:
msg = "Quacc does not support setting the `trajectory` kwarg."
raise ValueError(msg)

if "temperature" in dynamics_kwargs or "temp" in dynamics_kwargs:
LOGGER.warning(
"In quacc `temperature`, `temp` and `temperature_K` are"
" equivalent and will be interpreted in Kelvin."
)
dynamics_kwargs["temperature_K"] = dynamics_kwargs.pop(
"temperature", None
) or dynamics_kwargs.pop("temp", None)

if "pressure" in dynamics_kwargs:
LOGGER.warning(
"In quacc `pressure` and `pressure_au` are equivalent and will be"
" interpreted in GPA."
)
dynamics_kwargs["pressure_au"] = dynamics_kwargs.pop("pressure")

Andrew-S-Rosen marked this conversation as resolved.
Show resolved Hide resolved
if "pressure_au" in dynamics_kwargs:
LOGGER.warning(
"In quacc `pressure` and `pressure_au` are equivalent and will be"
" interpreted in GPA."
)

if "compressibility" in dynamics_kwargs:
LOGGER.warning(
"In quacc `compressibility` and `compressibility_au` are equivalent"
" and will be interpreted in 1/GPa."
)
dynamics_kwargs["compressibility_au"] = dynamics_kwargs.pop(
"compressibility"
)

if "compressibility_au" in dynamics_kwargs:
LOGGER.warning(
"In quacc `compressibility` and `compressibility_au` are equivalent"
" and will be interpreted in 1/GPa."
)

if "dt" in dynamics_kwargs:
LOGGER.warning(
"The `dt` kwarg is ASE deprecated and will"
" be interpreted as `timestep` in Quacc."
)
dynamics_kwargs["timestep"] = dynamics_kwargs.pop("dt")

if "fixcm" in dynamics_kwargs:
LOGGER.warning("`fixcm` is interpreted as `fix_com` in Quacc.")

if "fixrot" in dynamics_kwargs:
LOGGER.warning("`fixrot` is interpreted as `fix_rot` in Quacc.")

if "fix_com" in dynamics_kwargs:
dynamics_kwargs["fixcm"] = dynamics_kwargs.pop("fix_com")

if "fix_rot" in dynamics_kwargs:
dynamics_kwargs["fixrot"] = dynamics_kwargs.pop("fix_rot")

return dynamics_kwargs
22 changes: 22 additions & 0 deletions src/quacc/schemas/_aliases/ase.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,18 @@ class ParametersOpt(TypedDict):
"""Dictionary of parameters from Optimizer.todict()"""


class ParametersDyn(TypedDict):
"""Dictionary of parameters from Dynamics.todict()"""


class TrajectoryLog(TypedDict):
"""Dictionary of parameters related to the MD trajectory"""

kinetic_energy: float
temperature: float
time: float


class RunSchema(AtomsSchema):
"""Schema for [quacc.schemas.ase.summarize_run][]"""

Expand All @@ -45,6 +57,16 @@ class OptSchema(RunSchema):
trajectory_results: list[Results]


class DynSchema(RunSchema):
"""Schema for [quacc.schemas.ase.summarize_md_run][]"""

parameters_md: ParametersDyn # from Dynamics.todict()
nsteps: int
trajectory: list[Atoms]
trajectory_log: TrajectoryLog
trajectory_results: list[Results]


class ParametersVib(TypedDict):
delta: float
direction: str
Expand Down