You can easily save and load a REBOUND simulation to a binary file. The binary file includes all information about the particles (mass, position, velocity, etc), as well as the current simulation settings such as time, integrator choise, etc.
Let's add three particles to REBOUND and save them to a file.
In [1]:
import rebound
sim = rebound.Simulation()
sim.add(m=1.)
sim.add(m=1e-6, a=1.)
sim.add(a=2.)
sim.integrator = "whfast"
sim.save("checkpoint.bin")
sim.status()
The binary files are small in size and store every floating point number exactly, so you don't have to worry about efficiency or losing precision. You can make lots of checkpoints if you want!
Let's delete the old REBOUND simulation (that frees up the memory from that simulation) and then read the binary file we just saved.
In [2]:
del sim
sim = rebound.Simulation("checkpoint.bin")
sim.status()
Note that you will have to re-set any function pointers manually (if you're using them)