Commit 3db1c2e2 authored by Alejandro Saez's avatar Alejandro Saez

md_val for new version

Julien's most updated code has all valence derivatives with the sign changed, so md_val needs to flip the sign. Also, the reader does not write "_d1, _d2" in the derivatives anymore for the new data files, so md_val does not look for "_d1, _d2". You need to select by hand which correlators are your valence derivatives, looking at the log file e.g.
parent 85034d61
......@@ -91,6 +91,10 @@ ADerrors id can be specified as argument. If is not specified, the `id` is fixed
*For the old version (without smearing, distance preconditioning and theta) set legacy=true.
For Julien's most updated inversion code, the sign of the valence derivatives is flipped. Note also that for the new dat files version, no `_d1, _d2`
is written by the reader, so you must select by hand (looking at the log files e.g.) which are you derivative correlators. In the log file, the
derivative correlators are signaled by `seq_prop=some number`.
Examples:
```@example
read_mesons(path)
......
......@@ -21,14 +21,20 @@ function apply_rw(data::Vector{<:Array{Float64}}, W::Vector{Matrix{Float64}})
return (data_r, rw)
end
function check_corr_der(obs::Corr, derm::Vector{Corr})
function check_corr_der(obs::Corr, derm::Vector{Corr}; new_version::Bool=false)
g1 = Vector{String}(undef, 0)
g2 = Vector{String}(undef, 0)
for d in derm
aux = [d.gamma[1], d.gamma[2]]
push!(g1, aux[1][1:end-3])
push!(g2, aux[2][1:end-3])
if !new_version
aux = [d.gamma[1], d.gamma[2]]
push!(g1, aux[1][1:end-3])
push!(g2, aux[2][1:end-3])
else
aux = [d.gamma[1], d.gamma[2]]
push!(g1, aux[1][1:end])
push!(g2, aux[2][1:end])
end
end
h = copy(derm)
......@@ -388,9 +394,14 @@ function md_sea(a::uwreal, md::Vector{Matrix{Float64}}, ow::Array{uwreal}, w::Un
end
@doc raw"""
md_val(a::uwreal, obs::Corr, derm::Vector{Corr})
md_val(a::uwreal, obs::Corr, derm::Vector{Corr}; new_version::Bool=false)
Computes the derivative of an observable A with respect to the valence quark masses.
Computes the derivative of an observable A with respect to the valence quark masses.
If `new_version=true`, then the sign of the valence derivatives in `derm` is flipped
(Julien's most updated code has the sign changed for the valence derivatives). Note
also that for the new dat files version, no `_d1, _d2` is written by the reader, so
you must select by hand (looking at the log files e.g.) which are you derivative
correlators. In the log file, the derivative correlators are signaled by `seq_prop=some number`.
``\frac{d <A>}{dm(val)} = \sum_i \frac{\partial <A>}{\partial <O_i>} \frac{d <O_i>}{d m(val)}``
......@@ -421,7 +432,7 @@ m_md1, m_md2 = md_val(m, corr_pp[1], derm[1])
m_shifted = m + dm1 * m_md1 + dm2 * m_md2
```
"""
function md_val(a::uwreal, obs::Corr, derm::Vector{Corr})
function md_val(a::uwreal, obs::Corr, derm::Vector{Corr}; new_version::Bool=false)
nid = neid(a)
if nid != 1
error("Error: neid > 1")
......@@ -429,7 +440,7 @@ function md_val(a::uwreal, obs::Corr, derm::Vector{Corr})
if length(derm) != 2
error("Error: length derm != 2")
end
if !check_corr_der(obs, derm)
if !check_corr_der(obs, derm; new_version=new_version)
error("Corr parameters does not match")
end
......@@ -463,7 +474,11 @@ function md_val(a::uwreal, obs::Corr, derm::Vector{Corr})
return nothing
end
derm1, derm2 = derm
return (sum(der .* derm1.obs), sum(der .* derm2.obs))
if !new_version
return (sum(der .* derm1.obs), sum(der .* derm2.obs))
else
return (-sum(der .* derm1.obs), -sum(der .* derm2.obs))
end
end
function plat_av(obs::Vector{uwreal}, plat::Vector{Int64}, wpm::Union{Dict{Int64,Vector{Float64}},Dict{String,Vector{Float64}}, Nothing}=nothing)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment