Add thermo-output-to-file notebook; map wasm /work to the kernel cwd#88
Merged
Conversation
New basics/05 tutorial: the classic file-based LAMMPS workflow — the input script writes time/temperature/energy to thermo.txt with fix ave/time during the run, and a separate cell (with the simulation already closed) reads the file with numpy.loadtxt and plots it. Doing this surfaced a wart in the DriveFS mount from #86: /work was mapped to the drive root, so files written by LAMMPS landed at the site root instead of next to the notebook (whose kernel runs in its own directory, e.g. /drive/basics). Map /work through the kernel's current directory instead — files now land where native LAMMPS would put them (the process cwd), and np.loadtxt("thermo.txt") just works. Notebooks at the site root are unaffected (empty prefix). Verified headlessly (playwright + freshly built wasm): the new notebook runs end-to-end and renders the plot; index, basics/02 (file I/O), basics/03 (plots), basics/04 and materials/01 all still pass. The remaining materials notebooks do no file I/O. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
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.
Summary
New tutorial
basics/05-thermo-output-to-file.ipynb— the classic file-based LAMMPS workflow: the input script writes time, temperature and energy tothermo.txtwithfix ave/timeduring the run; a separate cell — with the simulation already closed — reads the file back withnumpy.loadtxtand plots temperature relaxation and NVE energy conservation. Linked from the index table andNOTEBOOK_TUTORIALS.md.Bindings fix (required for the above): the DriveFS mount from #86 mapped the wasm
/workdirectory to the drive root, so files LAMMPS wrote landed at the site root while the notebook's kernel runs in its own subdirectory (e.g./drive/basics) —np.loadtxt("thermo.txt")couldn't find the file./workpaths are now prefixed with the kernel's current directory, so files land next to the running notebook — the same place native LAMMPS would put them (the process cwd). Notebooks at the site root are unaffected (empty prefix).Test plan
thermo.txtlands next to the notebook, plot renders.index.ipynb,basics/02(file I/O),basics/03(live plotting),basics/04,materials/01all pass headlessly with the bindings change. The remaining materials notebooks do no file I/O.🤖 Generated with Claude Code