-
Notifications
You must be signed in to change notification settings - Fork 23
Closed
Description
I am trying to understand why we need to make parameters for the Hamiltonians callable and hence depend on the graph. I want to define three-body terms (actual node, nearest neighbor node, and next nearest neighbor), should I make the parameters depend also on these (below)?
function haldane(g::AbstractGraph; J=1, h₁=0, h₂=0)
(; J, h₁, h₂) = map(to_callable, (;J, h₁, h₂))
ℋ = OpSum()
for e in edges(g)
for nextnn in next_nearest_neighbors(g, dst(e))
ℋ -= J(e,nextnn) , "Sz", src(e), "Sx", dst(e), "Sx", nextnn
end
#Other terms go here
end
return ℋ
end
What would be the implications of skipping the callable part as shown below?
function haldane(g::AbstractGraph; J=1, h₁=0, h₂=0)
ℋ = OpSum()
for e in edges(g)
for nextnn in next_nearest_neighbors(g, dst(e))
ℋ -= J , "Sz", src(e), "Sx", dst(e), "Sx", nextnn
end
#Other terms go here
end
return ℋ
end
Metadata
Metadata
Assignees
Labels
No labels