# Interactive calls of Simulations

This notebook illustrates how to use simulations in TeNPy. Simulations are designed to be “complete” runs of what you might want to do on a computing cluster, but you can also use them interactively.

[1]:

import numpy as np
import scipy
import matplotlib.pyplot as plt
np.set_printoptions(precision=5, suppress=True, linewidth=100)
plt.rcParams['figure.dpi'] = 150

[2]:

import tenpy
from tenpy.simulations.ground_state_search import GroundStateSearch

[3]:

sim_params = {
'algorithm_class': 'TwoSiteDMRGEngine',
'algorithm_params': {
'trunc_params': {
'chi_max': 100,
'svd_min': 1.e-6,
},
},
'model_class': 'XXZChain',
'model_params': {
'Jxx': 1.,
'Jz': 1.2,
'bc_MPS': 'finite',
'L': 12,
},
'initial_state_params': {
'method': 'lat_product_state',
'product_state': [['up'], ['down']]
},
}

[4]:

# it can be more convenient to use yaml, as you would in parameter files:
import yaml
algorithm_class: TwoSiteDMRGEngine
algorithm_params:
trunc_params:
chi_max: 100
svd_min: 1.e-06
model_class: XXZChain
model_params:
Jxx: 1.0
Jz: 1.2
L: 12
bc_MPS: finite
initial_state_params:
method: lat_product_state
product_state: [[up], [down]]
""")

[5]:

# this runs the simulations, so it takes a while
data = {}
for L in [2**i for i in range(4, 8)]:
print("+"*80)
print("L=", L)
sim_params['model_params']['L'] = L
# the with statement works similar as for open files
# (for the same reason: make sure we can free resources after use)
#     with GroundStateSearch(sim_params) as sim:
#         data[L] = sim.run()
# alternatively, you can just call
data[L] = tenpy.run_simulation(**sim_params)

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
L= 16
INFO    : new simulation
================================================================================
GroundStateSearch
================================================================================
INFO    : output filename: None
INFO    : GroundStateSearch: reading 'algorithm_params'={'trunc_params': {'chi_max': 100, 'svd_min': 1e-06}}
INFO    : GroundStateSearch: subconfig 'model_params'=Config(<4 options>, 'model_params')
INFO    : GroundStateSearch: subconfig 'initial_state_params'=Config(<2 options>, 'initial_state_params')
INFO    : calling InitialStateBuilder.lat_product_state()
INFO    : initial_state_params: reading 'product_state'=[['up'], ['down']]
INFO    : algorithm_params: subconfig 'trunc_params'=Config(<2 options>, 'trunc_params')
INFO    : make measurements
INFO    : Running sweep with optimization
INFO    : checkpoint after sweep 1
energy=-7.3131775815488540, max S=0.5542315344546915, age=16, norm_err=2.7e-01
Current memory usage 144.0MB, wall time: 0.3s
Delta E = nan, Delta S = 3.9819e-01 (per sweep)
max trunc_err = 0.0000e+00, max E_trunc = 5.3291e-15
chi: [2, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 2]
================================================================================
INFO    : Running sweep with optimization
INFO    : checkpoint after sweep 2
energy=-7.3843512880312856, max S=0.7592781821813208, age=16, norm_err=2.4e-01
Current memory usage 144.9MB, wall time: 0.8s
Delta E = -7.1174e-02, Delta S = 2.2813e-01 (per sweep)
max trunc_err = 0.0000e+00, max E_trunc = 7.1054e-15
chi: [2, 4, 8, 16, 16, 16, 16, 16, 16, 16, 16, 16, 8, 4, 2]
================================================================================
INFO    : Running sweep with optimization
INFO    : checkpoint after sweep 3
energy=-7.3844120891696399, max S=0.7733449099087668, age=16, norm_err=7.3e-04
Current memory usage 145.2MB, wall time: 1.1s
Delta E = -6.0801e-05, Delta S = 1.4061e-02 (per sweep)
max trunc_err = 3.1754e-12, max E_trunc = 1.4764e-11
chi: [2, 4, 8, 16, 32, 33, 40, 35, 40, 33, 32, 16, 8, 4, 2]
================================================================================
INFO    : Running sweep with optimization
INFO    : checkpoint after sweep 4
energy=-7.3844120891830496, max S=0.7733460964952327, age=16, norm_err=3.3e-10
Current memory usage 145.4MB, wall time: 0.5s
Delta E = -1.3410e-11, Delta S = 1.1366e-06 (per sweep)
max trunc_err = 4.0299e-12, max E_trunc = 1.6083e-11
chi: [2, 4, 8, 16, 32, 33, 40, 37, 40, 33, 32, 16, 8, 4, 2]
================================================================================
INFO    : DMRG finished after 4 sweeps, max chi=40
INFO    : make measurements
INFO    : finished simulation run
================================================================================
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
L= 32
INFO    : new simulation
================================================================================
GroundStateSearch
================================================================================
INFO    : output filename: None
INFO    : GroundStateSearch: reading 'algorithm_params'={'trunc_params': Config(<5 options>, 'trunc_params'), 'diag_method': 'default', 'combine': False, 'lanczos_params': Config(<9 options>, 'lanczos_params'), 'chi_list': None, 'P_tol_to_trunc': 0.05, 'P_tol_min': 5e-14, 'P_tol_max': 0.0001, 'E_tol_to_trunc': None, 'N_sweeps_check': 1, 'min_sweeps': 1, 'max_sweeps': 1000, 'max_E_err': 1e-08, 'max_S_err': 1e-05, 'max_hours': 8760, 'mixer': None, 'chi_list_reactivates_mixer': True, 'max_N_for_ED': 400, 'norm_tol': 1e-05, 'norm_tol_final': 1e-10}
INFO    : GroundStateSearch: subconfig 'model_params'=Config(<5 options>, 'model_params')
INFO    : GroundStateSearch: subconfig 'initial_state_params'=Config(<5 options>, 'initial_state_params')
INFO    : calling InitialStateBuilder.lat_product_state()
INFO    : initial_state_params: reading 'product_state'=[['up'], ['down']]
INFO    : algorithm_params: subconfig 'trunc_params'=Config(<5 options>, 'trunc_params')
INFO    : algorithm_params: subconfig 'lanczos_params'=Config(<9 options>, 'lanczos_params')
INFO    : make measurements
INFO    : Running sweep with optimization
INFO    : checkpoint after sweep 1
energy=-14.8530479047126267, max S=0.5542315344546911, age=32, norm_err=2.8e-01
Current memory usage 146.5MB, wall time: 0.5s
Delta E = nan, Delta S = 3.8254e-01 (per sweep)
max trunc_err = 0.0000e+00, max E_trunc = 1.5987e-14
chi: [2, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 2]
================================================================================
INFO    : Running sweep with optimization
INFO    : checkpoint after sweep 2
energy=-14.9534663537509509, max S=0.7621881506484742, age=32, norm_err=2.5e-01
Current memory usage 147.5MB, wall time: 1.9s
Delta E = -1.0042e-01, Delta S = 2.5496e-01 (per sweep)
max trunc_err = 0.0000e+00, max E_trunc = 2.6645e-14
chi: [2, 4, 8, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 8, 4, 2]
================================================================================
INFO    : Running sweep with optimization
INFO    : checkpoint after sweep 3
energy=-14.9573402762201724, max S=0.8447157272194061, age=32, norm_err=2.8e-02
Current memory usage 148.5MB, wall time: 3.1s
Delta E = -3.8739e-03, Delta S = 7.9850e-02 (per sweep)
max trunc_err = 4.3411e-12, max E_trunc = 2.1300e-11
chi: [2, 4, 8, 16, 32, 38, 43, 43, 45, 45, 47, 47, 48, 47, 48, 47, 48, 47, 47, 47, 46, 44, 44, 41, 42, 38, 32, 16, 8, 4, 2]
================================================================================
INFO    : Running sweep with optimization
INFO    : checkpoint after sweep 4
energy=-14.9573403706169401, max S=0.8452634724052701, age=32, norm_err=8.7e-07
Current memory usage 149.0MB, wall time: 1.6s
Delta E = -9.4397e-08, Delta S = 3.5032e-04 (per sweep)
max trunc_err = 8.7847e-12, max E_trunc = 4.0311e-11
chi: [2, 4, 8, 16, 32, 38, 46, 50, 54, 56, 58, 60, 62, 60, 64, 63, 64, 60, 62, 60, 58, 56, 54, 50, 46, 38, 32, 16, 8, 4, 2]
================================================================================

INFO    : Running sweep with optimization
INFO    : checkpoint after sweep 5
energy=-14.9573403706178905, max S=0.8452635548972184, age=32, norm_err=2.7e-09
Current memory usage 149.0MB, wall time: 1.1s
Delta E = -9.5035e-13, Delta S = 4.6968e-08 (per sweep)
max trunc_err = 9.8489e-12, max E_trunc = 4.3139e-11
chi: [2, 4, 8, 16, 32, 38, 46, 50, 54, 56, 58, 60, 62, 60, 64, 63, 64, 60, 62, 60, 58, 56, 54, 50, 46, 38, 32, 16, 8, 4, 2]
================================================================================
INFO    : DMRG finished after 5 sweeps, max chi=64
INFO    : make measurements
INFO    : finished simulation run
================================================================================
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
L= 64
INFO    : new simulation
================================================================================
GroundStateSearch
================================================================================
INFO    : output filename: None
INFO    : GroundStateSearch: reading 'algorithm_params'={'trunc_params': Config(<5 options>, 'trunc_params'), 'diag_method': 'default', 'combine': False, 'lanczos_params': Config(<9 options>, 'lanczos_params'), 'chi_list': None, 'P_tol_to_trunc': 0.05, 'P_tol_min': 5e-14, 'P_tol_max': 0.0001, 'E_tol_to_trunc': None, 'N_sweeps_check': 1, 'min_sweeps': 1, 'max_sweeps': 1000, 'max_E_err': 1e-08, 'max_S_err': 1e-05, 'max_hours': 8760, 'mixer': None, 'chi_list_reactivates_mixer': True, 'max_N_for_ED': 400, 'norm_tol': 1e-05, 'norm_tol_final': 1e-10}
INFO    : GroundStateSearch: subconfig 'model_params'=Config(<5 options>, 'model_params')
INFO    : GroundStateSearch: subconfig 'initial_state_params'=Config(<5 options>, 'initial_state_params')
INFO    : calling InitialStateBuilder.lat_product_state()
INFO    : initial_state_params: reading 'product_state'=[['up'], ['down']]
INFO    : algorithm_params: subconfig 'trunc_params'=Config(<5 options>, 'trunc_params')
INFO    : algorithm_params: subconfig 'lanczos_params'=Config(<9 options>, 'lanczos_params')
INFO    : make measurements
INFO    : Running sweep with optimization
INFO    : checkpoint after sweep 1
energy=-29.9408430436184823, max S=0.5542315344546911, age=64, norm_err=3.4e-01
Current memory usage 150.0MB, wall time: 1.1s
Delta E = nan, Delta S = 3.7536e-01 (per sweep)
max trunc_err = 0.0000e+00, max E_trunc = 3.5527e-14
chi: 4
================================================================================
INFO    : Running sweep with optimization
INFO    : checkpoint after sweep 2
energy=-30.0951118736049530, max S=0.7285083740182744, age=64, norm_err=1.7e-01
Current memory usage 150.8MB, wall time: 4.0s
Delta E = -1.5427e-01, Delta S = 2.3490e-01 (per sweep)
max trunc_err = 0.0000e+00, max E_trunc = 3.5527e-14
chi: 16
================================================================================
INFO    : Running sweep with optimization
INFO    : checkpoint after sweep 3
energy=-30.1111048290635779, max S=0.9093862569534614, age=64, norm_err=9.2e-02
Current memory usage 152.7MB, wall time: 7.3s
Delta E = -1.5993e-02, Delta S = 1.8557e-01 (per sweep)
max trunc_err = 4.7143e-12, max E_trunc = 1.9980e-11
chi: 62
================================================================================
INFO    : Running sweep with optimization
INFO    : checkpoint after sweep 4
energy=-30.1111270929408903, max S=0.9328355080045621, age=64, norm_err=4.9e-04
Current memory usage 156.5MB, wall time: 6.4s
Delta E = -2.2264e-05, Delta S = 1.3166e-02 (per sweep)
max trunc_err = 9.8294e-12, max E_trunc = 4.0625e-11
chi: 100
================================================================================
INFO    : Running sweep with optimization
INFO    : checkpoint after sweep 5
energy=-30.1111270939436544, max S=0.9328428461865337, age=64, norm_err=1.0e-08
Current memory usage 156.8MB, wall time: 2.8s
Delta E = -1.0028e-09, Delta S = 4.2219e-06 (per sweep)
max trunc_err = 1.4352e-11, max E_trunc = 5.6087e-11
chi: 100
================================================================================
INFO    : DMRG finished after 5 sweeps, max chi=100
INFO    : make measurements
INFO    : finished simulation run
================================================================================
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
L= 128
INFO    : new simulation
================================================================================
GroundStateSearch
================================================================================
INFO    : output filename: None
INFO    : GroundStateSearch: reading 'algorithm_params'={'trunc_params': Config(<5 options>, 'trunc_params'), 'diag_method': 'default', 'combine': False, 'lanczos_params': Config(<9 options>, 'lanczos_params'), 'chi_list': None, 'P_tol_to_trunc': 0.05, 'P_tol_min': 5e-14, 'P_tol_max': 0.0001, 'E_tol_to_trunc': None, 'N_sweeps_check': 1, 'min_sweeps': 1, 'max_sweeps': 1000, 'max_E_err': 1e-08, 'max_S_err': 1e-05, 'max_hours': 8760, 'mixer': None, 'chi_list_reactivates_mixer': True, 'max_N_for_ED': 400, 'norm_tol': 1e-05, 'norm_tol_final': 1e-10}
INFO    : GroundStateSearch: subconfig 'model_params'=Config(<5 options>, 'model_params')
INFO    : GroundStateSearch: subconfig 'initial_state_params'=Config(<5 options>, 'initial_state_params')
INFO    : calling InitialStateBuilder.lat_product_state()
INFO    : initial_state_params: reading 'product_state'=[['up'], ['down']]
INFO    : algorithm_params: subconfig 'trunc_params'=Config(<5 options>, 'trunc_params')
INFO    : algorithm_params: subconfig 'lanczos_params'=Config(<9 options>, 'lanczos_params')

INFO    : make measurements
INFO    : Running sweep with optimization
INFO    : checkpoint after sweep 1
energy=-60.1165323079136513, max S=0.5542315344546935, age=128, norm_err=4.3e-01
Current memory usage 159.5MB, wall time: 2.0s
Delta E = nan, Delta S = 3.7185e-01 (per sweep)
max trunc_err = 0.0000e+00, max E_trunc = 1.2079e-13
chi: 4
================================================================================
INFO    : Running sweep with optimization
INFO    : checkpoint after sweep 2
energy=-60.3998120339698801, max S=0.7218582936657029, age=128, norm_err=1.7e-01
Current memory usage 159.7MB, wall time: 8.4s
Delta E = -2.8328e-01, Delta S = 2.2834e-01 (per sweep)
max trunc_err = 0.0000e+00, max E_trunc = 8.5265e-14
chi: 16
================================================================================
INFO    : Running sweep with optimization
INFO    : checkpoint after sweep 3
energy=-60.4215476346035558, max S=0.9045201589904625, age=128, norm_err=9.8e-02
Current memory usage 161.5MB, wall time: 15.7s
Delta E = -2.1736e-02, Delta S = 1.9819e-01 (per sweep)
max trunc_err = 4.4432e-12, max E_trunc = 1.9490e-11
chi: 62
================================================================================
INFO    : Running sweep with optimization
INFO    : checkpoint after sweep 4
energy=-60.4232397950888966, max S=1.0316094737853023, age=128, norm_err=2.0e-02
Current memory usage 172.6MB, wall time: 17.1s
Delta E = -1.6922e-03, Delta S = 1.1169e-01 (per sweep)
max trunc_err = 1.5028e-10, max E_trunc = 4.9643e-10
chi: 100
================================================================================
INFO    : Running sweep with optimization
INFO    : checkpoint after sweep 5
energy=-60.4232399595648815, max S=1.0330770799636901, age=128, norm_err=3.0e-06
Current memory usage 173.2MB, wall time: 8.8s
Delta E = -1.6448e-07, Delta S = 7.3439e-04 (per sweep)
max trunc_err = 4.9061e-10, max E_trunc = 1.6911e-09
chi: 100
================================================================================
INFO    : Running sweep with optimization
INFO    : checkpoint after sweep 6
energy=-60.4232399599185612, max S=1.0330792070318480, age=128, norm_err=8.7e-08
Current memory usage 173.4MB, wall time: 5.4s
Delta E = -3.5368e-10, Delta S = 1.0180e-06 (per sweep)
max trunc_err = 5.1253e-10, max E_trunc = 1.7433e-09
chi: 100
================================================================================
INFO    : DMRG finished after 6 sweeps, max chi=100
INFO    : make measurements
INFO    : finished simulation run
================================================================================

[ ]:



[6]:

print(data[32].keys())
print(data[32]['measurements'].keys())

dict_keys(['simulation_parameters', 'version_info', 'finished_run', 'psi', 'sweep_stats', 'update_stats', 'measurements', 'energy', 'resume_data'])
dict_keys(['measurement_index', 'bond_dimension', 'energy_MPO', 'entropy'])

[7]:

Ls = np.array(list(data.keys()))
Es = np.array([data[L]['energy'] for L in Ls])

[8]:

Es/Ls

[8]:

array([-0.46153, -0.46742, -0.47049, -0.47206])

[9]:

coeffs = np.polyfit(1./Ls, Es/Ls, 2)
E0_inf = coeffs[-1]
print("E/L [L->inf] =", E0_inf)

E/L [L->inf] = -0.47364442364092396

[10]:

plt.plot(1/Ls, Es/Ls, 'o', label='DMRG')
plt.xlabel('1/L')
plt.ylabel('E/L')

inv_L = np.linspace(0., np.max(1./Ls) * 1.1, 30)
plt.plot(inv_L, np.poly1d(coeffs)(inv_L), label=f"fit to DMRG, E/L$\\rightarrow${E0_inf:.8f}")
plt.legend()

[10]:

<matplotlib.legend.Legend at 0x7f720c052340>

[ ]:




## Compare that to infinite DMRG

[11]:

sim_params = yaml.safe_load("""
algorithm_class: TwoSiteDMRGEngine
algorithm_params:
trunc_params:
chi_max: 100
svd_min: 1.e-06
model_class: XXZChain
model_params:
Jxx: 1.0
Jz: 1.2
L: 2
bc_MPS: infinite
initial_state_params:
method: lat_product_state
product_state: [[up], [down]]
""")

[12]:

data_inf = tenpy.run_simulation(**sim_params)

INFO    : new simulation
================================================================================
GroundStateSearch
================================================================================
INFO    : output filename: None
INFO    : GroundStateSearch: reading 'algorithm_params'={'trunc_params': {'chi_max': 100, 'svd_min': 1e-06}}
INFO    : GroundStateSearch: subconfig 'model_params'=Config(<4 options>, 'model_params')
INFO    : GroundStateSearch: subconfig 'initial_state_params'=Config(<2 options>, 'initial_state_params')
INFO    : calling InitialStateBuilder.lat_product_state()
INFO    : initial_state_params: reading 'product_state'=[['up'], ['down']]
INFO    : algorithm_params: subconfig 'trunc_params'=Config(<2 options>, 'trunc_params')
INFO    : start environment_sweep
INFO    : make measurements
INFO    : Running sweep with optimization
INFO    : start environment_sweep
INFO    : checkpoint after sweep 10
energy=-0.4736481564429367, max S=0.7731363373059471, age=128, norm_err=1.0e-03
Current memory usage 184.4MB, wall time: 2.8s
Delta E = nan, Delta S = 7.7169e-02 (per sweep)
max trunc_err = 9.9762e-12, max E_trunc = 3.9492e-11
chi: [100, 96]
================================================================================
INFO    : Running sweep with optimization
INFO    : start environment_sweep
INFO    : checkpoint after sweep 20
energy=-0.4736547719211615, max S=0.8533806515799183, age=248, norm_err=4.8e-04
Current memory usage 184.4MB, wall time: 3.3s
Delta E = -6.6155e-07, Delta S = 8.1244e-03 (per sweep)
max trunc_err = 4.8027e-10, max E_trunc = 1.6308e-09
chi: [100, 100]
================================================================================
INFO    : Running sweep with optimization
INFO    : start environment_sweep
INFO    : checkpoint after sweep 30
energy=-0.4736556405594676, max S=0.8917521286678392, age=368, norm_err=2.7e-04
Current memory usage 184.4MB, wall time: 2.3s
Delta E = -8.6864e-08, Delta S = 3.8612e-03 (per sweep)
max trunc_err = 1.7333e-09, max E_trunc = 5.8446e-09
chi: [100, 100]
================================================================================
INFO    : Running sweep with optimization
INFO    : start environment_sweep
INFO    : checkpoint after sweep 40
energy=-0.4736558650600493, max S=0.9142933755299241, age=488, norm_err=1.6e-04
Current memory usage 184.4MB, wall time: 1.4s
Delta E = -2.2450e-08, Delta S = 2.2623e-03 (per sweep)
max trunc_err = 3.2944e-09, max E_trunc = 1.0756e-08
chi: [100, 100]
================================================================================
INFO    : Running sweep with optimization
INFO    : start environment_sweep
INFO    : checkpoint after sweep 50
energy=-0.4736559404143890, max S=0.9285899390746313, age=608, norm_err=1.0e-04
Current memory usage 184.4MB, wall time: 1.3s
Delta E = -7.5354e-09, Delta S = 1.4340e-03 (per sweep)
max trunc_err = 4.7629e-09, max E_trunc = 1.5278e-08
chi: [100, 100]
================================================================================
INFO    : Running sweep with optimization
INFO    : start environment_sweep
INFO    : checkpoint after sweep 60
energy=-0.4736559679718866, max S=0.9381016176776413, age=728, norm_err=5.3e-05
Current memory usage 184.4MB, wall time: 2.2s
Delta E = -2.7557e-09, Delta S = 9.5297e-04 (per sweep)
max trunc_err = 5.9455e-09, max E_trunc = 1.9335e-08
chi: [100, 100]
================================================================================
INFO    : Running sweep with optimization
INFO    : start environment_sweep
INFO    : checkpoint after sweep 70
energy=-0.4736559816868038, max S=0.9446099480051955, age=848, norm_err=5.3e-05
Current memory usage 184.4MB, wall time: 1.2s
Delta E = -1.3715e-09, Delta S = 6.5329e-04 (per sweep)
max trunc_err = 6.8097e-09, max E_trunc = 2.2169e-08
chi: [100, 100]
================================================================================
INFO    : Running sweep with optimization
INFO    : start environment_sweep
INFO    : checkpoint after sweep 80
energy=-0.4736559867521350, max S=0.9482863203946925, age=968, norm_err=1.5e-05
Current memory usage 184.4MB, wall time: 1.3s
Delta E = -5.0653e-10, Delta S = 3.6680e-04 (per sweep)
max trunc_err = 7.5489e-09, max E_trunc = 2.4451e-08
chi: [100, 100]
================================================================================
INFO    : Running sweep with optimization
INFO    : start environment_sweep
INFO    : checkpoint after sweep 90
energy=-0.4736559892324763, max S=0.9517713064821304, age=1088, norm_err=2.7e-05
Current memory usage 184.4MB, wall time: 1.3s
Delta E = -2.4803e-10, Delta S = 3.5048e-04 (per sweep)
max trunc_err = 8.0767e-09, max E_trunc = 2.6065e-08
chi: [100, 100]
================================================================================
INFO    : Running sweep with optimization
INFO    : start environment_sweep
INFO    : checkpoint after sweep 100
energy=-0.4736559902494122, max S=0.9538733822033918, age=1208, norm_err=2.0e-05
Current memory usage 184.4MB, wall time: 1.1s
Delta E = -1.0169e-10, Delta S = 2.1084e-04 (per sweep)
max trunc_err = 8.4764e-09, max E_trunc = 2.7318e-08
chi: [100, 100]
================================================================================
INFO    : Running sweep with optimization
INFO    : start environment_sweep
INFO    : checkpoint after sweep 110
energy=-0.4736559906350948, max S=0.9554013572697746, age=1328, norm_err=1.9e-05
Current memory usage 184.4MB, wall time: 1.1s
Delta E = -3.8568e-11, Delta S = 1.5356e-04 (per sweep)
max trunc_err = 8.7638e-09, max E_trunc = 2.8240e-08
chi: [100, 100]
================================================================================
INFO    : Running sweep with optimization
INFO    : start environment_sweep
INFO    : checkpoint after sweep 120
energy=-0.4736559905823725, max S=0.9566023583891443, age=1448, norm_err=2.1e-05
Current memory usage 184.4MB, wall time: 1.1s
Delta E = 5.2722e-12, Delta S = 1.2095e-04 (per sweep)
max trunc_err = 8.9660e-09, max E_trunc = 2.8969e-08
chi: [100, 100]
================================================================================
INFO    : Running sweep with optimization
INFO    : start environment_sweep
INFO    : checkpoint after sweep 130
energy=-0.4736559905812214, max S=0.9566186108050732, age=1568, norm_err=3.1e-06
Current memory usage 184.4MB, wall time: 1.3s
Delta E = 1.1511e-13, Delta S = 4.6951e-07 (per sweep)
max trunc_err = 9.0570e-09, max E_trunc = 2.9619e-08
chi: [100, 100]
================================================================================
WARNING : final DMRG state not in canonical form up to norm_tol_final=1.00e-10: norm_err=3.11e-06, calling psi.canonical_form()
INFO    : arnoldi_params: setting 'E_tol'=1.1942488502918118e-05
INFO    : DMRG finished after 130 sweeps, max chi=100
INFO    : make measurements
INFO    : finished simulation run
================================================================================

[13]:

E_iDMRG = data_inf['energy']
print("E_iDMRG = ", E_iDMRG)

E_iDMRG =  -0.47365599058122143

[14]:

plt.plot(1/Ls, Es/Ls, 'o', label='DMRG')
plt.xlabel('1/L')
plt.ylabel('E/L')

inv_L = np.linspace(0., np.max(1./Ls) * 1.1, 30)
plt.plot(inv_L, np.poly1d(coeffs)(inv_L), label=f"fit to DMRG, E/L$\\rightarrow${E0_inf:.8f}")

plt.axhline(y=E_iDMRG, label=f"iDMRG E/L={E_iDMRG:.8f}")
plt.legend()

[14]:

<matplotlib.legend.Legend at 0x7f71cb3b3430>

[ ]: