Skip to content

Commit

Permalink
0.4.3
Browse files Browse the repository at this point in the history
  • Loading branch information
cometscome committed Jan 23, 2025
1 parent 6ae8064 commit 7f0180b
Show file tree
Hide file tree
Showing 12 changed files with 137 additions and 16 deletions.
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name = "Gaugefields"
uuid = "a461e10c-0d91-493e-bc41-027b226eee91"
authors = ["Akio Tomiya, Yuki Nagai <[email protected]> and contributors"]
version = "0.4.2"
version = "0.4.3"

[deps]
CLIME_jll = "3c6ae550-c37b-5556-a07e-d40b4910cf1c"
Expand Down
1 change: 1 addition & 0 deletions samples/filelist.dat
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
testbin.dat ildg-binary-data
Binary file added samples/hoge.ildg
Binary file not shown.
33 changes: 33 additions & 0 deletions samples/ildgtest.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
using Gaugefields

function main()
NX = 4
NY = 4
NZ = 4
NT = 4
NC = 3
Nwing = 1
Dim = 4

U = Initialize_Gaugefields(NC, Nwing, NX, NY, NZ, NT, condition="cold")
filename = "hoge.ildg"
save_binarydata(U, filename; tempfile1="temp1.dat", tempfile2="temp2.dat")


filename = "hoge.ildg"
ildg = ILDG(filename)
i = 1
L = [NX, NY, NZ, NT]
load_gaugefield!(U, i, ildg, L, NC)

temp1 = similar(U[1])
temp2 = similar(U[1])

comb = 6
factor = 1 / (comb * U[1].NV * U[1].NC)
@time plaq_t = calculate_Plaquette(U, temp1, temp2) * factor
println("plaq_t = $plaq_t")
poly = calculate_Polyakov_loop(U, temp1, temp2)
println("polyakov loop = $(real(poly)) $(imag(poly))")
end
main()
Binary file added samples/temp1.dat
Binary file not shown.
1 change: 1 addition & 0 deletions samples/temp2.dat
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
temp1.dat ildg-binary-data
Binary file modified samples/tempconf.dat
Binary file not shown.
Binary file added samples/testbin.dat
Binary file not shown.
34 changes: 26 additions & 8 deletions src/heatbath/heatbathmodule.jl
Original file line number Diff line number Diff line change
Expand Up @@ -249,13 +249,22 @@ function overrelaxation!(
overrelaxation!(U, h._tempotal_gauges, h.β; ITERATION_MAX=h.ITERATION_MAX)
end

function heatbath!(
U::Array{<:AbstractGaugefields{NC,Dim},1},
temps_g, # length >= 5
β;
ITERATION_MAX=10^5,
) where {Dim,NC}
error("now heatbath!(U,temp_g::Temporalfields,β) is supported. Use temp=Temporalfields(U[1]; num=10)")
end


function heatbath!(
U::Array{<:AbstractGaugefields{2,Dim},1},
temps_g, # length >= 5
temps_g::Temporalfields{TG}, # length >= 5
β;
ITERATION_MAX=10^5,
) where {Dim}
) where {Dim,TG}
NC = 2
#temp1 = temps[1]
#temp2 = temps[2]
Expand Down Expand Up @@ -297,10 +306,10 @@ end

function heatbath!(
U::Array{<:AbstractGaugefields{3,Dim},1},
temps_g, # length >= 5
temps_g::Temporalfields{TG}, # length >= 5
β;
ITERATION_MAX=10^5,
) where {Dim}
) where {Dim,TG}
NC = 3
#temp1 = temps[1]
#temp2 = temps[2]
Expand Down Expand Up @@ -346,11 +355,11 @@ end

function heatbath!(
U::Array{<:AbstractGaugefields{3,Dim},1},
temps_g, # length >= 5
temps_g::Temporalfields{TG}, # length >= 5
β,
gauge_action;
ITERATION_MAX=10^5,
) where {Dim} #This function is for debugging
) where {Dim,TG} #This function is for debugging
NC = 3
#temp1 = temps[1]
#temp2 = temps[2]
Expand Down Expand Up @@ -398,10 +407,10 @@ end

function heatbath!(
U::Array{<:AbstractGaugefields{NC,Dim},1},
temps_g, # length >= 5
temps_g::Temporalfields{TG}, # length >= 5
β;
ITERATION_MAX=10^5,
) where {Dim,NC}
) where {Dim,NC,TG}

