Simple reduction (still wrong)
This commit is contained in:
parent
adae9f3aae
commit
b79c57d7db
|
|
@ -15,17 +15,18 @@ struct system{T}
|
||||||
unique_i::Array{Int}
|
unique_i::Array{Int}
|
||||||
unique_point::Array{Int}
|
unique_point::Array{Int}
|
||||||
multiplicity::Array{Int}
|
multiplicity::Array{Int}
|
||||||
|
labels::Array{Int}
|
||||||
|
|
||||||
function system{T}(d::Int, n::Int, N::Int, L::Real, μ::Real=0.5, sym::rep=all) where {T<:Float}
|
function system{T}(d::Int, n::Int, N::Int, L::Real, μ::Real=0.5, sym::rep=all) where {T<:Float}
|
||||||
@assert d == 3 "Only supports 3D"
|
@assert d == 3 "Only supports 3D"
|
||||||
if sym == all
|
if sym == all
|
||||||
unique_i, unique_point, multiplicity = calculate_all_data(N)
|
unique_i, unique_point, multiplicity, labels = calculate_all_data(N)
|
||||||
elseif sym == A1
|
elseif sym == A1
|
||||||
unique_i, unique_point, multiplicity = calculate_A1_data(N)
|
unique_i, unique_point, multiplicity, labels = calculate_A1_data(N)
|
||||||
else
|
else
|
||||||
throw(ArgumentError("Symmetry not yet implemented"))
|
throw(ArgumentError("Symmetry not yet implemented"))
|
||||||
end
|
end
|
||||||
return new{T}(d, n, N, convert(T, L), convert(T, μ), sym, unique_i, unique_point, multiplicity)
|
return new{T}(d, n, N, convert(T, L), convert(T, μ), sym, unique_i, unique_point, multiplicity, labels)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
@ -90,7 +91,6 @@ function calculate_Vs(s::system{T}, V_twobody::Function, ϕ::T, n_image::Int)::A
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
Vs[i] *= s.multiplicity[i[1]]
|
|
||||||
end
|
end
|
||||||
return Vs
|
return Vs
|
||||||
end
|
end
|
||||||
|
|
|
||||||
18
irrep.jl
18
irrep.jl
|
|
@ -3,12 +3,13 @@ using DelimitedFiles, LinearAlgebra
|
||||||
function calculate_all_data(N::Int)
|
function calculate_all_data(N::Int)
|
||||||
ks = -N÷2:N÷2-1
|
ks = -N÷2:N÷2-1
|
||||||
lattice = hcat((collect.(Iterators.product(ks, ks, ks)))...)
|
lattice = hcat((collect.(Iterators.product(ks, ks, ks)))...)
|
||||||
|
labels = reshape(collect(1:N^3), (N, N, N))
|
||||||
|
|
||||||
unique_i = collect(1:N^3)
|
unique_i = collect(1:N^3)
|
||||||
multiplicity = fill(1, length(unique_i))
|
multiplicity = fill(1, length(unique_i))
|
||||||
unique_point = transpose(lattice)
|
unique_point = transpose(lattice)
|
||||||
|
|
||||||
return unique_i, unique_point, multiplicity
|
return unique_i, unique_point, multiplicity, labels
|
||||||
end
|
end
|
||||||
|
|
||||||
function calculate_A1_data(N::Int)
|
function calculate_A1_data(N::Int)
|
||||||
|
|
@ -38,7 +39,7 @@ function calculate_A1_data(N::Int)
|
||||||
multiplicity = [count(labels.==i) for i in unique_i]
|
multiplicity = [count(labels.==i) for i in unique_i]
|
||||||
unique_point = transpose(lattice[:, unique_i])
|
unique_point = transpose(lattice[:, unique_i])
|
||||||
|
|
||||||
return unique_i, unique_point, multiplicity
|
return unique_i, unique_point, multiplicity, labels
|
||||||
end
|
end
|
||||||
|
|
||||||
function sym_reduce(s, K_partial)
|
function sym_reduce(s, K_partial)
|
||||||
|
|
@ -47,13 +48,12 @@ function sym_reduce(s, K_partial)
|
||||||
K_partial_y = kron(kron(I, K_partial), I)
|
K_partial_y = kron(kron(I, K_partial), I)
|
||||||
K_partial_z = kron(kron(I, I), K_partial)
|
K_partial_z = kron(kron(I, I), K_partial)
|
||||||
|
|
||||||
for (i, j) in enumerate(s.unique_i)
|
for (i, label) in enumerate(s.labels)
|
||||||
K_partial_x[j, :] *= sqrt(s.multiplicity[i])
|
if i != label
|
||||||
K_partial_x[:, j] *= sqrt(s.multiplicity[i])
|
K_partial_x[:, i] += K_partial_x[:, label]
|
||||||
K_partial_y[j, :] *= sqrt(s.multiplicity[i])
|
K_partial_y[:, i] += K_partial_y[:, label]
|
||||||
K_partial_y[:, j] *= sqrt(s.multiplicity[i])
|
K_partial_z[:, i] += K_partial_z[:, label]
|
||||||
K_partial_z[j, :] *= sqrt(s.multiplicity[i])
|
end
|
||||||
K_partial_z[:, j] *= sqrt(s.multiplicity[i])
|
|
||||||
end
|
end
|
||||||
|
|
||||||
K_partial_x = K_partial_x[s.unique_i, s.unique_i]
|
K_partial_x = K_partial_x[s.unique_i, s.unique_i]
|
||||||
|
|
|
||||||
|
|
@ -12,7 +12,7 @@ n = 2
|
||||||
N = 16
|
N = 16
|
||||||
println("\n$n-body system with N=$N")
|
println("\n$n-body system with N=$N")
|
||||||
|
|
||||||
for L::T in 5.0:9.0
|
for L::T in [16]
|
||||||
println("L=$L")
|
println("L=$L")
|
||||||
println("Constructing Hamiltonian")
|
println("Constructing Hamiltonian")
|
||||||
s=system{T}(3,n,N,L,0.5,A1)
|
s=system{T}(3,n,N,L,0.5,A1)
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue