Dear miles,
I would like to define two different latticebonds in a square lattice.
I made below changes in the lattices.jl file:
function square_lattice(Nx::Int, Ny::Int; kwargs...)::Lattice
yperiodic = get(kwargs, :yperiodic, false)
yperiodic = yperiodic && (Ny > 2)
N = Nx * Ny
Nbond = 2N - Ny + (yperiodic ? 0 : -Nx)
latt = Lattice(undef, Nbond)
b1 = 0
b2 = 0
for n in 1:N
x = div(n - 1, Ny) + 1
y = mod(n - 1, Ny) + 1
if x < Nx
latt[b1 += 1] = LatticeBond(n, n + Ny, x, y, x + 1, y)
end
if Ny > 1
if y < Ny
latt[b2 += 1] = LatticeBond(n, n + 1, x, y, x, y + 1)
end
if yperiodic && y == 1
latt[b1 += 1] = LatticeBond(n, n + Ny - 1, x, y, x, y + Ny)
end
end
end
return latt
end
and also I make the Hamiltonian function as:
function H_fst_2D_square(Nx,Ny,JH,JI,Delta,sites)
lattice = square_lattice(Nx, Ny; yperiodic = false)
# Define the Heisenberg spin Hamiltonian on this lattice
ampo = OpSum()
for b1 in lattice
ampo .+= 0.5*J1, "S+", b1.s1, "S-", b1.s2
ampo .+= 0.5*J1, "S-", b1.s1, "S+", b1.s2
ampo .+= J1, "Sz", b1.s1, "Sz", b1.s2
end
for b2 in lattice
ampo .+= 0.5*J2, "S+", b2.s1, "S-", b2.s2
ampo .+= 0.5*J2, "S-", b2.s1, "S+", b2.s2
ampo .+= J2, "Sz", b2.s1, "Sz", b2.s2
end
H = MPO(ampo,sites)
return(H)
end
after running the code I get below error:
ERROR: LoadError: UndefRefError: access to undefined reference
Stacktrace:
[1] getindex
@ ./array.jl:924 [inlined]
[2] iterate
@ ./array.jl:898 [inlined]
[3] H_fst_2D_square(Nx::Int64, Ny::Int64, JH::Int64, JI::Float64, Delta::Int64, sites::Vector{Index{Vector{Pair{QN, Int64}}}})
Should I do something else?
For the uniform exchange coupling I can run the code without problem.
QUESTION:
- I think your pre-defined periodic boundary conditions along the y-direction is not true (what I see in lattices.jl file after installing ITensor).
In fact, in line:
if yperiodic && y == 1
latt[b += 1] = LatticeBond(n, n + Ny - 1, x, y, x, y + Ny)
end
it should be like:
if yperiodic && y == 1
latt[b += 1] = LatticeBond(n, n + Ny - 1, x, y, x, y + Ny - 1)
end
am I right?
-
I also obtained the magnetization per site for a square lattice with uniform exchange coupling by using ED method under full periodic boundary conditions. In ITensor I considered periodic boundary conditions along the y-direction. For 24 number of spins I got large discrepancy in magnetic field position of the true magnetization plateaus and jumps with the ED results.
I increased the number of sweeps up to 20 and linkdim=200 with cutoff!(sweeps, 1E-5,1E-5,1E-5,1E-8,1E-8).
Do I encounter this discrepancy (magnetic field position of the magnetization plateaus) for large-size lattice, let say for N=144? -
When I compose my own lattice function with an arbitrary name, i.e.,
function triangle_hexagon_lattice(Nx::Int, Ny::Int; kwargs...)::Lattice
, I get the error:ERROR: LoadError: UndefVarError: triangle_hexagon_lattice not defined
.
Should I define the lattice name triangle_hexagon_lattice in another file?
Thanks!