Stochasm

User Guide Open the app ↗

Building systems: designing each model in the Builder

The second stage of the workflow. Once the Launcher has selected a model, the Builder specifies what the system is, in palette, rules and particles. Each model has its own design surface, and the sections below are the reference for each. How a system behaves once it runs is covered in Simulating systems.

The Builder

Pressing Next in the Launcher opens the Builder. For the two designable models, the Multi-Component Lattice and Patchy Discs, it has two steps, one card each. Step 1 holds the System seed settings, the lattice size or the disc count and packing fraction, and in ensemble mode the number of systems, together with the model’s structure editors, which are the site types for the lattice model and the patch types, bead types and molecules for Patchy Discs. Step 2 holds the Rules editor and the shared Compute card. The action button reads Next on Step 1 and Initialize on Step 2, where a Back button returns to Step 1. 2D Ising and the Single Particle have a single Builder step, showing their own System card and the shared Compute card, and initialize from there.

Edits that change the seed re-seed the live preview on the stage immediately, so the preview always shows what will launch. These are the occupancy, lattice size and type count for the lattice model, and the disc count, packing fraction and bead or molecule design for Patchy Discs. Name, colour and rule edits change the design without re-seeding, since the preview is a static initial state on which rules have not yet acted.

Initialize turns the previewed system into the running one in a paused state, and its structure is then fixed. The header’s Back to Builder returns here, landing on Step 2 with the run held. Resume Simulation returns to it exactly as left, and Re-Initialize re-seeds every system from the current design while controls, views and windows stay in place. Rule and dynamics edits made while a run is held take effect on Resume, since they never re-seed the state. Returning Back to Step 1 discards the held run and re-opens Step 1 as a first entry, and an amber note directly beneath that button states so beforehand. The seed settings and the setup flow are covered in Setting up → The Builder.

Multi-Component Lattice

The lattice model’s structure is its site types, the palette, and its rules, which say how those sites transform, move and interact. Both are edited in the Builder and shown read-only while a system runs. Colours remain adjustable everywhere, since they are display rather than physics.

Site types

Sites are the coloured squares the lattice is made of, between two and ten types per system. The type count is set by the Site types slider in the Builder’s System card, and only when the Launcher source is Blank. A Preset or Import arrives with its type count fixed by the configuration. Reducing the count removes the highest-numbered types, which deletes every rule that used a removed type as an endpoint, clears masquerade targets aimed at it, discards any stored import snapshot, re-indexes the survivors, and repaints the affected sites. Each type carries the following properties.

PropertyMeaning
NameA label. It has no effect on the physics.
ColourHow the type is drawn everywhere, in the lattice, statistics, plots and matrices.
Default initial occupancyThe type’s relative share when the lattice is seeded randomly. It does not apply when a system starts from a pinned snapshot. Edits re-seed the preview immediately, unless a snapshot is pinned, in which case they are held until the lattice next seeds randomly and a green note says so.
ImmobileThe type never moves. Swap rules cannot displace it.
Masquerade as a second site type for facilitationFor facilitation counting only, the type is counted as another. This lets several species jointly satisfy one kinetic constraint.
Site H-fieldThe type’s energetic bias, in kBT, over the range −10 to +10. It is tuned live in the Simulation stage rather than here. Transformations run from high-field types toward low-field ones. See The science.

Name, occupancy, immobility, masquerade and the type count are fixed once a system runs. The colour, the Site H-field and the per-type Blur and Alpha trail settings remain adjustable during the run.

The Builder at Step 1 of 2, with the Site types editor beside a four-type lattice preview.
The Builder at Step 1 of 2. The Site types editor sits beside the live preview of the lattice it will seed.

Rules

Rules define how sites transform, move and interact. There are four kinds, each with its own connector glyph, drawn between the two endpoint swatches, and its own matrix code.

FI Irreversible Flip: a site of type A becomes type B, one way only.
FR Reversible Flip: A becomes B and B becomes A, both governed by the same parameter.
SW Swap: adjacent A and B sites exchange places. This is the mechanism of transport. Immobile types are excluded.
SS Site-Site Interaction: not a move at all, but an energy, attraction or repulsion between neighbouring A and B sites that biases every other rule.

A rule’s structure, its kind and two endpoints, is fixed at creation, so changing either requires deleting the rule and creating a new one. The rule’s name stays editable in the Builder. Each endpoint names a specific type or the any-site wildcard. A rule’s parameter is tuned live once the system runs, under Simulation → Rule Controls, where it appears as Rate for flips and swaps, over 0 to 1, and as Coupling J in kBT for a Site-Site Interaction, over −10 to +10, with negative values attracting. A new flip or swap starts at rate 1, and a new Site-Site Interaction starts at 0, which is energetically neutral.

Facilitation. A flip rule can be made conditional on its neighbourhood. Setting Requires Neighbour Site to a type and a # of Neighbours Required between 1 and 8 restricts the flip to sites having at least that many neighbours of that type. This is the defining ingredient of kinetically constrained models, and the Fredrickson–Andersen preset is exactly one facilitated flip. Masquerading types count toward the requirement of the type they imitate. Swap and Site-Site rules take no facilitation condition.

The interaction matrix. Both the Builder and the Simulation stage show a type-by-type matrix in which every rule appears in its A–B cell as a coloured kind pill, together with an f(●×n) chip where the rule is facilitated. The Simulation copy adds each rule’s parameter value and the ignore-energetics marker. An any row and column hold wildcard endpoints, and disabled rules are shown struck through rather than omitted. Above eight site types the matrix is replaced by a note pointing at the rules list. If two enabled Site-Site rules address the same type pair the later one takes effect, and that rule’s card in Simulation → Rule Controls carries an amber note naming the rule it overrides.

2D Ising

The Ising model has no palette to build, since every site is one of two spins. Its Builder card carries the lattice size and, in ensemble mode, the number of systems. The starting condition is chosen in the Launcher’s Initial Distribution segment, which offers Hot (random), Cold ↑ and Cold ↓. Everything shaping its behaviour, namely temperature, coupling and field, is a live control in the Simulation stage.

Single Particle

The single particle’s structure is the potential it occupies. The Launcher’s Initial Distribution segment selects a Thermal or Coherent start, and the Builder card sets only the ensemble size. The potential shape, a Single well set by its frequency or a Double well set by a separation and depth and a left/right bias, and the rest of the Langevin dynamics are tuned in the Simulation stage.

Patchy Discs & Polymers

Patchy Discs & Polymers is the off-lattice model. Its design divides in two. Bead types are the palette, describing what a bead is in size, shape, colour and patches, and molecules are the population, describing what stands in the box as free discs or bead-spring chains. Around them sit patch types, the coloured triangles on disc rims whose tips point along their bonding direction, and rules, which are either patch–patch bonds or disc–disc attractions.

Designing particles

The Particle design editor stacks three cards. Patch types are the bonding species, each a name and a colour, drawn as triangles wherever they appear, up to eight of them. Each bead type, again up to eight, carries a name, colour, radius, two shape-distribution settings and its list of up to eight patches, each patch a patch type placed at a rim angle in degrees. A bead type carries no count. It states what a bead is, never how many there are.

The two shape settings make a bead type irregular. Smoothness below 1 gives every particle its own boundary, drawn at initialization from a low-mode random spectrum, with lower smoothness producing stronger deviations. Polydispersity spreads the base radii as a clamped Gaussian of that relative width. Every particle in the population is therefore distinct. An irregular pair repels, and under a disc–disc rule attracts, through the usual soft potential evaluated with the local contact distance, which is the sum of the two surface radii along the line joining the centres. The shape therefore pushes, exerts torque and packs as drawn. Patches sit on the true local surface at their angle, so bond anchors follow each particle’s own boundary.

Patches are optional. Removing every patch, and even every patch type, gives bare discs interacting only through their soft core and any disc–disc attractions. The patch-bond matrix and the patch–patch rule kind disappear when no bead carries a patch.

The Molecules card is the population, up to sixteen entries. Each molecule names an architecture, which is Single disc, Homopolymer or one of the copolymer sequences described below, selects the bead type it is made of, or two of them for a copolymer, and sets an abundance, its share of the discs in the box, with the readouts showing normalised percentages. A chain molecule adds Beads per chain and Bead-count spread, plus whatever parameter its architecture requires. Each card also carries an editable name, whose placeholder is a generated description of the molecule. The same bead type may appear in several molecules, giving free monomers and chains of one species at once, and a bead type used by no molecule never appears in the box. Deleting a bead type also deletes every molecule referring to it, and deleting a patch type removes the patch–patch rules that used it and reassigns any patch wearing it to the first remaining patch type. Deleting the last patch type clears every patch, leaving bare discs. The readout in the System card, directly below Regenerate initial configuration, reports what the current draw produced. During a run the design is read-only, with colours still adjustable.

Bead-spring polymers

A polymer is a molecule with a chain architecture, a linear chain of Beads per chain beads. Every bead remains the bead type designed for it, carrying its radius, colour, smoothness, polydispersity, patches and disc–disc rules. A polymer with patches can therefore crosslink into a network, and one with a disc–disc attraction collapses in poor solvent, without any change to the rest of the model.

A Homopolymer is one bead type throughout. The four two-component architectures mix two bead types along one backbone. A Diblock is an A-block followed by a B-block, divided by the Block fraction slider. A Multiblock alternates A- and B-blocks of Beads per block each, where 1 gives the strictly alternating copolymer. A Gradient runs linearly from pure A at the head to pure B at the tail, each bead drawing its type from the local composition. Random draws every bead independently at the Composition set. The molecule’s dot icon previews the pattern. Sequences are drawn when the box is built, so Regenerate initial configuration gives a new realisation of the stochastic architectures.

