class HeisenbergModel(VMPSApp): ''' Heisenberg model application for vMPS. The Hamiltonian is: sum_i J/2*(S_i^+S_{i+1}^- + S_i^-S_{i+1}^+) + Jz*S_i^zS_{i+1}^z -h*S_i^z Construct ----------------- HeisenbergModel(J,Jz,h) Attributes ------------------ J/Jz: Exchange interaction at xy direction and z direction. h: The strength of weiss field. *see VMPSApp for more attributes.* ''' def __init__(self,J,Jz,h,nsite): self.spaceconfig=SpinSpaceConfig([2,1]) I=OpUnitI(hndim=2) scfg=SpinSpaceConfig([2,1]) Sz=opunit_Sz(spaceconfig=scfg) Sp=opunit_Sp(spaceconfig=scfg) Sm=opunit_Sm(spaceconfig=scfg) wi=zeros((5,5),dtype='O') wi[:,0],wi[4,1:]=(I,Sp,Sm,Sz,-h*Sz),(J/2.*Sm,J/2.*Sp,Jz*Sz,I) WL=[copy.deepcopy(wi) for i in xrange(nsite)] WL[0]=WL[0][4:] WL[-1]=WL[-1][:,:1] self.H=MPO(WL) mpc=self.H.serialize() mpc.compactify() self.H_serial=mpc
class IsingModel(object): ''' Heisenberg model application for vMPS. The Hamiltonian is: sum_i J/2*(S_i^+S_{i+1}^- + S_i^-S_{i+1}^+) + Jz*S_i^zS_{i+1}^z -h*S_i^z Construct ----------------- HeisenbergModel(J,Jz,h) Attributes ------------------ J/Jz: Exchange interaction at xy direction and z direction. h: The strength of weiss field. *see VMPSApp for more attributes.* ''' def __init__(self,J,h,nsite): self.spaceconfig=SpinSpaceConfig([2,1]) self.J,self.h,self.nsite=J,h,nsite I=OpUnitI(hndim=2) Sz=opunit_Sz(spaceconfig=self.spaceconfig) Sx=opunit_Sx(spaceconfig=self.spaceconfig) wi=zeros((3,3),dtype='O') wi[:,0],wi[2,1:]=(I,Sx,-h*Sz),(Sx,I) WL=[copy.deepcopy(wi) for i in xrange(nsite)] WL[0]=WL[0][2:] WL[-1]=WL[-1][:,:1] self.H=MPO(WL) mpc=self.H.serialize() mpc.compactify() if isinstance(mpc,(OpString,OpUnit)): mpc=OpCollection([mpc]) self.H_serial=mpc self.qnumber='R' def get_str(self): return get_name(self.J,self.h,self.nsite)
class Spin1Model(object): ''' Heisenberg model application for vMPS. The Hamiltonian is: sum_i J/2*(S_i^+S_{i+1}^- + S_i^-S_{i+1}^+) + Jz*S_i^zS_{i+1}^z -h*S_i^z Construct ----------------- HeisenbergModel(J,Jz,D) Attributes ------------------ J/Jz: Exchange interaction at xy direction and z direction. D: The strength of easy plane field. *see VMPSApp for more attributes.* ''' def __init__(self,J,Jz,D,nsite): self.spaceconfig=SpinSpaceConfig([3,1]) self.J,self.Jz,self.D,self.nsite=J,Jz,D,nsite I=OpUnitI(hndim=self.spaceconfig.hndim) Sz=opunit_Sz(spaceconfig=self.spaceconfig) Sp=opunit_Sp(spaceconfig=self.spaceconfig) Sm=opunit_Sm(spaceconfig=self.spaceconfig) wi=zeros((5,5),dtype='O') wi[:,0],wi[4,1:]=(I,Sp,Sm,Sz,D*Sz*Sz),(J/2.*Sm,J/2.*Sp,Jz*Sz,I) WL=[copy.deepcopy(wi) for i in xrange(nsite)] WL[0]=WL[0][4:] WL[-1]=WL[-1][:,:1] self.H=MPO(WL) mpc=self.H.serialize() mpc.compactify() self.H_serial=mpc ion() cla() mpc.show_advanced() pdb.set_trace()