hi
I am applying DMRG to a problem with a 1d non-hamiltonian
I ran into problems when I wanted to define a Custom Observer,Since the energy returned is complex, I tried changing the variable type and found it didn’t solve the problem
mutable struct DemoObserver <: AbstractObserver
energy_tol::Float64
last_energy::ComplexF64
DemoObserver(energy_tol=0.0) = new(energy_tol,1000.0)
end
function ITensors.checkdone!(o::DemoObserver;kwargs...)
sw = kwargs[:sweep]
energy = kwargs[:energy]
if abs(real(energy)-real(o.last_energy))/abs(real(energy)) < o.energy_tol
println("Stopping DMRG after sweep $sw")
return true
end
# Otherwise, update last_energy and keep going
o.last_energy = energy
return false
end
How and what should I change so that the work it?
Thanks.