diff --git a/docs/make.jl b/docs/make.jl index f17a9fd..b06156d 100644 --- a/docs/make.jl +++ b/docs/make.jl @@ -9,8 +9,8 @@ makedocs(sitename="LatticeGPU", modules=[LatticeGPU], doctest=true, "LatticeGPU.jl" => "index.md", "Space-time" => "space.md", "Groups and algebras" => "groups.md", - "Fields" => "fields.md" - "Dirac" => "dirac.md" + "Fields" => "fields.md", + "Dirac" => "dirac.md", "Solvers" => "solvers.md" - ], + ], repo = "https://igit.ific.uv.es/alramos/latticegpu.jl") diff --git a/docs/src/dirac.md b/docs/src/dirac.md index bcca0d3..30c59a9 100644 --- a/docs/src/dirac.md +++ b/docs/src/dirac.md @@ -28,24 +28,21 @@ Wilson-Dirac operator. The action of the Dirac operator `Dw!` is the following: ```math -D\psi (\vec{x} = x_1,x_2,x_3,x_4) = (4 + m_0)psi(\vec{x}) +D_w\psi (\vec{x} = x_1,x_2,x_3,x_4) = (4 + m_0)\psi(\vec{x}) - ``` ```math - - \frac{1}{2}\sum_{\mu = 1}^4 \theta (\mu) (1-\gamma_\mu) U_\mu(\vec{x}) \psi(\vec{x} + \hat{\mu}) -``` -```math - + \theta^* (\mu) (1 + \gamma_\mu) U^{-1}_\mu(\vec{x} - \hat{\mu}) \psi(\vec{x} - \hat{\mu}) + - \frac{1}{2}\sum_{\mu = 1}^4 \theta (\mu) (1-\gamma_\mu) U_\mu(\vec{x}) \psi(\vec{x} + \hat{\mu}) + \theta^* (\mu) (1 + \gamma_\mu) U^{-1}_\mu(\vec{x} - \hat{\mu}) \psi(\vec{x} - \hat{\mu}) ``` where $$m_0$$ and $$\theta$$ are respectively the values `.m0` and `.th` of [`DiracParam`](@ref). -Note that $$|\theta(i)|=1$$ is not built into the code, so it should be imposed explicitly. +Note that $$|\theta(\mu)|=1$$ is not built into the code, so it should be imposed explicitly. Additionally, if |`dpar.csw`| > 1.0E-10, the clover term is assumed to be stored in `ymws.csw`, which -can be done via the [`Csw`](@ref) function. In this case we have the Sheikholeslami–Wohlert (SW) term +can be done via the [`Csw!`](@ref) function. In this case we have the Sheikholeslami–Wohlert (SW) term in `Dw!`: ```math - \frac{i}{2}c_{sw} \sum_{\pi = 1}^6 F^{cl}_\pi \sigma_\pi \psi(\vec{x}) + \delta D_w^{sw} = \frac{i}{2}c_{sw} \sum_{\pi = 1}^6 F^{cl}_\pi \sigma_\pi \psi(\vec{x}) ``` where the $$\sigma$$ matrices are those described in the `Spinors` module and the index $$\pi$$ runs as specified in `lp.plidx`. @@ -54,7 +51,7 @@ If the boudary conditions, defined in `lp`, are either `BC_SF_ORBI,D` or `BC_SF_ improvement term ```math - (c_t -1) (\delta_{x_4,a} \psi(\vec{x}) + \delta_{x_4,T-a} \psi(\vec{x})) + \delta D_w^{SF} = (c_t -1) (\delta_{x_4,a} \psi(\vec{x}) + \delta_{x_4,T-a} \psi(\vec{x})) ``` is added. Since the time-slice $$t=T$$ is not stored, this accounts to modifying the second and last time-slice. @@ -66,7 +63,7 @@ in the first time-slice is zero. To enforce this, we have the function SF_bndfix! ``` -The function [`Csw`](@ref) is used to store the clover in `dws.csw`. It is computed +The function [`Csw!`](@ref) is used to store the clover in `dws.csw`. It is computed according to the expression ```math @@ -76,9 +73,13 @@ F_{\mu,\nu} = \frac{1}{8} (Q_{\mu \nu} - Q_{\nu \mu}) where ```math Q_{\mu\nu} = U_\mu(\vec{x})U_{\nu}(x+\mu)U_{\mu}^{-1}(\vec{x}+\nu)U_{\nu}(\vec{x}) + -+ U_{\nu}^{-1}(\vec{x}-\nu) U_\mu (\vec{x}-\nu) U_{\nu}(\vec{x} +\mu - \nu) U^{-1}_{\mu}(\vec{x}) + +U_{\nu}^{-1}(\vec{x}-\nu) U_\mu (\vec{x}-\nu) U_{\nu}(\vec{x} +\mu - \nu) U^{-1}_{\mu}(\vec{x}) + +``` +```math + U^{-1}_{\mu}(x-\mu)U_\nu^{-1}(\vec{x} - \mu - \nu)U_\mu(\vec{x} - \mu - \nu)U_\nu^{-1}(x-\nu) + -+ U_{\nu}(\vec{x})U_{\mu}^{-1}(\vec{x} + \nu - \mu)U^{-1}_{\nu}(\vec{x} - \mu)U_\mu(\vec{x}-\mu) +``` +```math ++U_{\nu}(\vec{x})U_{\mu}^{-1}(\vec{x} + \nu - \mu)U^{-1}_{\nu}(\vec{x} - \mu)U_\mu(\vec{x}-\mu) ``` @@ -91,7 +92,8 @@ F[b,4,r] \to F_{31}(b,r) ,\quad F[b,5,r] \to F_{32}(b,r) ,\quad F[b,6,r] \to F_{ ``` where $$(b,r)$$ labels the lattice points as explained in the module `Space` -The function [`pfrandomize!`](@ref), userfull for stochastic sources, is also present. +The function [`pfrandomize!`](@ref), userfull for stochastic sources, is also present. It +randomizes a fermion field either in all the space or in a specifit time-slice. The generic interface of these functions reads diff --git a/docs/src/spinors.md b/docs/src/spinors.md new file mode 100644 index 0000000..16675bc --- /dev/null +++ b/docs/src/spinors.md @@ -0,0 +1,86 @@ +# Spinors + +The module Spinors defines the necessary functions for the structure `Spinor{NS,G}`, +which is a NS-tuple with values in G. + +The functions `norm`, `norm2`, `dot`, `*`, `/`, `/`, `+`, `-`, `imm` and `mimm`, +if defined for G, are extended to Spinor{NS,G} for general NS. + +For the 4d case where NS = 4 there are some specific functions to implement different +operations with the gamma matrices. The convention for these matrices is + + +```math +\gamma _4 = \left( + \begin{array}{cccc} + 0 & 0 & -1 & 0\\ + 0 & 0 & 0 & -1\\ + -1 & 0 & 0 & 0\\ + 0 & -1 & 0 & 0\\ + \end{array} + \right) + \quad + \gamma_1 = \left( + \begin{array}{cccc} + 0 & 0 & 0 & -i\\ + 0 & 0 & -i & 0\\ + 0 & i & 0 & 0\\ + i & 0 & 0 & 0\\ + \end{array} + \right) +``` +```math + \gamma _2 = \left( + \begin{array}{cccc} + 0 & 0 & 0 & -1\\ + 0 & 0 & 1 & 0\\ + 0 & 1 & 0 & 0\\ + -1 & 0 & 0 & 0\\ + \end{array} + \right) + \quad + \gamma_3 = \left( + \begin{array}{cccc} + 0 & 0 & -i & 0\\ + 0 & 0 & 0 & i\\ + i & 0 & 0 & 0\\ + 0 & -i & 0 & 0\\ + \end{array} + \right) +``` + + +The function [`dmul`](@ref) implements the multiplication over the $$\gamma$$ matrices + +```@docs +dmul +``` + +The function [`pmul`](@ref) implements the $$ (1 \pm \gamma_N) $$ proyectors. The functions +[`gpmul`](@ref) and [`gdagpmul`](@ref) do the same and then multiply each element by `g`and +g^-1 repectively. + +```@docs +pmul +gpmul +gdagpmul +``` + +## Some examples + +Here we just display some examples for these functions. We display it with `ComplexF64` +instead of `SU3fund` or `SU2fund` for simplicity. + + +```@setup exs +import Pkg # hide +Pkg.activate("/home/alberto/code/julia/LatticeGPU/") # hide +using LatticeGPU # hide +``` +```@repl exs +spin = Spinor{4,Complex{Float64}}((1.0,im*0.5,2.3,0.0)) +println(spin) +println(dmul(Gamma{4},spin)) +println(pmul(Pgamma{2,-1},spin)) + +``` diff --git a/src/Dirac/Dirac.jl b/src/Dirac/Dirac.jl index 6ca05e9..5655287 100644 --- a/src/Dirac/Dirac.jl +++ b/src/Dirac/Dirac.jl @@ -522,7 +522,6 @@ end Applies the operator \`\` \\gamma_5 D_w \`\` twice to `si` and stores the result in `so`. This is equivalent to appling the operator \`\` \`\` The Dirac operator is the same as in the functions `Dw!` and `g5Dw!` """ - function DwdagDw!(so, U, si, dpar::DiracParam, dws::DiracWorkspace, lp::Union{SpaceParm{4,6,BC_SF_ORBI,D},SpaceParm{4,6,BC_SF_AFWB,D}}) where {D} if abs(dpar.csw) > 1.0E-10 diff --git a/src/LatticeGPU.jl b/src/LatticeGPU.jl index 6c615b1..c091ac3 100644 --- a/src/LatticeGPU.jl +++ b/src/LatticeGPU.jl @@ -50,7 +50,7 @@ export import_lex64, import_cern64, import_bsfqcd, save_cnfg, read_cnfg, read_gp include("Spinors/Spinors.jl") using .Spinors -export Spinor, Pgamma +export Spinor, Pgamma, Gamma export imm, mimm export pmul, gpmul, gdagpmul, dmul diff --git a/src/Solvers/CG.jl b/src/Solvers/CG.jl index 684090e..ffec5d4 100644 --- a/src/Solvers/CG.jl +++ b/src/Solvers/CG.jl @@ -29,7 +29,7 @@ end """ - function CG! + function CG!(si, U, A, dpar::DiracParam, lp::SpaceParm, dws::DiracWorkspace{T}, maxiter::Int64 = 10, tol=1.0) Solves the linear equation `Ax = si` """ @@ -75,4 +75,4 @@ function CG!(si, U, A, dpar::DiracParam, lp::SpaceParm, dws::DiracWorkspace{T}, end return niter -end \ No newline at end of file +end diff --git a/src/Spinors/Spinors.jl b/src/Spinors/Spinors.jl index 6b8a46b..1cd29ea 100644 --- a/src/Spinors/Spinors.jl +++ b/src/Spinors/Spinors.jl @@ -169,7 +169,7 @@ end """ - gpmul(pgamma{N,S}, g::G, a::Spinor) G <: Group + gpmul(Pgamma{N,S}, g::G, a::Spinor) G <: Group Returns ``g(1+s\\gamma_N)a`` """ @@ -226,7 +226,7 @@ end end """ - gdagpmul(pgamma{N,S}, g::G, a::Spinor) G <: Group + gdagpmul(Pgamma{N,S}, g::G, a::Spinor) G <: Group Returns ``g^+ (1+s\\gamma_N)a`` """ @@ -284,33 +284,33 @@ end # dummy structs for dispatch: -# Basis of \\Gamma_n +# Basis of \\gamma_n struct Gamma{N} end """ - dmul(n::Int64, a::Spinor) + dmul(Gamma{n}, a::Spinor) -Returns ``\\Gamma_n a`` +Returns ``\\gamma_n a`` -indexing for Dirac basis ``\\Gamma_n``: +indexing for Dirac basis ``\\gamma_n``: - 1 gamma1 - 2 gamma2 - 3 gamma3 - 4 gamma0 - 5 gamma5 - 6 gamma1 gamma5 - 7 gamma2 gamma5 - 8 gamma3 gamma5 - 9 gamma0 gamma5 -10 sigma01 -11 sigma02 -12 sigma03 -13 sigma21 -14 sigma32 -15 sigma31 -16 identity + 1 gamma1; + 2 gamma2; + 3 gamma3; + 4 gamma0; + 5 gamma5; + 6 gamma1 gamma5; + 7 gamma2 gamma5; + 8 gamma3 gamma5; + 9 gamma0 gamma5; +10 sigma01; +11 sigma02; +12 sigma03; +13 sigma21; +14 sigma32; +15 sigma31; +16 identity; """ @inline dmul(::Type{Gamma{1}}, a::Spinor{NS,G}) where {NS,G} = Spinor{NS,G}((mimm(a.s[4]), mimm(a.s[3]), imm(a.s[2]), imm(a.s[1])))