Skip to content

Fix examples broken on current LAMMPS; add example smoke test - #442

Merged
andeplane merged 6 commits into
mainfrom
anders/lammps-stable-30sep2026
Nov 5, 2026
Merged

andeplane merged 6 commits into
mainfrom
anders/lammps-stable-30sep2026

Conversation

@andeplane

@andeplane andeplane commented Oct 1, 2026 •

Copy link
Copy Markdown
Owner

Before: several bundled examples fail on current LAMMPS (removed compute_modify keywords, an unmatched quote in benzene), unterminated ReaxFF output can swallow the group-inspection marker, and nothing checks that the example library actually runs.

After: those example scripts are fixed, the worker matches the group marker as a line suffix (splitGroupReady), and npm run test:examples runs all 53 examples against the real lammps.js wasm build exactly as the app drives them.

This PR does not bump lammps.js; main stays on 1.5.1. The fix pour examples (pour_2d, pour_2d_molecule, pour_3d, granular_patterns) still fail with "Cannot yet use fix pour with the KOKKOS package" until lammps.js 1.6.x is published and bumped in a follow-up.

How

  • deposit_atom, deposit_molecule and the 3 pour scripts: dynamic yes extra 0 → dynamic/dof / extra/dof.
  • benzene: reworded a print with an apostrophe.
  • src/utils/lammpsGroups.ts: splitGroupReady plus a unit test; used by src/wasm/lammps.worker.ts.
  • src/examples.smoke.ts + vitest.examples.config.mts: the smoke test (not part of the regular vitest run).

Testing

  • Typecheck, unit tests, lint and prettier pass locally (also checked against vitest 5 / eslint 10).
  • npm run test:examples on lammps.js 1.5.1: only the 4 fix pour examples fail.

🤖 Generated with Claude Code

https://claude.ai/code/session_019ZnTFmiih3xq95b7ioCPY7

andeplane and others added 5 commits October 1, 2026 19:40
Adds `npm run test:examples` (src/examples.smoke.ts + vitest.examples.config.mts),
which runs every example in public/examples/examples.json against the real
atomify wasm build the way the app does: the same LammpsAdapter, the same -k on/-sf kk
startup args, the same KOKKOS serial-style and group-inspection
preprocessing, #/bond directives, per-step snapshot calls, and the final
post-run snapshot. Any LAMMPS error, ERROR output line, or snapshot exception
fails the test. Not part of `npm test` (it takes minutes and needs the real
module).

Fixed examples:
- deposit_atom, deposit_molecule, pour_2d, pour_2d_molecule, pour_3d:
  `compute_modify ... dynamic yes extra 0` -> `dynamic/dof yes extra/dof 0`.
  The old keywords were removed from LAMMPS, which made the deposit examples
  error out.
- benzene: a lone apostrophe in a `print "..."` line ("I'm") is an unmatched
  quote error once LAMMPS re-parses the print text; reworded.
- pour/granular examples also need lammps.js's fix pour KOKKOS patch (next
  lammps.js release).

Group-inspection marker: match __ATOMIFY_GROUPS_READY__ as a line suffix
(splitGroupReady). Output that lacks a trailing newline — the new LAMMPS's
ReaxFF "Changed valency_val" warning — otherwise glues onto the marker, the
include file is never written, and the run fails.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019ZnTFmiih3xq95b7ioCPY7
…uential)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019ZnTFmiih3xq95b7ioCPY7
@andeplane andeplane changed the title Use lammps.js 1.6.0 (LAMMPS stable_30Sep2026); make every example run Fix examples broken on current LAMMPS; add example smoke test Nov 5, 2026
@andeplane
andeplane merged commit 9e29b97 into main Nov 5, 2026
3 checks passed
@andeplane
andeplane deleted the anders/lammps-stable-30sep2026 branch November 5, 2026 09:22
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