feat: a second project, where the physics is real - #5
Merged
Merged
Conversation
`ExampleMonteCarlo` sweeps the Ising model on a square lattice over size and temperature, using
ClassicalMonteCarlo over a Lattice2D lattice through the LatticeCore interface. It exists because
the first project's kernel is a placeholder, and three of this template's claims are only worth
anything against a real work package.
**The compute environment has no plotting backend, and that is not hygiene.** Both physics packages
carried `Plots` as a hard dependency until this week (DynamicalModels#14, Lattice2D#88 moved it
behind an extension). `run!(…; load=ExampleMonteCarlo)` ships this module to every worker, so before
those fixes this project would have put a plotting stack on all of them. `report/` is where Plots
lives, and it reads the same vault off disk.
**Every call is qualified, because two packages export `run!`.** ClassicalMonteCarlo's advances a
Markov chain; SweepRunner's dispatches the sweep. Every module is imported `using X: X`, so neither
can be reached unqualified by accident.
**The test asserts physics rather than a threshold.** Deep in the ordered phase the magnetisation is
near saturation and the Binder cumulant near 2/3; well above the transition both collapse. A chain
that quietly stopped equilibrating fails from both directions, which a tolerance picked to match
today's output would not catch. Measured: kbT=1.2 gives |M|=0.9977, E/N=-1.9909, U4=0.6666;
kbT=4.0 gives 0.1913, -0.5579, 0.0285.
The temperature grids crowd kbT ≈ 2.269, the exact 2D Ising transition, because a sweep earns its
cost when the interesting thing happens between two of its points.
One correction worth recording. `build_lattice` takes the topology TYPE, not an instance —
`Type{<:AbstractTopology{2}}`. ClassicalMonteCarlo's own `script/random_runner.jl` calls it as
`LType()`, so copying that working-looking example produced a MethodError; the signature came from
`methods(build_lattice)` instead. An example can be stale, and only the method table is not.
Verified end to end: 5 tests pass, smoke sweep done=2/err=0, `collect.jl` prints both points, and a
second run reports skipped=2.
|
📚 Docs preview: https://qatlashub.github.io/templateHPC.jl/previews/PR5/ (updates on each push to this PR) |
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.
ExampleMonteCarlosweeps the Ising model on a square lattice over size and temperature —ClassicalMonteCarlo over a Lattice2D lattice, through the LatticeCore interface.
It exists because the first project's kernel is a placeholder, and three of this template's claims
are only worth anything against a real work package.
The compute environment has no plotting backend, and that is not hygiene
Both physics packages carried
Plotsas a hard dependency until this week(sotashimozono/DynamicalModels.jl#14, sotashimozono/Lattice2D.jl#88 moved it behind an extension).
run!(…; load=ExampleMonteCarlo)ships this module to every worker, so before those fixes thisproject would have put a plotting stack on all of them.
report/is where Plots lives. It reads the same vault off disk and calls the same reduction fromsrc/, so the table printed on the cluster and the figure drawn afterwards cannot disagree.Every call is qualified, because two packages export
run!ClassicalMonteCarlo.run!advances a Markov chain.SweepRunner.run!dispatches the sweep. Everymodule is imported as
using X: X— the module, none of its exports — so neither can be reachedunqualified by accident.
The test asserts physics, not a threshold
Deep in the ordered phase the magnetisation is near saturation and the Binder cumulant near 2/3;
well above the transition both collapse. A chain that quietly stopped equilibrating fails from
both directions, which a tolerance picked to match today's output would not catch.
E/N → -2andU4 → 2/3are the textbook values, which is what makes the assertion meaningfulrather than a snapshot.
The temperature grids crowd
kbT ≈ 2.269, the exact 2D Ising transition, because a sweep earns itscost when the interesting thing happens between two of its points.
One correction worth recording
build_latticetakes the topology type, not an instance:Type{<:AbstractTopology{2}}.ClassicalMonteCarlo's own
script/random_runner.jlcalls it asLType(), so copying thatworking-looking example produced a
MethodError. The signature came frommethods(build_lattice)instead. An example can be stale; the method table cannot.
Verified
CI picks this up without being told:
discoverfinds everyprojects/*/Project.toml, so the matrixnow has two entries.