#temp1 = temps[1]
#temp2 = temps[2]
Expand Down Expand Up @@ -450,6 +459,15 @@ function overrelaxation!(
β;
ITERATION_MAX=10^5,
) where {Dim,NC}
error("now overrelaxation!(U,temp_g::Temporalfields,β) is supported. Use temp=Temporalfields(U[1]; num=10)")
end

function overrelaxation!(
U::Array{<:AbstractGaugefields{NC,Dim},1},
temps_g::Temporalfields{TG}, # length >= 5
β;
ITERATION_MAX=10^5,
) where {Dim,NC,TG}

#temp1 = temps[1]
#temp2 = temps[2]
Expand Down
14 changes: 7 additions & 7 deletions src/output/ildg_format.jl
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ function __init__()
for iy = 1:NY
for ix = 1:NX
rank, ix_local, iy_local, iz_local, it_local =
Gaugefields.calc_rank_and_indices(U[1], ix, iy, iz, it)
calc_rank_and_indices(U[1], ix, iy, iz, it)
#counts[rank+1] += 1
counttotal += 1

Expand All @@ -65,7 +65,7 @@ function __init__()
println("$it $(it_local)")
end
=#
Gaugefields.barrier(U[1])
barrier(U[1])
if U[1].myrank == 0
count = 0
for μ = 1:4
Expand Down Expand Up @@ -110,7 +110,7 @@ function __init__()
end
#end

Gaugefields.barrier(U[1])
barrier(U[1])
#=
N = length(data[:,:,:,:,1])
Expand Down Expand Up @@ -195,7 +195,7 @@ function __init__()
for iy = 1:NY
for ix = 1:NX
rank, ix_local, iy_local, iz_local, it_local =
Gaugefields.calc_rank_and_indices(U[1], ix, iy, iz, it)
calc_rank_and_indices(U[1], ix, iy, iz, it)
#counts[rank+1] += 1
counttotal += 1

Expand All @@ -208,7 +208,7 @@ function __init__()
println("$it $(it_local)")
end
=#
Gaugefields.barrier(U[1])
barrier(U[1])
if U[1].myrank == 0
count = 0
for μ = 1:4
Expand All @@ -232,7 +232,7 @@ function __init__()
for ic1 = 1:NC
count += 1
v = recv_mesg[count]
Gaugefields.setvalue!(
setvalue!(
U[μ],
v,
ic2,
Expand All @@ -246,7 +246,7 @@ function __init__()
end
end
end
Gaugefields.barrier(U[1])
barrier(U[1])
end
end
end
Expand Down
63 changes: 63 additions & 0 deletions test/heatbathtest_bare.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@

using Gaugefields
using Random

import Gaugefields.Temporalfields_module: Temporalfields, get_temp, unused!

function heatbathtest_bare()
Nwing = 0
nc = 3
L = [8, 8, 8, 8]
U = Initialize_Gaugefields(nc, Nwing, L..., condition="cold")
nsteps = 10
β = 6.0
numOR = 4
temp = Temporalfields(U[1]; num=5)
t_tot = 0.0

volume = prod(L)
dim = length(L)
factor = 1 / (binomial(dim, 2) * nc * volume)
measure_every = 10

for istep = 1:nsteps

println("# istep = $istep")

t = @timed begin

heatbath!(U, temp, β)
unused!(temp)

for _ = 1:numOR

overrelaxation!(U, temp, β)
unused!(temp)

end

end
t_tot += t.time

println("Update: Elapsed time $(t.time) [s]")

plaq = calculate_Plaquette(U, temp[1], temp[2]) * factor
unused!(temp)
println("$istep $plaq # plaq")

if istep % measure_every == 0

poly = calculate_Polyakov_loop(U, temp[1], temp[2])
unused!(temp)
println("$istep $(real(poly)) $(imag(poly)) # poly")

end

end

println("Total elapsed time $t_tot [s]")
println(log_out, "Total elapsed time $t_tot [s]")

end

@test heatbathtest_bare()
5 changes: 5 additions & 0 deletions test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,11 @@ end
include("heatbathtest_nowing.jl")
end

@testset "heatbath_bare" begin
println("heatbath_bare")
include("heatbathtest_bare.jl")
end


@testset "heatbath with plaq and rect actions" begin
println("heatbath with plaq and rect actions")
Expand Down

0 comments on commit 7f0180b

Please sign in to comment.