I am trying to run QUIMB's Simple Update Algorithm on an MPS. The first step I do is create a random MPS using the qtn.MPS_rand_state function. After this, I create the Local Hamiltonian required for the Simple Update method using the qtn.LocalHam1D function. With this one can run the Simple Update Algorithm as:
su = qtn.SimpleUpdate(
psi0 = psi0,
ham = ham_local,
chi = 15,
compute_energy_every = None,
compute_energy_per_site = True,
keep_best = True,
progbar = True
)
for tau in [0.1, 0.01, 0.001, 0.0001]:
su.evolve(200, tau=tau)
I have done this for PEPS using LocalHam2D instead and no execution errors happen, reaching correct ground state energies and ground states. Nevertheless, for MPSit does not run correctly.
The following error appears:
●
╱┃4
┃
●
╱┃4
┃
●
╱┃4
┃
●
╱┃4
┃
●
╱┃4
┃
●
╱┃4
┃
●
╱┃4
┃
●
╱┃4
┃
●
╱┃4
┃
●
╱┃4
┃
●
╱┃4
┃
●
╱
100%|##########| 200/200 [00:06<00:00, 29.16it/s]
---------------------------------------------------------------------------
IndexError Traceback (most recent call last)
***.ipynb Cell 8 line 7
63 su = qtn.SimpleUpdate(
64 psi0 = psi0,
65 ham = ham_local,
(...)
70 progbar = True
71 )
72 for tau in [0.1, 0.01, 0.001, 0.0001]:
---> 73 su.evolve(200, tau=tau)
75 print(f'Approximated ground state energy: {(su.best["energy"] * np.prod(n)):.6f}')
77 # Continue with Full Update -> this doesn't improve the result at all, but it's really slow
78 # fu = qtn.FullUpdate(
79 # psi0 = su.best['state'].copy(),
(...)
94 # plt.ylabel('Energy')
95 # plt.xlabel('Iteration')
File ***\lib\site-packages\quimb\tensor\tensor_arbgeom_tebd.py:583, in TEBDGen.evolve(self, steps, tau, progbar)
581 # possibly compute the energy
582 if self.compute_energy_final:
--> 583 self._check_energy()
584 self._update_progbar(pbar)
586 except KeyboardInterrupt:
587 # allow the user to interupt early
File ***\lib\site-packages\quimb\tensor\tensor_arbgeom_tebd.py:630, in TEBDGen._check_energy(self)
628 en = self.compute_energy_fn(self)
629 else:
--> 630 en = self.compute_energy()
632 if self.compute_energy_per_site:
633 en = en / self.ham.nsites
File ***\lib\site-packages\quimb\tensor\tensor_2d_tebd.py:333, in TEBD2D.compute_energy(self)
330 def compute_energy(self):
331 """Compute and return the energy of the current state.
332 """
--> 333 return self.state.compute_local_expectation(
334 self.ham.terms,
335 **self.compute_energy_opts
336 )
File ***\lib\site-packages\quimb\tensor\tensor_2d.py:4205, in TensorNetwork2DVector.compute_local_expectation(self, terms, max_bond, cutoff, canonize, mode, layer_tags, normalized, autogroup, contract_optimize, return_all, plaquette_envs, plaquette_map, **plaquette_env_options)
4202 plaquette_envs = dict()
4203 for x_bsz, y_bsz in calc_plaquette_sizes(terms.keys(), autogroup):
4204 plaquette_envs.update(
-> 4205 norm.compute_plaquette_environments(
4206 x_bsz=x_bsz, y_bsz=y_bsz, **plaquette_env_options
4207 )
4208 )
4210 if plaquette_map is None:
4211 # work out which plaquettes to use for which terms
4212 plaquette_map = calc_plaquette_map(plaquette_envs)
File ***\lib\site-packages\quimb\tensor\tensor_2d.py:3141, in TensorNetwork2D.compute_plaquette_environments(self, x_bsz, y_bsz, max_bond, cutoff, canonize, mode, layer_tags, first_contract, second_dense, compress_opts, **compute_environment_opts)
3134 first_contract = "y"
3136 compute_env_fn = {
3137 "x": self._compute_plaquette_environments_x_first,
3138 "y": self._compute_plaquette_environments_y_first,
3139 }[first_contract]
-> 3141 return compute_env_fn(
3142 x_bsz=x_bsz,
3143 y_bsz=y_bsz,
3144 max_bond=max_bond,
3145 cutoff=cutoff,
3146 canonize=canonize,
3147 mode=mode,
3148 layer_tags=layer_tags,
3149 compress_opts=compress_opts,
3150 second_dense=second_dense,
3151 **compute_environment_opts,
3152 )
File ***\lib\site-packages\quimb\tensor\tensor_2d.py:2934, in TensorNetwork2D._compute_plaquette_environments_y_first(self, x_bsz, y_bsz, max_bond, cutoff, canonize, layer_tags, second_dense, y_envs, **compute_environment_opts)
2932 # first we contract from either side to produce column environments
2933 if y_envs is None:
-> 2934 y_envs = self.compute_y_environments(
2935 max_bond=max_bond,
2936 cutoff=cutoff,
2937 canonize=canonize,
2938 layer_tags=layer_tags,
2939 **compute_environment_opts,
2940 )
2942 # next we form vertical strips and contract from both top and bottom
2943 # for each column
2944 x_envs = dict()
File ***\lib\site-packages\quimb\tensor\tensor_2d.py:2791, in TensorNetwork2D.compute_y_environments(self, max_bond, cutoff, canonize, dense, mode, layer_tags, compress_opts, envs, **contract_boundary_opts)
2788 if envs is None:
2789 envs = {}
-> 2791 self.compute_ymin_environments(envs=envs, **contract_boundary_opts)
2792 self.compute_ymax_environments(envs=envs, **contract_boundary_opts)
2794 return envs
File ***\lib\site-packages\quimb\tensor\tensor_2d.py:2529, in TensorNetwork2D.compute_environments(self, from_which, xrange, yrange, max_bond, cutoff, canonize, mode, layer_tags, dense, compress_opts, envs, **contract_boundary_opts)
2527 if dense:
2528 tn ^= first_row
-> 2529 envs[from_which, sweep[1]] = tn.select(first_row)
2531 for i in sweep[2:]:
2532 iprevprev = i - 2 * sweep.step
IndexError: range object index out of range
The problem arises after the entire set of steps for one specific tau. I believe it is due to the SimpleUpdate algorithm being defined for 2D systems. I also tried defining the MPS as a PEPS of size Nx1 with a LocalHam2D but the exact same problem occurs.
Any help would be largely appreciated, pretty new using QUIMB.
Thanks.