mirror of
https://igit.ific.uv.es/alramos/latticegpu.jl.git
synced 2025-06-29 21:39:27 +02:00
Added import for CERN format. Corrected bug in Qtop
This commit is contained in:
parent
230493c9ce
commit
1ab51e0727
5 changed files with 69 additions and 10 deletions
|
@ -45,3 +45,47 @@ function import_lex64(fname, lp::SpaceParm)
|
|||
|
||||
return CuArray(Ucpu), Ubnd
|
||||
end
|
||||
|
||||
"""
|
||||
function import_cern64(fname::String, ibc, lp::SpaceParm)
|
||||
|
||||
import a double precision configuration in CERN format.
|
||||
"""
|
||||
function import_cern64(fname, ibc, lp::SpaceParm; log=true)
|
||||
|
||||
fp = open(fname, "r")
|
||||
iL = Vector{Int32}(undef, 4)
|
||||
read!(fp, iL)
|
||||
avgpl = Vector{Float64}(undef, 1)
|
||||
read!(fp, avgpl)
|
||||
if log
|
||||
println("# [import_cern64] Read from conf file: ", iL, " (plaq: ", avgpl, ")")
|
||||
end
|
||||
|
||||
dtr = [4,1,2,3]
|
||||
assign(V, ic) = SU3{Float64}(V[1,ic],V[2,ic],V[3,ic],V[4,ic],V[5,ic],V[6,ic])
|
||||
|
||||
Ucpu = Array{SU3{Float64}, 3}(undef, lp.bsz, lp.ndim, lp.rsz)
|
||||
V = Array{ComplexF64, 2}(undef, 9, 2)
|
||||
for i4 in 1:lp.iL[4]
|
||||
for i1 in 1:lp.iL[1]
|
||||
for i2 in 1:lp.iL[2]
|
||||
for i3 in 1:lp.iL[3]
|
||||
if (mod(i1+i2+i3+i4-4, 2) == 1)
|
||||
b, r = point_index(CartesianIndex(i1,i2,i3,i4), lp)
|
||||
for id in 1:lp.ndim
|
||||
read!(fp, V)
|
||||
Ucpu[b,dtr[id],r] = assign(V, 1)
|
||||
|
||||
bd, rd = dw((b,r), dtr[id], lp)
|
||||
Ucpu[bd,dtr[id],rd] = assign(V, 2)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
close(fp)
|
||||
|
||||
return CuArray(Ucpu)
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue