To preface, I would like to mention that I am very new to TeNPy, so I am sure that there might be a simple fix to my problem. I am trying to simulate a 2D Square Heisenberg Lattice (https://en.wikipedia.org/wiki/Quantum_Heisenberg_model), to calculate its ground state and ground state energy. I had initially set up some code using Scipy sparse matrices to do this calculation, but my computer memory could not handle it beyond a 4x4 lattice. I created the following model to simulate the system using TeNPy. This model seemed to agree with my Scipy results until a 4x4 matrix, and DMRG worked up until a 7x7 lattice. When I moved to an 8x8 lattice, however, DMRG took a very long time to run.
Python: Select all
bc_xx = 'open'; bc_yy = 'open'; bc_MPSS = 'finite'; # boundary conditions
# coupling_axis = 'Sz' # adds exchange interaction along Sz axis
lx = 8
ly= 8
tot_sites = lx*ly; # lattice
# Create antiferromagnetic initial state
product_state = []
for i in range(ly):
for j in range(lx):
if (i + j) % 2 == 0:
product_state.append('up')
else:
product_state.append('down')
jz= 1.0
h = 1.0
jx = 1.0
class MyModel(CouplingMPOModel):
def init_sites(self, model_params):
conserve = model_params.get('conserve', None)
site = SpinHalfSite(conserve=conserve)
return site
def init_lattice(self, model_params):
Lx = model_params.get('Lx', 2.)
Ly = model_params.get('Ly', 2.)
bc_x = model_params.get('bc_x', bc_xx)
bc_y = model_params.get('bc_y', bc_yy)
bc_MPS = model_params.get('bc_MPS', bc_MPSS)
lattice = Square(Lx, Ly, site=self.init_sites(model_params), bc=[bc_x, bc_y], bc_MPS=bc_MPS)
return lattice
def init_terms(self, model_params):
Jz = model_params.get('Jz', 1.0)
Jx = model_params.get('Jx', 1.0)
Hz = model_params.get('Hz', 1.0)
for u in range(tot_sites):
self.add_onsite_term(Hz, u, 'Sz')
for u1, u2, dx in self.lat.pairs['nearest_neighbors']:
self.add_coupling(Jz, u1, 'Sz' , u2, 'Sz', dx)
self.add_coupling(Jx/2, u1, 'Sp', u2, 'Sm', dx)
self.add_coupling(Jx/2, u1, 'Sm', u2, 'Sp', dx)
dmrg_params = {
'mixer': True,
'trunc_params': {
'chi_max': 100,
'svd_min': 1.e-10,
},
'max_E_err': 1.e-3,
'verbose': True,
}
model_params = {
'conserve': None,
'Lx': lx,
'Ly': ly,
'Jz': jz,
'Jx': jx,
'Hz': h,
'bc_MPS': bc_MPSS,
'bc_x': bc_xx,
'bc_y': bc_yy
}
M = MyModel(model_params)
lattice = M.init_lattice(model_params)
psi = MPS.from_product_state(lattice.mps_sites(), product_state, bc=lattice.bc_MPS)
eng = dmrg.TwoSiteDMRGEngine(psi, M, dmrg_params)
info = eng.run() # the main work; modifies psi in place
E = info[0]
psi = info[1]
As mentioned, I am very new to TeNPy and tensor networks in general, so I might be misunderstanding how DMRG works or trying to do something not feasible. Any help or guidance would be greatly appreciated.
Best,
Onat