Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/models/phi4_complex.jl
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ function moment_matrix(N, μ0, λ; rtol = 1.0e-8)
return M
end

function phi4_complex_tensor(f::TensorMap{TT, SS, NN, NN}, weights::Matrix{Float64}; T::Type{<:Number} = ComplexF64) where {TT, SS, NN} # for Trivial symmetry
function phi4_complex_tensor(f::TensorMap{TT, SS, NN, NN}, weights::Matrix{<:Number}; T::Type{<:Number} = ComplexF64) where {TT, SS, NN} # for Trivial symmetry
Comment thread
VictorVanthilt marked this conversation as resolved.
K = size(weights, 1)
N = K^2
perms = collect(permutations(1:4)) # 24 total
Expand Down
53 changes: 53 additions & 0 deletions test/models.jl
Original file line number Diff line number Diff line change
Expand Up @@ -84,3 +84,56 @@ for (model, temp, answer, description) in model_temp_answer_string_3d
@test free_energy(data, temp; scalefactor = 8.0) ≈ answer rtol = 1.0e-3
end
end


# Test for impurity tensors
# Real phi^4
@testset "Real φ⁴ model - Impure" begin
# Disordered phase
λ = 1.0
μ0 = 0.0

Tpure = phi4_real(Trivial, 10, μ0, λ)
T_imp1 = phi4_real_imp1(Trivial, 10, μ0, λ)
T_imp2 = phi4_real_imp2(Trivial, 10, μ0, λ)

scheme = ImpurityHOTRG(Tpure, T_imp1, T_imp1, T_imp2)

data = run!(scheme, truncrank(16), maxiter(25))

order_para = data[end][4] / data[end][1]
@test order_para ≈ 0.0 atol = 1.0e-3

# Ordered phase
μ0 = -2.0

Tpure = phi4_real(Trivial, 10, μ0, λ)
T_imp1 = phi4_real_imp1(Trivial, 10, μ0, λ)
T_imp2 = phi4_real_imp2(Trivial, 10, μ0, λ)

scheme = ImpurityHOTRG(Tpure, T_imp1, T_imp1, T_imp2)

data = run!(scheme, truncrank(16), maxiter(25))

order_para = data[end][4] / data[end][1]
@test order_para ≈ 1.5317112652447245 rtol = 1.0e-3
end

# Complex phi^4
@testset "Complex φ⁴ model - Impure" begin
# Disordered phase
λ = 1.0
μ0 = 0.0

Tpure = phi4_complex(Trivial, 6, μ0, λ; T = ComplexF64)
T_imp11 = phi4_complex_impϕ(6, μ0, λ)
T_imp12 = phi4_complex_impϕdag(6, μ0, λ)
T_imp2 = phi4_complex_impϕ2(6, μ0, λ)

scheme = ImpurityHOTRG(Tpure, T_imp11, T_imp12, T_imp2)

data = run!(scheme, truncrank(16), maxiter(25))

order_para = data[end][4] / data[end][1]
@test order_para ≈ 0.0 atol = 1.0e-3
end
Loading