Stochasm

User Guide Open the app ↗

Saving & sharing — the configuration format, per model

Saving & sharing

A Stochasm system is a single JSON document. The Export tab shows the running system's JSON (with an option to include the current lattice as a pinned snapshot, in single mode); copy it to a file. The Launcher's Import pastes one back — with exactly its settings. The presets are these same files, served from the app's presets/ folder.

Two of the models carry a rich enough structure to serialise: the Multi-Component Lattice and Patchy Discs (Ising and the single particle have no config export).

The envelope

Every config is the same extensible three-part shape, whatever the model:

Structure
KeyWhat it holds
nameA display name for the system (optional).
model.typeWhich model — multi_component_lattice or patchy_discs. It routes a pasted config to the right model, and a preset file to its picker.
model.configurationThe model-specific structure — site types & rules, or the patchy design. Detailed per model below.
snapshotAn optional saved stage state — an object, so it can hold several pieces at once. Today only the lattice writes one (snapshot.lattice); omit it for a freshly-generated start.

The two sections below spell out each model’s configuration (and, where it has one, its snapshot); the complete field-by-field specification lives in the project README ("The model configuration format").

Multi-Component Lattice format

For a lattice config, model.type is "multi_component_lattice" and model.configuration holds the coordination number, the site types, and the rules. The saved initial state, when present, lives in snapshot.lattice.

configuration
FieldMeaning
coordination_number4 (von Neumann) or 8 (Moore) — the neighbour shell.
types[]The site-type palette (below).
rules[]The transformation rules (below).
snapshot (optional)
FieldMeaning
latticeA 2D array of type ids whose shape is the lattice size — a pinned initial state. Omit the whole snapshot and the Builder's size slider decides the dimensions, seeded from each type's default_initial_relative_amount.
Each type
FieldMeaning
name, colorLabel and hex colour.
immobiletrue ⇒ swap rules cannot displace it.
masquerade_asType id this one imitates for facilitation counting (or −1 = none).
fieldThe type's energetic bias, in kBT.
default_initial_relative_amountIts relative share when the lattice is seeded randomly.
persistence, alphaDisplay-only trail decay and opacity.
Each rule
FieldMeaning
kindOne of irreversible_flip · reversible_flip · swap · site_site_interaction.
a, bThe two endpoint type ids (−1 = the any-site wildcard).
paramThe attempt-weight (flips/swaps) or interaction energy (site-site).
disabled, ignore_energeticsRule enable flag; bypass all fields & interactions.
facilitation (optional)A { "number": n, "site": t } node — the flip needs n neighbours of type t.

Patchy Discs format

For a patchy config, model.type is "patchy_discs" and model.configuration describes the patch types, the disc species, and the bond rules. The disc count and packing fraction are chosen in the Builder (defaulting to 100 discs at φ 0.5) — like the lattice size, they are not stored in the config. Patchy has no stage snapshot yet, so it omits snapshot.

configuration
FieldMeaning
patch_bond_stiffnessThe spring constant of every formed patch bond.
patch_types[]The bonding patch species (below).
species[]The disc species (below).
rules[]The bond rules (below).
Each patch type & species
FieldMeaning
patch type: name, colorLabel and hex colour of a bonding patch.
species: name, colorLabel and hex colour of a disc species.
radius, relative_abundanceDisc size and its share of the box population.
patches[]Each rim patch as { "angle", "patch_type" } — the angle in degrees, the patch type an index into patch_types.
Each rule
FieldMeaning
nameA label for the bond rule.
a, bThe two patch-type indices this rule lets bond.
strengthThe bond strength ε, in kBT.
attempt_rateBind/unbind attempts per MD step, per patch.
disabledRule enable flag.
© Nicholas B. Tito · Stochasm — explore statistical thermodynamics, machine learning, and create digital art.