Exemplo n.º 1
0
 def load_checkpoint(lbb_handle, path):
     logging.info('loading checkpoint and fluid state')
     checkpoint = checkpointing.Checkpoint(checkpoint_id="mycheckpoint",
                                           checkpoint_path=path)
     try:
         checkpoint.load()
         input = gzip.GzipFile(path_fluid_compressed, 'rb')
         s = input.read()
         input.close()
         output = open(path_fluid_sacrifice, 'wb')
         output.write(s)
         output.close()
         lbb_handle.load_checkpoint(path=path_fluid_sacrifice, binary=True)
         os.remove(path_fluid_sacrifice)
     except Exception:
         exc_type, value, traceback = sysos.exc_info()
         logging.info("Failed with exception [%s,%s ,%s]" %
                      (exc_type, value, traceback))
         sys.part.clear()
         logging.info('Retrying to load')
         checkpoint.load()
     return checkpoint
Exemplo n.º 2
0
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program.  If not, see <http://www.gnu.org/licenses/>.
"""
This sample illustrates how various observables of interest can be checkpointed.
"""
import espressomd

required_features = ["P3M", "LENNARD_JONES"]
espressomd.assert_features(required_features)

from espressomd import checkpointing
import numpy as np

checkpoint = checkpointing.Checkpoint(checkpoint_id="mycheckpoint")
checkpoint.load()

# print out actors

print("\n### current active actors ###")
for act in system.actors.active_actors:
    print(act)

# test user variable
print("\n### user variable test ###")
print("myvar = {}".format(myvar))

# test "system"
print("\n### system test ###")
print("system.time = {}".format(system.time))
Exemplo n.º 3
0
 def init_checkpoint(lb_handle, path):
     checkpoint = checkpointing.Checkpoint(checkpoint_id="mycheckpoint",
                                           checkpoint_path=path)
     checkpoint.register("sys.part")
     return checkpoint