Skip to content

Commit

Permalink
initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
lxvm committed Jul 17, 2024
1 parent 43e8889 commit f9094ac
Showing 1 changed file with 16 additions and 5 deletions.
21 changes: 16 additions & 5 deletions src/wannier90io.jl
Original file line number Diff line number Diff line change
Expand Up @@ -403,7 +403,7 @@ function load_wannier90_data(seedname::String; precision=Float64, load_interp=lo
ref = wi(k)
err, idx = findmax(bz.syms) do S
val = wi(S*k)
return calc_interp_error(wi, val, ref)
return calc_interp_error(wi, val, ref, S, bz.A)
end
sym = CompactDisplay(bz.syms[idx])
kpt = CompactDisplay(k)
Expand All @@ -427,14 +427,25 @@ function calc_interp_error_(solver, g::AbstractGauge, val, err)
werr = g isa Hamiltonian ? err : to_gauge!(solver, Hamiltonian(), err)
return norm(wval.values - werr.values)
end
function calc_interp_error(h::AbstractHamiltonianInterp, val, err)
function calc_interp_error(h::AbstractHamiltonianInterp, val, err, S, A)
return calc_interp_error_(init(h.prob, h.alg), gauge(h), val, err)
end
function calc_interp_error(hv::AbstractVelocityInterp, val, err)
function calc_interp_error(hv::AbstractVelocityInterp, val, err, S, A)
# TODO test the symmetry on the velocity with a trace over the orbital indices, rotation
# on coordinate indices
return calc_interp_error_(gauge(hv), val[1], err[1])
_Aval = spectral_function(_inv(complex(11.0, 1.0)*I-val[1]))
_Aref = spectral_function(_inv(complex(11.0, 1.0)*I-err[1]))
_S = coord(hv) isa Lattice ? _inv(S') : A*_inv(S')*_inv(A)
return norm(tr.(val[2] .* Ref(_Aval)) .- _S * tr.(err[2] .* Ref(_Aref)))#calc_interp_error_(gauge(hv), val[1], err[1])
end
function calc_interp_error(hv::AbstractInverseMassInterp, val, err, S, A)
# TODO test the symmetry on the velocity with a trace over the orbital indices, rotation
# on coordinate indices
_S = coord(hv) isa Lattice ? _inv(S)' : A*_inv(S')*_inv(A)
return norm(tr.(val[3]) .- tr.(_S * err[3] * _S'))#calc_interp_error_(gauge(hv), val[1], err[1])
end
function calc_interp_error(::BerryConnectionInterp, val, err, S, A)
norm(tr.(val) .- S * tr.(err))
end
calc_interp_error(::BerryConnectionInterp, val, err) = NaN

function load_wannierio_interp end

0 comments on commit f9094ac

Please sign in to comment.