Skip to content

Commit

Permalink
add spin-symmetries for su2-hkg
Browse files Browse the repository at this point in the history
  • Loading branch information
lgresista committed Oct 27, 2023
1 parent 630b944 commit 52a439a
Show file tree
Hide file tree
Showing 17 changed files with 984 additions and 427 deletions.
132 changes: 109 additions & 23 deletions src/Action/Action.jl
Original file line number Diff line number Diff line change
Expand Up @@ -46,16 +46,21 @@ function get_Γ_comp(

# add s channel
if ch_s
# check for site exchange
site_s = site

# apply flags (from frequency symmetries)
comp_s = comp
sgn_s, comp_s = apply_flags(bs, comp_s)

# check for particle exchange
site_s = site

if bs.exchange_flag
site_s = r.exchange[site_s]
end

# apply other flags
comp_s = comp
sgn_s, comp_s = apply_flags(bs, comp_s)
#map exchanged vertex to reduced lattice with accompanying spin transformation
sgn_s *= r.exchange[site_s].signs[comp_s]
comp_s = r.exchange[site_s].components[comp_s]
site_s = r.exchange[site_s].site
end

# check for mapping to u channel and interpolate
if bs.map_flag
Expand All @@ -67,34 +72,41 @@ function get_Γ_comp(

# add t channel
if ch_t
# check for site exchange

# apply flags (from frequency symmetries)
comp_t = comp
sgn_t, comp_t = apply_flags(bt, comp_t)

# check for particle exchange
site_t = site

if bt.exchange_flag
site_t = r.exchange[site_t]
#map exchanged vertex to reduced lattice with accompanying spin transformation
sgn_t *= r.exchange[site_t].signs[comp_t]
comp_t = r.exchange[site_t].components[comp_t]
site_t = r.exchange[site_t].site
end

# apply other flags
comp_t = comp
sgn_t, comp_t = apply_flags(bt, comp_t)

# interpolate
val += sgn_t * get_vertex(site_t, bt, a.Γ[comp_t], 2)
end

# add u channel
if ch_u
# check for site exchange
# apply flags (from frequency symmetries)
comp_u = comp
sgn_u, comp_u = apply_flags(bu, comp_u)

# check for particle exchange
site_u = site

if bu.exchange_flag
site_u = r.exchange[site_u]
#map exchanged vertex to reduced lattice with accompanying spin transformation
sgn_u *= r.exchange[site_u].signs[comp_u]
comp_u = r.exchange[site_u].components[comp_u]
site_u = r.exchange[site_u].site
end

# apply other flags
comp_u = comp
sgn_u, comp_u = apply_flags(bu, comp_u)

# check for mapping to s channel and interpolate
if bu.map_flag
val += sgn_u * get_vertex(site_u, bu, a.Γ[comp_u], 1)
Expand Down Expand Up @@ -166,6 +178,79 @@ function get_Γ_comp_avx!(
return nothing
end

#Get vertex components for site exchange for quick buffering
function symmetrize_site_exchange!(
r :: Reduced_lattice,
a :: Action
)
# get dimensions
num_sites = size(a.Γ[1].ch_s.q2_1, 1)
num_Ω = size(a.Γ[1].ch_s.q2_1, 2)
num_ν = size(a.Γ[1].ch_s.q2_1, 3)

# computation for q1
#@turbo
for w in 1 : num_Ω
for i in 1 : num_sites
# add q1 to s channel (right part from v <-> v' exchange)
i_exchange = r.exchange[i].site
comps_exchange = r.exchange[i].components
signs_exchange = r.exchange[i].signs

for comp in eachindex(a.Γ)
a.Γ[comp].ch_s.q1x[i, w] = signs_exchange[comp] * a.Γ[comps_exchange[comp]].ch_s.q1[i_exchange, w]
a.Γ[comp].ch_t.q1x[i, w] = signs_exchange[comp] * a.Γ[comps_exchange[comp]].ch_t.q1[i_exchange, w]
a.Γ[comp].ch_u.q1x[i, w] = signs_exchange[comp] * a.Γ[comps_exchange[comp]].ch_u.q1[i_exchange, w]
end
end
end

# computation for q2_1 and q2_2
#@turbo
for v in 1 : num_ν
for w in 1 : num_Ω
for i in 1 : num_sites
i_exchange = r.exchange[i].site
comps_exchange = r.exchange[i].components
signs_exchange = r.exchange[i].signs

for comp in eachindex(a.Γ)
a.Γ[comp].ch_s.q2_1x[i, w, v] = signs_exchange[comp] * a.Γ[comps_exchange[comp]].ch_s.q2_1[i_exchange, w, v]
a.Γ[comp].ch_t.q2_1x[i, w, v] = signs_exchange[comp] * a.Γ[comps_exchange[comp]].ch_t.q2_1[i_exchange, w, v]
a.Γ[comp].ch_u.q2_1x[i, w, v] = signs_exchange[comp] * a.Γ[comps_exchange[comp]].ch_u.q2_1[i_exchange, w, v]

a.Γ[comp].ch_s.q2_2x[i, w, v] = signs_exchange[comp] * a.Γ[comps_exchange[comp]].ch_s.q2_2[i_exchange, w, v]
a.Γ[comp].ch_t.q2_2x[i, w, v] = signs_exchange[comp] * a.Γ[comps_exchange[comp]].ch_t.q2_2[i_exchange, w, v]
a.Γ[comp].ch_u.q2_2x[i, w, v] = signs_exchange[comp] * a.Γ[comps_exchange[comp]].ch_u.q2_2[i_exchange, w, v]
end
end
end
end

# computation for q3
#@turbo
for vp in 1 : num_ν
for v in 1 : num_ν
for w in 1 : num_Ω
for i in 1 : num_sites
i_exchange = r.exchange[i].site
comps_exchange = r.exchange[i].components
signs_exchange = r.exchange[i].signs

for comp in eachindex(a.Γ)
a.Γ[comp].ch_s.q3x[i, w, v, vp] = signs_exchange[comp] * a.Γ[comps_exchange[comp]].ch_s.q3[i_exchange, w, v, vp]
a.Γ[comp].ch_t.q3x[i, w, v, vp] = signs_exchange[comp] * a.Γ[comps_exchange[comp]].ch_t.q3[i_exchange, w, v, vp]
a.Γ[comp].ch_u.q3x[i, w, v, vp] = signs_exchange[comp] * a.Γ[comps_exchange[comp]].ch_u.q3[i_exchange, w, v, vp]
end
end
end
end
end

return nothing
end


# load saving and reading for channels and vertices
include("disk.jl")

Expand All @@ -175,9 +260,6 @@ include("action_lib/action_u1_dm.jl") ; include("checkpoint_lib/checkpoint_u1_d
include("action_lib/action_su2_hkg.jl"); include("checkpoint_lib/checkpoint_su2_hkg.jl")





# interface function to replace action with another action (except for bare)
function replace_with!(
a1 :: Action,
Expand Down Expand Up @@ -493,7 +575,8 @@ function resample_from_to(
m_old :: Mesh,
a_old :: Action,
a_new :: Action,
χ :: Vector{Matrix{Float64}}
χ :: Vector{Matrix{Float64}},
r :: Reduced_lattice
) :: Mesh

# scale linear bounds
Expand Down Expand Up @@ -553,6 +636,9 @@ function resample_from_to(
resample_from_to!(m_old, a_old.Γ[i], m_new, a_new.Γ[i])
end

# save new values to site exchange kernels
symmetrize_site_exchange!(r, a_new)

return m_new
end

Expand Down
75 changes: 42 additions & 33 deletions src/Action/action_lib/action_su2_hkg.jl
Original file line number Diff line number Diff line change
Expand Up @@ -236,43 +236,48 @@ function symmetrize!(
# computation for q3
for v in 1 : num_ν
for vp in v + 1 : num_ν
@turbo for w in 1 : num_Ω
#@turbo
for w in 1 : num_Ω
for i in 1 : num_sites
i_exchange = r.exchange[i].site
comps_exchange = r.exchange[i].components
signs_exchange = r.exchange[i].signs

#get upper triangular matrix for (v, v') plane for s channel
a.Γ[1].ch_s.q3[i, w, v, vp] = a.Γ[1].ch_s.q3[r.exchange[i], w, vp, v]
a.Γ[2].ch_s.q3[i, w, v, vp] = a.Γ[2].ch_s.q3[r.exchange[i], w, vp, v]
a.Γ[3].ch_s.q3[i, w, v, vp] = a.Γ[3].ch_s.q3[r.exchange[i], w, vp, v]
a.Γ[4].ch_s.q3[i, w, v, vp] = a.Γ[7].ch_s.q3[r.exchange[i], w, vp, v]
a.Γ[5].ch_s.q3[i, w, v, vp] = a.Γ[8].ch_s.q3[r.exchange[i], w, vp, v]
a.Γ[6].ch_s.q3[i, w, v, vp] = a.Γ[9].ch_s.q3[r.exchange[i], w, vp, v]
a.Γ[7].ch_s.q3[i, w, v, vp] = a.Γ[4].ch_s.q3[r.exchange[i], w, vp, v]
a.Γ[8].ch_s.q3[i, w, v, vp] = a.Γ[5].ch_s.q3[r.exchange[i], w, vp, v]
a.Γ[9].ch_s.q3[i, w, v, vp] = a.Γ[6].ch_s.q3[r.exchange[i], w, vp, v]
a.Γ[10].ch_s.q3[i, w, v, vp] = a.Γ[10].ch_s.q3[r.exchange[i], w, vp, v]
a.Γ[11].ch_s.q3[i, w, v, vp] = -a.Γ[14].ch_s.q3[r.exchange[i], w, vp, v]
a.Γ[12].ch_s.q3[i, w, v, vp] = -a.Γ[15].ch_s.q3[r.exchange[i], w, vp, v]
a.Γ[13].ch_s.q3[i, w, v, vp] = -a.Γ[16].ch_s.q3[r.exchange[i], w, vp, v]
a.Γ[14].ch_s.q3[i, w, v, vp] = -a.Γ[11].ch_s.q3[r.exchange[i], w, vp, v]
a.Γ[15].ch_s.q3[i, w, v, vp] = -a.Γ[12].ch_s.q3[r.exchange[i], w, vp, v]
a.Γ[16].ch_s.q3[i, w, v, vp] = -a.Γ[13].ch_s.q3[r.exchange[i], w, vp, v]
a.Γ[1].ch_s.q3[i, w, v, vp] = signs_exchange[1] * a.Γ[comps_exchange[1]].ch_s.q3[i_exchange, w, vp, v]
a.Γ[2].ch_s.q3[i, w, v, vp] = signs_exchange[2] * a.Γ[comps_exchange[2]].ch_s.q3[i_exchange, w, vp, v]
a.Γ[3].ch_s.q3[i, w, v, vp] = signs_exchange[3] * a.Γ[comps_exchange[3]].ch_s.q3[i_exchange, w, vp, v]
a.Γ[4].ch_s.q3[i, w, v, vp] = signs_exchange[7] * a.Γ[comps_exchange[7]].ch_s.q3[i_exchange, w, vp, v]
a.Γ[5].ch_s.q3[i, w, v, vp] = signs_exchange[8] * a.Γ[comps_exchange[8]].ch_s.q3[i_exchange, w, vp, v]
a.Γ[6].ch_s.q3[i, w, v, vp] = signs_exchange[9] * a.Γ[comps_exchange[9]].ch_s.q3[i_exchange, w, vp, v]
a.Γ[7].ch_s.q3[i, w, v, vp] = signs_exchange[4] * a.Γ[comps_exchange[4]].ch_s.q3[i_exchange, w, vp, v]
a.Γ[8].ch_s.q3[i, w, v, vp] = signs_exchange[5] * a.Γ[comps_exchange[5]].ch_s.q3[i_exchange, w, vp, v]
a.Γ[9].ch_s.q3[i, w, v, vp] = signs_exchange[6] * a.Γ[comps_exchange[6]].ch_s.q3[i_exchange, w, vp, v]
a.Γ[10].ch_s.q3[i, w, v, vp] = signs_exchange[10] * a.Γ[comps_exchange[10]].ch_s.q3[i_exchange, w, vp, v]
a.Γ[11].ch_s.q3[i, w, v, vp] = -signs_exchange[14] * a.Γ[comps_exchange[14]].ch_s.q3[i_exchange, w, vp, v]
a.Γ[12].ch_s.q3[i, w, v, vp] = -signs_exchange[15] * a.Γ[comps_exchange[15]].ch_s.q3[i_exchange, w, vp, v]
a.Γ[13].ch_s.q3[i, w, v, vp] = -signs_exchange[16] * a.Γ[comps_exchange[16]].ch_s.q3[i_exchange, w, vp, v]
a.Γ[14].ch_s.q3[i, w, v, vp] = -signs_exchange[11] * a.Γ[comps_exchange[11]].ch_s.q3[i_exchange, w, vp, v]
a.Γ[15].ch_s.q3[i, w, v, vp] = -signs_exchange[12] * a.Γ[comps_exchange[12]].ch_s.q3[i_exchange, w, vp, v]
a.Γ[16].ch_s.q3[i, w, v, vp] = -signs_exchange[13] * a.Γ[comps_exchange[13]].ch_s.q3[i_exchange, w, vp, v]

# get upper triangular matrix for (v, v') plane for t channel
a.Γ[1].ch_t.q3[i, w, v, vp] = a.Γ[1].ch_t.q3[r.exchange[i], w, vp, v]
a.Γ[2].ch_t.q3[i, w, v, vp] = a.Γ[2].ch_t.q3[r.exchange[i], w, vp, v]
a.Γ[3].ch_t.q3[i, w, v, vp] = a.Γ[3].ch_t.q3[r.exchange[i], w, vp, v]
a.Γ[4].ch_t.q3[i, w, v, vp] = a.Γ[7].ch_t.q3[r.exchange[i], w, vp, v]
a.Γ[5].ch_t.q3[i, w, v, vp] = a.Γ[8].ch_t.q3[r.exchange[i], w, vp, v]
a.Γ[6].ch_t.q3[i, w, v, vp] = a.Γ[9].ch_t.q3[r.exchange[i], w, vp, v]
a.Γ[7].ch_t.q3[i, w, v, vp] = a.Γ[4].ch_t.q3[r.exchange[i], w, vp, v]
a.Γ[8].ch_t.q3[i, w, v, vp] = a.Γ[5].ch_t.q3[r.exchange[i], w, vp, v]
a.Γ[9].ch_t.q3[i, w, v, vp] = a.Γ[6].ch_t.q3[r.exchange[i], w, vp, v]
a.Γ[10].ch_t.q3[i, w, v, vp] = a.Γ[10].ch_t.q3[r.exchange[i], w, vp, v]
a.Γ[11].ch_t.q3[i, w, v, vp] = -a.Γ[14].ch_t.q3[r.exchange[i], w, vp, v]
a.Γ[12].ch_t.q3[i, w, v, vp] = -a.Γ[15].ch_t.q3[r.exchange[i], w, vp, v]
a.Γ[13].ch_t.q3[i, w, v, vp] = -a.Γ[16].ch_t.q3[r.exchange[i], w, vp, v]
a.Γ[14].ch_t.q3[i, w, v, vp] = -a.Γ[11].ch_t.q3[r.exchange[i], w, vp, v]
a.Γ[15].ch_t.q3[i, w, v, vp] = -a.Γ[12].ch_t.q3[r.exchange[i], w, vp, v]
a.Γ[16].ch_t.q3[i, w, v, vp] = -a.Γ[13].ch_t.q3[r.exchange[i], w, vp, v]
a.Γ[1].ch_t.q3[i, w, v, vp] = signs_exchange[1] * a.Γ[comps_exchange[1]].ch_t.q3[i_exchange, w, vp, v]
a.Γ[2].ch_t.q3[i, w, v, vp] = signs_exchange[2] * a.Γ[comps_exchange[2]].ch_t.q3[i_exchange, w, vp, v]
a.Γ[3].ch_t.q3[i, w, v, vp] = signs_exchange[3] * a.Γ[comps_exchange[3]].ch_t.q3[i_exchange, w, vp, v]
a.Γ[4].ch_t.q3[i, w, v, vp] = signs_exchange[7] * a.Γ[comps_exchange[7]].ch_t.q3[i_exchange, w, vp, v]
a.Γ[5].ch_t.q3[i, w, v, vp] = signs_exchange[8] * a.Γ[comps_exchange[8]].ch_t.q3[i_exchange, w, vp, v]
a.Γ[6].ch_t.q3[i, w, v, vp] = signs_exchange[9] * a.Γ[comps_exchange[9]].ch_t.q3[i_exchange, w, vp, v]
a.Γ[7].ch_t.q3[i, w, v, vp] = signs_exchange[4] * a.Γ[comps_exchange[4]].ch_t.q3[i_exchange, w, vp, v]
a.Γ[8].ch_t.q3[i, w, v, vp] = signs_exchange[5] * a.Γ[comps_exchange[5]].ch_t.q3[i_exchange, w, vp, v]
a.Γ[9].ch_t.q3[i, w, v, vp] = signs_exchange[6] * a.Γ[comps_exchange[6]].ch_t.q3[i_exchange, w, vp, v]
a.Γ[10].ch_t.q3[i, w, v, vp] = signs_exchange[10] * a.Γ[comps_exchange[10]].ch_t.q3[i_exchange, w, vp, v]
a.Γ[11].ch_t.q3[i, w, v, vp] = -signs_exchange[14] * a.Γ[comps_exchange[14]].ch_t.q3[i_exchange, w, vp, v]
a.Γ[12].ch_t.q3[i, w, v, vp] = -signs_exchange[15] * a.Γ[comps_exchange[15]].ch_t.q3[i_exchange, w, vp, v]
a.Γ[13].ch_t.q3[i, w, v, vp] = -signs_exchange[16] * a.Γ[comps_exchange[16]].ch_t.q3[i_exchange, w, vp, v]
a.Γ[14].ch_t.q3[i, w, v, vp] = -signs_exchange[11] * a.Γ[comps_exchange[11]].ch_t.q3[i_exchange, w, vp, v]
a.Γ[15].ch_t.q3[i, w, v, vp] = -signs_exchange[12] * a.Γ[comps_exchange[12]].ch_t.q3[i_exchange, w, vp, v]
a.Γ[16].ch_t.q3[i, w, v, vp] = -signs_exchange[13] * a.Γ[comps_exchange[13]].ch_t.q3[i_exchange, w, vp, v]

# get upper triangular matrix for (v, v') plane for u channel
a.Γ[1].ch_u.q3[i, w, v, vp] = a.Γ[1].ch_u.q3[i, w, vp, v]
Expand All @@ -296,9 +301,13 @@ function symmetrize!(
end
end

#Get new action for site exchange
symmetrize_site_exchange!(r, a)

return nothing
end

#NOT YET DONE WITH SPIN SYMMETRIES
# syymetrized addition for left part (right part symmetric to left part)
function symmetrize_add_to!(
r :: Reduced_lattice,
Expand Down
Loading

0 comments on commit 52a439a

Please sign in to comment.