Continuing a Path Sampling Simulation

You’ll often want to continue a simulation – either because there was a problem with a previous simulation, or because you’d decided you need more data than was captured in an initial run.

Like most codes, OpenPathSampling makes it easy for you to continue from a previous simulation. The example we show here is based on the alanine dipeptide MSTIS example.


Restart from existing production file and continue

Restarting to generate more data

We obviously need OPS

In [1]:
import openpathsampling as paths

Open the storage with mode a for appendable.

In [2]:
storage = paths.Storage("", "a")

Next, we load the pathsimulator. Note, that this object is not really immutable and it has a state. What you actually save are all the immutable options like root sampleset and the move scheme that is used.

Loading a Pathsimulator will automatically set its storage to the one you loaded from. You can of course change this manually.

As a remark! The MoveScheme is also not immutable and depends on the time when you save it. This is currently acceptable from a useability standpoint. It should not affect you but you might keep it in mind.

In [3]:
mstis_calc = storage.pathsimulators[0]

Since the PathSimulator is hollow in the sense described above we still need to initialize it with the actual initial sampleset we want to use. If you really want to continue you can use the restart_at_step function and it will setup the PathSimulator in a way the it continues from the given step without creating the initial step and resetting Samples etc.

In [4]:

After that we are good to continue at the last (or any other) step of the simulation. This restarting will keep references to the original PathSimulation object so you can better find step that are generated from the same PathSimulator object.

In [5]:
Working on Monte Carlo cycle number 1002
Running for 0 seconds -  0.77 seconds per step
Estimated time remaining: 0 seconds
DONE! Completed 1002 Monte Carlo cycles.

Check the current file size

In [6]:

And close the file. We can continue later...

In [7]:
In [ ]: