Stochasm

User Guide Open the app ↗

Watching systems — views, the Sampler, statistics, and each model's observables

Every running system is measured continuously and drawn several ways. The first sections cover the concepts shared by all models — the views, the Statistics window, the Sampler, and the machine-learning layer — and the per-model sections that follow detail each model's own views, display options, and observables.

Views

The header's View selector lists what the current model + mode offers. Each is drawn on the GPU. Two floating windows sit beside the View selector: View Settings (the eye icon) holds a view's display options — colours, trails, glow, phase axes — and Interaction & Paint (the brush icon) holds its tools — the paint brushes and, in the phase view, the Pan/Zoom tool. Both are detailed per model below.

ViewShows
LatticeThe grid itself (single-system lattice models). Trails, alpha, and painting live here — see Multi-Component Lattice.
ParticlesPatchy Discs’ periodic box: every disc, patch, and bond, live — see Patchy Discs.
ObservablesA live time-series plot of any observable through time, in single-system mode — for the Multi-Component Lattice (by class, per type) and Patchy Discs (any single observable). See Multi-Component Lattice.
EnsembleThe phase-space cloud: every replica plotted at two observables of your choosing (pick the axes in View Settings). Smart zoom opens the view framed on the cloud. Where provable, amber dashed curves mark theoretical envelopes with the forbidden region shaded. Glow and history smearing are tunable.
GraphThe cluster graph — the ensemble organised by similarity instead of coordinates.

Framing the phase view

Every Ensemble (phase-space) view shares two ways to frame the cloud. Smart zoom — on by default; toggle it in View Settings — opens the view zoomed onto where the systems actually are rather than showing the whole axis range with a speck in the middle, and it re-frames as the cloud spreads out. It has a built-in zoom-in limit, so a cloud collapsed onto a single point (an ensemble at the very start, before any structure develops) is centred and bounded instead of magnified to infinity. Switch it off to see the full phase space with its theoretical envelopes. For manual control, the Pan/Zoom tool — the default interaction mode — lets you drag to pan and scroll to zoom in and out at the cursor; a double-click resets to the auto-fit. A single click still samples the nearest system into the Sampler — the same as in Paint mode — so you can inspect systems without leaving Pan/Zoom. Panning or zooming by hand stands smart zoom down until you reset. To paint systems in phase space (Multi-Component Lattice), switch the tool to Paint in Interaction & Paint.

Observables & statistics

Stochasm measures a feature vector for every system, every step — the same numbers that drive the phase-space axes, the plots, and the machine-learning layer. What’s measured is model-specific (detailed in the per-model sections below); how you read it is shared.

The Statistics window

The header's bars icon opens a floating window listing every currently-enabled observable, live. In single mode it describes the system; in ensembles it lives inside the Sampler and describes the selected system, reporting the population means alongside it.

The heavier observables can be switched off to save their compute cost — the System tab's Observables card (per model) toggles the optional groups, and a disabled group's observables vanish everywhere: axes, plots, statistics, learning.

The Sampler

Ensembles show you ten thousand systems at once; the Sampler lets you hold one of them in your hand. Click any point in the Ensemble view (or any node in the Graph view) and the Sampler window opens. It has three yellow-headed sections: a Mode selector, a System View of the system's actual state (with its ID), and its full Statistics.

Ten thousand systems mid-relaxation; one of them held in the Sampler with its lattice and statistics.
Ten thousand systems mid-relaxation; one of them held in the Sampler with its lattice and statistics.

The Mode selector (at the top of the Sampler) chooses how the preview behaves:

  • Sample near point (default) — the Sampler cycles through systems near your click, a fresh one every third of a second, each shown as a frozen snapshot. The green rings mark the sampled spot; the green dot shows where the current sample actually sits.
  • Follow one — hold a single system and watch it evolve live, its green dot riding along as it drifts through the cloud.

The selected system is immune to the phase brush, so you can paint around it without losing it. ✕ (or a click on empty space, or Reset Simulation) deselects; the neon green ring and sprite always mean "the selected system" — nothing else in the app uses that colour.

Machine Learning

The Machine Learning tab hosts Stochasm's learning layer, and works for any model's ensemble. Its first instrument is the cluster graph: every system's observables form a feature vector; the app standardises the features, clusters the ensemble, and draws the result as a force-directed graph — one node per community, sized by population, colour-coded (the palette deliberately avoids selection-green), with edges expressing similarity. It learns continuously while the ensemble runs, in any view — sampling and re-clustering in step with the sampling cadence, so a low measurement rate means slower (never stale) learning, and the green follow-tracer glides between nodes at that cadence rather than snapping.

Click a node to open a member system in the Sampler; repeated clicks cycle through distinct members, and a node whose members have all migrated elsewhere falls back to a stored specimen (titled Stored sample). Render options (physics of the layout, label style) sit in View Settings while the Graph view is active.

Toggling observable groups off changes the feature space, and the graph re-learns accordingly. To restart the learning by hand, open the header's Reset Simulation menu (ensembles only) and pick Reset learning — it clears the communities, reservoir, and learned features while the ensemble itself keeps running (its companion re-seeds the ensemble instead). More learning algorithms will join this tab over time.

Multi-Component Lattice

Observables

The lattice model's observables come in six classes — each with a Global (system-wide) value and, where meaningful, one value per site type:

