RETIS in a 1D triple-well: the zero_left shortcut

This example shows how a left interface for the [0:math:^-] ensemble (set with the zero_left keyword) can make a RETIS simulation a lot cheaper, without altering the transition statistics.

The motivation is simple. In RETIS the [0:math:^-] ensemble samples the recrossings inside the reactant state. By default, paths in [0:math:^-] can wander arbitrarily far to the left of \(\lambda_0\). In a multi-state landscape this means they can fall into a neighbouring metastable well, where they get trapped and finally rejected at maxlength. zero_left adds a hard left boundary to [0:math:^-] so that paths that would escape into the neighbouring well are rejected on the spot with the cheap 0-L status code.

Verification status: passing – see Tutorial map.

Tutorial quick start

  • Best starting point: examples/tutorials/path_sampling/1D-triple-well/.
  • Edit first: compare retis-no-zero-left/retis.rst and retis-zero-left/retis.rst; the key setting is zero_left in the Simulation section.
  • Run: execute pyretisrun -i retis.rst -p in each variant directory.
  • Analyse: run pyretisanalyse -i out.rst in each completed variant directory, then run python compare.py from the tutorial directory.
  • Expected output: two comparable RETIS output trees and a short comparison of [0:math:^-] path cost.
  • Related checks: represented by the internal RETIS checks and the tutorial smoke runner; see Example test status.

The system

We use the TripleWell potential

\[V(x) = a x^6 + b x^4 + c x^2 + d x\]

with \((a, b, c, d) = (1, -3, 2, 0)\). This gives three minima

  • A at \(x \approx -1.256\) (well depth \(\approx -0.39\))
  • B at \(x = 0\) (metastable intermediate, \(V = 0\))
  • C at \(x \approx +1.256\) (well depth \(\approx -0.39\))

separated by two barriers of height \(\approx 0.385\) above B at \(x \approx \pm 0.65\). From the A side, the same barriers are \(\approx 0.776\) high, so a particle that drops into A spends many integration steps before escaping.

We sample only the B \(\to\) C transition. Without a left bound, [0:math:^-] paths that wander into A inflate the sampling cost; with a left bound at \(x = -0.4\) (well inside the B basin) they cannot reach A at all.

The two input files

The example ships two input files that differ in one line.

Baseline (retis-no-zero-left/retis.rst) – uses flux = True to enable [0:math:^-] without a left bound:

Simulation
----------
task = retis
steps = 250
interfaces = [0.05, 0.20, 0.40, 0.55, 0.90]
flux = True
zero_ensemble = True
seed = 0

With zero_left (retis-zero-left/retis.rst):

Simulation
----------
task = retis
steps = 250
interfaces = [0.05, 0.20, 0.40, 0.55, 0.90]
zero_left = -0.4
zero_ensemble = True
seed = 0

Everything else (interfaces, engine, temperature, seeds, output) is identical. The full input files are bundled with the PyRETIS sources under examples/tutorials/path_sampling/1D-triple-well/.

The triple-well potential itself is specified by:

Potential
---------
class = TripleWell
a = 1.0
b = -3.0
c = 2.0
d = 0.0

Running the example

Each variant runs in roughly one minute on a typical laptop. From the example directory:

cd retis-no-zero-left
pyretisrun -i retis.rst -p
pyretisanalyse -i out.rst

cd ../retis-zero-left
pyretisrun -i retis.rst -p
pyretisanalyse -i out.rst

A small helper script then reports the [0:math:^-] ensemble cost for both runs:

"""Compare the [0^-] cost of the two triple-well RETIS runs.

Run after both ``retis-no-zero-left`` and ``retis-zero-left`` have
been simulated and analysed. The script reads ``000/pathensemble.txt``
in each directory and reports the accepted-path statistics that show
the cost of the [0^-] ensemble.
"""
import os
import sys

Run it with python compare.py.

What to look for

In a typical run, the variant with zero_left shows:

  • much shorter average accepted paths in [0:math:^-];
  • zero FTX / BTX rejections in [0:math:^-] (rejections now appear as the much cheaper 0-L status);
  • the same B \(\to\) C crossing probability and rate constant in [0:math:^+], [1:math:^+], …

That is the take-away: zero_left is a “free” speed-up whenever the reactant state is bounded on the left by another long-lived basin you are not interested in sampling.

Going further

  • Try setting zero_left very close to the A-B barrier (e.g. -0.6) and watch the 0-L rejection rate grow.
  • Add a tilt to the potential (d parameter of TripleWell) to make A deeper and the trapping effect more dramatic.
  • Run with and without swapsimul to see how swap acceptance in [0:math:^-] \(\leftrightarrow\) [0:math:^+] changes.

Tested by

  • The tutorial is included in examples/tutorials/path_sampling/1D-triple-well/ and runs every time the tutorial smoke runner (examples/run-tutorials.sh) is invoked, including from the top-level ./test-heavy.sh.

  • A dedicated, deterministic regression fixture lives at examples/tests/test-internal/retis-zero-left/. It runs the same two input files at a much smaller size, checks that the 0-L rejections appear in [0:math:^-] (and may propagate to [0:math:^+] through a failed swap-zero) but never in [1:math:^+] or beyond, and that zero_left does not produce FTX/BTX rejections in [0:math:^-]. Run it with:

    cd examples/tests/test-internal/retis-zero-left
    ./run.sh