-
Notifications
You must be signed in to change notification settings - Fork 101
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
Atomate2 OpenMM integration & broader classical MD framework #782
Conversation
…generate_interchange methods.
… for classical_md.openmm.tasks.py
…with new BaseOpenMMMaker
…al pycharm debugger.
…tion despite conflicting pydantic versioning between Interchange (using v1) and atomate2 (using v2)
…ix CalculationOutput.from_directory
EDIT: hold off actually, I forgot that I disabled the openmm tests because a new emmet release is needed. Pinging the MP team. |
…nd enhance readability.
…nd make importing openff to openmm base optional
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.
huge amount of work here! 👍
This is now pinned to the most recent version of emmet and ready to merge @utf. Your previous suggestion to split out OpenMM and OpenFF was very good. They are now independent and the OpenMM workflows support MLFFs and can return structures to better interoperate with the rest of Atomate2. |
- uses: actions/setup-python@v5 | ||
with: | ||
python-version: ${{ matrix.python-version }} | ||
- name: Set up micromamba |
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.
@utf i think it could help to have the micromamba
-dependent MD CI be its own job or even its own test-md.yml
workflow. that would enable only running the MD tests when any MD source files change and would also uncouple the remaining CI from any install/env issues micromamba
might encounter
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'd be happy with that solution!
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.
Using micromamba saves us from manually building enumlib so I favor keeping it in the main CI.
This really is fantastic. Thank you very much @orionarcher. @janosh, once you're happy I think we can merge. |
Amazing work, thanks for sticking with this @orionarcher ! |
…lsproject#782) * Move remaining content from common.py to renamed base.py. * Update core.py with skeleton code for openff_job and generate_interchange methods. * Complete Calculation, CalculationInput, and CalculationOutput schemas for classical_md.openmm.tasks.py * Implement BaseOpenMMMaker for classical_md.openmm workflow * Update core jobs for classical_md.openmm to be compatible with new BaseOpenMMMaker * Add MoleculeSpec to classical_md.schemas and modify OpenMMTaskDoc * Implement attribute inheritance logic for base openmm maker and openmm jobs * Add from/as_dict functions for openff topology, interchange, molecule, and quantity * Fix serialization issues with conflicting pydantic versions between Interchange and atomate2 * Implement anneal and production workflows * Update resolve_attr logic to set missing attributes * Change ClassicalMDTaskDocument to OpenMMTaskDocument in base.py * Store interchange intermediate as a JSON string to fix parsing issues * Implement temperature change logic in TempChangeMaker * Improve state reporter to append to state file * Output taskdoc_json file to directory for easy building * Enhance documentation for all components * Implement micromamba for testing environment * Change all docstrings to numpy format * Add CodeCov for classical_md tests * Rename "steps" argument to "n_steps" and "output_steps" to "steps" in CalculationOutput * Add support for writing trajectory to HDF5 file * Implement MDAReporter for trajectory output * Add embed_traj argument to base_openmm_maker * Add traj_blob keyword and switch interchange to type HexBytes * Move classical_md schemas to emmet * Implement OPLS force field support through ligpargen * Create FauxInterchange object for OPLS compatibility * Refactor OpenMMFlowMaker and BaseOpenMMMaker * Add XMLMoleculeFF class for manipulating XML files representing OpenMM-compatible ForceFields * Split utilities and jobs in jobs/opls.py into separate files * Refactor utilities to isolate OpenFF dependency * Add support for MACE-based interchanges * Update OpenMM tutorial * Support BaseOpenMMMaker returning structures * Implement reading and writing of structure to/from OpenMMTaskDocument --------- Co-authored-by: Alex Ganose <utf@users.noreply.github.com> Co-authored-by: Orion Cohen <orioncohen@Orions-MBP.localdomain> Co-authored-by: Janosh Riebesell <janosh.riebesell@gmail.com>
Developed by @xperrylinn and @orionarcher
Summary
This PR builds out support for OpenMM with a framework that could be extended to support other MD codes. Namely LAMMPS, Amber, and Gromacs. Rough visual example here
Core ideas:
openff.interchange.Interchange
object as a core engine-agnostic representation of an MD simulation.ClassicalMDTaskDocument
and genericInterchange
creation functions, then hand off responsibility for evolving the simulation to workflows for each MD engine. Currently only OpenMM support is implemented.prev_task
to pass meta-data between jobs. Since OpenMM is programmatic, the core information is not stored in the local directory.InputSets
. Since OpenMM is programmatic,InputSets
andInputGenerators
don't make conceptual sense.What's implemented:
monty
To do / open questions:
Future PR
additional_stores
, if availableopenff.interchange.Interchange
object can be larger than 16MB MongoDB doc limit. Need to implement a workaround by zipping the object and/or putting it on S3.Related PRs:
pymatgen
would move most ofatomate2.classical_md.utils
upstream. PR #3729emmet
would moveatomate2.classical_md.schemas
upstream. PR #975Example usage
Additional dependencies introduced
These are all necessary for the classical MD setup and execution workflow.
Checklist
Before a pull request can be merged, the following items must be checked:
The easiest way to handle this is to run the following in the correct sequence on
your local machine. Start with running
ruff
andruff format
on your new code. This willautomatically reformat your code to PEP8 conventions and fix many linting issues.
Run ruff on your code.
type check your code.
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.