Skip to content

[WIP] Breaking: Read ASE MD velocities in Angstrom/fs and let MultiMDMaker chain VASP and ASE MD jobs - #1606

Draft
hrushikesh-s wants to merge 5 commits into
materialsproject:mainfrom
hrushikesh-s:multi-md-ase
Draft

hrushikesh-s wants to merge 5 commits into
materialsproject:mainfrom
hrushikesh-s:multi-md-ase

Conversation

@hrushikesh-s

@hrushikesh-s hrushikesh-s commented Oct 16, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

Include a summary of major changes in bullet points:

  • Breaking: AseMDMaker now reads the velocities site property in Angstrom/fs. This is
    the unit of a VASP POSCAR and of the structures that pymatgen and emmet read from a
    CONTCAR. Before, it was read in ASE units, so a structure from a VASP MD started about
    10 times too slow.
  • New option store_velocities of AseMDMaker, False by default. If True, the final
    velocities, in Angstrom/fs, are added to the velocities site property of the output
    structure.
  • Breaking: the output structure of AseMDMaker no longer keeps the momenta site
    property, the input velocities or the VASP MD state of a CONTCAR. Before, the momenta
    silently started a following NVE job from the previous velocities.
  • MultiMDMaker now chains VASP and ASE MD makers, such as ForceFieldMDMaker, in any
    order. With store_velocities=True for the ASE makers, each job continues from the
    final positions and velocities of the previous one. A VASP maker gets prev_dir only
    after a VASP job.
  • Tests: the velocity units are checked against the kinetic temperature. Two chained NVE
    runs of 5 steps end in the same positions and velocities as one run of 10 steps. The
    test also covers restart_from_uuid with ASE makers. Two more tests chain VASP to
    ASE and ASE to VASP.

Additional dependencies introduced (if any)

  • List all new dependencies needed and justify why. While adding dependencies that bring
    significantly useful functionality is perfectly fine, adding ones that add trivial
    functionality, e.g., to use one single easily implementable function, is frowned upon.
    Justify why that dependency is needed. Especially frowned upon are circular dependencies.

  • None

TODO (if any)

If this is a work-in-progress, write something about what else needs to be done.

Checklist

Work-in-progress pull requests are encouraged, but please put [WIP] in the pull request
title.

Before a pull request can be merged, the following items must be checked:

  • Code is in the standard Python style.
    The easiest way to handle this is to run the following in the correct sequence on
    your local machine. Start with running ruff and ruff format on your new code. This will
    automatically reformat your code to PEP8 conventions and fix many linting issues.
  • Doc strings have been added in the Numpy docstring format.
    Run ruff on your code.
  • Type annotations are highly encouraged. Run mypy to
    type check your code.
  • Tests have been added for any new functionality or bug fixes.
  • All linting and tests pass.

Note that the CI system will run all the above checks. But it will be much more
efficient if you already fix most errors prior to submitting the PR. It is highly
recommended that you use the pre-commit hook provided in the repository. Simply run
pre-commit install and a check will be run prior to allowing commits.

@ZKC19940412

Copy link
Copy Markdown

Hi, after reviewing this PR, I noticed a structural inconsistency between the
documented contract and the type annotation for md_makers. The docstring
(L36-38 of src/atomate2/vasp/flows/md.py) states that the makers "are either
all VASP makers or all ASE makers," but the annotation list[Maker] accepts
any mix, and nothing in make() enforces the constraint.

Suppose a user wants a short but accurate VASP NPT equilibration chained into
a production ASE force-field NVT run . As written, this
would either break somewhere downstream or run with unexpected behavior,
since the two maker families chain state differently (VASP via prev_dir,
ASE via the velocities site property), and the docstring suggests the chain
is meant to be PES-consistent.

So the question is which contract you intend:

  • If mixed chains are disallowed, make() (or __post_init__) should detect
    the mix and raise a clear ValueError early, rather than failing deep in
    the flow.
  • If mixed chains are allowed, the docstring should be updated, and the
    cross-family state handoff (positions + velocities across the VASP/ASE
    boundary, and the PES discontinuity at the splice) should be defined and
    tested.

@hrushikesh-s

Copy link
Copy Markdown
Collaborator Author

Hi, after reviewing this PR, I noticed a structural inconsistency between the documented contract and the type annotation for md_makers. The docstring (L36-38 of src/atomate2/vasp/flows/md.py) states that the makers "are either all VASP makers or all ASE makers," but the annotation list[Maker] accepts any mix, and nothing in make() enforces the constraint.

Suppose a user wants a short but accurate VASP NPT equilibration chained into a production ASE force-field NVT run . As written, this would either break somewhere downstream or run with unexpected behavior, since the two maker families chain state differently (VASP via prev_dir, ASE via the velocities site property), and the docstring suggests the chain is meant to be PES-consistent.

So the question is which contract you intend:

  • If mixed chains are disallowed, make() (or __post_init__) should detect
    the mix and raise a clear ValueError early, rather than failing deep in
    the flow.
  • If mixed chains are allowed, the docstring should be updated, and the
    cross-family state handoff (positions + velocities across the VASP/ASE
    boundary, and the PES discontinuity at the splice) should be defined and
    tested.

Mixed chains are not meant to be supported, since a VASP maker copies the VASP output files of the previous job from prev_dir, which an ASE job does not write, and an ASE maker ignores prev_dir. MultiMDMaker now raises a ValueError when it is created with a mix of VASP and ASE makers, with a test. Does that look fine?

@hrushikesh-s hrushikesh-s changed the title [WIP] Breaking: Read ASE MD velocities in Angstrom/fs and let MultiMDMaker chain ASE MD jobs [WIP] Breaking: Read ASE MD velocities in Angstrom/fs and let MultiMDMaker chain VASP and ASE MD jobs Oct 19, 2026
@hrushikesh-s

Copy link
Copy Markdown
Collaborator Author

@ZKC19940412, I have dropped the ValueError from my earlier reply and now allow mixed chains, since the finite-temperature phonon workflow needs VASP and force-field MD in either order. Each job starts from the final positions and velocities of the previous one (ASE makers need store_velocities=True), and a VASP maker in the chain gets prev_dir only after a VASP job, with a test for each direction. Nothing corrects the energy jump where the potential changes, so the first steps after a switch should be discarded. Does that look fine?

@ZKC19940412

ZKC19940412 commented Oct 19, 2026 •

Copy link
Copy Markdown

I also lean towards allowing mix MD chains between MLIP and ASE as well. So this change looks good to me.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants