Two operators for 1st and 2nd time (incorrect)
This commit is contained in:
parent
b79c57d7db
commit
14e40273c9
|
|
@ -10,6 +10,7 @@ struct Hamiltonian{T}
|
||||||
K_diag::Union{CuTensor{Complex{T}},Nothing}
|
K_diag::Union{CuTensor{Complex{T}},Nothing}
|
||||||
K_mixed::Union{CuTensor{Complex{T}},Nothing}
|
K_mixed::Union{CuTensor{Complex{T}},Nothing}
|
||||||
K_partial_1::Union{Tuple,Nothing}
|
K_partial_1::Union{Tuple,Nothing}
|
||||||
|
K_partial_2::Union{Tuple,Nothing}
|
||||||
Vs::Union{Array{Complex{T}},CuArray{Complex{T}}}
|
Vs::Union{Array{Complex{T}},CuArray{Complex{T}}}
|
||||||
hermitian::Bool
|
hermitian::Bool
|
||||||
mode::Hamiltonian_backend
|
mode::Hamiltonian_backend
|
||||||
|
|
@ -19,7 +20,7 @@ struct Hamiltonian{T}
|
||||||
k = -s.N÷2:s.N÷2-1
|
k = -s.N÷2:s.N÷2-1
|
||||||
hermitian = ϕ == 0.0
|
hermitian = ϕ == 0.0
|
||||||
K_partial = (exp(-im * convert(T, ϕ)) * im / sqrt(2 * s.μ)) .* ∂_1DOF.(Ref(s), k, k')
|
K_partial = (exp(-im * convert(T, ϕ)) * im / sqrt(2 * s.μ)) .* ∂_1DOF.(Ref(s), k, k')
|
||||||
K_partial_1 = sym_reduce(s, K_partial)
|
K_partial_1, K_partial_2 = sym_reduce(s, K_partial)
|
||||||
Vs = calculate_Vs(s, V_twobody, convert(T, ϕ), n_image)
|
Vs = calculate_Vs(s, V_twobody, convert(T, ϕ), n_image)
|
||||||
if mode == gpu_cutensor
|
if mode == gpu_cutensor
|
||||||
K_diag = CuTensor(CuArray(K_partial * K_partial), ['a', 'A'])
|
K_diag = CuTensor(CuArray(K_partial * K_partial), ['a', 'A'])
|
||||||
|
|
@ -29,7 +30,7 @@ struct Hamiltonian{T}
|
||||||
K_diag = nothing
|
K_diag = nothing
|
||||||
K_mixed = nothing
|
K_mixed = nothing
|
||||||
end
|
end
|
||||||
return new{T}(s, K_partial, K_diag, K_mixed, K_partial_1, Vs, hermitian, mode)
|
return new{T}(s, K_partial, K_diag, K_mixed, K_partial_1, K_partial_2, Vs, hermitian, mode)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
@ -62,7 +63,7 @@ function LinearAlgebra.mul!(out::Array{Complex{T}}, H::Hamiltonian{T}, v::Array{
|
||||||
nconList_v[i2] = 2
|
nconList_v[i2] = 2
|
||||||
|
|
||||||
tensor1 = coord1 == 1 ? H.K_partial_1[dim] : H.K_partial
|
tensor1 = coord1 == 1 ? H.K_partial_1[dim] : H.K_partial
|
||||||
tensor2 = coord2 == 1 ? H.K_partial_1[dim] : H.K_partial
|
tensor2 = coord2 == 1 ? H.K_partial_2[dim] : H.K_partial
|
||||||
v_new = @ncon((tensor1, tensor2, v), (nconList_1, nconList_2, nconList_v))
|
v_new = @ncon((tensor1, tensor2, v), (nconList_1, nconList_2, nconList_v))
|
||||||
|
|
||||||
out = axpy!(1, v_new, out)
|
out = axpy!(1, v_new, out)
|
||||||
|
|
|
||||||
29
irrep.jl
29
irrep.jl
|
|
@ -44,21 +44,30 @@ end
|
||||||
|
|
||||||
function sym_reduce(s, K_partial)
|
function sym_reduce(s, K_partial)
|
||||||
I = one(K_partial)
|
I = one(K_partial)
|
||||||
K_partial_x = kron(kron(K_partial, I), I)
|
|
||||||
K_partial_y = kron(kron(I, K_partial), I)
|
K_partial_x1 = kron(kron(K_partial, I), I)
|
||||||
K_partial_z = kron(kron(I, I), K_partial)
|
K_partial_y1 = kron(kron(I, K_partial), I)
|
||||||
|
K_partial_z1 = kron(kron(I, I), K_partial)
|
||||||
|
|
||||||
|
K_partial_x2 = kron(kron(K_partial, I), I)
|
||||||
|
K_partial_y2 = kron(kron(I, K_partial), I)
|
||||||
|
K_partial_z2 = kron(kron(I, I), K_partial)
|
||||||
|
|
||||||
for (i, label) in enumerate(s.labels)
|
for (i, label) in enumerate(s.labels)
|
||||||
if i != label
|
if i != label
|
||||||
K_partial_x[:, i] += K_partial_x[:, label]
|
K_partial_x2[:, i] .+= K_partial_x2[:, label]
|
||||||
K_partial_y[:, i] += K_partial_y[:, label]
|
K_partial_y2[:, i] .+= K_partial_y2[:, label]
|
||||||
K_partial_z[:, i] += K_partial_z[:, label]
|
K_partial_z2[:, i] .+= K_partial_z2[:, label]
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
K_partial_x = K_partial_x[s.unique_i, s.unique_i]
|
K_partial_x1 = K_partial_x1[s.unique_i, :]
|
||||||
K_partial_y = K_partial_y[s.unique_i, s.unique_i]
|
K_partial_y1 = K_partial_y1[s.unique_i, :]
|
||||||
K_partial_z = K_partial_z[s.unique_i, s.unique_i]
|
K_partial_z1 = K_partial_z1[s.unique_i, :]
|
||||||
|
|
||||||
return K_partial_x, K_partial_y, K_partial_z
|
K_partial_x2 = K_partial_x2[:, s.unique_i]
|
||||||
|
K_partial_y2 = K_partial_y2[:, s.unique_i]
|
||||||
|
K_partial_z2 = K_partial_z2[:, s.unique_i]
|
||||||
|
|
||||||
|
return (K_partial_x1, K_partial_y1, K_partial_z1), (K_partial_x2, K_partial_y2, K_partial_z2)
|
||||||
end
|
end
|
||||||
Loading…
Reference in New Issue