From ac796d95eb252cb21242946838eda80299da159e Mon Sep 17 00:00:00 2001 From: "Fernando P.Panadero" Date: Fri, 5 Jul 2024 14:34:14 +0200 Subject: [PATCH] Documentation update and sfbndfix included in Dw. --- docs/src/dirac.md | 17 ++++++----------- docs/src/fields.md | 11 +++++++---- docs/src/groups.md | 4 ++-- docs/src/solvers.md | 4 +++- docs/src/spinors.md | 3 +-- src/Dirac/Diracoper.jl | 3 +++ src/Fields/Fields.jl | 4 ++-- src/Groups/GroupSU2.jl | 2 +- src/Space/Space.jl | 20 ++++++++++---------- src/Spinors/Spinors.jl | 35 +++++++++++++++++------------------ src/YM/YM.jl | 20 ++++++++++---------- src/YM/YMflow.jl | 4 ++-- src/YM/YMhmc.jl | 4 ++-- 13 files changed, 66 insertions(+), 65 deletions(-) diff --git a/docs/src/dirac.md b/docs/src/dirac.md index 75a330a..2f7fade 100644 --- a/docs/src/dirac.md +++ b/docs/src/dirac.md @@ -1,7 +1,7 @@ # Dirac operator -The module `Dirac` has the necessary stuctures and function +The module `Dirac` has the necessary structures and functions to simulate non-dynamical 4-dimensional Wilson fermions. There are two main data structures in this module, the structure [`DiracParam`](@ref) @@ -18,7 +18,7 @@ DiracWorkspace The workspace stores four fermion fields, namely `.sr`, `.sp`, `.sAp` and `.st`, used for different purposes. If the representation is either `SU2fund` of `SU3fund`, an extra -field with values in `U2alg`/`U3alg` is created to store the clover, used for the improvent. +field with values in `U2alg`/`U3alg` is created to store the clover, used for the improvement. ## Functions @@ -38,7 +38,7 @@ where $$m_0$$ and $$\theta$$ are respectively the values `.m0` and `.th` of [`Di 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 @@ -53,7 +53,7 @@ improvement term ```math \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 +is added. Since the time-slice $$t=T$$ is not stored, this accounts for modifying the second and last time-slice. Note that the Dirac operator for SF boundary conditions assumes that the value of the field @@ -63,11 +63,6 @@ in the first time-slice is zero. To enforce this, we have the function SF_bndfix! ``` -Note that this is not enforced in the Dirac operators, so if the field `so` does not satisfy SF -boundary conditions, it will not (in general) satisfy them after applying [`Dw!`](@ref) -or [`g5Dw!`](@ref). This function is called for the function [`DwdagDw!`](@ref), so in this case -`so` will always be a proper SF field after calling this function. - The function [`Csw!`](@ref) is used to store the clover in `dws.csw`. It is computed according to the expression @@ -97,8 +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. It -randomizes a fermion field either in all the space or in a specifit time-slice. +The function [`pfrandomize!`](@ref), userful for stochastic sources, is also present. It +randomizes a fermion field, either in all the space or in a specific time-slice. The generic interface of these functions reads diff --git a/docs/src/fields.md b/docs/src/fields.md index 1dc42ab..eae5eab 100644 --- a/docs/src/fields.md +++ b/docs/src/fields.md @@ -1,16 +1,18 @@ # Lattice fields -The module `Fields` include simple routines to define a few typical +The module `Fields` includes simple routines to define a few typical fields. Fields are simple `CuArray` types with special memory layout. A field always has an associated elemental type (i.e. for gauge fields `SU3`, for scalar fields `Float64`). We have: -- scalar fields: One elemental type in each spacetime point. -- vector field: One elemental type at each spacetime point and +- Scalar fields: One elemental type in each spacetime point. +- Vector field: One elemental type at each spacetime point and direction. - `N` scalar fields: `N` elemental types at each spacetime point. +- Tensor fields: One elemental type at each spacetime point and + plane. They are to be thought of as symmetric tensors. -Fields can have **naturaL indexing**, where the memory layout follows +Fields can have **natural indexing**, where the memory layout follows the point-in-block and block indices (see [`SpaceParm`](@ref)). Fields can also have **lexicographic indexing**, where points are labelled by a D-dimensional index (see [`scalar_field_point`](@ref)). @@ -21,6 +23,7 @@ where points are labelled by a D-dimensional index (see [`scalar_field_point`](@ ```@docs scalar_field vector_field +tensor_field nscalar_field scalar_field_point ``` diff --git a/docs/src/groups.md b/docs/src/groups.md index 508ff32..7fa0c1a 100644 --- a/docs/src/groups.md +++ b/docs/src/groups.md @@ -1,7 +1,7 @@ # Groups and Algebras -The module `Groups` contain generic data types to deal with group and +The module `Groups` contains generic data types to deal with group and algebra elements. Group elements $$g\in SU(N)$$ are represented in some compact notation. For the case $$N=2$$ we use two complex numbers (Caley-Dickson representation, i.e. $$g=(z_1,z_2)$$ with @@ -79,7 +79,7 @@ elements. The objective is to get an idea on how group operations We can generate some random group elements. ```@repl exs # Generate random groups elements, -# check they are actually from the grup +# check they are actually from the group g = rand(SU2{Float64}) println("Are we in a group?: ", isgroup(g)) g = rand(SU3{Float64}) diff --git a/docs/src/solvers.md b/docs/src/solvers.md index e6425da..5ea1b90 100644 --- a/docs/src/solvers.md +++ b/docs/src/solvers.md @@ -29,13 +29,15 @@ is given by $$|$$``dws.sr``$$|^2$$. ## Propagators.jl -In this file, we define a couple of useful functions to obtain certain +In this file, we define some useful functions to obtain certain propagators. ```@docs propagator! ``` +Note that the indexing in Julia starts at 1, so the first tiime slice is t=1. + Internally, this function solves the equation ```math diff --git a/docs/src/spinors.md b/docs/src/spinors.md index 16675bc..55443e2 100644 --- a/docs/src/spinors.md +++ b/docs/src/spinors.md @@ -6,7 +6,7 @@ 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 +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 @@ -79,7 +79,6 @@ 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/Diracoper.jl b/src/Dirac/Diracoper.jl index ba363e1..d1d83d4 100644 --- a/src/Dirac/Diracoper.jl +++ b/src/Dirac/Diracoper.jl @@ -453,6 +453,7 @@ function Dw!(so, U, si, dpar::DiracParam, dws::DiracWorkspace, lp::Union{SpacePa end end end + SF_bndfix!(so,lp) return nothing end @@ -545,6 +546,7 @@ function g5Dw!(so, U, si, dpar::DiracParam, dws::DiracWorkspace, lp::Union{Space end end end + SF_bndfix!(so,lp) return nothing end @@ -626,6 +628,7 @@ end 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} + SF_bndfix!(si,lp) if abs(dpar.csw) > 1.0E-10 @timeit "DwdagDw" begin diff --git a/src/Fields/Fields.jl b/src/Fields/Fields.jl index 2d9e307..d7b1c22 100644 --- a/src/Fields/Fields.jl +++ b/src/Fields/Fields.jl @@ -31,7 +31,7 @@ scalar_field(::Type{T}, lp::SpaceParm) where {T} = CuArray{T, 2}(undef, lp.b """ nscalar_field(::Type{T}, n::Integer, lp::SpaceParm) -Returns `n` scalar fields of elemental type `T` +Returns `n` scalar fields of elemental type `T`. """ nscalar_field(::Type{T}, n, lp::SpaceParm) where {T} = CuArray{T, 3}(undef, lp.bsz, n, lp.rsz) @@ -46,7 +46,7 @@ scalar_field_point(::Type{T}, lp::SpaceParm{N,M,D}) where {T,N,M,D} = CuArray{T, """ tensor_field(::Type{T}, lp::SpaceParm) -Returns a tensor field of elemental type `T`. +Returns a (symmetric) tensor field of elemental type `T`. """ tensor_field(::Type{T}, lp::SpaceParm) where {T} = CuArray{T, 3}(undef, lp.bsz, lp.npls, lp.rsz) diff --git a/src/Groups/GroupSU2.jl b/src/Groups/GroupSU2.jl index 6faf622..f1b0282 100644 --- a/src/Groups/GroupSU2.jl +++ b/src/Groups/GroupSU2.jl @@ -36,7 +36,7 @@ norm2(a::SU2{T}) where T <: AbstractFloat = abs2(a.t1) + abs2(a.t2) """ tr(g::T) where T <: Group -Returns the trace of the groups element `g`. +Returns the trace of the group element `g`. """ tr(g::SU2{T}) where T <: AbstractFloat = complex(2*real(g.t1), 0.0) diff --git a/src/Space/Space.jl b/src/Space/Space.jl index 5726454..757fbaf 100644 --- a/src/Space/Space.jl +++ b/src/Space/Space.jl @@ -26,19 +26,19 @@ This structure contains information about the lattice being simulated. The param - `N`: The number of dimensions - `M`: The number of planes (i.e. \`\` N(N-1)/2 \`\`) - `B`: The boundary conditions in Euclidean time. Acceptable values are - - `BC_PERIODIC`: Periodic boundary conditions - - `BC_SF_AFWB`: Schrödinger Funtional Aoki-Frezzoptti-Weisz Choice B. - - `BC_SF_ORBI`: Schrödinger Funtional orbifold constructions. + - `BC_PERIODIC`: Periodic boundary conditions. + - `BC_SF_AFWB`: Schrödinger Functional Aoki-Frezzotti-Weisz Choice B. + - `BC_SF_ORBI`: Schrödinger Functional orbifold constructions. - `BC_OPEN`: Open boundary conditions. -The structure conatins the following components: +The structure contains the following components: - `iL`: Tuple containing the lattice length in each dimension. -- `plidx`: The directions of each plane -- `blk`: The block size in each each dimension -- `rbk`: The number of blocks in each dimension -- `bsz`: The number of points in each block -- `rsz`: The number of blocks in the lattice -- `ntw`: The twist tensor in each plane +- `plidx`: The directions of each plane. +- `blk`: The block size in each each dimension. +- `rbk`: The number of blocks in each dimension. +- `bsz`: The number of points in each block. +- `rsz`: The number of blocks in the lattice. +- `ntw`: The twist tensor in each plane. """ struct SpaceParm{N,M,B,D} ndim::Int64 diff --git a/src/Spinors/Spinors.jl b/src/Spinors/Spinors.jl index 1cd29ea..758dc8f 100644 --- a/src/Spinors/Spinors.jl +++ b/src/Spinors/Spinors.jl @@ -14,6 +14,7 @@ module Spinors using ..Groups import ..Groups.imm, ..Groups.mimm, ..Groups.norm, ..Groups.norm2, ..Groups.dot + struct Spinor{NS,G} s::NTuple{NS,G} end @@ -291,25 +292,23 @@ end """ 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; + 1 ``\\gamma_1``; + 2 ``\\gamma_2``; + 3 ``\\gamma_3``; + 4 ``\\gamma_0``; + 5 ``\\gamma_5``; + 6 ``\\gamma_1 \\gamma_5``; + 7 ``\\gamma_2 \\gamma_5``; + 8 ``\\gamma_3 \\gamma_5``; + 9 ``\\gamma_0 \\gamma_5``; +10 ``\sigma_{01}``; +11 ``\sigma_{02}``; +12 ``\sigma_{03}``; +13 ``\sigma_{21}``; +14 ``\sigma_{32}``; +15 ``\sigma_{31}``; 16 identity; """ diff --git a/src/YM/YM.jl b/src/YM/YM.jl index 16165e4..32ddb71 100644 --- a/src/YM/YM.jl +++ b/src/YM/YM.jl @@ -23,15 +23,15 @@ import Base.show """ struct GaugeParm{T,G,N} -Structure containning the parameters of a pure gauge simulation. These are: -- beta: Type `T`. The bare coupling of the simulation +Structure containing the parameters of a pure gauge simulation. These are: +- beta: Type `T`. The bare coupling of the simulation. - c0: Type `T`. LatticeGPU supports the simulation of gauge actions made of 1x1 Wilson Loops and 2x1 Wilson loops. The parameter c0 defines the coefficient on the simulation of the 1x1 loops. Some common choices are: - - c0=1: Wilson plaquette action + - c0=1: Wilson plaquette action. - c0=5/3: Tree-level improved Lüscher-Weisz action. - - c0=3.648: Iwasaki gauge action + - c0=3.648: Iwasaki gauge action. - cG: Tuple (`T`, `T`). Boundary improvement parameters. - ng: `Int64`. Rank of the gauge group. -- Ubnd: Boundary field for SF boundary conditions +- Ubnd: Boundary field for SF boundary conditions. """ struct GaugeParm{T,G,N} beta::T @@ -79,11 +79,11 @@ end """ struct YMworkspace{T} -Structure containing memory workspace that is resused by different routines in order to avoid allocating/deallocating time. +Structure containing memory workspace that is reused by different routines in order to avoid allocating/deallocating time. The parameter `T` represents the precision of the simulation (i.e. single/double). The structure contains the following components -- GRP: Group being simulated -- ALG: Corresponding Algebra -- PRC: Precision (i.e. `T`) +- GRP: Group being simulated. +- ALG: Corresponding Algebra. +- PRC: Precision (i.e. `T`). - frc1: Algebra field with natural indexing. - frc2: Algebra field with natural indexing. - mom: Algebra field with natural indexing. @@ -141,7 +141,7 @@ end """ function ztwist(gp::GaugeParm{T,G}, lp::SpaceParm{N,M,B,D}[, ipl]) -Returns the twist factor. If a plane index is passed, returns the twist factor as a complex{T}. If this is not provided, returns a tuple, containing the factor of each plane. +Returns the twist factor. If a plane index is passed, returns the twist factor as a Complex{T}. If this is not provided, returns a tuple, containing the factor of each plane. """ function ztwist(gp::GaugeParm{T,G}, lp::SpaceParm{N,M,B,D}) where {T,G,N,M,B,D} diff --git a/src/YM/YMflow.jl b/src/YM/YMflow.jl index 4f841c3..42ed545 100644 --- a/src/YM/YMflow.jl +++ b/src/YM/YMflow.jl @@ -347,7 +347,7 @@ end """ Qtop([Qslc,] U, gp::GaugeParm, lp::SpaceParm, ymws::YMworkspace) -Measure the topological charge `Q` of the configuration `U` using the clover definition of the field strength tensor. If the argument `Qslc` is present the contribution for each Euclidean time slice are returned. Only wors in 4D. +Measure the topological charge `Q` of the configuration `U` using the clover definition of the field strength tensor. If the argument `Qslc` is present the contributions for each Euclidean time slice are returned. Only works in 4D. """ function Qtop(Qslc, U, gp::GaugeParm, lp::SpaceParm{4,M,B,D}, ymws::YMworkspace) where {M,B,D} @@ -386,7 +386,7 @@ Qtop(U, gp::GaugeParm, lp::SpaceParm{4,M,D}, ymws::YMworkspace{T}) where {T,M,D} """ function Eoft_clover([Eslc,] U, gp::GaugeParm, lp::SpaceParm, ymws::YMworkspace) -Measure the action density `E(t)` using the clover discretization. If the argument `Eslc` +Measure the action density `E(t)` using the clover discretization. If the argument `Eslc` is given the contribution for each Euclidean time slice and plane are returned. """ function Eoft_clover(Eslc, U, gp::GaugeParm, lp::SpaceParm{4,M,B,D}, ymws::YMworkspace{T}) where {T,M,B,D} diff --git a/src/YM/YMhmc.jl b/src/YM/YMhmc.jl index 57d2d22..d49a8cd 100644 --- a/src/YM/YMhmc.jl +++ b/src/YM/YMhmc.jl @@ -13,7 +13,7 @@ function gauge_action(U, lp::SpaceParm, gp::GaugeParm, ymws::YMworkspace) -Returns the value of the gauge action for the configuration U. The parameters `\beta` and `c0` are taken from the `gp` structure. +Returns the value of the gauge action for the configuration U. The parameters ``\\beta`` and `c0` are taken from the `gp` structure. """ function gauge_action(U, lp::SpaceParm, gp::GaugeParm, ymws::YMworkspace{T}) where T <: AbstractFloat @@ -71,7 +71,7 @@ end """ HMC!(U, int::IntrScheme, lp::SpaceParm, gp::GaugeParm, ymws::YMworkspace; noacc=false) -Performs a HMC step (molecular dynamics integration and accept/reject step). The configuration `U` is updated ans function returns the energy violation and if the configuration was accepted in a tuple. +Performs a HMC step (molecular dynamics integration and accept/reject step). The configuration `U` is updated and function returns the energy violation and if the configuration was accepted in a tuple. """ function HMC!(U, int::IntrScheme, lp::SpaceParm, gp::GaugeParm, ymws::YMworkspace{T}; noacc=false) where T