Skip to content

Better input set generator and sets for io.lammps#4368

Open
vir-k01 wants to merge 54 commits intomaterialsproject:masterfrom
vir-k01:lammps_sets_templated
Open

Better input set generator and sets for io.lammps#4368
vir-k01 wants to merge 54 commits intomaterialsproject:masterfrom
vir-k01:lammps_sets_templated

Conversation

@vir-k01
Copy link

@vir-k01 vir-k01 commented Apr 19, 2025

Summary

This PR is part of an effort to include workflows for running LAMMPS via atomate2. A concurrent PR will be opened in atomate2 that has the flows, while this PR aims to update the input set generators to match the inputs required there.
These changes are based on initial work here: https://github.com/Matgenix/atomate2-lammps done by @ml-evs and @gbrunin. Also tagging in @esoteric-ephemera who helped structure the code in this PR, and @davidwaroquiers.
Major changes:

  • Updated templates for running NVT/NPT/Minimization jobs with the upcoming flows in atomate2.
  • Added in a data class to validate commonly utilized settings (based on the updated templates)
  • The new input set generator is written (to the best of my ability) to provide input settings consistent with classical MD run through other codes on solids (matched defaults to ASE MD)

TODO:

- Add tests
- I've made most of the design decisions here assuming these sets will be used with solids through the Structure object, but one could also argue including support for Molecules. I'm looking for suggestions on how that can be incorporated without varying too much of the logic (ex : for the default inputs, atom styles, force field parameters)
- I'm also looking for suggestions on how to best check/validate user specified force field parameters, which is difficult to do considering the numerous force field formats that exist out there. The existing ForceField object in io.lammps.data is not very intuitive to set-up for a user and does not support lammps integrated MLIPs yet.

vir-k01 and others added 20 commits October 30, 2024 17:17
…LammpsInputFile objects as input for the template to make use of all the other io.lammps functions in pmg
…rd lammps) files with the input set that are prepared independent of the input file
Added a new (and probs better?) implementation for generating lammps input sets, with a more expressive MD template. Everything is now based on the template to ensure the atomate2 workflows being written work without the user having to specify too much. Inputs and states have to be enumed.
…LammpsInputFile objects as input for the template to make use of all the other io.lammps functions in pmg
…rd lammps) files with the input set that are prepared independent of the input file
Added a new (and probs better?) implementation for generating lammps input sets, with a more expressive MD template. Everything is now based on the template to ensure the atomate2 workflows being written work without the user having to specify too much. Inputs and states have to be enumed.
…o lammps_sets"

This reverts commit c1f2ed6, reversing
changes made to 410d4b4.
…class for storing and validating user defined settings
 Changes to be committed:

Reworked the way the input set generator generates the input file to be less cumbersome and use fewer if-else clauses, this new approach goes back to the original generator in order to be a lot more flexible (esp for custom lammps jobs). A LammpsSettings object is now present in order to validate the inputs specified by the user prior to actually passing them to lammps. This approach works out for the makers implemented currently (NVT/NPT/NVE/Minimization).
Redid how input sets are validated, in particular how "general" settings can also be stored as attrs of LammpsSettings, and only validate keys from _BASE_LAMMPS_SETTINGS. This way, allows for very flexible inputs from user to also be present in the final taskdoc.inputs. Also used PathLike instead of Path objects.
@vir-k01 vir-k01 requested review from mkhorton and shyuep as code owners April 19, 2025 21:06
@vir-k01 vir-k01 changed the title [WIPBetter input set generator and sets for io.lammps [WIP] Better input set generator and sets for io.lammps Apr 19, 2025
return self.is_lanthanoid or self.is_actinoid or self.symbol in {"Sc", "Y"}

@property
@deprecated(
Copy link
Contributor

@DanielYang59 DanielYang59 Apr 20, 2025

Choose a reason for hiding this comment

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

I guess reverting changes to core.periodic_table and io.exciting is not intended?

If so you could revert those changes with (warning, this would drop all changes to that file, make sure this is what you need) git checkout upstream/master -- file_to_revert

Copy link
Contributor

Choose a reason for hiding this comment

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

Just behind the master branch, synced up now

vir-k01 added 3 commits April 29, 2025 13:47
…ized json where atoms and velocities are not resolved into dataframes before checking condition. Unsure why that is the case, commenting out for now
@davidwaroquiers
Copy link
Contributor

@vir-k01 any news about this PR ?
Can we provide some help or would you like us to take this on if needed on your side and possible on our side ?

@vir-k01
Copy link
Author

vir-k01 commented Jun 26, 2025

@davidwaroquiers apologies for slacking off on this. After a bit of experimentation, I've added a LammpsData.from_molecule method and added different defaults as per what @gbrunin suggested. Tbh although this supports using molecules, a better way would be for the user to first make the Topology and ForceField objects as they've been currently implemented and use the LammpsData.from_ff_and_topologies method instead. This would preserve information about bonding. I suppose this shouldn't be an issue though for force fields that do not rely on such info.

@esoteric-ephemera
Copy link
Contributor

@mkhorton and @shyuep when you get a chance, would you be able to review this PR? We'd need a new pymatgen release to get @vir-k01's LAMMPS workflows tested on the atomate2 side. Thanks!

@vir-k01's addressed the earlier review comments from community members

@esoteric-ephemera
Copy link
Contributor

@mkhorton and @shyuep bumping this - the PR should be ready to go!

@vir-k01 vir-k01 changed the title [WIP] Better input set generator and sets for io.lammps Better input set generator and sets for io.lammps Jan 29, 2026
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.

7 participants