A simple example of Milestoning

Introduction

The simple-milestoning package contains a minimal implementation of Milestoning on a simple system, it is written in a few lines of C++ code so that its inner workings can be easily understood.

Our system is a particle in a one-dimensional double well undergoing Brownian dynamics at a fixed temperature.

This code allows the user to specify a number of equally-spaced milestones in the interval [ − 10, 5], collect trajectory fragments, and estimate the stationary flux vector and the mean first passage time.

Compilation

Requirements:

In order to compile the program set the current working directory to the folder that contains the code and follow these steps:

  1. mkdir build
  2. cd build
  3. cmake ..
  4. make

This should result in a binary called milestoning being created.

Usage

The milestoning program takes the following command line arguments in order:

Number of milestones

How many milestones to create in the interval [ − 10, 5].

Maximum number of fragments

How many trajectory fragments per milestone to use.

Time step length

This tunes the error in the numerical integration of the dynamics. For this simple system you must appropriately decrease the time step length as the number of milestones increases.

Temperature

Value for the temperature of the system.

Random seed

Seed for the random number generator.

Example usage:

$ ./milestoning 8 10000 1e-3 1 `date +%N`
Using random seed 523009099
Sampling from milestone #0 (x = -10)
Sampling from milestone #1 (x = -7.85714)
Sampling from milestone #2 (x = -5.71429)
Sampling from milestone #3 (x = -3.57143)
Sampling from milestone #4 (x = -1.42857)
Sampling from milestone #5 (x = 0.714286)
Sampling from milestone #6 (x = 2.85714)
K (transition matrix):
        0   1.0000        0        0        0        0        0        0
   0.3462        0   0.6538        0        0        0        0        0
        0   0.6463        0   0.3537        0        0        0        0
        0        0   0.6628        0   0.3372        0        0        0
        0        0        0   0.5377        0   0.4623        0        0
        0        0        0        0   0.3837        0   0.6163        0
        0        0        0        0        0   0.2696        0   0.7304
        0        0        0        0        0        0        0        0
T (local MFPT matrix):
        0   2.0849        0        0        0        0        0        0
   3.1648        0   3.1542        0        0        0        0        0
        0   2.4923        0   2.4666        0        0        0        0
        0        0   2.1365        0   2.1032        0        0        0
        0        0        0   2.0896        0   2.1214        0        0
        0        0        0        0   2.0148        0   2.0867        0
        0        0        0        0        0   2.0979        0   2.1124
        0        0        0        0        0        0        0        0
Estimated stationary flux (q):
   0.1241   0.3163   0.2974   0.1366   0.0585   0.0324   0.0200   0.0146
Estimated MFPT: 172.421

The figure below shows two approximations to the stationary flux obtained with a coarse and a finer mesh of milestones.