I don't see the issue here, I checked that it works for an
even number of couplings, where the couplings are not incommensurable.
For nearest neighbor couplings A_i B_{i+1}, this means it works for (finite, odd # sites) or (infinite, even # sites), as you can easily check with the example below. Note that if you have next-nearest neighbors, this behaviour switches - then (finite, even # sites) or (infinite, odd # sites) work.
Code: Select all
import tenpy
from tenpy.models.xxz_chain import XXZChain2
class AltXXZChain(XXZChain2):
def init_terms(self, model_params):
Jz = model_params.get('Jz', 0.)
Jz1 = model_params.get('Jz1', 1.5)
Jz2 = model_params.get('Jz2', 0.5)
super().init_terms(model_params)
for u1, u2, dx in self.lat.pairs['nearest_neighbors']:
self.add_coupling([Jz1, Jz2], u1, 'Sz', u2, 'Sz', dx)
# Mfineven = AltXXZChain({'L': 8, 'bc_MPS': 'finite'}) # errors
Mfinodd = AltXXZChain({'L': 7, 'bc_MPS': 'finite'})
Minfeven = AltXXZChain({'L': 8, 'bc_MPS': 'infinite'})
# Minfodd = AltXXZChain({'L': 7, 'bc_MPS': 'infinite'}) # errors
Inderpreet Kaur wrote: ↑18 May 2022, 10:30
Can you please suggest, if there is any solution when one considers odd number of sites and finite MPS (with the motivation that the strengths of coupling is symmetric throughout the whole chain if one considers open boundaries)?
An odd number of sites for finite MPS with oben boundary conditions has an *even* number of couplings, so it is not symmetric over a bond, the bond strength for L=5 sites would be
[strong, weak, strong, weak]
.
If you want an *even* number of sites, e.g., L=6 with bonds
[strong, weak, strong, weak, strong
, you can explicitly set all the terms in the array by expanding the couplings to the corresponding shapes yourself:
Code: Select all
class AltXXZChainIncom(XXZChain2):
def init_terms(self, model_params):
Jz = model_params.get('Jz', 0.)
Jz1 = model_params.get('Jz1', 1.5)
Jz2 = model_params.get('Jz2', 0.5)
super().init_terms(model_params)
for u1, u2, dx in self.lat.pairs['nearest_neighbors']:
coupling_shape, _ = self.lat.coupling_shape(dx)
strength = to_array([Jz1, Jz2], coupling_shape, allow_incommensurate=True)
self.add_coupling(strength, u1, 'Sz', u2, 'Sz', dx)
iMfineven = AltXXZChainIncom({'L': 8, 'bc_MPS': 'finite'}) # does not error
iMfinodd = AltXXZChainIncom({'L': 7, 'bc_MPS': 'finite'})
iMinfeven = AltXXZChainIncom({'L': 8, 'bc_MPS': 'infinite'})
iMinfodd = AltXXZChainIncom({'L': 7, 'bc_MPS': 'infinite'}) # does not error