diff --git a/.gitignore b/.gitignore index c7e6298..2451423 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,3 @@ Manifest.toml +.ipynb_checkpoints .vscode diff --git a/src/utility/cft.jl b/src/utility/cft.jl index 346529f..c5b4467 100644 --- a/src/utility/cft.jl +++ b/src/utility/cft.jl @@ -24,8 +24,36 @@ function cft_data(scheme::TNRScheme; v=1, unitcell=1) return unitcell * (1 / (2π * v)) * log.(data[1] ./ data) end -function cft_data(scheme::BTRG; v=1, unitcell=1) - throw(NotImplementedError("BTRG requires extra care with the environment tensors, this method will be implemented later")) +function cft_data(scheme::BTRG; v=1, unitcell=1, is_real=true) + # make the indices + indices = [[i, -i, i + 1, -(i + unitcell)] for i in 1:unitcell] + indices[end][3] = 1 + + @tensor T_unit[-1 -2; -3 -4] := scheme.T[1 2; -3 -4] * scheme.S1[-2; 2] * + scheme.S2[-1; 1] + T = ncon(fill(T_unit, unitcell), indices) + + outinds = Tuple(collect(1:unitcell)) + ininds = Tuple(collect((unitcell + 1):(2unitcell))) + + T = permute(T, outinds, ininds) + D, _ = eig(T) + + data = zeros(ComplexF64, dim(space(D, 1))) + + i = 1 + for (_, b) in blocks(D) + for I in LinearAlgebra.diagind(b) + data[i] = b[I] + i += 1 + end + end + data = filter(x -> real(x) > 0, data) + data = sort(data; by=x -> real(x), rev=true) + if is_real + data = real(data) + end + return unitcell * (1 / (2π * v)) * log.(data[1] ./ data) end function central_charge(scheme::TNRScheme, trunc::TensorKit.TruncationScheme,