Skip to content

Lammps compatibility#322

Merged
jkalayan merged 6 commits intomainfrom
lammps-compatibility
Apr 29, 2026
Merged

Lammps compatibility#322
jkalayan merged 6 commits intomainfrom
lammps-compatibility

Conversation

@jkalayan
Copy link
Copy Markdown
Collaborator

Summary

Include functionality to run CE on LAMMPSDUMPS files. Currently MDA does not automatically convert force units from kcal to kJ, so this has to be done when the MDA Universe is created.

Changes

Read in LAMMPSDUMP file:

  • explicitly use "LAMMPSDUMP" as a "file_format" option
  • Convert forces and atomic energies (latter if applicable) from kcal to kJ when a MDA Universe is created
  • MDA expects column headers that contain atom potential and kinetic energies to be explicitly provided, these are hardcoded as c_5 and c_7 in CE.

Handle extra bonds to H atoms:

  • If restraints to H atoms (e.g. in water molecules) are explicitly defined as a bond, then rdkit complains about H valency, set inferrer=None to deal with this in symmetry calcs

Impact

  • Will allow projects that output atomic forces and energies in LAMMPSDUMP files to use CE

@jkalayan jkalayan requested review from harryswift01 and skfegan and removed request for harryswift01 April 28, 2026 15:27
Copy link
Copy Markdown
Member

@skfegan skfegan left a comment

Choose a reason for hiding this comment

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

This should improve the robustness when handling different file types and topology restraints.

The only request is to add a unit test to test_mda_universe_operations.py for the convert_lammps function.

Copy link
Copy Markdown
Member

@skfegan skfegan left a comment

Choose a reason for hiding this comment

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

Looks good to me

Copy link
Copy Markdown
Member

@harryswift01 harryswift01 left a comment

Choose a reason for hiding this comment

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

This looks really good overall, the LAMMPSDUMP handling is nice and clear, and the fallback logic is a good touch. Tests are solid too, especially capturing the transformation and checking the scaling directly rather than relying on a real MDA universe.

I've just left a couple of small comments to tidy things up, but nothing major. Once those are addressed I’m happy with this.

Comment thread CodeEntropy/levels/neighbors.py Outdated
Comment thread tests/unit/CodeEntropy/levels/test_mda_universe_operations.py Outdated
@jkalayan jkalayan requested a review from harryswift01 April 29, 2026 15:38
@jkalayan
Copy link
Copy Markdown
Collaborator Author

FYI: MDA issue for dealing with LAMMPSDUMP unit conversion bug is still open: MDAnalysis/mdanalysis#5115

Copy link
Copy Markdown
Member

@harryswift01 harryswift01 left a comment

Choose a reason for hiding this comment

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

This is a really nice, tidy addition that should allow LAMMPS files to be used correctly within CodeEntropy. Happy with the approach and the test coverage, thank you for adding this in

@jkalayan jkalayan merged commit 56fa6e1 into main Apr 29, 2026
44 of 45 checks passed
@jkalayan jkalayan deleted the lammps-compatibility branch April 29, 2026 15:51
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.

3 participants