I have been using TeNPy for investigating a custom model on a cluster provided by my university. For this reason, I have been using the ‘simulation’ interface of TeNPy. However, I have been having trouble continuing calculations that are interrupted before converging due to the time limits on my jobs.
From the previous posts 1, 2, my understanding is that it is not possible to use resume_from_checkpoint() function from a YAML file, but we need to call it from the terminal or create a Python script.
Python: Select all
import tenpy
import square_MPO #my custom model
h5name = 'dmrg_chi_0500.h5'
tenpy.resume_from_checkpoint(filename=h5name)
Python: Select all
Traceback (most recent call last):
File "/Users/gungunal/Downloads/dmrg_longrange/periodic_7x7/alpha=2.2/lambda=3/chi_0500/results/test/resume.py", line 5, in <module>
tenpy.resume_from_checkpoint(filename=h5name)
File "/Users/gungunal/Library/Python/3.9/lib/python/site-packages/tenpy/simulations/simulation.py", line 1330, in resume_from_checkpoint
results = sim.resume_run()
File "/Users/gungunal/Library/Python/3.9/lib/python/site-packages/tenpy/simulations/simulation.py", line 366, in resume_run
self.resume_run_algorithm() # continue with the actual algorithm
File "/Users/gungunal/Library/Python/3.9/lib/python/site-packages/tenpy/simulations/ground_state_search.py", line 73, in resume_run_algorithm
E, psi = self.engine.resume_run()
File "/Users/gungunal/Library/Python/3.9/lib/python/site-packages/tenpy/algorithms/algorithm.py", line 158, in resume_run
return self.run()
File "/Users/gungunal/Library/Python/3.9/lib/python/site-packages/tenpy/algorithms/dmrg.py", line 459, in run
return super().run()
File "/Users/gungunal/Library/Python/3.9/lib/python/site-packages/tenpy/algorithms/mps_common.py", line 775, in run
if self.stopping_criterion(iteration_start_time=iteration_start_time):
File "/Users/gungunal/Library/Python/3.9/lib/python/site-packages/tenpy/algorithms/mps_common.py", line 869, in stopping_criterion
if self.sweeps > min_sweeps and self.is_converged():
File "/Users/gungunal/Library/Python/3.9/lib/python/site-packages/tenpy/algorithms/dmrg.py", line 405, in is_converged
E = self.sweep_stats['E'][-1]
When I load the hdf5 file myself, I can access the last element of
Python: Select all
h5file['sweep_stats']['E'][-1]
-294.56640787413
Gun