mirror of
https://igit.ific.uv.es/alramos/latticegpu.jl.git
synced 2025-05-14 19:23:42 +02:00
read_gp function
This commit is contained in:
parent
0aae72ccea
commit
107586289a
3 changed files with 49 additions and 2 deletions
|
@ -45,7 +45,7 @@ export Eoft_clover, Eoft_plaq, Qtop
|
|||
export FlowIntr, wfl_euler, zfl_euler, wfl_rk2, zfl_rk2, wfl_rk3, zfl_rk3
|
||||
export flw, flw_adapt
|
||||
export sfcoupling, bndfield, setbndfield
|
||||
export import_lex64, import_cern64, import_bsfqcd, save_cnfg, read_cnfg
|
||||
export import_lex64, import_cern64, import_bsfqcd, save_cnfg, read_cnfg, read_gp
|
||||
|
||||
include("Spinors/Spinors.jl")
|
||||
|
||||
|
|
|
@ -147,6 +147,6 @@ include("YMsf.jl")
|
|||
export sfcoupling, bndfield, setbndfield
|
||||
|
||||
include("YMio.jl")
|
||||
export import_lex64, import_cern64, import_bsfqcd, save_cnfg, read_cnfg
|
||||
export import_lex64, import_cern64, import_bsfqcd, save_cnfg, read_cnfg, read_gp
|
||||
|
||||
end
|
||||
|
|
|
@ -297,3 +297,50 @@ function import_cern64(fname, ibc, lp::SpaceParm; log=true)
|
|||
|
||||
return CuArray(Ucpu)
|
||||
end
|
||||
|
||||
|
||||
|
||||
"""
|
||||
read_gp(fname::String)
|
||||
|
||||
Reads Gauge parameters from file `fname` using the native (BDIO) format. Returns GaugeParm and SpaceParm.
|
||||
"""
|
||||
function read_gp(fname::String)
|
||||
|
||||
UID_HDR = 14
|
||||
fb = BDIO_open(fname, "r")
|
||||
while BDIO_get_uinfo(fb) != UID_HDR
|
||||
BDIO_seek!(fb)
|
||||
end
|
||||
ihdr = Vector{Int32}(undef, 2)
|
||||
BDIO_read(fb, ihdr)
|
||||
if (ihdr[1] != convert(Int32, 1653996111)) && (ihdr[2] != convert(Int32, 2))
|
||||
error("Wrong file format [header]")
|
||||
end
|
||||
|
||||
run = BDIO.BDIO_read_str(fb)
|
||||
|
||||
while BDIO_get_uinfo(fb) != 1
|
||||
BDIO_seek!(fb)
|
||||
end
|
||||
|
||||
ifoo = Vector{Int32}(undef, 4)
|
||||
BDIO_read(fb, ifoo)
|
||||
ndim = convert(Int64, ifoo[1])
|
||||
npls = convert(Int64, round(ndim*(ndim-1)/2))
|
||||
ibc = convert(Int64, ifoo[2])
|
||||
nf = ifoo[4]
|
||||
|
||||
ifoo = Vector{Int32}(undef, ndim+convert(Int32, npls))
|
||||
BDIO_read(fb, ifoo)
|
||||
iL = ntuple(i -> convert(Int64, ifoo[i]),ndim)
|
||||
ntw = ntuple(i -> convert(Int64, ifoo[i+ndim]), npls)
|
||||
|
||||
dfoo = Vector{Float64}(undef, 4)
|
||||
BDIO_read(fb, dfoo)
|
||||
|
||||
lp = SpaceParm{ndim}(iL, (4,4,4,4), ibc, ntw)
|
||||
gp = GaugeParm{Float64}(SU3{Float64}, dfoo[1], dfoo[2])
|
||||
|
||||
return gp, lp
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue