2 crossed in order to reach some target bin: ‘forward’ then describes any shot which decreases this Hamming dis- tance. Dynamics [14] and has been very successful. Although these algorithms do not all require detailed balance and are successful for treating non-equilibrium steady states, application to general non-stationary dynamics is still ex- ploratory, and is so far only shown for WE [12] (although the authors step back from actually claiming this, pre- ferring to state that the method covers a ‘broad class of stochastic processes’ rather than the full range of stochas- tic non-stationary dynamics). The requirement for sta- tionarity in all existing methods apart from WE arises from the assumption that microstates from a given com- partment can be treated interchangably at the compart- ment boundaries - regardless of, often importantly, the duration of the path which has led to a given state. We carry out a variable number n t i of ‘shots’ (short dy- namics runs) of a fixed duration τ from the configurations in each bin i at each time t . (Here and in the following we use the term “configuration” for a microstate of the system at a given time on a given path. Two paths can, in principle, reach identical microstates at the same time. In this case the algorithm would still hold two configura- tions.) B. Importance Sampling for Adaptivity As we are considering stochastic processes, shots from the same starting configuration can be made to diverge by varying the random number seed used to generate the dynamics. n t i is adapted during the simulation to improve statistics. During the course of the simulation, the number of bins which are populated by configura- tions gradually increases (indicated by the triangles and squares in fig. 1) until transitions are sampled at each timestep from all bins which have a non-zero occupa- tion probability. In order to achieve a roughly constant number of forward transitions from each bin i , we select n t i based on the estimated transition probabilities at the previous timestep. The number of shots from bin i at time t + τ is defined as: We generalise this strategy of compartmentation to non-steady-state systems; in essence only by fixing the duration of each trajectory fragment (here called a ‘shot’), so that the time evolution can easily be tracked. The resulting method, once sampling and reweight- ing schemes have been developed around this central premise, is termed Stochastic Process Rare Event Sam- pling (S-PRES). The most important design choice is the procedure used to ensure dynamically adaptive sampling rates for the different bins. This is achieved here using a variant of Rosenbluth sampling, as is sometimes used in FFS; rather than by moving the bins as has been investi- gated for WE. The choice to keep the bin positions fixed has the benefit of allowing a high-level and mathemati- cally friendly description of the dynamics to be developed online in the form of a time-dependent matrix of transi- tion frequencies between the bins. where N is the target number of forward transitions, γ is a damping factor, R is the number of shots which moved forward from bin i to bins over higher ranges of λ on the step t − τ to t , (or R = 1 if this number is zero). The brackets ⌈ ⌉ indicate the ceiling function. This adap- tive sampling method makes S-PRES akin of the class of variational approaches to steady-state importance sam- pling (IS) described elsewhere [15]. Selection of values for the parameters N and γ is discussed in sec. II E. We define a scalar-valued coordinate λ as a function over the state space of our system. This coordinate is discretized into bins labelled by an index i . (Note that the phase space of the system need neither be discretized nor finite. These conditions only need to hold for the co- ordinate binning.) As an example choice for λ , one might use the number of particles in a liquid droplet forming in supersaturated vapour. The main goal of S-PRES is to observe a roughly con- stant number of forward transitions from each bin i on each interval [ t, t + τ ]; where a forward transition from i at t is defined as any shot where the microstate at time t + τ falls within a bin j > i . In this way unlikely transi- tions can be explored and sampled with high statistical accuracy. In principle, λ could be a vector instead of a scalar. The restriction to a scalar is used here to simplify the discussion. If using a vector-valued ⃗ λ , the concept of ‘forward’ becomes non-obvious. An example approach in two or more dimensions is to define a Hamming distance as the number of bin boundaries which remain to be be In order to enhance the exploration of rare states we apply a version of the pruned-enriched Rosenbluth method (PERM) [16], i.e. when picking configurations from a given bin as starting points for new shots, we do not select them with equal probabilities, but with a vari- able statistical weight which depends on the sampling history. In conventional PERM paths at a given time- point are either discarded, or selected for exactly one or two copies to extend to the next timepoint, based on lower and upper thresholds in their weights. The im- plementation presented here avoids having to set these thresholds. The number of branches n t i is shared out C. Explanation of Sampling for Path Generation A. Overview II. S-PRES: ALGORITHM DESCRIPTION n t + τ i = ⌈ n t i + γ ( N R − 1 ) n t i ⌉ (1)