Custom sequence is the general case, in which the chain is written out bead by bead. Each bead type takes a letter by its position in the palette, so A is the first bead type and B the second, and a number after a letter repeats it. A6B12A6 is therefore a 24-bead ABA triblock and ABAB a four-bead alternating chain. The card shows a legend of the letters and, beneath it, the chain as a row of beads, any of which can be clicked to change its type. Typing and clicking edit the same array. A sequence that will not parse is reported inline in red, and both the typed text and the design are left untouched until it parses. Selecting the Custom architecture pre-fills an A–B–A triblock over the molecule’s current length. The sequence fixes the length exactly, so a custom chain has no bead count or spread of its own. This is how architectures the other five cannot express are built, such as a triblock, a tapered end, or a sticky cap on one side only.

Bead-count spread is a polydispersity in the chain length. At 0 every chain is identical, and higher values draw each molecule’s bead count from a Gaussian around the set value, as real polymer samples are never monodisperse.

The length distribution is preserved exactly. The box is filled with whole molecules and stops at the first one that will not fit. A chain is never trimmed or shortened to reach an exact disc count, with one degenerate exception, namely a disc budget smaller than a single drawn chain, which truncates that chain to the budget. At spread 0 every chain is therefore the specified length, and at higher spreads the realised lengths are genuine draws from the requested Gaussian. The cost is that the realised disc count can land slightly below the slider, by less than one molecule, which the System readout reports. The packing fraction stays exact, because the box is sized from the composition that was drawn. Molecule drops are negligible up to about φ 0.65. Above that the contact floor caps the seeding lattice, and at the slider’s maximum of φ 0.7 whole molecules are left out rather than shortened, and roughly a fifth of the requested discs may go unplaced.

Abundance is a share of discs, exactly as for a single-disc molecule. A chain set to 75% therefore accounts for roughly three discs in four, whatever its length. What changes is the molecule count, since the box is filled with whole chains up to the requested disc count, so 100 discs of 24-bead chains is four molecules rather than 100. Larger disc counts give a closer approach to the requested split.

For chains mixing bead sizes, the crossing-free seeding lattice is spaced for the largest bead type, so a population dominated by smaller beads can require more lattice sites than the packing-fraction-derived box provides. The box is then enlarged until everything fits. Chain lengths and abundance stay exactly as designed, and the packing fraction comes in below the slider.

Chains never start crossed. In two dimensions flat chains cannot pass through one another, so any crossing present in the starting configuration persists for the entire run and no amount of simulation will remove it. Stochasm therefore builds the initial box by threading each molecule through a periodic triangular lattice of sites, six neighbours each, one bead per site, never revisiting a site. Distinct edges of a triangulation cannot intersect and no two beads share a site, so the box begins with zero crossings and zero overlaps by construction, at every packing fraction, with the bonds already at their natural length. The initial configuration is correspondingly ordered, which the thermal velocities randomise within a few steps.

Rough or polydisperse beads can reach past the spacing of that lattice, so their overlaps are relaxed before the run. When the relaxation would pull one backbone through another, Stochasm instead scales the whole lattice apart until every pair of beads reaches its contact distance. The box still starts crossing-free, but its packing fraction comes in below the slider, and the System readout shows the value reached. At smoothness 0 a target of 0.5 gives about 0.35, and about 0.2 with a polydispersity of 0.3.

The chain’s angular stiffness κ is not set here, since it is dynamics rather than structure. Like a rule’s ε it is tuned live while the system runs, under Simulation → Chain Controls. Bending does not affect how the box is built, so changing it never re-seeds. The backbone bond itself is the same harmonic spring a patch bond uses, at the same stiffness, pulling neighbouring beads to touching distance. It acts on the bead centres and so applies no torque, leaving κ as the sole determinant of chain flexibility. The Bond stiffness slider that sets it is shown whenever the design has a patch or a chain. Under Compute a Polymer chains observable group appears, measuring each chain’s radius of gyration and end-to-end distance.

Interaction rules

Every rule has a kind, chosen when it is created. A Patch–Patch rule makes one pair of patch types bindable, as a directional Kern–Frenkel bond formed and broken by Monte Carlo. A Disc–Disc rule adds an isotropic Lennard-Jones attraction between two bead types, a soft well of tunable depth handled directly by the molecular dynamics, with no bonds involved, which can drive condensation and demixing. One editor covers both kinds, with the kind chosen in the add-rule panel, and each rule is tagged BOND or LJ. With no rules at all, discs interact only through their soft core. A design holds up to 72 rules, enough for one on every pair of eight patch types and of eight bead types. A new rule starts at ε = 4 and, for a patch–patch rule, an attempt rate of 0.1.

Rule structure, the kind and the two endpoints, which are patch types for a bond and bead types for an attraction, is fixed at creation, so changing either requires deleting and re-creating the rule. The name remains editable. The dynamics are tuned live under Simulation, namely the strength ε for either kind and the bind and unbind attempt rate for patch–patch rules only. Disabling a rule there removes its interaction mid-run. Up to two matrices summarise the rules, showing symbolic entries in the Builder and live ε values under Simulation. Only the lower triangle is shown, since both interactions are symmetric. The Patch-bond matrix appears only when some bead type carries a patch, and the Disc–disc matrix only once a disc–disc rule exists, a disabled one included.

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