DOCUMENTATION
READER
juobs.read_mesons
— Functionread_mesons(path::String, g1::Union{String, Nothing}=nothing, g2::Union{String, Nothing}=nothing; id::Union{Int64, Nothing}=nothing)
read_mesons(path::Vector{String}, g1::Union{String, Nothing}=nothing, g2::Union{String, Nothing}=nothing; id::Union{Int64, Nothing}=nothing)
This function read a mesons dat file at a given path and returns a vector of CData
structures for different masses and Dirac structures. Dirac structures g1
and/or g2
can be passed as string arguments in order to filter correaltors. ADerrors id can be specified as argument. If is not specified, the id
is fixed according to the ensemble name (example: "H400"-> id = 400)
Examples:
read_mesons(path)
read_mesons(path, "G5")
read_mesons(path, nothing, "G5")
read_mesons(path, "G5", "G5")
read_mesons(path, "G5", "G5", id=1)
read_mesons([path1, path2], "G5", "G5")
juobs.read_ms
— Functionread_ms(path::String; id::Union{Int64, Nothing}=nothing, dtr::Int64=1)
Reads openQCD ms dat files at a given path. This method return YData:
t(t)
: flow time valuesYsl(icfg, x0, t)
: the time-slice sums of the densities of the Yang-Mills actionvtr
: vector that contains trajectory numberid
: ensmble id
Examples:
Y = read_ms(path)
juobs.read_ms1
— Functionread_ms1(path::String; v::String="1.2")
Reads openQCD ms1 dat files at a given path. This method returns a matrix W[irw, icfg]
that contains the reweighting factors, where irw
is the rwf
index and icfg the configuration number. The function is compatible with the output files of openQCD v=1.2, 1.4 and 1.6. Version can be specified as argument.
Examples:
read_ms1(path)
read_ms1(path, v="1.4")
read_ms1(path, v="1.6")
juobs.read_md
— Functionread_md(path::String)
Reads openQCD pbp.dat files at a given path. This method returns a matrix md[irw, icfg]
that contains the derivatives $dS/dm$, where $md[irw=1] = dS/dm_l$ and $md[irw=2] = dS/dm_s$
$Seff = -tr(log(D+m))$
$dSeff/ dm = -tr((D+m)^-1)$
Examples:
md = read_md(path)
juobs.truncate_data!
— Functiontruncate_data!(data::YData, nc::Int64)
truncate_data!(data::Vector{YData}, nc::Vector{Int64})
truncate_data!(data::Vector{CData}, nc::Int64)
truncate_data!(data::Vector{Vector{CData}}, nc::Vector{Int64})
Truncates the output of read_mesons
and read_ms
taking the first nc
configurations.
Examples:
#Single replica
dat = read_mesons(path, "G5", "G5")
Y = read_ms(path)
truncate_data!(dat, nc)
truncate_data!(Y, nc)
#Two replicas
dat = read_mesons([path1, path2], "G5", "G5")
Y = read_ms.([path1_ms, path2_ms])
truncate_data!(dat, [nc1, nc2])
truncate_data!(Y, [nc1, nc2])
TOOLS
juobs.corr_obs
— Functioncorr_obs(cdata::CData; real::Bool=true, rw::Union{Array{Float64, 2}, Nothing}=nothing, L::Int64=1)
corr_obs(cdata::Array{CData, 1}; real::Bool=true, rw::Union{Array{Array{Float64, 2}, 1}, Nothing}=nothing, L::Int64=1)
Creates a Corr
struct with the given CData
struct cdata
(read_mesons
) for a single replica. An array of CData
can be passed as argument for multiple replicas.
The flag real
select the real or imaginary part of the correlator. If rw
is specified, the method applies reweighting. rw
is passed as a matrix of Float64 (read_ms1
) The correlator can be normalized with the volume factor if L
is fixed.
#Single replica
data = read_mesons(path, "G5", "G5")
rw = read_ms1(path_rw)
corr_pp = corr_obs.(data)
corr_pp_r = corr_obs.(data, rw=rw)
#Two replicas
data = read_mesons([path_r1, path_r2], "G5", "G5")
rw1 = read_ms1(path_rw1)
rw2 = read_ms1(path_rw2)
corr_pp = corr_obs.(data)
corr_pp_r = corr_obs.(data, rw=[rw1, rw2])
juobs.md_sea
— Functionmd_sea(a::uwreal, md::Vector{Matrix{Float64}}, ws::ADerrors.wspace=ADerrors.wsg)
Computes the derivative of an observable A with respect to the sea quark masses.
$d <A> / dm(sea) = \sum_i (d<A> / d<O_i>) * (d<O_i> / dm(sea))$
$d <O> / dm(sea) = <O> <dS/dm> - <O dS/dm> = - <(O - <O>) (dS/dm - <dS/dm>)>$
where $O_i$ are primary observables
md is a vector that contains the derivative of the action S with respect to the sea quark masses for each replica. md[irep][irw, icfg]
md_sea returns a tuple of uwreal observables (dA/dml, dA/dms)|sea, where ml and ms are the light and strange quark masses.
#Single replica
data = read_mesons(path, "G5", "G5")
md = read_md(path_md)
corr_pp = corr_obs.(data)
m = meff(corr_pp[1], plat)
m_mdl, m_mds = md_sea(m, [md], ADerrors.wsg)
m_shifted = m + 2 * dml * m_mdl + dms * m_mds
#Two replicas
data = read_mesons([path_r1, path_r2], "G5", "G5")
md1 = read_md(path_md1)
md2 = read_md(path_md2)
corr_pp = corr_obs.(data)
m = meff(corr_pp[1], plat)
m_mdl, m_mds = md_sea(m, [md1, md2], ADerrors.wsg)
m_shifted = m + 2 * dml * m_mdl + dms * m_mds
juobs.lin_fit
— Functionlin_fit(x::Vector{<:Real}, y::Vector{uwreal})
Computes a linear fit of uwreal data points y. This method return uwreal fit parameters and chisqexpected.
fitp, csqexp = lin_fit(phi2, m2)
m2_phys = fitp[1] + fitp[2] * phi2_phys
juobs.fit_routine
— Functionfit_routine(model::Function, xdata::Array{<:Real}, ydata::Array{uwreal}, param::Int64=3; wpm::Union{Dict{Int64,Vector{Float64}},Dict{String,Vector{Float64}}, Nothing}=nothing)
fit_routine(model::Function, xdata::Array{uwreal}, ydata::Array{uwreal}, param::Int64=3; wpm::Union{Dict{Int64,Vector{Float64}},Dict{String,Vector{Float64}}, Nothing}=nothing, covar::Bool=false)
Given a model function with a number param of parameters and an array of uwreal
, this function fit ydata with the given model
and print fit information The method return an array upar
with the best fit parameters with their errors. The flag wpm
is an optional array of Float64 of lenght 4. The first three paramenters specify the criteria to determine the summation windows:
vp[1]
: The autocorrelation function is summed up to $t = round(vp[1])$.vp[2]
: The sumation window is determined using U. Wolff poposal with $S_\tau = wpm[2]$vp[3]
: The autocorrelation function $\Gamma(t)$ is summed up a point where its error $\delta\Gamma(t)$ is a factorvp[3]
times larger than the signal.
An additional fourth parameter vp[4]
, tells ADerrors to add a tail to the error with $\tau_{exp} = wpm[4]$. Negative values of wpm[1:4]
are ignored and only one component of wpm[1:3]
needs to be positive. If the flag covar
is set to true, fit_routine
takes into account covariances between x and y for each data point.
@. model(x,p) = p[1] + p[2] * exp(-(p[3]-p[1])*x)
@. model2(x,p) = p[1] + p[2] * x[:, 1] + (p[3] + p[4] * x[:, 1]) * x[:, 2]
fit_routine(model, xdata, ydata, param=3)
fit_routine(model, xdata, ydata, param=3, covar=true)
LINEAR ALGEBRA
juobs.uweigvals
— Functionuweigvals(a::Matrix{uwreal}; iter = 30)
uweigvals(a::Matrix{uwreal}, b::Matrix{uwreal}; iter = 30)
This function computes the eigenvalues of a matrix of uwreal objects. If a second matrix b is given as input, it returns the generalised eigenvalues instead. It takes as input:
a::Matrix{uwreal}
: a matrix of uwrealb::Matrix{uwreal}
: a matrix of uwreal, optional
It returns:
res = Vector{uwreal}
: a vector where each elements is an eigenvalue
juobs.uweigvecs
— Functionuweigvecs(a::Matrix{uwreal}; iter = 30)
uweigvecs(a::Matrix{uwreal}, b::Matrix{uwreal}; iter = 30)
This function computes the eigenvectors of a matrix of uwreal objects. If a second matrix b is given as input, it returns the generalised eigenvectors instead. It takes as input:
a::Matrix{uwreal}
: a matrix of uwrealb::Matrix{uwreal}
: a matrix of uwreal, optional
It returns:
res = Matrix{uwreal}
: a matrix where each column is an eigenvector
juobs.uweigen
— Functionuweigen(a::Matrix{uwreal}; iter = 30)
uweigen(a::Matrix{uwreal}, b::Matrix{uwreal}; iter = 30)
This function computes the eigenvalues and the eigenvectors of a matrix of uwreal objects. If a second matrix b is given as input, it returns the generalised eigenvalues and eigenvectors instead. It takes as input:
`a::Matrix{uwreal} : a matrix of uwreal
b::Matrix{uwreal}
: a matrix of uwreal, optional
It returns:
evals = Vector{uwreal}
: a vector where each elements is an eigenvalueevecs = Matrix{uwreal}
: a matrix where the i-th column is the eigenvector of the i-th eigenvalue
juobs.get_matrix
— Functionget_matrix(corr_diag::Vector{Array}, corr_upper::Vector{Array} )
This method returns an array of dim T
where each element is a symmetrix matrix of dimension n of uwreal
correlators at fixed time i=1..T. It takes as input:
corr_diag
: vector of dimension n of correlators liying on the diagonal
corr_upper
: vector of correlators liying on the upper diagonal.
Each correlator is an vector of uwreal variables of dimension T
.
Example:
for i in 1:n
a[i,i] = Vector{uwreal} # vector of uwreal variables of dimension T. They will constitute the diagonal elements of the matrices
for i in 1:n-1
for j in i+1:n
a[i,j] = Vector{uwreal} # vector of uwreal variables of dimension T. They will constitute the upper diagonal elements of the matrices. A matrix
of dimension n*n has n(n-1)/2 upper diagonal elements.
Assume n=4
diagonal = Vector{Array}()
push!(diagonal, a[1,1],a[2,2],a[3,3],a[4,4])
upsize = Vector{Array}()
push!(upsize, a[1,2], a[1,3], a[1,4], a[2,3], a[2,4], a[3,4])
array_of_matrices = get_matrix(diagonal, upsize)
Julia> T-element Array{Array,1}
size(array_of_matrices)
Julia> (T,)
array_of_matrices[t] # t in 1:T
Julia> 4*4 Array{uwreal,2}
juobs.energies
— Functionenergies(evals::Vector{Array})
Given a vector where each entry evals[t]
is a uwreal
array of eigenvalues, this method computes the effective energies of the first N states, where N=dim(evals[t])
. The index t
here runs from 1:T=lenght(evals), while the index i
stands for the number of energy levels computed: i = length(evals[t]) It returns a vector array eff_en
where each entry eff_en[t]
contains the first N states energies as uwreal objects
juobs.getall_eigvals
— Functiongetall_eigvals(a::Vector{Matrix}, t0; iter=30 )
This function solves a GEVP problem, returning the eigenvalues, for a list of matrices, taking as generalised matrix the one at index t0, i.e:
$C(t_i)v_i = λ_i C(t_0) v_i$, with i=1:lenght(a)
It takes as input:
a::Vector{Matrix}
: a vector of matricest0::Int64
: idex value at which the fixed matrix is takeniter=30
: the number of iterations of the qr algorithm used to extract the eigenvalues
It returns:
res
= Vector{Vector{uwreal}}
where res[i]
are the generalised eigenvalues of the i-th matrix of the input array.
Examples:
mat_array = get_matrix(diag, upper_diag)
evals = getall_eigvals(mat_array, 5)
juobs.getall_eigvecs
— Functiongetall_eigvecs(a::Vector{Matrix}, delta_t; iter=30 )
This function solves a GEVP problem, returning the eigenvectors, for a list of matrices.
$C(t_i)v_i = λ_i C(t_i-\delta_t) v_i$, with i=1:lenght(a)
Here delta_t
is the time shift within the two matrices of the problem, and is kept fixed. It takes as input:
a::Vector{Matrix}
: a vector of matricesdelta_t::Int64
: the fixed time shift t-t_0iter=30
: the number of iterations of the qr algorithm used to extract the eigenvalues
It returns:
res
= Vector{Matrix{uwreal}}
where each res[i]
is a matrix with the eigenvectors as columns Examples:
mat_array = get_matrix(diag, upper_diag)
evecs = getall_eigvecs(mat_array, 5)
OBSERVABLES
juobs.meff
— Functionmeff(corr::Vector{uwreal}, plat::Vector{Int64}; pl::Bool=true, data::Bool=false )
meff(corr::Corr, plat::Vector{Int64}; pl::Bool=true, data::Bool=false)
Computes effective mass for a given correlator corr at a given plateau plat
. Correlator can be passed as an Corr
struct or Vector{uwreal}
.
The flags pl
and data
allow to show the plots and return data as an extra result.
data = read_mesons(path, "G5", "G5")
corr_pp = corr_obs.(data)
m = meff(corr_pp[1], [50, 60], pl=false)
juobs.dec_const_pcvc
— Functiondec_const_pcvc(corr::Vector{uwreal}, plat::Vector{Int64}, m::uwreal, mu::Vector{Float64}, y0::Int64 ; pl::Bool=true, data::Bool=false)meff(corr::Corr, plat::Vector{Int64}; pl::Bool=true, data::Bool=false)
dec_const_pcvc(corr::Corr, plat::Vector{Int64}, m::uwreal; pl::Bool=true, data::Bool=false)
Computes decay constant using the PCVC relation for twisted mass fermions. The decay constant is computed in the plateau plat
. Correlator can be passed as an Corr
struct or Vector{uwreal}
. If it is passed as a uwreal vector, vector of twisted masses mu
and source position y0
must be specified.
The flags pl
and data
allow to show the plots and return data as an extra result.
data = read_mesons(path, "G5", "G5")
corr_pp = corr_obs.(data)
m = meff(corr_pp[1], [50, 60], pl=false)
f = dec_const_pcvc(corr_pp[1], [50, 60], m, pl=false)
juobs.comp_t0
— Functioncomp_t0(Y::YData, plat::Vector{Int64}; L::Int64, pl::Bool=false, rw::Union{Matrix{Float64}, Nothing}=nothing, npol::Int64=2)
comp_t0(Y::Vector{YData}, plat::Vector{Int64}; L::Int64, pl::Bool=false, rw::Union{Vector{Matrix{Float64}}, Nothing}=nothing, npol::Int64=2)
Computes t0
using the energy density of the action Ysl
(Yang-Mills action). t0
is computed in the plateau plat
. A polynomial interpolation in t
is performed to find t0
, where npol
is the degree of the polynomial (linear fit by default)
The flag pl
allows to show the plot.
#Single replica
Y = read_ms(path)
rw = read_ms(path_rw)
t0 = comp_t0(Y, [38, 58], L=32)
t0_r = comp_t0(Y, [38, 58], L=32, rw=rw)
#Two replicas
Y1 = read_ms(path1)
Y2 = read_ms(path2)
rw1 = read_ms(path_rw1)
rw2 = read_ms(path_rw2)
t0 = comp_t0([Y1, Y2], [38, 58], L=32, pl=true)
t0_r = comp_t0(Y, [38, 58], L=32, rw=[rw1, rw2], pl=true)