Repository navigation
Fix examples broken on current LAMMPS; add example smoke test - #442
Merged
Merged
Conversation
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Before: several bundled examples fail on current LAMMPS (removed
compute_modifykeywords, an unmatched quote inbenzene), 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), andnpm run test:examplesruns 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 pourexamples (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_moleculeand the 3 pour scripts:dynamic yes extra 0→dynamic/dof/extra/dof.benzene: reworded aprintwith an apostrophe.src/utils/lammpsGroups.ts:splitGroupReadyplus a unit test; used bysrc/wasm/lammps.worker.ts.src/examples.smoke.ts+vitest.examples.config.mts: the smoke test (not part of the regularvitest run).Testing
npm run test:exampleson lammps.js 1.5.1: only the 4fix pourexamples fail.🤖 Generated with Claude Code
https://claude.ai/code/session_019ZnTFmiih3xq95b7ioCPY7