ClassWhat it measures
Site-type fractionsThe composition — each type's share of the lattice.
Composition entropyShannon entropy of the composition (in nats): 0 when one type dominates, ln N when equimolar.
Same-type bond excessHow much neighbouring same-type pairs exceed what random mixing would give: positive = clustered, negative = anti-clustered (striped, checkerboarded).
Correlation rangeAn integrated pair-correlation excess — a proxy for domain size.
Largest-cluster fractionThe biggest connected same-type cluster as a fraction of the lattice — the percolation order parameter.
Cluster-size varianceHow unequal the cluster sizes are.

The last three involve real work (union-find and correlation scans), so the System tab's Observables card lets you switch the Pair correlation and Union-Find groups off — dropping them (and their cost) from axes, plots, statistics and learning. Its checkmark matrix shows exactly what's available globally vs. per type.

The Observables view

The Observables view plots any of those classes as a live time-series: pick the class, toggle each global/per-type series, set the scrolling time window, and overlay dashed cumulative time-average curves — either the mean since launch or a trailing window mean, with a reset button for the running averages.

Phase & lattice display

In the Ensemble view, the axis pickers (View Settings) put any two observables on the plane; when one axis is a site-type fraction and the other is same-type bond excess, amber dashed curves draw the provable Moore-8 envelopes — a phase-separated ceiling and an anti-clustered floor — with the no-go region shaded. Sprites colour by uniform tint or by each system's dominant type, and glow and history smearing are tunable. On the single Lattice view, each type also has display-only Blur and Alpha controls: Blur gives moving sites a fading trail (logarithmic — most travel is in the long-trail region near the top; at maximum the display becomes a pure occupancy heat-map), and Alpha sets the type's opacity. Neither touches the physics.

2D Ising

The Ising ensemble is plotted as a magnetisation–energy cloud — the two observables that map its phase diagram. Below the critical temperature the cloud splits toward the ordered corners; above it, it pools near zero magnetisation. Amber dashed curves mark the exact phase-separated and Néel envelopes, with the forbidden region shaded, so you can watch the population press against the bounds statistical mechanics allows.

Single Particle

The single particle's home is the ensemble phase view over position × momentum. Thousands of walkers, released and thermalised, settle into a Boltzmann cloud whose shape is the equilibrium distribution of the chosen potential — a single Gaussian blob in a harmonic trap, a two-lobed cloud in a double well. Glow and history smearing trace the flow as walkers hop between wells.

Patchy Discs

The Particles view

The Particles view draws the periodic box live, and the View Settings window (eye icon) controls how. Disc opacity and patch opacity set per-species and per-patch-type alphas (outlines fade with their fill). Periodic images toggles the wrapped copies at the box edges. Bound patches chooses how bonds are drawn — a neon dot between the bonded patches, the patches themselves turning neon, both, or nothing — and the Show bonds for tick matrix narrows the rendering to the patch-type pairs you care about. Binding renders are always full-opacity, so a favourite trick is to drop every opacity low and let only the bond network glow. Highlight bonded discs floods any disc with at least one bond in the same neon green, and Bond trail leaves fading after-images of the binding renders — the history smear, patchy-style.

Observables

The Statistics window reports the mean energy per disc, the fraction of patches currently bonded, and the mean coordination (bonded patches per disc); in ensemble mode these are population means. A patchy ensemble's phase axes offer patch bond fraction, patch bonds / disc, energy per disc, largest-cluster fraction, and mean cluster size — each system an independent box of the designed discs, so the cloud traces the self-assembly as bonds knit the discs into chains, networks, or micelles.

Alongside those bond-based measures are three geometric contact observables — the disc analog of the lattice’s same-type bond excess, measuring positional (not bonded) neighbours: contacts per disc (how many discs sit in a disc’s first coordination shell), same-type contacts per disc (of those, how many are the same species), and same-type contact excess (the same-type contact fraction minus the random-mixing baseline — zero for a random mix, positive when like discs cluster, negative when they alternate). Two discs count as neighbours when their centres fall within the first-shell cutoff times their contact distance; that cutoff is a live slider on the Compute tab, whose Observables card also lets you switch the heavier Contacts and Union-Find groups off to save computation.

NVT & NPT — the thermodynamic ensemble

The Simulation tab runs the discs in either ensemble. NVT (the default) holds the box fixed and thermostats the temperature. NPT lets the box breathe: a Martyna–Tobias–Klein barostat expands or compresses it until the internal pressure matches the Pressure you set, so the discs settle at whatever density that pressure implies — raise the pressure and the box shrinks (φ climbs); lower it and the box swells. The Barostat coupling slider sets how quickly the box responds (low = a snappy piston, high = slow and gentle). Watch the box side L and packing fraction φ drift live in the System tab (population means in ensemble mode), and NPT adds a packing fraction φ observable to the phase axes and the Observables view. Both ensembles work in single-system and ensemble mode; the choice is a live run setting, not saved in the config.

The Observables view

Single-system Patchy Discs also offers the Observables view (the seg beside Particles in the header) — a live time-series of any single observable through simulation time, with the same scrolling window and dashed time-average overlays as the lattice model’s. Pick the observable from the class dropdown; the history keeps recording whichever view you are watching.

© Nicholas B. Tito · Stochasm — explore statistical thermodynamics, machine learning, and create digital art.