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("ala_mstis_production.nc", "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]:
mstis_calc.restart_at_step(storage.steps[-1])

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]:
mstis_calc.run(2)


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]:
storage.file_size_str


Out[6]:
'915.74MB'

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


In [7]:
storage.close()

In [ ]: