Skip to content

fix(molecule): bug fix for reading in molecule json files#4732

Merged
akohlmey merged 3 commits into
lammps:developfrom
salamaaya:fix-molecule-json
Oct 16, 2025
Merged

fix(molecule): bug fix for reading in molecule json files#4732
akohlmey merged 3 commits into
lammps:developfrom
salamaaya:fix-molecule-json

Conversation

@salamaaya

Copy link
Copy Markdown
Collaborator

Summary

Fixes:

  1. incorrect atom ordering when reading molecule JSON: swap atom1 and atom2 for both dihedrals and impropers when updating the count array so the internal representation matches LAMMPS conventions and the original molecule files.
  2. parsing of the dihedrals section was using aoffset rather than the correct doffset to calculate itype

Related Issue(s)

fixes #4726

Author(s)

Aya Salama (asalama0204@gmail.com, Stevens Institute of Technology)
Jacob Gissinger (jgissing@stevens.edu, Stevens Institute of Technology)

Licensing

By submitting this pull request, I agree, that my contribution will be included in LAMMPS and redistributed under either the GNU General Public License version 2 (GPL v2) or the GNU Lesser General Public License version 2.1 (LGPL v2.1).

Backward Compatibility

Implementation Notes

Post Submission Checklist

  • The feature or features in this pull request is complete
  • Licensing information is complete
  • Corresponding author information is complete
  • The source code follows the LAMMPS formatting guidelines
  • Suitable new documentation files and/or updates to the existing docs are included
  • The added/updated documentation is integrated and tested with the documentation build system
  • The feature has been verified to work with the conventional build system
  • The feature has been verified to work with the CMake based build system
  • Suitable tests have been added to the unittest tree.
  • A package specific README file has been included or updated
  • One or more example input decks are included

Further Information, Files, and Links

revert nmolecules
@jrgissing
jrgissing self-requested a review October 15, 2025 21:51
@akohlmey akohlmey moved this to Ready for Merge in LAMMPS Pull Requests Oct 16, 2025
@akohlmey

Copy link
Copy Markdown
Member
  1. incorrect atom ordering when reading molecule JSON: swap atom1 and atom2 for both dihedrals and impropers when updating the count array so the internal representation matches LAMMPS conventions and the original molecule files.

@salamaaya Actually, in this branch you changed it for angles and dihedrals, but did not update impropers. I've added the change (and another bugfix I came across while working on adding a "write_molecule" command.

@akohlmey
akohlmey merged commit cb43dec into lammps:develop Oct 16, 2025
14 checks passed
@github-project-automation github-project-automation Bot moved this from Ready for Merge to Done in LAMMPS Pull Requests Oct 16, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

Development

Successfully merging this pull request may close these issues.

[BUG] Molecule JSON vs .molecule_template molecule command parsing causes different simulation outputs

3 participants