diff --git a/ChainOhmT/mcdis2.jl b/ChainOhmT/mcdis2.jl index af80714..4ce8834 100644 --- a/ChainOhmT/mcdis2.jl +++ b/ChainOhmT/mcdis2.jl @@ -69,7 +69,7 @@ MCDIS Multiple-component discretization procedure. in multi-component form. """ -function mcdis(N,eps0,quad::Function,Nmax) +function mcdis(N,eps0,quad::Function,Nmax,idelta,mc,AB,wf,mp,irout) suc = true f = "Ncap exceeds Nmax in mcdis with irout = " @@ -104,7 +104,7 @@ function mcdis(N,eps0,quad::Function,Nmax) xwm = Array{Float64}(undef, mc*Ncap, 2) for i=1:mc im1tn = (i-1)*Ncap - xw = quad(Ncap,i,uv) + xw = quad(Ncap,i,uv,mc,AB,wf) xwm[im1tn+1:im1tn+Ncap,:] = xw end diff --git a/ChainOhmT/quadohmT.jl b/ChainOhmT/quadohmT.jl index 2564827..9636388 100644 --- a/ChainOhmT/quadohmT.jl +++ b/ChainOhmT/quadohmT.jl @@ -1,73 +1,73 @@ -function quadfinT(N,i,uv) +function quadfinT(N,i,uv,mc,AB,wf) if (i>1 && ix!=0, xw[:,2]) #index = min(find(xw(:,2)~=0)) xw = xw[index:length(xw[:,2]),:] - Ibis = sortper(xw[:,1]) #xw = sortrows(xw,1) + Ibis = sortperm(xw[:,1]) #xw = sortrows(xw,1) xw = xw[Ibis,:] Ncap = size(xw,1) @@ -27,7 +27,8 @@ function stieltjes(N,xw) #return ab error("N in sti out of range") end - s0 = ones(1,Ncap)*xw[:,2] + s0 = (ones(1,Ncap)*xw[:,2])[1] + ab = zeros(N, 2) ab[1,1] = transpose(xw[:,1])*xw[:,2]/s0 ab[1,2] = s0 if N==1 @@ -50,23 +51,22 @@ function stieltjes(N,xw) #return ab # % end # % - c = 1e240 - p2 = c*p2 - s0 = c^2*s0 + #c = 1e240 + #p2 = c*p2 + #s0 = c^2*s0 for k=1:N-1 p0 = p1 p1 = p2 - p2 = (xw[:,1] - ab[k,1]).*p1 - ab[k,2]*p0 - s1 = transpose(xw[:,2])*(p2.^2) - s2 = transpose(xw[:,1])*(xw[:,2].*(p2.^2)) - - if (max(abs(p2))>huge)||(abs(s2)>huge) - error("impending overflow in stieltjes for k=$(k)") - end - if abs(s1)huge)||(abs(s2)>huge) + # error("impending overflow in stieltjes for k=$(k)") + # end + # if abs(s1) alpha -> s -> data (e, t or c) + + # Write onsite energies + h5write("$curdir/ohmicT/chaincoeffs.h5", string("/N=",Nstr,"/α=",astr,"/s=",sstr,"/β=",bstr,"/e"), jacerg[1:N,1]) + # Write hopping energies + h5write("$curdir/ohmicT/chaincoeffs.h5", string("/N=",Nstr,"/α=",astr,"/s=",sstr,"/β=",bstr,"/t"), jacerg[1:N-1,2]) + # Write coupling coefficient + h5write("$curdir/ohmicT/chaincoeffs.h5", string("/N=",Nstr,"/α=",astr,"/s=",sstr,"/β=",bstr,"/c"), jacerg[N,2]) + + else + Nstr = string(N) + wstr = string(ωc) + bstr = string(β) + # the "path" to the data inside of the h5 file is N -> ωc -> beta -> data (e, t or c) + + # Write onsite energies + h5write("$curdir/ohmicT/chaincoeffs.h5", string("/N=",Nstr,"/ωc=",wstr,"/β=",bstr,"/e"), jacerg[1:N,1]) + # Write hopping energies + h5write("$curdir/ohmicT/chaincoeffs.h5", string("/N=",Nstr,"/ωc=",wstr,"/β=",bstr,"/t"), jacerg[1:N-1,2]) + # Write coupling coefficient + h5write("$curdir/ohmicT/chaincoeffs.h5", string("/N=",Nstr,"/ωc=",wstr,"/β=",bstr,"/c"), jacerg[N,2]) + end + end + + return [jacerg[:,1], jacerg[1:N-1,2],jacerg[N,2]] +end